/**
 * WaterMath Pro - Modern Light-Theme Design System
 * Inspired by thestaircalculator.com & stair-calculator.com
 * Clean, High-Readability, Precision Engineering Aesthetic
 */

:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #f0f9ff;
  --primary-border: #bae6fd;
  --primary-dark: #075985;
  
  --accent: #0d9488;
  --accent-light: #f0fdfa;
  
  --success: #10b981;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-alt: #f1f5f9;
  --bg-input: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --text-light: #94a3b8;
  
  --border: #e2e8f0;
  --border-focus: #0284c7;
  --border-light: #f1f5f9;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 0 3px rgba(2, 132, 199, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Header & Navigation */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.15rem;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.brand span.highlight {
  color: var(--primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

.nav-item {
  position: relative;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.15s;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

.dropdown-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  color: var(--text-dim);
}

.nav-dropdown:hover .dropdown-chevron,
.nav-dropdown:focus-within .dropdown-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Dropdown Menu Popover */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  width: 290px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.05);
  padding: 0.6rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 150;
  pointer-events: none;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 0.4rem 0.6rem 0.25rem;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

.dropdown-item-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.dropdown-item-content {
  display: flex;
  flex-direction: column;
}

.dropdown-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.dropdown-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.4rem 0;
}

.btn-cta {
  background: var(--primary);
  color: #ffffff !important;
  padding: 0.5rem 1.15rem !important;
  border-radius: var(--radius-sm);
  font-weight: 700 !important;
  transition: all 0.15s !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.btn-cta:hover {
  background: var(--primary-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

/* Mobile Navigation Bar */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-main);
}

@media (max-width: 880px) {
  .mobile-nav-toggle {
    display: block;
  }
  
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1.5rem 1.5rem;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
  }
  
  .nav-links.show {
    display: flex;
  }
  
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 1px solid var(--border-light);
    width: 100%;
    margin-top: 0.25rem;
    background: var(--bg-hover);
  }
  
  .btn-cta {
    text-align: center;
    justify-content: center;
    margin-top: 0.5rem;
  }
}

/* Main Content Layout */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.25rem 1.5rem;
}

/* Hero Header */
.hero {
  text-align: center;
  padding: 2.75rem 1.5rem 2.25rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 2.25rem;
  box-shadow: var(--shadow-sm);
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary-border);
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.85rem;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.hero p {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 750px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

/* Quick Filter Nav Tabs */
.tool-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.tab-btn {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.925rem;
  font-weight: 600;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tab-btn:hover, .tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

/* Responsive 2-Col Layout (Primary Tool + Clean Utility Sidebar) */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 960px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
}

/* Clean White Card Component */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
}

.card-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.card-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.35rem;
  line-height: 1.5;
}

/* Form Controls - Big & Comfortable */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  color: var(--text-main);
}

.form-hint {
  font-size: 0.825rem;
  color: var(--text-dim);
  font-weight: normal;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-control {
  width: 100%;
  height: 48px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  color: var(--text-main);
  padding: 0.65rem 1rem;
  padding-right: 4.5rem;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-family: var(--font-mono);
  outline: none;
  transition: all 0.15s ease-in-out;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.input-unit {
  position: absolute;
  right: 1rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 700;
  pointer-events: none;
}

.input-invalid {
  border-color: var(--danger) !important;
  background-color: var(--danger-bg) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* Dynamic Result Box */
.result-box {
  background: linear-gradient(135deg, var(--primary-light), #e0f2fe);
  border: 1.5px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-top: 1.75rem;
  text-align: center;
  position: relative;
}

.result-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-dark);
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.result-value {
  font-size: 2.6rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #0369a1;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.result-unit {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-left: 0.4rem;
}

.result-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1.15rem;
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-card-alt);
  border-color: #cbd5e1;
}

/* Step-by-Step Mathematical Breakdown */
.breakdown-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.breakdown-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.formula-display {
  background: #ffffff;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--primary-dark);
  margin-bottom: 0.85rem;
  border: 1px solid var(--border);
  border-left: 3.5px solid var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  line-height: 1.4;
}

.math-fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  padding: 0 0.4rem;
  font-size: 0.9em;
}

