@import url(https://fonts.bunny.net/css?family=abeezee:400|aleo:400);

:root {
  --navy:      #1B3A5C;
  --navy-light:#234a72;
  --red:       #C0392B;
  --gold:      #D4A017;
  --lt-blue:   #E8F0F7;
  --mid:       #4A6FA5;
  --charcoal:  #2C2C2C;
  --white:     #FFFFFF;
  --rule:      #B0BEC5;
  --hover-bg:  #eef2f7;
  --expanded-bg:#f5f7fa;
  --gold-bg:   #fef9e7;
  --gold-hover:#fdf3d0;

  --font-heading: Aleo, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: Aleo, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-menu: ABeeZee, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Z-index scale */
  --z-footer:         100;
  --z-backdrop:       499;
  --z-nav:            500;
  --z-lightbox:      1000;
  --z-feedback:       2500;
  --z-presentation:  9999;
  --z-presentation-exit: 10000;
  --z-presentation-overlay: 10001;
}

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

html {
  overflow-y: scroll;
}

html, body {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--charcoal);
  line-height: 1.6;
  background: #1a1a2e;
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('../images/mapleham_bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Header */
.app-header {
  background: var(--navy);
  color: var(--white);
  padding: 8px 8px;
  border-bottom: 3px solid var(--gold);
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-header .header-logo {
  width: auto;
  height: 80px;
  border-radius: 6px;
  flex-shrink: 0;
}
.app-header .site-title {
  font-size: 21px;
  font-weight: 700;
  margin: 0;
}
.app-header .site-title .title-short {
  display: none;
}

/* Server-rendered H1 — visible before SPA boot; hidden by JS once content renders */
.page-title {
  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: 14px 20px;
  margin: -24px -32px 24px;
  border-bottom: 3px solid var(--gold);
}

/* Layout */
#app {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 48px);
  max-width: 1160px;
  margin: 14px auto;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--rule), 0 8px 32px rgba(255,255,255,0.5), 0 2px 8px rgba(255,255,255,0.5);
  background: var(--lt-blue);
}

#layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Content Area */
#content {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 24px 32px 80px;
  max-width: 900px;
  line-height: 1.65;
  letter-spacing: 0.01em;
}

#content::-webkit-scrollbar {
  display: none;
}

/* Chapter Nav */
.chapter-nav {
  width: 220px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-menu);
}
.chapter-nav a {
  display: block;
  padding: 8px 16px;
  color: var(--white);
  text-decoration: none;
  font-size: 14px;
  border-left: 6px solid transparent;
  transition: border-color 0.2s, background 0.2s, padding-left 0.2s ease;
  border-radius: 0 6px 6px 0;
}
.chapter-nav a:hover,
.chapter-nav a.active {
  border-left-color: var(--gold);
  background: rgba(255,255,255,0.1);
  padding-left: 20px;
}
.chapter-nav a.active {
  font-weight: 700;
  background: rgba(255,255,255,0.14);
}
.chapter-nav a.disabled {
  opacity: 0.4;
  cursor: default;
}
.chapter-nav a.disabled:hover {
  border-left-color: transparent;
  background: transparent;
}

/* Settings — top of sidebar */
.settings {
  padding: 10px 14px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.present-btn,
.home-btn,
.voice-btn,
.practice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 5px 10px;
  font-size: 13px;
  line-height: 1;
  font-family: var(--font-menu);
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.15s;
}

.present-btn {
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
}

.present-btn:hover,
.home-btn:hover,
.voice-btn:hover,
.practice-btn:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.35);
}

.present-btn:active {
  transform: scale(0.97);
  box-shadow: none;
}

.present-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

.voice-btn--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.home-btn:active,
.voice-btn:active {
  transform: scale(0.96);
  box-shadow: none;
}

.voice-btn {
  user-select: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.voice-btn input { display: none; }
.voice-btn .voice-icon { font-size: 13px; line-height: 1; }
.voice-btn-text {
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}
/* On state — gold like present button */
.voice-btn input:checked ~ .voice-btn-text {
  color: var(--navy);
}
.voice-btn:has(input:checked),
.voice-btn--checked {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
}

/* Video player — matches image frame styling */
.video-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  min-height: 200px;
  max-height: 400px;
}
.slide-video {
  width: 100%;
  height: auto;
  max-height: 400px;
  display: block;
}

/* Sub navigation — section links */
.sub-nav {
  display: none;
  background: rgba(0,0,0,0.15);
}
.sub-nav.visible {
  display: block;
}
.sub-nav a.sub {
  padding: 3px 16px 3px 24px;
  font-size: 12px;
  opacity: 0.8;
  border-left: 6px solid transparent;
}
.sub-nav a.sub:hover { opacity: 1; }
.sub-nav a.sub.active-slide {
  border-left-color: var(--gold);
  opacity: 1;
  font-weight: 600;
}

