/* ==========================================================================
   Proverbs-V3 Interactive Bible Study Academy
   Clear Blue Theme — Senior-Friendly Typography, High Contrast & Mobile Comfort
   ========================================================================== */

:root {
  --blue-950: #0c2542;
  --blue-900: #133863;
  --blue-800: #194d88;
  --blue-700: #2061aa;
  --blue-600: #2974c7;
  --blue-100: #e4effb;
  --blue-50: #f2f7fd;

  --bg-page: #edf3f9;
  --bg-card: #ffffff;
  --bg-soft: #f7fafd;

  /* High-contrast inks (WCAG AAA on white & soft tints) */
  --text-main: #0f1e30;
  --text-en: #203b59;
  --text-muted: #3d5673;

  --border: #c5d9ee;
  --border-strong: #8fb4dc;

  --green-800: #0e542f;
  --green-700: #13683b;
  --green-100: #e7f6ee;
  --green-border: #68be8d;

  --red-800: #8c1a1a;
  --red-700: #a82222;
  --red-100: #fdf0f0;
  --red-border: #df8c8c;

  /* Discreet editorial notice palette */
  --notice-bg: #faf6ed;
  --notice-border: #dfcaa0;
  --notice-accent: #b78529;
  --notice-text: #5b4416;

  --shadow-sm: 0 2px 8px rgba(12, 37, 66, 0.06);
  --shadow-md: 0 6px 22px rgba(12, 37, 66, 0.11);
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Generous default sizes for adults & seniors */
  --base-font: 20px;
  --line-height: 1.82;
}

html.font-standard,
body.font-standard {
  --base-font: 20px;
  --line-height: 1.82;
}

html.font-enlarged,
body.font-enlarged {
  --base-font: 23px;
  --line-height: 1.86;
}

html.font-xlarge,
body.font-xlarge {
  --base-font: 27px;
  --line-height: 1.9;
}

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

html {
  scroll-behavior: smooth;
  font-size: var(--base-font);
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: var(--base-font);
  line-height: var(--line-height);
  color: var(--text-main);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--blue-900);
  color: #ffffff;
  padding: 14px 20px;
  z-index: 1000;
  border-radius: 0 0 8px 0;
  font-weight: 700;
}
.skip-link:focus {
  left: 0;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}

/* Stacked bilingual button helper */
.btn-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.28;
}

.btn-sub {
  font-size: 0.78em;
  font-weight: 600;
  opacity: 0.92;
  margin-top: 2px;
}