.math-num {
  border-bottom: 1.5px solid var(--primary);
  padding-bottom: 2px;
}

.math-den {
  padding-top: 2px;
}

.step-item {
  font-size: 0.925rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  line-height: 1.6;
}

.step-num {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary-border);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Exam Tip Box */
.exam-tip-box {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.exam-tip-title {
  color: #92400e;
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.exam-tip-content {
  font-size: 0.9rem;
  color: #78350f;
  line-height: 1.55;
}

/* In-Feed Contextual Soft CTA Card (Under Calculator Results) */
.soft-cta-card {
  background: linear-gradient(135deg, #ffffff, #f0fdf4);
  border: 1.5px solid #86efac;
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 700px) {
  .soft-cta-card {
    flex-direction: column;
    text-align: center;
  }
}

.soft-cta-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.soft-cta-icon {
  font-size: 2.25rem;
  flex-shrink: 0;
}

.soft-cta-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.soft-cta-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.btn-soft-cta {
  background: #15803d;
  color: #ffffff !important;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.925rem;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.2);
}

.btn-soft-cta:hover {
  background: #166534;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(21, 128, 61, 0.3);
}

/* Sidebar Clean Utility Widget */
.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.sidebar-widget-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.constant-list {
  list-style: none;
  font-size: 0.875rem;
}

.constant-item {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-light);
}

.constant-item:last-child {
  border-bottom: none;
}

.constant-name {
  color: var(--text-muted);
  font-weight: 500;
}

.constant-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary-dark);
}

.widget-nav-list {
  list-style: none;
  font-size: 0.9rem;
}

.widget-nav-list li {
  margin-bottom: 0.6rem;
}

.widget-nav-list a {
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  font-weight: 500;
}

.widget-nav-list a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Tool Grid on Homepage */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.tool-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.tool-card-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.tool-card h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.tool-card p {
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.tool-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 700;
}

/* Footer */
.footer {
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 3.5rem 1.5rem 2.5rem;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
}

