/* Honu Learning — design system
   chathonu brand palette (YouTube banner + turtle): deep sea green, mint, white star, lavender glow.
   (Layout rhythm inherited from the original Wuanberri stylesheet.) */

:root {
  --bg: #04211f;
  --bg-soft: #082b28;
  --surface: #0c322e;
  --ink: #e2f4e9;
  --ink-soft: #b4d3c2;
  --ink-muted: #7fa699;
  --line: #164139;
  --line-strong: #22574b;
  --accent: #90cca8;        /* Honu mint (from the chathonu turtle) */
  --accent-soft: rgba(144, 204, 168, 0.14);
  --accent-ink: #b4dbbe;
  --glow: #b9a3ef;          /* lavender glow (from the chathonu banner) */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.20), 0 4px 14px rgba(0, 0, 0, 0.25);
  --maxw: 1120px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

img { max-width: 100%; display: block; }

/* ---------- Layout ---------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

section { padding: 80px 0; }
section.tight { padding: 48px 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(4, 33, 31, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.nav {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav a {
  font-size: 14px;
  color: var(--ink-soft);
}
.nav a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #04211f;
}
.btn-primary:hover { background: #b4dbbe; }
.btn-accent {
  background: var(--glow);
  color: #04211f;
}
.btn-accent:hover { background: #cdbcf5; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--surface); }

/* ---------- Hero ---------- */
.hero {
  padding: 96px 0 64px;
  text-align: center;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  font-weight: 600;
}
.hero .sub {
  max-width: 640px;
  margin: 0 auto 36px;
  color: var(--ink-soft);
  font-size: 18px;
}
.hero .ctas {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 56px;
  flex-wrap: wrap;
}

/* Hero flashcard */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 520px;
  margin: 0 auto;
  text-align: left;
}
.flashcard .glyph {
  font-family: var(--font-display);
  font-size: 56px;
  line-height: 1;
  margin-bottom: 4px;
}
.flashcard .meta {
  color: var(--ink-muted);
  font-size: 14px;
  margin-bottom: 16px;
  font-style: italic;
}
.flashcard .meaning {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 12px;
}
.flashcard .example {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.flashcard .example code {
  font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", ui-serif, Georgia, serif;
  color: var(--accent-ink);
  font-size: 15px;
}
.flashcard .decomp {
  display: none;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--accent-ink);
  margin-bottom: 16px;
}
.flashcard .decomp.show { display: block; }
.flashcard .actions {
  display: flex;
  gap: 8px;
}
.flashcard .actions .btn { flex: 1; padding: 8px 12px; font-size: 13px; }

/* ---------- Section header ---------- */
.section-head {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 48px;
}
.eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  font-weight: 600;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 12px;
  font-weight: 600;
}
.section-head p {
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- "What sets us apart" — three points ---------- */
.points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.point h3 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 8px;
  font-weight: 600;
}
.point p {
  color: var(--ink-soft);
  margin: 0;
  font-size: 15px;
}

/* ---------- Subject profile tabs ---------- */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  max-width: 880px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding: 4px 4px 0;
}
.tab {
  background: transparent;
  border: 0;
  padding: 12px 18px;
  font-size: 14px;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-weight: 500;
}
.tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.profile-body {
  padding: 24px 16px 16px;
}
.profile-body h4 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 6px;
  font-weight: 600;
}
.profile-body p {
  color: var(--ink-soft);
  margin: 0 0 20px;
  font-size: 14px;
}
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 40px; align-items: center; gap: 12px; }
.bar-row .label { font-size: 13px; color: var(--ink-soft); }
.bar-row .track { background: var(--bg); border-radius: 999px; height: 8px; overflow: hidden; }
.bar-row .fill { background: var(--accent); height: 100%; border-radius: 999px; }
.bar-row .val { font-size: 12px; color: var(--ink-muted); text-align: right; }

/* ---------- Features grid ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
}
.feature h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
  font-weight: 600;
}
.feature p { color: var(--ink-soft); font-size: 14px; margin: 0; }
.feature .preview {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 13px;
  color: var(--ink-soft);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.preview .chip {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--ink-soft);
  width: fit-content;
}
.preview .math { font-family: "Cambria Math", "STIX Two Math", ui-serif, Georgia, serif; color: var(--accent-ink); font-size: 15px; }

/* ---------- The Coach ---------- */
.coach {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.coach-copy h2 { font-family: var(--font-display); font-size: 36px; margin: 0 0 16px; font-weight: 600; letter-spacing: -0.01em; }
.coach-copy p { color: var(--ink-soft); }
.coach-copy ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.coach-copy li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--ink-soft); }
.coach-copy li::before {
  content: "";
  display: block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 9px;
  flex-shrink: 0;
}