/* ---------- Header & Progress Strip ---------- */
.site-header {
  background: linear-gradient(135deg, var(--blue-950) 0%, var(--blue-800) 62%, var(--blue-700) 100%);
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-titles {
  cursor: pointer;
}

.site-title-zh {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: 0.01em;
}

.site-title-en {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: #dcebfa;
  line-height: 1.38;
  font-weight: 500;
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.control-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: rgba(255, 255, 255, 0.13);
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.control-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e4f1fd;
  padding: 0 6px;
  line-height: 1.2;
}

.control-label-en {
  font-size: 0.68rem;
  font-weight: 500;
  color: #c8e0f7;
}

.ctrl-btn {
  min-height: 48px;
  padding: 6px 13px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.22;
  transition: background 0.15s ease;
}

.ctrl-sub {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.9;
  margin-top: 2px;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.ctrl-btn[aria-pressed="true"] {
  background: #ffffff;
  color: var(--blue-900);
  border-color: #ffffff;
}

.ctrl-btn-danger {
  background: rgba(180, 34, 34, 0.82);
  border-color: rgba(255, 200, 200, 0.55);
}
.ctrl-btn-danger:hover {
  background: rgba(160, 24, 24, 0.96);
}

.icon-btn {
  min-height: 50px;
  min-width: 50px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.mobile-only {
  display: none;
}

/* Progress Strip */
.progress-strip {
  background: rgba(7, 25, 48, 0.46);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.progress-strip-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  padding: 12px 16px;
}

.stat-label-zh {
  font-size: 0.84rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
}

.stat-label-en {
  font-size: 0.74rem;
  color: #d0e6fc;
  line-height: 1.25;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.22rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 2px;
  line-height: 1.3;
}

.stat-sub {
  font-size: 0.76rem;
  color: #dcebfa;
  margin-top: 4px;
  line-height: 1.35;
}

.stat-bar {
  height: 9px;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: #7cdbff;
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* ---------- Main App Shell ---------- */
.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 332px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  background: var(--blue-50);
  border-bottom: 2px solid var(--border);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-header .icon-btn {
  color: var(--blue-900);
  background: #ffffff;
  border-color: var(--border-strong);
  min-width: 48px;
  min-height: 48px;
}

.sidebar-header .icon-btn:hover {
  background: var(--blue-100);
}

.sidebar-title-zh {
  font-weight: 800;
  color: var(--blue-950);
  font-size: 1rem;
  line-height: 1.35;
}

.sidebar-title-en {
  font-size: 0.82rem;
  color: var(--text-en);
  font-weight: 500;
  margin-top: 2px;
}

.chapter-nav {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid #dde8f5;
  border-left: 4px solid transparent;
  background: #ffffff;
  border-radius: 11px;
  padding: 13px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-main);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-item:hover {
  background: var(--blue-50);
  border-color: var(--border-strong);
}

.nav-item.active {
  background: var(--blue-100);
  border-color: var(--blue-600);
  border-left-color: var(--blue-800);
}

.nav-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-ch-label {
  font-weight: 800;
  font-size: 0.94rem;
  color: var(--blue-950);
  line-height: 1.3;
}

.nav-badges {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
}

.pill-read {
  background: var(--green-100);
  color: var(--green-800);
  border: 1px solid var(--green-border);
}

.pill-score {
  background: var(--blue-50);
  color: var(--blue-900);
  border: 1px solid var(--border-strong);
}

.pill-draft {
  background: var(--notice-bg);
  color: var(--notice-text);
  border: 1px solid var(--notice-border);
}

.nav-sub-zh {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}

.nav-sub-en {
  font-size: 0.8rem;
  color: var(--text-en);
  line-height: 1.38;
}

/* ---------- Main Content ---------- */
.main-content {
  min-width: 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px 32px;
  margin-bottom: 24px;
}

.loading-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

/* Overview Grid */
.hero-card {
  background: linear-gradient(180deg, #ffffff 0%, var(--blue-50) 100%);
  border-left: 6px solid var(--blue-700);
}

.hero-card h2 {
  margin: 0 0 6px;
  color: var(--blue-950);
  font-size: 1.42rem;
  line-height: 1.38;
}

.hero-en {
  margin: 0 0 18px;
  color: var(--text-en);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.48;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.ch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.ch-card:hover {
  border-color: var(--blue-600);
  transform: translateY(-2px);
}

.ch-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.ch-num-badge {
  display: inline-block;
  background: var(--blue-800);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 8px;
}

.ch-card-title-zh {
  margin: 10px 0 4px;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--blue-950);
  line-height: 1.42;
}

.ch-card-title-en {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-en);
  line-height: 1.44;
}

.ch-card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e6eff8;
}

.ch-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Buttons */
.btn {
  min-height: 52px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 2px solid transparent;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--blue-800);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--blue-900);
}

.btn-secondary {
  background: var(--blue-50);
  color: var(--blue-950);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--blue-100);
}

.btn-success {
  background: var(--green-700);
  color: #ffffff;
}
.btn-success:hover {
  background: var(--green-800);
}

.btn-danger {
  background: var(--red-700);
  color: #ffffff;
}
.btn-danger:hover {
  background: var(--red-800);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  min-height: 48px;
  padding: 8px 14px;
  font-size: 0.86rem;
}

/* Chapter Header & Tabs */
.chapter-header-card {
  border-top: 5px solid var(--blue-700);
}

.chapter-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.chapter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge-info {
  background: var(--blue-100);
  color: var(--blue-950);
  border: 1px solid var(--border-strong);
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.chapter-title-zh {
  margin: 6px 0 6px;
  font-size: 1.46rem;
  color: var(--blue-950);
  line-height: 1.4;
}

.chapter-title-en {
  margin: 0 0 18px;
  font-size: 1.04rem;
  color: var(--text-en);
  font-weight: 600;
  line-height: 1.48;
}

/* Discreet Editorial Notice */
.editorial-notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-left: 4px solid var(--notice-accent);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 14px 0 18px;
  font-size: 0.88rem;
  color: var(--notice-text);
}