/* ── Home Page Content (slide-style) ──────────────────────────── */
#home-frame {
  border: 3px solid var(--gold);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.1);
  background: var(--white);
  max-width: 740px;
  margin: 0 auto 32px;
}
.home-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: 700;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 3px solid var(--gold);
}
.home-header .chapter-num {
  background: var(--gold);
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 4px;
  flex-shrink: 0;
}
.home-content {
  padding: 24px 28px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--charcoal);
  letter-spacing: 0.01em;
}
.home-content h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--navy);
  margin: 24px 0 8px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 700;
}
.home-content p {
  margin-bottom: 8px;
}
.home-content ul {
  margin: 4px 0 8px 20px;
  padding-left: 4px;
}
.home-content ul li {
  margin-bottom: 4px;
}
.home-disclaimer {
  background: var(--gold-bg);
  border-left: 3px solid var(--gold);
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 14px;
}
.home-disclaimer strong {
  color: var(--red);
}

/* Error state */
.error-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--red);
  font-size: 15px;
}
.error-state button {
  margin-top: 12px;
  padding: 6px 16px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: box-shadow 0.15s;
}
.error-state button:active { transform: scale(0.96); box-shadow: none; }

.error-404 {
  text-align: center;
  padding: 60px 24px;
}
.error-404 h2 {
  font-family: var(--font-heading);
  font-size: 28px;
  margin-bottom: 16px;
}

/* Slide Header */
.slide-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  padding: 10px 22px;
  border-bottom: 3px solid var(--gold);
  font-size: 21px;
  font-weight: 700;
  font-family: var(--font-heading);
}
.slide-header::before {
  content: "\25B8";
  color: var(--white);
  margin-right: 8px;
  font-size: 14px;
  display: inline-block;
}

/* Chapter frame — gold border wraps title through nav */
#chapter-frame {
  border: 3px solid var(--gold);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.1);
  background: var(--white);
}

/* Chapter banner — above slides */
.chapter-title {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: 700;
  padding: 14px 20px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chapter-title .chapter-num {
  background: var(--gold);
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 4px;
  flex-shrink: 0;
}

.chapter-title .exam-tag {
  margin-left: auto;
  font-family: var(--font-menu);
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(255,255,255,0.12);
  padding: 2px 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.slide-image {
  position: relative;
  margin: 12px 0 16px 0;
  text-align: center;
}
.slide-image .img-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.slide-image img {
  max-width: 500px;
  max-height: 500px;
  width: auto;
  height: auto;
  border-radius: 6px;
  display: block;
  cursor: pointer;
  border: 2px solid var(--white);

}
@media (max-width: 600px) {
  .slide-image img {
    max-width: 100%;
    max-height: none;
  }
}
.slide-image img:hover {
  border: 2px solid var(--gold);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.slide-image .zoom-icon {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 19px;
  background: rgba(27,58,92,0.85);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border: 2px solid var(--gold);
  line-height: 36px;
  opacity: 0;
  transition: opacity 0.2s;
}
.slide-image:hover .zoom-icon {
  opacity: 1;
}

/* Slide */
.slide {
  margin-bottom: 28px;
  display: none;
}
.slide.active {
  display: block;
}

/* Bullet Row */
.bullet-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 16px;
  font-size: 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.15s, border-bottom 0.15s;
  user-select: none;
  border-radius: 4px;
  margin: 0 4px;
}
.bullet-row:hover {
  background: var(--hover-bg);
  border-bottom: 1px solid var(--rule);
}
.bullet-row.expanded {
  border-left-color: var(--gold);
  border-bottom-color: var(--rule);
  font-weight: 600;
  background: var(--expanded-bg);
  border-radius: 4px;
}

/* Remove bottom border from last expandable item (skip exam questions divider) */
.slide .bullet-row.last-row:not(.questions-bullet) {
  border-bottom: none !important;
}

/* Expand hint — appears on hover */
.expand-hint {
  font-size: 11px;
  color: var(--gold);
  font-weight: 400;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

/* Bullet topic — key-term emphasis */
.bullet-topic {
  color: var(--navy);
  font-weight: 700;
}

.bullet-text {
  flex: 1;
}
.bullet-row:hover .expand-hint,
.bullet-row.expanded .expand-hint {
  opacity: 1;
}

/* Exam questions bullet */
.bullet-row.questions-bullet {
  border-left-color: transparent;
  background: var(--gold-bg);
  border-top: 1px dashed var(--gold);
  border-bottom: 1px dashed var(--gold);
  margin-top: 8px;
  font-weight: 700;
  font-size: 14px;
}
.bullet-row.questions-bullet:hover {
  background: var(--gold-hover);
}
.bullet-row.questions-bullet.expanded {
  border-left-color: var(--gold);
}

.bullet-marker {
  color: var(--gold);
  font-size: 12px;
  line-height: 1.8;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  display: inline-block;
  align-self: center;
}
.bullet-row.expanded .bullet-marker {
  transform: rotate(90deg);
}

/* ── Detail Panel ────────────────────────────────────────────── */
.detail-panel {
  max-height: 0;
  overflow: hidden;
  background: var(--white);
  margin: 0 16px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  transition: max-height 0.35s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease;
  opacity: 0;
}
.detail-panel.open {
  padding: 14px 16px;
  opacity: 1;
}

/* Structured detail paragraphs */
.detail-para {
  margin-bottom: 10px;
  line-height: 1.6;
}
.detail-para:last-child {
  margin-bottom: 0;
}

/* Structured detail lists */
.detail-list {
  margin: 4px 0 6px 20px;
  padding-left: 4px;
}
.detail-list li {
  margin-bottom: 3px;
  line-height: 1.5;
}

/* Source reference links in detail panels */
.source-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--gold);
  text-decoration: none;
  border: 1px solid rgba(212, 160, 23, 0.3);
  border-radius: 4px;
  padding: 2px 8px;
  transition: background 0.2s, border-color 0.2s;
}
.source-link:hover {
  background: rgba(212, 160, 23, 0.12);
  border-color: var(--gold);
}

/* Slide Navigation Arrows */
.slide-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 0;
  padding: 12px 16px;
  border-top: 1px solid var(--rule);
}
.slide-nav button {
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: background 0.2s, box-shadow 0.15s, transform 0.1s;
}
.slide-nav button:hover { background: var(--mid); }
.slide-nav button:disabled { opacity: 0.3; cursor: default; background: var(--rule); box-shadow: none; }
.slide-nav button:active { transform: scale(0.96); box-shadow: none; }
.slide-nav .slide-counter {
  font-size: 13px;
  color: var(--mid);
}