.chat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 380px;
}
.chat-head {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.chat-body {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 320px;
}
.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}
.bubble.bot {
  background: var(--bg);
  border: 1px solid var(--line);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bubble.user {
  background: var(--accent);
  color: #04211f;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bubble.bot .math { font-family: "Cambria Math", "STIX Two Math", ui-serif, Georgia, serif; }
.chips {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.chip {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
}
.chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.chat-input input {
  flex: 1;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.chat-input input:focus { border-color: var(--accent); }
.chat-input button { padding: 8px 16px; font-size: 13px; }

/* ---------- Pull quote ---------- */
.pullquote {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 0;
  position: relative;
}
.pullquote::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 2px;
  height: 32px;
  background: var(--accent);
}
.pullquote blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.35;
  margin: 24px 0 0;
  color: var(--ink);
}

/* ---------- Subjects row ---------- */
.subjects {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: center;
  font-size: 36px;
  margin-bottom: 16px;
}
.subjects .note { font-size: 14px; color: var(--ink-muted); text-align: center; }

/* ---------- Pricing ---------- */
.pricing {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto;
}
.plan {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
}
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.plan .plan-badge { align-self: flex-start; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 4px 10px; margin-bottom: 10px; }
.plan h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 4px;
  font-weight: 600;
}
.plan .price { font-size: 32px; font-weight: 600; margin: 12px 0 4px; }
.plan .price small { font-size: 14px; font-weight: 400; color: var(--ink-muted); }
.plan .trial { font-size: 13px; color: var(--ink-muted); margin-bottom: 20px; }
.plan ul { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; }
.plan li { font-size: 14px; color: var(--ink-soft); display: flex; gap: 8px; }
.plan li::before { content: "✓"; color: var(--accent); font-weight: 600; }
.plan .btn { margin-top: auto; width: 100%; }

/* ---------- Closing CTA ---------- */
.closing {
  text-align: center;
  padding: 96px 0;
}
.closing h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 48px;
  color: var(--ink-muted);
  font-size: 13px;
}
.site-footer .wrap {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}
.site-footer h5,
.site-footer .footer-head {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 12px;
  color: var(--ink-soft);
}
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.site-footer a:hover { color: var(--accent); }
.copy {
  text-align: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* ---------- Subject hub pages ---------- */
.subject-hero {
  padding: 80px 0 40px;
  text-align: center;
}
.subject-hero .eyebrow { color: var(--accent); }
.subject-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  margin: 8px 0 16px;
  letter-spacing: -0.01em;
  font-weight: 600;
}
.subject-hero p { color: var(--ink-soft); max-width: 600px; margin: 0 auto; }

.unit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.unit {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.unit:hover { border-color: var(--accent); transform: translateY(-2px); }
.unit .tag { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.unit h3 { font-family: var(--font-display); font-size: 20px; margin: 0; font-weight: 600; }
.unit p { color: var(--ink-soft); font-size: 14px; margin: 0; }
.unit .meta { font-size: 12px; color: var(--ink-muted); margin-top: 8px; }

/* ---------- Lesson page ---------- */
.lesson-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 24px;
}
.lesson-wrap .back {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 16px;
  display: inline-block;
}
.lesson-wrap h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 44px);
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.lesson-wrap .lede { color: var(--ink-soft); font-size: 17px; margin-bottom: 32px; }

.lesson-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}
.lesson-card h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 12px;
  font-weight: 600;
}
.lesson-card p { color: var(--ink-soft); }
.lesson-card .math {
  font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", ui-serif, Georgia, serif;
  background: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: block;
  margin: 12px 0;
  color: var(--accent-ink);
  font-size: 17px;
  /* long display equations scroll inside their box instead of being clipped on phones */
  overflow-x: auto;
  overflow-y: hidden;
}
/* Phones: give lesson maths more width, and set plain tables (journal
   entries, statements) at body-text size with tighter column gaps so they
   fit a 375 px screen. Only unbracketed arrays without vertical rules are
   affected (KaTeX gives their columns 0.5em gaps); matrices, cases, aligned
   equations and truth tables keep their normal spacing and size. */
@media (max-width: 480px) {
  .lesson-card { padding-left: 14px; padding-right: 14px; }
  .lesson-card .math { padding-left: 8px; padding-right: 8px; }
  .lesson-card .math .mtable:not(.minner .mtable):not(:has(.vertical-separator)) > .arraycolsep[style*="0.5em"] { width: 0.08em !important; }
  .lesson-card .math .katex-display:has(.mtable > .arraycolsep[style*="0.5em"]):not(:has(.minner .mtable)):not(:has(.vertical-separator)) { font-size: 0.8em; }
}