.editorial-notice summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--notice-text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
}

.editorial-notice summary::-webkit-details-marker {
  display: none;
}

.editorial-notice summary::after {
  content: "展开详情 ▾";
  font-size: 0.78rem;
  font-weight: 600;
  color: #7c5c20;
  flex-shrink: 0;
}

.editorial-notice[open] summary::after {
  content: "收起 ▴";
}

.editorial-notice-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eadcc0;
}

.editorial-notice-body p {
  margin: 0 0 8px;
  line-height: 1.65;
}

.editorial-notice-body p:last-child {
  margin-bottom: 0;
}

.editorial-notice-en {
  color: #6b5324;
  font-size: 0.94em;
}

.editorial-notice-list {
  margin: 8px 0 0;
  padding-left: 1.3em;
}

.editorial-notice-list li {
  margin-bottom: 6px;
  line-height: 1.6;
}

/* Tabs */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.tab-btn {
  flex: 1 1 240px;
  min-height: 62px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--blue-950);
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  background: var(--blue-100);
}

.tab-btn.active {
  background: var(--blue-800);
  color: #ffffff;
  border-color: var(--blue-800);
  box-shadow: var(--shadow-sm);
}

.tab-sub {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.9;
  margin-top: 2px;
}

/* Quick Jump Bar inside Study View */
.jump-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
  background: var(--blue-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 22px;
  align-items: center;
}

.jump-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--blue-950);
  margin-right: 4px;
}

.jump-chip {
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--blue-950);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s ease;
}

.jump-chip:hover {
  background: var(--blue-100);
}

/* Study Section Cards with Clear Layer Separation */
.study-section {
  border-left: 6px solid var(--blue-600);
}