/* Question Block */
.question-block {
  margin: 6px 0;
  border-left: 3px solid var(--mid);
  border-radius: 0 3px 3px 0;
  font-size: 14px;
}
.question-block.expanded {
  background: var(--white);
  padding: 6px 10px 10px;
}

/* Question header — clickable */
.q-header {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 2px;
  transition: background 0.15s;
}
.q-header:hover {
  background: #f0f2f5;
}
.q-num {
  font-weight: 700;
  color: var(--navy);
  min-width: 22px;
  flex-shrink: 0;
}
.q-text {
  font-weight: 600;
}

.q-ref {
  color: var(--mid);
  font-weight: 400;
  font-size: 12px;
  margin-top: 8px;
}

.question-refs {
  color: var(--mid);
  font-weight: 400;
}

/* Expandable question body */
.q-body {
  display: none;
  margin-top: 6px;
}

/* Option Rows */
.question-options {
  margin: 4px 0 8px;
}
.option-row {
  display: flex;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 2px;
  transition: background 0.15s;
  cursor: pointer;
}
.option-label {
  font-weight: 600;
  color: var(--mid);
  min-width: 18px;
}
.option-row.correct {
  background: #d4edda;
  border-left: 3px solid #28a745;
}
.option-row.correct::before {
  content: "✓";
  color: #28a745;
  font-weight: 700;
  font-size: 14px;
  align-self: center;
  line-height: 1;
}
.option-row.correct .option-label,
.option-row.correct .option-text {
  color: #155724;
  font-weight: 600;
}
.option-row.wrong {
  background: #f8d7da;
  border-left: 3px solid #dc3545;
}
.option-row.wrong::before {
  content: "✕";
  color: #dc3545;
  font-weight: 700;
  font-size: 14px;
  align-self: center;
  line-height: 1;
}
.option-row.wrong .option-label,
.option-row.wrong .option-text {
  color: #721c24;
  font-weight: 600;
}

/* Loading */
.loading {
  text-align: center;
  padding: 60px 24px;
  color: var(--mid);
  font-size: 15px;
}

/* Slide loading spinner (per-slide fetch) */
.slide-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.slide-loading::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid var(--rule);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Chapter nav loading placeholder */
.chapter-nav-loading {
  padding: 12px 16px;
  color: var(--mid);
  font-size: 0.9em;
}

/* Hamburger — hidden on desktop */
.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--white);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 10px;
  margin-left: auto;
  flex-shrink: 0;
  line-height: 1;
}
.menu-btn:hover {
  opacity: 0.8;
}

/* Nav backdrop — hidden on desktop */
.nav-backdrop {
  display: none;
}