.q-flashcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.q-flashcard .q {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 6px;
  font-weight: 600;
}
.q-flashcard .hint { color: var(--ink-muted); font-size: 14px; margin-bottom: 20px; }
.q-flashcard .answer {
  display: none;
  font-family: "Cambria Math", "STIX Two Math", ui-serif, Georgia, serif;
  color: var(--accent-ink);
  font-size: 22px;
  margin: 16px 0;
}
.q-flashcard .answer.show { display: block; }
.q-flashcard .actions { display: flex; gap: 8px; justify-content: center; }

.mcq { display: grid; gap: 8px; margin-top: 16px; }
.mcq button {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}
.mcq button:hover { border-color: var(--accent); background: var(--surface); }
.mcq button.correct { background: #0f3326; border-color: #34c27a; color: #8fe0b0; }
.mcq button.wrong { background: #3a1518; border-color: #e06666; color: #f0a0a0; }
.mcq .feedback { font-size: 14px; margin-top: 8px; min-height: 1em; }
/* Quiz and final-exam result panel (quiz.js), shown once every question is answered. */
.quiz-result { margin-top: 24px; padding: 20px 22px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); border-left-width: 6px; }
.quiz-result-score { margin: 0; font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.quiz-result-score strong { font-size: 30px; color: var(--ink); margin-right: 4px; }
.quiz-result-title { margin: 8px 0 4px; font-size: 22px; }
.quiz-result-note { margin: 0; }
.quiz-result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.quiz-result-actions .btn { min-height: 44px; }
.quiz-result-top, .quiz-result-great { border-left-color: #34c27a; background: #0f3326; }
.quiz-result-good { border-left-color: var(--accent); background: var(--accent-soft); }
.quiz-result-mid, .quiz-result-low { border-left-color: #b9a3ef; background: #33290f; }
@media (max-width: 720px) {
  .quiz-result { padding: 18px 16px; }
  .quiz-result-actions .btn { flex: 1 1 100%; justify-content: center; text-align: center; }
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .points, .features, .unit-grid { grid-template-columns: 1fr 1fr; }
  .coach { grid-template-columns: 1fr; }
  .pricing { grid-template-columns: 1fr; }
  .site-footer .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .points, .features, .unit-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
  .bar-row { grid-template-columns: 100px 1fr 36px; }
  section { padding: 56px 0; }
}

/* ---------- Polish: page-load fade, mobile menu, focus rings ---------- */
@keyframes wu-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
main, .lesson-wrap, .workout-wrap, .placement-wrap, .partner-grid {
  animation: wu-fade-in 0.45s ease both;
}

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Mobile menu trigger (only shown when nav is hidden) */
.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  width: 40px; height: 40px;
  border-radius: 999px;
  padding: 0;
  align-items: center; justify-content: center;
}
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
  content: "";
  display: block;
  width: 16px; height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  position: relative;
}
.menu-toggle span::before { position: absolute; top: -5px; }
.menu-toggle span::after  { position: absolute; top:  5px; }

@media (max-width: 720px) {
  .menu-toggle { display: inline-flex; }
  .site-header .nav {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    gap: 0;
    padding: 8px 24px 16px;
    align-items: stretch;
  }
  .site-header .nav.open {
    display: flex;
    /* The header is sticky, so the open menu must scroll on its own: cap it at the
       visible screen below the header and keep swipes from scrolling the page. */
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  html.menu-open, html.menu-open body { overflow: hidden; }
  .site-header .nav a {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .site-header .nav a:last-child { border-bottom: 0; }
  .site-header { position: sticky; }
}

/* Hover micro-interactions */
.btn, .tab, .chip, .partner-card, .unit, .plan {
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.unit:hover, .plan:hover { transform: translateY(-2px); }
.partner-card:hover, .tab:hover { transform: none; }

/* Smooth in-page anchor scrolling */
html { scroll-behavior: smooth; }

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Polish: skip link, empty/error states, loading dots ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--ink); color: var(--bg);
  padding: 8px 14px; border-radius: var(--radius-sm);
  z-index: 100; font-size: 13px; font-weight: 500;
}
.skip-link:focus { left: 8px; }

.empty-state {
  text-align: center; padding: 48px 24px;
  background: var(--surface); border: 1px dashed var(--line-strong);
  border-radius: var(--radius); color: var(--ink-soft);
}
.empty-state h3 { font-family: var(--font-display); font-size: 20px; margin: 0 0 8px; color: var(--ink); font-weight: 600; }
.empty-state p { margin: 0 0 16px; font-size: 14px; }
.empty-state .btn { margin: 0 auto; }

.error-banner {
  background: #3a1518; border: 1px solid #6b2a2f; color: #f0a0a0;
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; margin: 12px 0;
}
.error-banner a { color: #f0a0a0; text-decoration: underline; }

/* ---------- Global floating chatbox ---------- */
.chatbox-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%;
  background: #04211f; border: 1px solid rgba(144, 204, 168, 0.45); padding: 3px;
  box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.chatbox-fab img { width: 100%; height: 100%; object-fit: contain; display: block; }
.chatbox-fab:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.30), 0 8px 24px rgba(0, 0, 0, 0.50); }
.chatbox-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chatbox-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 60;
  width: 360px; max-width: calc(100vw - 40px); height: 520px; max-height: calc(100vh - 120px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: none; flex-direction: column; overflow: hidden;
}
.chatbox-panel.open { display: flex; }
.chatbox-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.chatbox-title { font: 600 14px var(--font); }
.chatbox-close {
  background: transparent; border: 0; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--ink-muted);
  padding: 0 4px;
}
.chatbox-close:hover { color: var(--ink); }
.chatbox-body {
  flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; background: var(--bg);
}
.chatbox-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface);
}
.chatbox-chips .chip { font-size: 12px; padding: 6px 10px; }
.chatbox-input {
  display: flex; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface);
}
.chatbox-input input {
  flex: 1; border: 1px solid var(--line-strong); background: var(--bg);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 14px;
  outline: none;
}
.chatbox-input input:focus { border-color: var(--accent); }
.chatbox-input .btn { padding: 8px 14px; font-size: 13px; }