.study-section[data-cat="big_idea"] {
  background: linear-gradient(180deg, #f3f9ff 0%, #ffffff 100%);
  border-left-color: var(--blue-800);
}
.study-section[data-cat="exegesis"] { border-left-color: #1a5ba3; }
.study-section[data-cat="hebrew"] { border-left-color: #0e7490; }
.study-section[data-cat="scholarship"] { border-left-color: #4338ca; }
.study-section[data-cat="theology"] { border-left-color: #3730a3; }
.study-section[data-cat="application"] { border-left-color: #0f766e; }
.study-section[data-cat="discussion"] { border-left-color: #0369a1; }
.study-section[data-cat="preaching"],
.study-section[data-cat="pitfalls"] { border-left-color: #475569; }

.section-layer-tag {
  display: inline-flex;
  flex-direction: column;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--blue-100);
  color: var(--blue-950);
  margin-bottom: 12px;
  line-height: 1.3;
}

.section-layer-tag-en {
  font-size: 0.85em;
  font-weight: 600;
  opacity: 0.88;
}

.study-section[data-cat="theology"] .section-layer-tag {
  background: #ebe9fe;
  color: #2b2778;
}
.study-section[data-cat="application"] .section-layer-tag {
  background: #e4f6f3;
  color: #0e524c;
}
.study-section[data-cat="hebrew"] .section-layer-tag {
  background: #e2f4f8;
  color: #115166;
}
.study-section[data-cat="scholarship"] .section-layer-tag {
  background: #eceeff;
  color: #2d268c;
}

.section-head-zh {
  margin: 0 0 6px;
  font-size: 1.28rem;
  color: var(--blue-950);
  line-height: 1.42;
}

.section-head-en {
  margin: 0 0 20px;
  font-size: 0.98rem;
  color: var(--text-en);
  font-weight: 600;
  padding-bottom: 14px;
  border-bottom: 2px solid #dfeaf6;
  line-height: 1.48;
}

/* Rendered Markdown Typography — Generous Spacing & Strong Contrast */
.md-body h3 {
  margin: 30px 0 10px;
  font-size: 1.15rem;
  color: var(--blue-950);
  line-height: 1.45;
  padding-top: 16px;
  border-top: 1px solid #d9e6f4;
}
.md-body h3:first-child {
  margin-top: 4px;
  padding-top: 0;
  border-top: none;
}

.md-body h4 {
  margin: 22px 0 8px;
  font-size: 1.05rem;
  color: var(--blue-800);
  line-height: 1.45;
}

.md-body p {
  margin: 0 0 14px;
}

.md-body p.en-para {
  color: var(--text-en);
  font-size: 0.95em;
  margin-top: -6px;
  margin-bottom: 20px;
  line-height: 1.76;
}

.md-body ul,
.md-body ol {
  margin: 10px 0 20px;
  padding-left: 1.4em;
}

.md-body li {
  margin-bottom: 12px;
  line-height: var(--line-height);
}

.md-body blockquote {
  margin: 18px 0;
  padding: 16px 20px;
  background: var(--blue-50);
  border-left: 4px solid var(--blue-700);
  border-radius: 0 10px 10px 0;
}

.md-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.md-table-wrap {
  overflow-x: auto;
  margin: 18px 0;
}

.md-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}

.md-body th,
.md-body td {
  border: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  line-height: 1.65;
}

.md-body th {
  background: var(--blue-100);
  color: var(--blue-950);
  font-weight: 700;
}

.md-body tr:nth-child(even) td {
  background: var(--bg-soft);
}

/* Discreet inline review pill */
.review-flag-pill {
  display: inline-block;
  margin: 6px 2px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  color: var(--notice-text);
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.45;
}

.guardrail-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  background: #eef0ff;
  border: 1px solid #b4bdf7;
  color: #2c287a;
  font-size: 0.84em;
  font-weight: 700;
}

/* ---------- Quiz View ---------- */
.quiz-summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--blue-50);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 18px;
}

.quiz-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-weight: 700;
  color: var(--blue-950);
}

.quiz-stat-item {
  display: flex;
  flex-direction: column;
  line-height: 1.32;
}

.quiz-stat-en {
  font-size: 0.78em;
  font-weight: 600;
  color: var(--text-en);
}

.quiz-shuffle-note {
  font-size: 0.86rem;
  color: var(--text-en);
  margin: 0 0 22px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  line-height: 1.55;
}

.quiz-shuffle-note-en {
  display: block;
  font-size: 0.92em;
  color: var(--text-muted);
  margin-top: 3px;
}

.quiz-card {
  border-left: 6px solid var(--blue-700);
}

.quiz-card.answered-correct {
  border-left-color: var(--green-700);
}

.quiz-card.answered-wrong {
  border-left-color: var(--red-700);
}

.quiz-q-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.quiz-q-num-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.quiz-q-num-zh {
  font-weight: 800;
  color: var(--blue-900);
  font-size: 1rem;
}

.quiz-q-num-en {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-en);
}

.quiz-q-zh {
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--text-main);
  margin: 0 0 8px;
  line-height: 1.65;
}

.quiz-q-en {
  font-size: 0.96rem;
  color: var(--text-en);
  margin: 0 0 20px;
  line-height: 1.65;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.option-btn {
  width: 100%;
  min-height: 64px;
  text-align: left;
  padding: 16px 18px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--bg-soft);
  cursor: pointer;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  transition: background 0.15s ease, border-color 0.15s ease;
  color: var(--text-main);
  font-size: inherit;
  line-height: 1.6;
}

.option-btn:hover:not(:disabled) {
  background: var(--blue-100);
  border-color: var(--blue-600);
}

.option-btn:disabled {
  cursor: default;
}

.opt-letter {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-950);
  font-weight: 800;
  font-size: 0.96rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1px solid var(--border-strong);
}

.opt-text-zh {
  display: block;
  font-weight: 700;
  color: var(--text-main);
}

.opt-text-en {
  display: block;
  font-size: 0.92em;
  color: var(--text-en);
  margin-top: 5px;
  line-height: 1.55;
}

.option-btn.opt-correct {
  background: var(--green-100);
  border-color: var(--green-700);
}
.option-btn.opt-correct .opt-letter {
  background: var(--green-700);
  color: #ffffff;
  border-color: var(--green-700);
}

.option-btn.opt-wrong {
  background: var(--red-100);
  border-color: var(--red-700);
}
.option-btn.opt-wrong .opt-letter {
  background: var(--red-700);
  color: #ffffff;
  border-color: var(--red-700);
}