/* Mobile breakpoint */
@media (max-width: 600px) {
  .menu-btn {
    display: flex;
  }

  .chapter-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 85vw;
    max-width: 320px;
    height: 100dvh;
    z-index: var(--z-nav);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    background: rgba(27, 58, 92, 0.82);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
  }

  .nav-open .chapter-nav {
    transform: translateX(0);
  }

  .nav-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: var(--z-backdrop);
  }

  .nav-open .nav-backdrop {
    display: block;
  }

  body.nav-open {
    overflow: hidden;
  }

  #layout {
    flex-direction: column;
  }

  #content {
    padding: 1rem;
    padding-bottom: calc(45px + env(safe-area-inset-bottom));
  }

  /* Responsive sizing — logo and site title share one line */
  .app-header {
    flex-wrap: wrap;
  }

  .app-header .header-logo-link {
    display: inline-flex;
    flex-shrink: 0;
  }

  .app-header .header-logo {
    height: 40px;
  }

  .app-header .site-title {
    flex: 1;
    min-width: 0;
  }

  .app-header .site-title .title-long {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(11px, 3vw, 16px);
    display: inline;
  }

  .app-header .site-title .title-short {
    display: none;
  }

  /* Mobile: swap long title for short */
  .app-header .site-title .title-long {
    display: none;
  }
  .app-header .site-title .title-short {
    display: inline;
    font-size: clamp(11px, 3vw, 16px);
    font-weight: 700;
  }

  .search-wrap {
    margin-left: auto;
  }

  .menu-btn {
  }

  .chapter-title {
    font-size: 18px;
  }

  .slide-header {
    font-size: 17px;
  }

  .bullet-row {
    font-size: 15px;
  }

  /* Prevent iOS zoom on input focus */
  .bullet-row,
  .q-header,
  .option-row,
  .slide-nav button,
  .present-btn,
  .home-btn,
  .voice-btn-text,
  .practice-btn {
    font-size: 16px;
  }

  /* Presentation mode on mobile */
  body.presentation-mode .bullet-row {
    font-size: 18px;
    padding: 0.6rem 0.8rem;
  }
  body.presentation-mode .detail-panel {
    font-size: 16px;
  }
  body.presentation-mode #content {
    padding: 0.7rem 1rem 1rem;
  }
  body.presentation-mode .slide-image img {
    max-height: 35vh;
  }

  /* Safe area insets for notched devices */
  .app-header {
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
    padding-top: calc(10px + env(safe-area-inset-top));
  }

  .app-footer {
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
  }

  .chapter-nav {
    padding-top: calc(env(safe-area-inset-top));
  }

  /* Minimum touch targets (44px HIG) */
  .chapter-nav a,
  .sub-nav a.sub,
  .bullet-row,
  .option-row,
  .q-header,
  .slide-nav button,
  .present-btn,
  .home-btn,
  .voice-btn,
  .practice-btn {
    min-height: 44px;
  }

  .bullet-row {
    min-height: 44px;
    align-items: center;
  }

  /* Cleaner tap highlight */
  .chapter-nav a,
  .sub-nav a.sub,
  .bullet-row,
  .option-row,
  .q-header,
  .slide-nav button,
  .present-btn,
  .home-btn,
  .voice-btn,
  .practice-btn,
  .menu-btn {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Print */
@media print {
  .chapter-nav, .search-wrap, .search-results { display: none; }
  .detail-panel { max-height: none !important; padding: 14px 16px; }
  .bullet-row { border-left: none; cursor: default; }
  .bullet-row.expanded { border-left: none; }
  .question-block .a-text { display: block; }
  .question-block .q-text::after { content: none; }
  .slide-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { font-size: 12pt; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bullet-row, .detail-panel, .chapter-nav a { transition: none !important; }
  .search-results { transition: none; }
  .search-input { transition: none; }
  .feedback-overlay, .feedback-modal,
  .lightbox-overlay, .lightbox-overlay img { transition: none !important; transform: none !important; }
  .slide-nav button:active, .feedback-submit:active,
  .error-state button:active { transform: none !important; }
}

/* Footer */
.app-footer {
  bottom: 0;
  z-index: var(--z-footer);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--navy);
  border-top: 1px solid var(--gold);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px;
  line-height: 1.4;
  position: relative;
}

.app-footer a {
  color: var(--gold);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.privacy-link {
  font-size: 11px;
  letter-spacing: 1px;
}

.footer-divider {
  color: var(--mid);
  font-size: 11px;
  opacity: 0.5;
}

/* Feedback button */
.feedback-btn {
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 4px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-menu);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  letter-spacing: 0.5px;
}
.feedback-btn:hover {
  background: #e6b800;
}
.feedback-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

#bmc-wrap {
  transform: scale(0.75);
  transform-origin: center center;
  vertical-align: middle;
  margin-left: 12px;
}