@media (max-width: 480px) {
  .chatbox-fab { right: 14px; bottom: 14px; }
  .chatbox-panel { right: 8px; bottom: 80px; width: calc(100vw - 16px); height: 70vh; }
}

/* ---------- Pop quiz modal ---------- */
.pop-quiz-modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0, 0, 0, 0.60);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.pop-quiz-modal.open { display: flex; }
.pop-quiz-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 28px;
}
.pop-quiz-progress { display: flex; gap: 6px; margin-bottom: 16px; }
.pop-quiz-progress .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line-strong); transition: background 0.2s ease;
}
.pop-quiz-progress .dot.done { background: var(--accent); }
.pop-quiz-progress .dot.current { background: var(--accent); outline: 2px solid var(--accent-soft); }
.pop-quiz-prompt { font: 500 17px var(--font); margin: 0 0 16px; line-height: 1.4; }
.pop-quiz-choices { display: grid; gap: 8px; }
.pop-quiz-choices button {
  text-align: left; background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font: inherit; font-size: 14px; cursor: pointer; transition: border-color 0.15s ease;
}
.pop-quiz-choices button:hover:not(:disabled) { border-color: var(--accent); }
.pop-quiz-choices button.correct { background: #0f3326; border-color: #34c27a; }
.pop-quiz-choices button.wrong { background: #3a1518; border-color: #e06666; }
.pop-quiz-feedback { font-size: 13px; color: var(--ink-soft); margin-top: 12px; min-height: 1em; }
.pop-quiz-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }
.pop-quiz-foot .progress-text { font-size: 13px; color: var(--ink-muted); }
.pop-quiz-foot .btn { padding: 8px 16px; font-size: 14px; }

/* ---------- Daily warm-up banner ---------- */
.warmup-banner {
  background: linear-gradient(135deg, var(--accent-soft) 0%, #0a2b35 100%);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 18px 22px; margin: 16px 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.warmup-banner .text { flex: 1; }
.warmup-banner h3 { margin: 0 0 4px; font: 600 16px var(--font); }
.warmup-banner p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.warmup-banner .actions { display: flex; gap: 8px; }
.warmup-banner .btn { padding: 8px 14px; font-size: 13px; }
.warmup-banner .skip { background: transparent; color: var(--ink-muted); border: 0; cursor: pointer; font: inherit; font-size: 13px; }
.warmup-banner .skip:hover { color: var(--ink); }

/* ---------- Subjects dropdown ---------- */
.nav-dd { position: relative; }
.nav-dd-btn {
  font-size: 14px; color: var(--ink-soft); background: none;
  border: 0; cursor: pointer; padding: 0; font-family: inherit;
  display: inline-flex; align-items: center; gap: 4px;
}
.nav-dd-btn:hover { color: var(--ink); }
.nav-dd-caret { font-size: 10px; }
.nav-dd-panel {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  display: none; grid-template-columns: repeat(3, 1fr); gap: 4px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 22px; min-width: 560px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  z-index: 60;
}
.nav-dd:hover .nav-dd-panel,
.nav-dd.open .nav-dd-panel { display: grid; }
@media (min-width: 721px) {
  /* Invisible bridge over the 10px gap, so moving the mouse down into the panel keeps it open. */
  .nav-dd:hover::after { content: ""; position: absolute; left: -24px; right: -24px; top: 100%; height: 14px; }
  /* Tall panels scroll inside themselves instead of running off short screens. */
  .nav-dd-panel { max-height: calc(100vh - 80px); overflow-y: auto; overscroll-behavior: contain; }
}
.dd-col h6,
.dd-col .dd-col-label {
  display: block;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); margin: 2px 0 6px;
}
.dd-col a { display: block; font-size: 14px; color: var(--ink); padding: 3px 0; }
.dd-col a:hover { color: var(--accent); }
.brand-img img { height: 30px; width: auto; display: block; }
.brand-img { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.brand-img .brand-word {
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  color: var(--ink); line-height: 1; letter-spacing: .01em;
}
@media (max-width: 720px) {
  .nav-dd-panel {
    position: static; transform: none; display: none; grid-template-columns: 1fr;
    min-width: 0; box-shadow: none; border: 0; padding: 0 0 8px 12px; background: transparent;
  }
  .nav-dd:hover .nav-dd-panel { display: none; }
  .nav-dd.open .nav-dd-panel { display: block; }
  .nav-dd-btn { padding: 10px 0; width: 100%; justify-content: flex-start; border-bottom: 1px solid var(--line); }
}

/* ---------- Header remodel (2026-10-27): short menu, no wrapping labels ---------- */
.site-header .nav a, .site-header .nav-dd-btn, .site-header .btn, .brand-word { white-space: nowrap; }
.site-header .nav { gap: 26px; }
.nav-dd-list { grid-template-columns: 1fr; min-width: 210px; }
.nav-dd-list a { display: block; padding: 6px 4px; }

/* ---------- Homepage illustration ---------- */
.hero-art { padding: 8px 0 0; }
.hero-art .wrap { display: flex; justify-content: center; }
.hero-art svg { width: 100%; max-width: 360px; height: auto; display: block; }

/* ---------- My Flashcards (my-cards.html, lesson "Add to my cards", AI Decks save) ---------- */
.fc-wrap { max-width: 880px; margin: 0 auto; padding: 48px 24px 96px; }
.fc-wrap h1 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 36px); margin: 0 0 8px; font-weight: 600; letter-spacing: -0.01em; }
.fc-wrap .lede { color: var(--ink-soft); margin: 0 0 20px; font-size: 15px; }
.fc-wrap .btn, .fc-chooser .btn, .fc-save-panel .btn, .fc-add-btn { min-height: 40px; }
.fc-wrap .btn:disabled, .fc-save-panel .btn:disabled { opacity: .5; cursor: not-allowed; }
.fc-h2 { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin: 0 0 4px; overflow-wrap: anywhere; }
.fc-h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); font-weight: 600; margin: 0 0 6px; }
.fc-meta { color: var(--ink-muted); font-size: 13px; margin: 4px 0; }
.fc-meta a { color: var(--accent-ink); text-decoration: underline; }
.fc-center { text-align: center; }
.fc-empty { color: var(--ink-muted); font-size: 14px; padding: 16px 0; margin: 0; }