/* Explanation Panel — High-Contrast White Inner Cards */
.feedback-box {
  margin-top: 20px;
  padding: 20px 22px;
  border-radius: 14px;
  border: 2px solid var(--border-strong);
  background: var(--blue-50);
}

.feedback-box.fb-correct {
  background: var(--green-100);
  border-color: var(--green-border);
}

.feedback-box.fb-wrong {
  background: var(--red-100);
  border-color: var(--red-border);
}

.feedback-verdict-zh {
  font-weight: 800;
  font-size: 1.04rem;
  line-height: 1.45;
}

.feedback-verdict-en {
  font-weight: 700;
  font-size: 0.92rem;
  margin-top: 3px;
  margin-bottom: 14px;
  line-height: 1.45;
}

.fb-correct .feedback-verdict-zh,
.fb-correct .feedback-verdict-en { color: var(--green-800); }
.fb-wrong .feedback-verdict-zh,
.fb-wrong .feedback-verdict-en { color: var(--red-800); }

.feedback-detail-card {
  background: #ffffff;
  border: 1px solid rgba(15, 30, 48, 0.12);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 10px;
}

.feedback-heading-zh {
  font-weight: 800;
  color: var(--blue-950);
  font-size: 0.9rem;
}

.feedback-heading-en {
  font-weight: 700;
  color: var(--text-en);
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.feedback-row {
  margin: 0 0 6px;
  color: var(--text-main);
  line-height: 1.72;
}

.feedback-row-en {
  color: var(--text-en);
  font-size: 0.94em;
  margin: 0;
  line-height: 1.68;
}

/* Chapter Bottom Bar */
.chapter-footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
}

/* Modal & Toast */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 46, 0.64);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 28px 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  border-top: 5px solid var(--blue-800);
}

.modal-title-zh {
  margin: 0 0 4px;
  color: var(--blue-950);
  font-size: 1.24rem;
  line-height: 1.35;
}

.modal-title-en {
  margin: 0 0 16px;
  color: var(--text-en);
  font-size: 0.95rem;
  font-weight: 600;
}

.modal-text-zh {
  margin: 0 0 10px;
  font-weight: 600;
  color: var(--text-main);
}

.modal-text-en {
  margin: 0 0 24px;
  color: var(--text-en);
  font-size: 0.94rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--blue-950);
  color: #ffffff;
  padding: 16px 22px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  font-size: 0.92rem;
  font-weight: 600;
  z-index: 2500;
  max-width: 460px;
  line-height: 1.55;
}

.toast-en {
  display: block;
  font-size: 0.88em;
  color: #d6e9fc;
  margin-top: 3px;
}

.site-footer {
  text-align: center;
  padding: 30px 20px 42px;
  color: var(--text-en);
  font-size: 0.86rem;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  margin-top: 36px;
}

.site-footer p {
  margin: 4px 0;
}

.footer-zh {
  font-weight: 700;
  color: var(--blue-950);
}

.footer-note,
.footer-note-en {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ---------- Responsive (Tablet & Mobile) ---------- */
@media (max-width: 1024px) {
  .progress-strip-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .mobile-only {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(345px, 90vw);
    max-height: 100vh;
    z-index: 1500;
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 26, 46, 0.52);
    z-index: 1400;
  }

  .drawer-backdrop[hidden] {
    display: none;
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 16px 14px 14px;
    gap: 12px;
  }

  .site-title-zh {
    font-size: 1.06rem;
  }

  .site-title-en {
    font-size: 0.82rem;
  }

  .controls-bar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .control-group {
    width: 100%;
    justify-content: space-between;
  }

  .control-label {
    display: none;
  }

  .ctrl-btn {
    flex: 1 1 0;
    min-height: 50px;
    padding: 6px 8px;
    font-size: 0.82rem;
  }

  .progress-strip-inner {
    padding: 12px 14px;
    gap: 10px;
  }

  .app-shell {
    padding: 14px;
  }

  .card {
    padding: 20px 16px;
    margin-bottom: 18px;
  }

  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .option-btn {
    padding: 16px 14px;
    gap: 12px;
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .opt-letter {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .chapter-footer-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .chapter-footer-nav > div,
  .chapter-footer-nav .btn {
    width: 100%;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }
}