/* Lightbox */
.lightbox-overlay {
  display: flex;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: var(--z-lightbox);
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.lightbox-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  cursor: default;
  object-fit: contain;
  transform: scale(0.9);
  transition: transform 0.25s ease;
}
.lightbox-overlay.open img {
  transform: scale(1);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  color: #fff;
  font-size: 33px;
  cursor: pointer;
  background: none;
  border: none;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.lightbox-close:hover {
  opacity: 1;
}

/* ── Search ─────────────────────────────────────────────────── */

/* Search variables are in :root — uses existing --navy, --gold, etc. */

/* Search bar — right-aligned in header */
.search-wrap {
  margin-left: auto;
  margin-right: 10px;
  display: flex;
  align-items: center;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 200px;
  padding: 6px 64px 6px 12px;
  border: 1px solid var(--search-border, #d0d7de);
  border-radius: 20px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--search-bg, #f8f9fa);
  color: var(--charcoal);
  transition: width 0.2s ease, border-color 0.2s, box-shadow 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

/* Focus styles — visible keyboard focus on all interactive elements */
/* Using :focus-visible so focus rings only appear on keyboard navigation,
   never on mouse/touch clicks. Pattern: prominent outline with offset. */
.search-input:focus {
  width: 300px;
  border-color: var(--gold);
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.08), 0 0 0 3px rgba(212,160,23,0.25);
}

/* Grouped focus-visible for buttons, links, clickable rows */
.chapter-nav a:focus-visible,
.sub-nav a.sub:focus-visible,
.slide-nav button:focus-visible,
.present-btn:focus-visible,
.home-btn:focus-visible,
.voice-btn:focus-visible,
.practice-btn:focus-visible,
.q-header:focus-visible,
.bullet-row:focus-visible,
.option-row:focus-visible,
.menu-btn:focus-visible,
.search-submit-btn:focus-visible,
.mobile-search-icon:focus-visible,
.search-filter-chip:focus-visible,
.search-result-toggle:focus-visible,
.search-go-to-slide:focus-visible,
.lightbox-close:focus-visible,
.feedback-close:focus-visible,
.search-results-close:focus-visible,
.practice-generate-btn:focus-visible,
.practice-evaluate-btn:focus-visible,
.error-state button:focus-visible,
.feedback-submit:focus-visible,
.source-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.search-input::placeholder {
  color: var(--mid);
  opacity: 0.7;
}

/* Clear button — now uses browser-native ::-webkit-search-cancel-button */

/* Submit button — magnifying glass icon, right side of search bar */
.search-submit-btn {
  position: absolute;
  right: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--mid);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.search-submit-btn:hover {
  color: var(--navy);
}

/* Mobile search icon — only visible on mobile */
.mobile-search-icon {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  color: var(--white);
}

/* ── Search Results Panel ────────────────────────────────────── */

.search-results {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100dvh;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: -2px 0 16px rgba(0,0,0,0.18);
  z-index: var(--z-nav);
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.search-results.open {
  right: 0;
}

.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--navy);
  color: var(--white);
  flex-shrink: 0;
}

.search-results-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.search-results-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--white);
  font-size: 22px;
  opacity: 0.7;
  padding: 0 4px;
  line-height: 1;
  transition: opacity 0.15s;
}

.search-results-close:hover {
  opacity: 1;
}

/* ── Filter chips ────────────────────────────────────────────── */

.search-filter-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  margin: 0 12px;
  justify-content: center;
}

.search-filter-chip {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.6;
}

.search-filter-chip:hover {
  background: rgba(255,255,255,0.25);
}

.search-filter-chip.active {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
  font-weight: 700;
}

.search-results-body {
  overflow-y: auto;
  flex: 1;
}

/* ── Tree Hierarchy ──────────────────────────────────────────── */

.search-chapter {
  border-bottom: 1px solid var(--search-border, #d0d7de);
}
.search-chapter:first-child {
  border-top: 1px solid var(--search-border, #d0d7de);
}

.search-chapter-header {
  padding: 10px 16px;
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: background 0.15s;
}

.search-chapter-header:hover {
  background: var(--navy-light);
}

.search-slide-group {
  margin-left: 16px;
}

.search-slide-header {
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px solid var(--search-border, #d0d7de);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  transition: background 0.15s;
}

.search-slide-header:hover {
  background: var(--hover-bg, #eef2f7);
}

.search-toggle-icon {
  font-size: 10px;
  flex-shrink: 0;
  width: 12px;
  text-align: center;
}

.search-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  opacity: 0.7;
  white-space: nowrap;
}

/* ── Result Items ────────────────────────────────────────────── */

.search-result-item {
  margin-left: 32px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--hover-bg, #eef2f7);
  font-size: 13px;
}

.search-result-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 2px;
  letter-spacing: 0.5px;
}

.search-result-content {
  max-height: 2.8em;
  overflow: hidden;
  transition: max-height 0.2s ease;
  line-height: 1.4;
  display: block;
}

.search-result-content.expanded {
  max-height: none;
}

.search-result-toggle {
  color: var(--mid);
  font-size: 12px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 0;
  display: block;
  margin-top: 2px;
}

.search-result-toggle:hover {
  color: var(--navy);
  text-decoration: underline;
}

.search-go-to-slide {
  display: inline-block;
  margin-top: 4px;
  color: var(--navy);
  font-size: 12px;
  text-decoration: none;
  font-weight: 600;
}

.search-go-to-slide:hover {
  text-decoration: underline;
}

/* ── Loading / Empty / Error States ──────────────────────────── */

.search-loading {
  padding: 32px 16px;
  text-align: center;
  color: var(--mid);
  font-size: 14px;
}

.search-error {
  padding: 24px 16px;
  text-align: center;
  color: var(--red);
  font-size: 14px;
}

.search-error p {
  margin-bottom: 12px;
}

.search-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--mid);
  font-size: 14px;
}