@media (max-width: 768px) {
  .footer-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.footer-col h4 {
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0.55rem;
}

.footer-col a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2.5rem auto 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Practice Quiz & Exam Module Styles
   ========================================================================== */
.quiz-wrapper {
  max-width: 860px;
  margin: 0 auto;
}

.quiz-header-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.quiz-progress-stats {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.quiz-stat-box {
  text-align: center;
}

.quiz-stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.quiz-stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.quiz-filter-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.quiz-filter-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 0.45rem 1rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.quiz-filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.quiz-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.quiz-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.quiz-card:hover {
  box-shadow: var(--shadow-md);
}

.quiz-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.quiz-q-num {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quiz-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.quiz-badge.grade-3-4 {
  background: #fef3c7;
  color: #92400e;
}

.quiz-badge.wastewater {
  background: #ecfdf5;
  color: #065f46;
}

.quiz-question-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.15rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  background: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  user-select: none;
}

.quiz-option:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.quiz-option.correct {
  border-color: var(--success) !important;
  background: #ecfdf5 !important;
  color: #065f46 !important;
  font-weight: 700 !important;
}

.quiz-option.incorrect {
  border-color: var(--danger) !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
}

.quiz-option-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
}

.quiz-option.selected .quiz-option-marker {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.quiz-option.correct .quiz-option-marker {
  border-color: var(--success);
  background: var(--success);
  color: #ffffff;
}

.quiz-option.incorrect .quiz-option-marker {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.quiz-btn-check {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
}

.quiz-btn-check:hover {
  background: var(--primary-hover);
}

.quiz-btn-check:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
}

.quiz-explanation {
  display: none;
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #f8fafc;
  line-height: 1.6;
}

.quiz-explanation.show {
  display: block;
}

.quiz-explanation.is-correct {
  border-left: 4px solid var(--success);
}

.quiz-explanation.is-incorrect {
  border-left: 4px solid var(--danger);
}

.quiz-exp-title {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-exp-title.text-success { color: #065f46; }
.quiz-exp-title.text-danger { color: #991b1b; }

.quiz-exp-body {
  font-size: 0.92rem;
  color: var(--text-main);
}

.quiz-exp-body code {
  background: #e2e8f0;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88rem;
  color: #0f172a;
}

/* ==========================================================================
   Gamification Engine, SRS Flashcards & Interactive Quests
   ========================================================================== */

/* Operator Profile & Status Widget */
.operator-profile-widget {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-avatar-badge {
  font-size: 2.25rem;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-meta-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.profile-meta-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.profile-stats-cluster {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-main);
  border: 1px solid var(--border);
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-pill.streak {
  background: #fff7ed;
  color: #c2410c;
  border-color: #ffedd5;
}

.xp-progress-box {
  min-width: 180px;
}

.xp-bar-bg {
  background: #e2e8f0;
  height: 8px;
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.xp-bar-fill {
  background: linear-gradient(90deg, #0284c7, #10b981);
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* Floating XP Toast */
.xp-floating-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #15803d;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.xp-floating-toast.fade-out {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease;
}

/* Badge Unlocked Toast */
.badge-unlocked-toast {
  position: fixed;
  top: 5rem;
  right: 2rem;
  background: #ffffff;
  border: 2px solid #22c55e;
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.25);
  display: flex;
  align-items: center;
  z-index: 1000;
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.badge-unlocked-toast.fade-out {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.5s ease;
}

/* Level Up Modal Backdrop */
.level-up-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  animation: fadeIn 0.25s ease;
}

.level-up-modal-card {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Quiz Hub - Two-Tier Cascading Filter Architecture & Elevated UWorld UI
   ========================================================================== */

.quiz-filter-hub {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

/* Tier 1 Primary Domain Tabs */
.quiz-tier-1 {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  border-bottom: 1.5px solid #f1f5f9;
  scrollbar-width: thin;
}

.domain-tab {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.domain-tab:hover {
  background: #f0f9ff;
  color: var(--primary);
  border-color: #bae6fd;
  transform: translateY(-2px);
}

.domain-tab.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transform: translateY(-2px);
}

.domain-tab.active-danger {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
  transform: translateY(-2px);
}

.domain-tab.active-amber {
  background: #d97706 !important;
  color: #ffffff !important;
  border-color: #d97706 !important;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
  transform: translateY(-2px);
}

.domain-count-badge {
  background: rgba(0, 0, 0, 0.08);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 800;
}

.domain-tab.active .domain-count-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Tier 2 Cascading Filter Row */
.quiz-tier-2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 1.15rem;
}

.tier-2-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.35rem;
}

.sub-pill {
  padding: 0.45rem 1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sub-pill:hover {
  background: #f8fafc;
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.sub-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

.sub-pill.active-grade {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.3);
}

/* Elevated Question Cards (UWorld Aesthetic) */
.qcard-elevated {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.qcard-elevated:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 25px -4px rgba(0, 0, 0, 0.08);
}

.qcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.qcard-badges {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.badge-qid {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
}

.badge-grade {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
}

.badge-domain {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
}

.qcard-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.65;
  margin-bottom: 1.75rem;
  letter-spacing: -0.01em;
}

.qcard-options {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.qcard-opt-btn {
  text-align: left;
  justify-content: flex-start;
  padding: 1rem 1.35rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.qcard-opt-btn:hover:not(:disabled) {
  border-color: #0284c7;
  background: #f0f9ff;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
}

.qcard-opt-btn.correct {
  background: #ecfdf5 !important;
  color: #065f46 !important;
  border-color: #10b981 !important;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.qcard-opt-btn.wrong {
  background: #fef2f2 !important;
  color: #991b1b !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Explanation Box & Action Pills */
.qcard-feedback {
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 1.5rem;
  animation: fadeIn 0.25s ease;
  border: 1.5px solid;
}

.qcard-feedback.correct {
  background: #f8fafc;
  border-color: #86efac;
  border-left: 6px solid #16a34a;
}

.qcard-feedback.incorrect {
  background: #f8fafc;
  border-color: #fca5a5;
  border-left: 6px solid #dc2626;
}

.qcard-formula-box {
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid #1e293b;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.qcard-steps {
  padding-left: 1.25rem;
  margin: 0 0 1.25rem;
  color: #334155;
  line-height: 1.75;
  font-size: 0.95rem;
}

.qcard-trap {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 5px solid #d97706;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: #92400e;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.qcard-action-bar {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px dashed #cbd5e1;
  margin-top: 1.25rem;
}

.qcard-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}

.qcard-action-btn.guide {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.qcard-action-btn.guide:hover {
  background: #dbeafe;
}

.qcard-action-btn.calc {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.qcard-action-btn.calc:hover {
  background: #dcfce7;
}

.qcard-action-btn.flashcard {
  background: #fdf4ff;
  color: #86198f;
  border: 1px solid #f5d0fe;
}

.qcard-action-btn.flashcard:hover {
  background: #fae8ff;
}

.qcard-action-btn.passbook {
  background: #15803d;
  color: #ffffff !important;
}

.qcard-action-btn.passbook:hover {
  background: #166534;
}

/* ==========================================================================
   SRS Flashcards - Spacious 3D Interactive Deck & Structured Typography
   ========================================================================== */

.srs-flashcard-wrapper {
  perspective: 1200px;
  max-width: 760px;
  margin: 2rem auto 1.5rem;
}

.srs-flashcard {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-xl);
  min-height: 440px;
  padding: 2.75rem;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.srs-flashcard:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.12);
}

.srs-front-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.srs-front-category {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #eff6ff;
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  border: 1px solid #bfdbfe;
}

.srs-front-q {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.6;
  text-align: center;
  margin: auto 0;
  padding: 2rem 0;
  letter-spacing: -0.01em;
}

.srs-flip-hint {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: auto;
  padding-top: 1.25rem;
}

.srs-back-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #f1f5f9;
}

.srs-back-content {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #1e293b;
  margin-bottom: 1.5rem;
  white-space: pre-line;
}

.srs-back-formula {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-left: 5px solid #38bdf8;
  padding: 1.15rem 1.35rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #38bdf8;
  margin-bottom: 1.5rem;
  font-weight: 700;
  line-height: 1.6;
}

.srs-back-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 1.25rem;
  border-top: 1px dashed #e2e8f0;
  margin-top: auto;
}

.srs-rating-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  max-width: 760px;
  margin: 0 auto 2.5rem;
}

.btn-srs-rate {
  padding: 0.95rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.btn-srs-rate.again { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn-srs-rate.hard { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.btn-srs-rate.good { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.btn-srs-rate.easy { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

.btn-srs-rate:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Study experience: readable question, persistent context, explicit answer reveal. */
#flashcard-category-filters {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start !important;
  overflow-x: auto;
  max-width: 900px;
  margin: 0 auto 1.7rem !important;
  padding: .15rem .15rem .7rem;
  scrollbar-width: thin;
}
#flashcard-category-filters .filter-btn { flex: 0 0 auto; white-space: nowrap; }
#flashcard-category-filters .filter-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 38px;
  padding: .45rem .75rem;
  border: 1px solid #d7e3ed;
  border-radius: 999px;
  background: #fff;
  color: #31516a;
  font: inherit;
  font-size: .83rem;
  font-weight: 700;
  cursor: pointer;
}
#flashcard-category-filters .filter-btn:hover { border-color: #7dd3fc; background: #f0f9ff; }
#flashcard-category-filters .filter-btn.active { border-color: #0878ad; background: #0878ad; color: #fff; }
#flashcard-category-filters .filter-btn span { opacity: .7; font-size: .73rem; }
.study-progress {
  max-width: 800px;
  margin: 0 auto 0.6rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 700;
}
.study-progress-track {
  max-width: 800px;
  height: 7px;
  margin: 0 auto 1.4rem;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.study-progress-track > div { height: 100%; width: 0; background: #0284c7; border-radius: inherit; transition: width .2s ease; }
.srs-flashcard-wrapper { max-width: 800px; margin: 0 auto 1rem; perspective: none; }
.srs-flashcard {
  display: block;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  cursor: default;
  border: 1px solid #d7e3ed;
  border-radius: 22px;
  box-shadow: 0 15px 35px rgba(15, 51, 77, .08);
  background: #fff;
}
.srs-flashcard:hover { transform: none; border-color: #d7e3ed; box-shadow: 0 15px 35px rgba(15, 51, 77, .08); }
.study-card-topline {
  padding: 1.15rem 1.6rem;
  background: #f4f9fc;
  border-bottom: 1px solid #e3edf4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}
.study-topic { color: #075985; font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.study-state { color: #64748b; font-size: .82rem; font-weight: 700; }
.study-state.mastered { color: #15803d; }
.study-question-block { padding: 2.5rem 2.6rem 2.7rem; }
.study-eyebrow { display: block; color: #0284c7; font-weight: 900; font-size: .74rem; letter-spacing: .14em; margin-bottom: 1rem; }
.study-question-block h2 { max-width: 680px; color: #0f2a40; font-size: clamp(1.4rem, 2.5vw, 2rem); font-weight: 800; line-height: 1.42; letter-spacing: -.025em; margin: 0; }
.study-question-block p { color: #64748b; margin: 1.7rem 0 0; font-size: .95rem; }
.study-answer-block { padding: 2.1rem 2.6rem 2.3rem; border-top: 2px solid #bde8db; background: #f8fcfa; }
.study-answer-block .study-eyebrow { color: #15803d; }
.study-answer-block > p { color: #17324a; font-size: 1.1rem; line-height: 1.7; margin: 0 0 1.6rem; white-space: pre-line; }
.study-formula { display: grid; gap: .45rem; padding: 1.1rem 1.25rem; border-left: 4px solid #0ea5e9; border-radius: 10px; background: #eaf6fd; color: #0f4867; }
.study-formula span { font-size: .72rem; font-weight: 900; letter-spacing: .08em; }
.study-formula strong { font-family: var(--font-mono); font-size: .98rem; overflow-wrap: anywhere; line-height: 1.6; }
.study-resource-links { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin-top: 1.6rem; }
.study-resource-links a { color: #075985; font-size: .87rem; font-weight: 750; text-decoration: none; }
.study-resource-links a:hover { text-decoration: underline; }
.srs-primary-actions { max-width: 800px; margin: 0 auto 1.4rem; display: grid; grid-template-columns: 1fr 2fr 1fr; gap: .75rem; }
.srs-primary-actions button { border-radius: 12px; min-height: 50px; cursor: pointer; font-weight: 800; }
.srs-nav-btn { background: #fff; border: 1px solid #cbd5e1; color: #334155; }
.srs-nav-btn:hover { background: #f1f5f9; }
.srs-reveal-btn { background: #0878ad; border: 1px solid #0878ad; color: #fff; font-size: 1rem; }
.srs-reveal-btn:hover { background: #075f8b; }
.srs-reveal-btn span { font-size: .72rem; opacity: .8; margin-left: .5rem; }
.srs-rating-panel { max-width: 800px; margin: 0 auto 1.3rem; }
.srs-rating-panel[hidden] { display: none; }
.srs-rating-panel > p { color: #17324a; font-weight: 800; margin: 0 0 .75rem; }
.srs-rating-panel > p span { color: #64748b; font-size: .84rem; font-weight: 500; margin-left: .4rem; }
.srs-rating-controls { max-width: none; margin: 0; gap: .7rem; }
.btn-srs-rate { min-height: 67px; gap: .2rem; font-size: .94rem; }
.btn-srs-rate small { font-weight: 600; font-size: .74rem; }
.srs-primary-actions button:focus-visible, .btn-srs-rate:focus-visible, .filter-btn:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* Practice questions: stronger hierarchy and answer states. */
#quiz-questions-list { max-width: 920px; margin: 0 auto; }
.qcard-elevated { border: 1px solid #dbe6ee; border-radius: 20px; padding: 0; overflow: hidden; box-shadow: 0 10px 28px rgba(15, 51, 77, .06); }
.qcard-header { background: #f5f9fc; border-bottom: 1px solid #e5edf3; padding: 1rem 1.65rem; margin: 0; }
.qcard-text { font-size: clamp(1.13rem, 1.7vw, 1.32rem); line-height: 1.55; padding: 1.7rem 1.8rem .4rem; margin: 0; color: #102d44; }
.qcard-options { gap: .65rem; margin: 0; padding: 1rem 1.8rem 1.8rem; }
.qcard-opt-btn { border-radius: 12px; min-height: 58px; padding: .85rem 1rem; align-items: center; }
.qcard-opt-btn:hover:not(:disabled) { transform: none; }
.qcard-opt-btn:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.qcard-feedback { border-width: 1px 0 0; border-radius: 0; margin: 0; padding: 1.5rem 1.8rem 1.8rem; }
.qcard-feedback.correct { border-left: 0; background: #f4fbf7; }
.qcard-feedback.incorrect { border-left: 0; background: #fff9f6; }
.qcard-formula-box { background: #eaf6fd; color: #0f4867; border: 1px solid #c4e6f6; border-left: 4px solid #0ea5e9; overflow-wrap: anywhere; }
.qcard-steps { font-size: .97rem; }
@media (max-width: 640px) {
  .study-progress { padding: 0 .25rem; font-size: .8rem; }
  .study-card-topline { padding: 1rem 1.15rem; }
  .study-question-block { padding: 1.75rem 1.35rem 2rem; }
  .study-answer-block { padding: 1.7rem 1.35rem; }
  .srs-primary-actions { grid-template-columns: 1fr 1fr; }
  .srs-reveal-btn { grid-column: 1 / -1; grid-row: 1; }
  .srs-rating-controls { grid-template-columns: 1fr 1fr; }
  .srs-rating-panel > p span { display: block; margin: .3rem 0 0; }
  .qcard-header { padding: .9rem 1rem; }
  .qcard-text { padding: 1.4rem 1.15rem .2rem; }
  .qcard-options { padding: 1rem 1.15rem 1.4rem; }
  .qcard-feedback { padding: 1.35rem 1.15rem; }
  .qcard-action-bar { display: flex; flex-wrap: wrap; gap: .5rem; }
  .qcard-action-btn { font-size: .8rem; padding: .45rem .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .qcard-elevated, .srs-flashcard, .study-progress-track > div { transition: none; animation: none; }
}

/* Topic paths shared by calculators, guides, and the knowledge map. */
.learning-links, .knowledge-topic { background: #fff; border: 1px solid #dbe7ef; border-radius: 18px; padding: 1.5rem; }
.learning-links { margin: 2rem auto; max-width: 1100px; }
.learning-links h2 { margin: 0 0 .4rem; }
.learning-links-grid, .knowledge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.learning-links-grid a { display: flex; flex-direction: column; gap: .4rem; padding: 1rem; background: #f0f9ff; border-radius: 12px; text-decoration: none; }
.learning-links-grid a span { color: #475569; font-size: .9rem; }
.knowledge-nav { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding: 1rem max(1rem, calc((100vw - 1100px) / 2)); background: #fff; border-bottom: 1px solid #dbe7ef; }
.knowledge-nav div { display: flex; flex-wrap: wrap; gap: 1rem; }
.knowledge-main { max-width: 1100px; margin: 2rem auto; padding: 0 1rem 3rem; }
.knowledge-main h1 { margin-bottom: .5rem; }
.knowledge-grid { margin-top: 2rem; }
.knowledge-topic { scroll-margin-top: 1rem; }
.knowledge-topic:target { outline: 3px solid #0ea5e9; }
.knowledge-topic h2 { font-size: 1.2rem; margin: .4rem 0 1rem; }
.knowledge-domain { color: #0369a1; font-size: .8rem; font-weight: 800; text-transform: uppercase; }
.knowledge-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.knowledge-actions a { border-radius: 999px; background: #e0f2fe; color: #075985; padding: .45rem .7rem; font-size: .85rem; text-decoration: none; }
.knowledge-gap { border-radius: 999px; background: #f1f5f9; color: #64748b; padding: .45rem .7rem; font-size: .85rem; }
.knowledge-actions a:hover, .learning-links-grid a:hover { background: #bae6fd; }