.fc-meter { margin-bottom: 16px; font-size: 13px; color: var(--ink-muted); }
.fc-meter-text { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.fc-meter-track { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.fc-meter-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.fc-meter-fill.warn { background: #b33a3a; }
.fc-msg { background: var(--accent-soft); color: var(--accent-ink); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin: 0 0 16px; }
.fc-msg.err { background: #3a1518; color: #f0a0a0; border: 1px solid #e06666; }

.fc-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); min-width: 0; }
.fc-due-panel { display: grid; gap: 12px; }
.fc-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.fc-section-head > div { min-width: 0; flex: 1 1 240px; }
.fc-row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fc-back { background: none; border: 0; padding: 8px 0; margin-bottom: 8px; min-height: 40px; color: var(--ink-muted); font-size: 14px; }
.fc-back:hover { color: var(--ink); }

.fc-form { display: grid; gap: 12px; margin: 0 0 16px; padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.fc-form[hidden] { display: none; }
.fc-label { display: grid; gap: 6px; font-size: 12px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; min-width: 0; }
.fc-req, .fc-opt { text-transform: none; letter-spacing: 0; font-weight: 400; }
.fc-wrap input[type="text"], .fc-wrap input[type="search"], .fc-wrap select, .fc-wrap textarea,
.fc-chooser input, .fc-chooser select, .fc-save-panel input, .fc-save-panel select {
  width: 100%; box-sizing: border-box; min-height: 40px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); padding: 8px 12px; font: inherit; font-size: 15px; text-transform: none; letter-spacing: 0; font-weight: 400;
}
.fc-wrap textarea { resize: vertical; line-height: 1.45; }
.fc-wrap input:focus, .fc-wrap select:focus, .fc-wrap textarea:focus, .fc-chooser input:focus, .fc-chooser select:focus,
.fc-save-panel input:focus, .fc-save-panel select:focus { border-color: var(--accent); outline: none; }
.fc-hint-note { font-size: 12px; color: var(--ink-muted); margin: 0; }
.fc-hint-note code { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 12px; }
.fc-form-err, .fc-feedback.err { color: #f0a0a0; font-size: 13px; margin: 0; }
.fc-form-err:empty { display: none; }

.fc-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 12px; margin-bottom: 16px; }
.fc-filters-cards { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; }
.fc-checks { display: flex; gap: 12px; flex-wrap: wrap; }
.fc-check { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.fc-check input { width: 18px; height: 18px; accent-color: var(--accent); }

.fc-deck-list, .fc-card-list { display: grid; gap: 10px; }
.fc-deck { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.fc-deck-main { min-width: 0; flex: 1 1 260px; }
.fc-deck h3 { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.fc-deck h3 a:hover { color: var(--accent); }
.fc-due-pill { display: inline-block; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 0 8px; font-weight: 600; }

.fc-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 12px 0; }
.fc-mode { display: grid; gap: 4px; text-align: left; padding: 14px 16px; min-height: 40px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); font: inherit; }
.fc-mode:hover:not(:disabled) { border-color: var(--accent); background: var(--surface); }
.fc-mode:disabled { opacity: .55; cursor: not-allowed; }
.fc-mode-name { font-weight: 600; font-size: 15px; }
.fc-mode-desc { font-size: 13px; color: var(--ink-soft); }
.fc-mode-note { font-size: 12px; color: var(--accent-ink); }
.fc-pro { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--ink); color: var(--bg); border-radius: 999px; padding: 1px 7px; vertical-align: middle; }

.fc-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.fc-card-editing { display: block; padding: 0; border: 0; background: none; }
.fc-card-editing .fc-form { margin: 0; }
.fc-card-text { min-width: 0; }
.fc-front { font-weight: 600; color: var(--ink); font-size: 15px; overflow-wrap: anywhere; }
.fc-back-text { color: var(--ink-soft); font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; white-space: pre-wrap; }
.fc-hint-text { color: var(--ink-muted); font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }
.fc-hint-text span, .fc-hint-box span { font-weight: 600; }
.fc-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.fc-tag { font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--ink-soft); }
.fc-card-meta { font-size: 12px; color: var(--ink-muted); margin: 6px 0 0; }
.fc-card-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.fc-card-actions .btn { padding: 6px 12px; font-size: 13px; }
.fc-star { min-width: 40px; font-size: 18px !important; line-height: 1; }
.fc-star.on { color: var(--accent); border-color: var(--accent); }
.fc-card .fc-confirm { grid-column: 1 / -1; }
.fc-front .katex-display, .fc-back-text .katex-display, .fc-face .katex-display, .fc-answer .katex-display, .fc-compare-box .katex-display { overflow-x: auto; overflow-y: hidden; }

.btn.fc-danger { color: #f0a0a0; }
.btn.fc-btn-danger { background: #b33a3a; color: #fff; }
.btn.fc-btn-danger:hover { background: #8f2d2d; }
.fc-confirm { display: grid; gap: 10px; margin: 12px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: #3a1518; border: 1px solid #e06666; color: #f0a0a0; font-size: 14px; }

/* Study screen */
.fc-study-head { margin-bottom: 12px; }
.fc-study-head .eyebrow { color: var(--accent); }
.fc-progress { display: grid; gap: 6px; font-size: 13px; color: var(--ink-muted); margin-bottom: 16px; }
.fc-stage { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 20px; text-align: center; min-height: 160px; display: grid; align-content: center; gap: 14px; min-width: 0; }
.fc-face { font-family: var(--font-display); font-size: 22px; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.fc-answer { font-size: 18px; color: var(--accent-ink); border-top: 1px solid var(--line); padding-top: 14px; overflow-wrap: anywhere; white-space: pre-wrap; min-width: 0; }
.fc-hint-box { font-size: 14px; color: var(--ink-soft); background: var(--surface); border-radius: var(--radius-sm); padding: 8px 12px; overflow-wrap: anywhere; }
.fc-study-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.fc-study-sub { display: flex; justify-content: center; margin-top: 10px; }
.btn.fc-btn-good { background: #1f8f55; color: #fff; }
.btn.fc-btn-good:hover { background: #176b40; }
.btn.fc-btn-bad { background: #b33a3a; color: #fff; }
.btn.fc-btn-bad:hover { background: #8f2d2d; }
.fc-choices { display: grid; gap: 8px; margin-top: 16px; }
.fc-choice { text-align: left; min-height: 44px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; font: inherit; font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.fc-choice:hover:not(:disabled) { border-color: var(--accent); background: var(--surface); }
.fc-choice:disabled { cursor: default; }
.fc-choice.correct { background: #0f3326; border-color: #34c27a; color: #8fe0b0; }
.fc-choice.wrong { background: #3a1518; border-color: #e06666; color: #f0a0a0; }
.fc-feedback { font-size: 14px; margin: 12px 0 0; text-align: center; }
.fc-feedback.good { color: #8fe0b0; }
.fc-feedback.bad { color: #f0a0a0; }
.fc-typed { margin: 16px 0 0; }
.fc-typed .fc-study-actions { margin-top: 4px; }
.fc-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.fc-compare-box { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 15px; overflow-wrap: anywhere; white-space: pre-wrap; }
.fc-summary { text-align: center; }
.fc-score { font-family: var(--font-display); font-size: 44px; font-weight: 600; margin: 8px 0 0; }
.fc-summary .fc-row-actions { justify-content: center; margin-top: 16px; }
.fc-missed { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; text-align: left; }
.fc-missed li { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.fc-pro-note { background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--radius-sm); padding: 16px 20px; }
.fc-pro-note p { margin: 0 0 10px; }
.fc-pro-note p:last-child { margin: 0; }

/* Typed-answer history */
.fc-attempts { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.fc-attempt { border: 1px solid var(--line); border-left: 4px solid #34c27a; border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); }
.fc-attempt.bad { border-left-color: #e06666; }
.fc-attempt-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.fc-attempt-mark { font-size: 13px; font-weight: 600; }
.fc-attempt.good .fc-attempt-mark { color: #8fe0b0; }
.fc-attempt.bad .fc-attempt-mark { color: #f0a0a0; }

/* Lesson flashcards: "Add to my cards" button and inline deck chooser */
.q-flashcard .actions { flex-wrap: wrap; }
.btn.fc-saved { border-color: #34c27a; color: #8fe0b0; }
.fc-chooser { text-align: left; display: grid; gap: 10px; margin-top: 16px; padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.fc-chooser[hidden], .fc-chooser [hidden] { display: none; }
.fc-chooser > div:not(.fc-chooser-actions) { display: grid; gap: 10px; }
.fc-chooser-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fc-chooser .fc-feedback { text-align: left; margin: 0; }
.fc-chooser .fc-feedback:empty { display: none; }
/* Buttons that read as links (deck names, "My typed answers for this deck"). */
.fc-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.fc-link:hover { color: var(--accent-ink); }

/* AI Decks: "Save to My Flashcards" */
.fc-save-panel { margin-bottom: 16px; display: grid; gap: 10px; justify-items: start; }
.fc-save-panel .fc-form { width: 100%; margin: 0; }
.fc-save-panel .fc-feedback { text-align: left; margin: 0; }
.fc-save-panel .fc-feedback:empty { display: none; }
.fc-save-panel .fc-feedback a { color: var(--accent-ink); text-decoration: underline; font-weight: 600; }

@media (max-width: 720px) {
  .fc-wrap { padding: 32px 16px 72px; }
  .fc-panel { padding: 16px; }
  .fc-filters, .fc-filters-cards, .fc-compare { grid-template-columns: minmax(0, 1fr); }
  .fc-card { grid-template-columns: minmax(0, 1fr); }
  .fc-card-actions { justify-content: flex-start; }
  .fc-modes { grid-template-columns: minmax(0, 1fr); }
  .fc-stage { padding: 20px 14px; }
  .fc-face { font-size: 19px; }
  .fc-study-actions .btn { flex: 1 1 calc(50% - 8px); }
  .fc-deck .fc-row-actions { width: 100%; }
  .fc-deck .fc-row-actions .btn { flex: 1 1 0; }
}

/* ---------- Study Guides (study.html) ---------- */
/* Builds on the My Flashcards styles (fc-wrap, fc-panel, fc-form, fc-choice, fc-confirm). */
.sg-usage { display: inline-block; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 6px 14px; font-size: 14px; margin: 0 0 16px; }
.sg-usage a { color: var(--accent-ink); text-decoration: underline; font-weight: 600; }
.sg-input { display: grid; gap: 12px; }
.sg-input .fc-h2 { margin-top: 4px; }
.sg-file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.sg-file-btn { position: relative; min-height: 40px; cursor: pointer; }
.sg-file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.sg-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.sg-file-status { margin: 0; font-size: 14px; color: var(--ink-soft); }
.sg-file-status:empty { display: none; }
.sg-file-status.err, .sg-hl-warn { color: #f0a0a0; }
.sg-wrap #sgNotes { min-height: 180px; }
.sg-count { margin: -4px 0 0; font-size: 13px; color: var(--ink-muted); text-align: right; font-variant-numeric: tabular-nums; }
.sg-count.over { color: #f0a0a0; font-weight: 600; }
.sg-range { display: grid; gap: 8px; padding: 14px 16px; background: var(--accent-soft); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--accent-ink); }
.sg-range[hidden] { display: none; }
.sg-range-msg { margin: 0; font-size: 14px; }
.sg-range .fc-check { color: var(--accent-ink); }
.sg-range .sg-start { max-width: 180px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 12px; font: inherit; font-size: 15px; background: var(--surface); }
.sg-range .fc-meta { color: var(--accent-ink); overflow-wrap: anywhere; }
.sg-privacy { margin: 0; font-size: 13px; color: var(--ink-soft); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
.sg-meta-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.sg-go-row .btn { min-height: 44px; }
.sg-progress { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sg-progress[hidden] { display: none; }
.sg-step { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); font-size: 14px; }
.sg-step-state { color: var(--ink-muted); }
.sg-step.run { border-left-color: var(--accent); }
.sg-step.run .sg-step-state::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 8px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: sg-spin .8s linear infinite; }
.sg-step.ok { border-left-color: #34c27a; }
.sg-step.ok .sg-step-state { color: #8fe0b0; font-weight: 600; }
.sg-step.fail { border-left-color: #e06666; }
.sg-step.fail .sg-step-state { color: #f0a0a0; font-weight: 600; }
@keyframes sg-spin { to { transform: rotate(360deg); } }

.sg-result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 28px 0 12px; }
.sg-result-head > div { min-width: 0; flex: 1 1 240px; }
.sg-result-head .eyebrow { margin-bottom: 4px; }
.sg-title { font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 30px); font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.sg-part-err { background: #3a1518; border: 1px solid #e06666; color: #f0a0a0; border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 10px; justify-items: start; font-size: 14px; }
.sg-part-err p { margin: 0; }
.sg-hl-help { margin: 0 0 12px; }
.sg-selarea.active { position: sticky; top: 72px; z-index: 5; }
.sg-selbar { display: grid; gap: 10px; margin: 0 0 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.sg-sel-text { margin: 0; font-size: 14px; color: var(--ink-soft); overflow-wrap: anywhere; }
.sg-note-form { margin: 0; }
.sg-outline { display: grid; gap: 18px; }
.sg-sec { min-width: 0; }
.sg-sec-head { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 0 0 6px; overflow-wrap: anywhere; }
.sg-points { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.sg-point { color: var(--ink); font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; min-width: 0; }
.sg-point .katex-display, .sg-term dd .katex-display, .sg-q .katex-display { overflow-x: auto; overflow-y: hidden; }
mark.sg-hl { background: rgba(245, 196, 107, 0.28); color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px #b9a3ef inset; }
.sg-note-ref { font-size: 11px; font-weight: 700; color: var(--accent-ink); margin-left: 2px; }
.sg-notes { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.sg-note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sg-note-item { padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); display: grid; gap: 6px; min-width: 0; }
.sg-note-item p { margin: 0; overflow-wrap: anywhere; }
.sg-note-num { display: inline-block; min-width: 20px; text-align: center; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 0 6px; }
.sg-note-body { font-size: 14px; color: var(--ink-soft); white-space: pre-wrap; }
.sg-terms-head { margin-top: 24px; }
.sg-terms { margin: 8px 0 0; display: grid; gap: 8px; }
.sg-term { padding: 10px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 0; }
.sg-term dt { font-weight: 600; overflow-wrap: anywhere; }
.sg-term dd { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; overflow-wrap: anywhere; }
.sg-q-list { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 18px; }
.sg-q { min-width: 0; }
.sg-q-prompt { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sg-q .fc-choices { margin-top: 10px; }
.sg-q-feedback { margin: 10px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.sg-q-feedback.good { color: #8fe0b0; }
.sg-q-feedback.bad { color: #f0a0a0; }
.sg-score { text-align: center; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.sg-score .fc-row-actions { justify-content: center; margin-top: 10px; }
.sg-saved-item .sg-confirm-full { flex: 1 1 100%; }
@media (max-width: 720px) {
  .sg-meta-row { grid-template-columns: minmax(0, 1fr); }
  .sg-count { text-align: left; }
  .sg-go-row .btn, .sg-file-btn { flex: 1 1 100%; }
  .sg-selarea.active { top: 68px; }
  .sg-selbar .fc-row-actions .btn { flex: 1 1 calc(50% - 8px); }
  .sg-points, .sg-q-list { padding-left: 18px; }
}

/* Honu Learning: form fields follow the dark theme everywhere (browsers default them to white). */
input, textarea, select { background-color: var(--bg-soft); color: var(--ink); border-color: var(--line-strong); }
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