.search-hint {
  padding: 32px 16px;
  text-align: center;
  color: var(--gold);
  font-size: 13px;
  font-style: italic;
}

/* ── Mobile (≤ 600px) ────────────────────────────────────────── */

@media (max-width: 600px) {
  .app-header {
    position: relative;
  }

  /* Hide the search bar by default, show only icon */
  .search-wrap {
    margin-left: 8px;
  }

  .search-bar {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100vw;
    padding: 8px 16px;
    background: var(--navy);
    border-bottom: 2px solid var(--gold);
    z-index: var(--z-nav);
    box-sizing: border-box;
  }

  .search-wrap.active .search-bar {
    display: flex;
  }

  .search-input {
    width: 100%;
    padding: 10px 64px 10px 14px;
    border: 1px solid var(--search-border, #d0d7de);
    border-radius: 20px;
    font-size: 16px;
  }

  .search-input:focus {
    width: 100%;
  }

  .mobile-search-icon {
    display: inline-flex;
  }

  .search-results {
    width: 100vw;
    right: -100vw;
  }

  .search-results.open {
    right: 0;
  }

  .search-result-item {
    margin-left: 16px;
  }

  .search-slide-group {
    margin-left: 8px;
  }

  .search-chapter-header {
    font-size: 13px;
    padding: 10px 12px;
  }

  .feedback-modal {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    max-height: 100vh;
    padding: 20px;
  }
  .feedback-overlay {
    align-items: flex-end;
  }
}

/* ── Presentation Mode ──────────────────────────────────── */
/* All presentation styles scoped under body.presentation-mode */

body.presentation-mode,
body.presentation-mode #app {
  background: var(--white);
  max-width: none;
  box-shadow: none;
}

/* Hide chrome elements in presentation mode */
body.presentation-mode :is(.app-header, .chapter-nav, .app-footer, #chapter-nav) {
  display: none !important;
}

body.presentation-mode #layout {
  position: fixed;
  inset: 0;
  z-index: var(--z-presentation);
  background: var(--white);
}

body.presentation-mode .lightbox-overlay {
  z-index: var(--z-presentation-overlay);
}

body.presentation-mode #content {
  max-width: none;
  padding: 24px 40px 40px;
  overflow-y: auto;
}

body.presentation-mode .slide-image img {
  max-height: 50vh;
  width: auto;
}

body.presentation-mode .bullet-row {
  font-size: 22px;
  padding: 12px 20px;
}

body.presentation-mode .detail-panel {
  font-size: 20px;
  line-height: 1.7;
}

body.presentation-mode :is(.question-block, .q-text) {
  font-size: 18px;
}

/* Presentation Mode — Wide Layout (≥1200px) */
@media (min-width: 1200px) {
  body.presentation-mode .slide.active {
    display: flow-root;
  }
  body.presentation-mode .slide-image {
    float: right;
    width: calc(33% - 24px);
    margin: 20px 0 20px 24px;
    padding: 0 20px 0 0;
  }
  body.presentation-mode .slide-image .img-frame {
    display: block;
  }
  body.presentation-mode .slide-image img {
    max-height: none;
    max-width: 100%;
    width: 100%;
    height: auto;
  }
  body.presentation-mode .bullet-row.questions-bullet {
    clear: both;
    margin-top: 20px;
  }
}

/* ── Present Exit Button ──────────────────────────────────── */
#present-exit-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: var(--z-presentation-exit);
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: var(--font-menu);
  cursor: pointer;
  transition: background 0.2s;
}

#present-exit-btn:hover {
  background: rgba(0,0,0,0.75);
}

/* ── Static Pages (Privacy, Changelog) ───────────────────── */

.page-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px;
  line-height: 1.7;
}
.page-content h1 {
  color: var(--navy);
  font-size: 24px;
  margin: 0 0 4px 0;
}
.page-content h2 {
  color: var(--navy);
  font-size: 24px;
  margin: 0 0 4px 0;
}
.page-content h3 {
  color: var(--navy);
  font-size: 18px;
  margin: 28px 0 8px 0;
}
.page-content h4 {
  color: var(--navy);
  font-size: 15px;
  margin: 20px 0 6px 0;
}
.page-content p {
  margin: 0 0 12px 0;
  color: var(--charcoal);
  font-size: 14px;
}
.page-content ul {
  margin: 0 0 12px 0;
  padding-left: 24px;
}
.page-content li {
  font-size: 14px;
  color: var(--charcoal);
  margin-bottom: 4px;
}
.page-content a {
  color: var(--navy);
}
.page-content a:hover {
  color: var(--gold-text);
}
.page-content code {
  font-size: 13px;
  background: var(--lt-blue);
  padding: 1px 5px;
  border-radius: 3px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--mid);
  font-style: italic;
  margin-bottom: 24px;
}
.privacy-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}
.privacy-table th {
  background: var(--navy);
  color: var(--white);
  padding: 8px 12px;
  text-align: left;
}
.privacy-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  color: var(--charcoal);
}
.privacy-table tr:nth-child(even) td {
  background: var(--lt-blue);
}
.privacy-email {
  font-family: monospace;
  background: var(--lt-blue);
  padding: 2px 6px;
  border-radius: 3px;
}
.changelog-entry {
  border-left: 3px solid var(--gold);
  padding: 0 0 8px 20px;
  margin-bottom: 28px;
}
.changelog-version {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}
.changelog-date {
  font-size: 13px;
  color: var(--mid);
  margin-bottom: 10px;
}
.changelog-summary {
  font-weight: 500;
}

/* ── Feedback Overlay ──────────────────────────────────── */
.feedback-overlay {
  display: flex;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: var(--z-feedback);
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.feedback-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.feedback-modal {
  transform: scale(0.92);
  transition: transform 0.25s ease;
}
.feedback-overlay.open .feedback-modal {
  transform: scale(1);
}
.feedback-modal {
  background: var(--white);
  border-radius: 12px;
  max-width: 520px;
  width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  cursor: default;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  position: relative;
  padding: 24px 28px;
}
.feedback-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--charcoal);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
  line-height: 1;
}
.feedback-close:hover {
  opacity: 1;
}
.feedback-title {
  font-family: var(--font-heading);
  font-size: 20px;
  color: var(--navy);
  margin: 0 0 16px;
}
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.feedback-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}
.feedback-field .required {
  color: var(--red);
}
.feedback-view-display {
  background: var(--lt-blue);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--charcoal);
}
.feedback-field input[type="text"],
.feedback-field input[type="email"],
.feedback-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--charcoal);
  background: var(--white);
}
.feedback-field input:focus,
.feedback-field textarea:focus {
  outline: 2px solid var(--mid);
  outline-offset: 1px;
  border-color: transparent;
}
.feedback-turnstile {
  min-height: 65px;
}
.feedback-submit {
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-menu);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background 0.15s, box-shadow 0.15s;
}
.feedback-submit:hover {
  background: var(--navy-light);
}
.feedback-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}
.feedback-submit:active { transform: scale(0.96); box-shadow: none; }
.feedback-status {
  margin-top: 10px;
  font-size: 14px;
  min-height: 1.5em;
}
.feedback-status.feedback-success {
  color: #2e7d32;
  font-weight: 600;
}
.feedback-status.feedback-error {
  color: var(--red);
}

/* Feedback overlay in presentation mode */
body.presentation-mode .feedback-overlay {
  z-index: var(--z-presentation-overlay);
}

/* About Me section */
.about-author {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 0;
}
.author-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--gold);
}
.about-author p {
  margin: 0;
  line-height: 1.6;
}

/* Content link styles — used in help overlay and elsewhere */
.home-content a,
.about-author p a {
  color: var(--mid);
  text-decoration: none;
  transition: color 0.15s;
}
.home-content a:hover,
.about-author p a:hover {
  color: var(--navy);
}

/* Reusable class for content links outside help overlay */
.content-link {
  color: var(--mid);
  text-decoration: none;
  transition: color 0.15s;
}
.content-link:hover {
  color: var(--navy);
}

/* Purpose section — logo floats next to heading + text */
.purpose-wrap {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 8px;
}
.purpose-wrap h3 {
  margin-top: 0;
}
.purpose-wrap p {
  margin-bottom: 0;
}

/* ── Practice Exam ─────────────────────────────────────────── */

/* Page header — matches chapter-title style */
.practice-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: 700;
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 3px solid var(--gold);
  border-radius: 6px;
}
.practice-header h1 {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}
.practice-icon {
  font-size: 20px;
}

/* Controls area */
.practice-controls {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Chapter selector */
.practice-chapter-selector {
  margin-bottom: 16px;
}
.practice-chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  margin-top: 8px;
}
.practice-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
  user-select: none;
}
.practice-checkbox:hover {
  background: var(--hover-bg);
}
.practice-checkbox.select-all {
  font-weight: 700;
  color: var(--navy);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 10px;
  margin-bottom: 4px;
}
.practice-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
  cursor: pointer;
}

/* Practice sidebar button — same ghost style as home-btn/present-btn/voice-btn */
.practice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 5px 10px;
  line-height: 1;
  font-family: var(--font-menu);
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.15s;
  text-decoration: none;
  text-align: center;
}
.practice-btn:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.35);
}
.practice-btn:active {
  transform: scale(0.96);
  box-shadow: none;
}

/* Generate button */
.practice-generate-btn {
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-menu);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: background 0.2s, transform 0.1s, box-shadow 0.15s;
}
.practice-generate-btn:hover {
  background: var(--mid);
}
.practice-generate-btn:active {
  transform: scale(0.97);
  box-shadow: none;
}
.practice-generate-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Error state */
.practice-error {
  background: #f8d7da;
  border: 1px solid #dc3545;
  color: #721c24;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.practice-error button {
  margin-top: 8px;
  padding: 4px 12px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

/* Questions container */
.practice-questions {
  /* questions rendered here */
}

/* Selected option (before evaluation) */
.option-row.selected {
  background: #e0e0e0;
  border-left: 3px solid #888;
}
.option-row.selected .option-label,
.option-row.selected .option-text {
  font-weight: 600;
}

/* Evaluate button */
.practice-actions {
  text-align: center;
  margin: 24px 0 32px;
}
.practice-evaluate-btn {
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 8px;
  padding: 12px 40px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-menu);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: background 0.2s, transform 0.1s, box-shadow 0.15s;
}
.practice-evaluate-btn:hover {
  background: #e6b800;
}
.practice-evaluate-btn:active {
  transform: scale(0.97);
  box-shadow: none;
}

/* Score bar */
.practice-score {
  padding: 14px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
  gap: 12px;
}
.practice-score.pass {
  background: #d4edda;
  border: 2px solid #28a745;
  color: #155724;
}
.practice-score.fail {
  background: #f8d7da;
  border: 2px solid #dc3545;
  color: #721c24;
}
.practice-score-label {
  text-transform: uppercase;
  letter-spacing: 1px;
}
.practice-score-unanswered {
  font-size: 14px;
  font-weight: 400;
  opacity: 0.7;
}

/* Practice info box */
.practice-info {
  background: var(--white);
  border: 1px solid var(--mid);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--navy);
}

/* Practice footer — counter, evaluate, results at the bottom */
.practice-footer {
  margin-top: 24px;
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}
.practice-counter {
  text-align: center;
  font-size: 14px;
  color: var(--mid);
  margin-bottom: 12px;
}
.practice-results {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-heading);
}
.practice-results.pass {
  background: #d4edda;
  border: 2px solid #28a745;
  color: #155724;
}
.practice-results.fail {
  background: #f8d7da;
  border: 2px solid #dc3545;
  color: #721c24;
}
.practice-results-label {
  text-transform: uppercase;
  letter-spacing: 1px;
}
.practice-results-bar {
  opacity: 0.4;
  font-weight: 400;
}
.practice-results-pct {
  font-size: 22px;
}
.practice-results-frac {
  font-size: 18px;
  opacity: 0.85;
}

/* Disable interactions after evaluation */
.practice-questions.evaluated .option-row {
  cursor: default;
}

/* Mobile adjustments for practice exam */
@media (max-width: 600px) {
  .practice-header {
    font-size: 18px;
  }
  .practice-chapter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .practice-controls {
    padding: 14px;
  }
  .practice-score {
    font-size: 15px;
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 600px) {
  #app {
    margin: 0 auto;
    min-height: 100dvh;
    border-radius: 0;
  }
}

/* ── Cookie Consent Banner ──────────────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(27,58,92,0.75);
  color: rgba(255,255,255,0.9);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
  font-size: 14px;
  flex-wrap: wrap;
  border-top: 2px solid var(--gold);
  pointer-events: none;
}
.cookie-text,
.cookie-actions {
  pointer-events: auto;
}
.cookie-learn-more {
  color: var(--gold);
  text-decoration: underline;
  margin-left: 2px;
}
.cookie-text {
  white-space: nowrap;
  background: rgba(27,58,92,0.7);
  padding: 2px 8px;
  border-radius: 4px;
}
.cookie-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cookie-btn {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-menu);
  transition: background 0.2s;
}
.cookie-btn:hover {
  background: rgba(255,255,255,0.22);
}
#cookie-accept {
  background: var(--gold);
  color: #1B3A5C;
  border-color: var(--gold);
  font-weight: 600;
}
#cookie-accept:hover {
  background: #e8b824;
  border-color: #e8b824;
}

@media (max-width: 600px) {
  .cookie-banner {
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
    text-align: center;
  }
  .cookie-text {
    white-space: normal;
  }
}
