/* ==========================================================================
   PARCOURS TCF · CLEAN CODE LIGHT THEME STYLESHEET
   Design: French study notebook on Seyès ruled paper with CEFR progress path
   ========================================================================== */

:root {
  color-scheme: light;
  box-sizing: border-box;

  /* Palette: Clean modern light canvas & crisp ink */
  --paper: #f8fafc;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --ink: #0f172a;
  --ink-soft: #475569;
  --card: #ffffff;
  --chip: #f1f5f9;
  --play: #0f172a;
  --on-play: #f8fafc;
  --margin: #e11d48;

  /* CEFR Level color spectrum: red to green */
  --a1: #d43d3d;
  --a2: #e5732a;
  --b1: #d9a514;
  --b2: #2c9a58;
  --tcf: #16704f;

  --a1-ink: #b8312f;
  --a2-ink: #b8571a;
  --b1-ink: #8f6a00;
  --b2-ink: #1f7a43;
  --tcf-ink: #125c41;

  /* Feedback states */
  --good: #1f8a5b;
  --good-bg: #e4f4ec;
  --bad: #c2414a;
  --bad-bg: #fbe8e9;
  --warn-bg: #fdf3dc;

  /* Typography */
  --display: "Young Serif", Georgia, serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--margin);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   TOP STICKY NAVIGATION BAR
   ========================================================================== */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 2px 12px rgba(29, 42, 92, 0.04);
}

.top-in {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--display);
  font-size: 1.35rem;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.brand i {
  display: inline-block;
  width: 26px;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--a1), var(--a2), var(--b1), var(--b2));
}

.lvnav {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.lvnav::-webkit-scrollbar {
  display: none;
}

.lvbtn {
  flex: none;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  border-radius: 8px;
  padding: 4px 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 58px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.lvbtn:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.lvbtn b {
  font-size: 0.9rem;
  color: var(--c-ink, var(--ink));
}

.lvbtn .mini {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.lvbtn .mini i {
  display: block;
  height: 100%;
  background: var(--c, var(--ink));
}

.lvbtn[aria-current="page"] {
  border-color: var(--c, var(--ink));
  background: color-mix(in srgb, var(--c, var(--ink)) 12%, var(--card));
  box-shadow: 0 2px 8px rgba(29, 42, 92, 0.08);
}

.stats {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.stat b {
  color: var(--ink);
  font-size: 0.95rem;
}

.iconbtn {
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.12s;
}

.iconbtn:hover {
  background: var(--chip);
}

.settings {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.88rem;
  color: var(--ink-soft);
  border-top: 1px dashed var(--line);
  margin-top: 6px;
  padding-top: 8px;
}

.settings label {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1 1 240px;
  min-width: 0;
}

select, input[type="text"], input[type="search"], textarea {
  font: inherit;
  color: var(--ink);
  background: var(--chip);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 6px 10px;
  min-width: 0;
}

select {
  flex: 1;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}

.seg button {
  border: 0;
  background: var(--chip);
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ==========================================================================
   MAIN PAGE CONTAINERS & TYPOGRAPHY
   ========================================================================== */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 72px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 400;
  margin: 0;
  text-wrap: balance;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
}

h2 {
  font-size: clamp(1.4rem, 3.2vw, 1.85rem);
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.15rem;
}

.muted {
  color: var(--ink-soft);
}

.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
}

.warnbar {
  background: var(--warn-bg);
  border-left: 3px solid var(--b1);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 18px;
  font-weight: 700;
  cursor: pointer;
  background: var(--ink);
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn.ghost {
  background: none;
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
}

.btn.ghost:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--chip);
}

.btn.small {
  padding: 7px 13px;
  font-size: 0.88rem;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

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

.spread {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   CEFR INTERACTIVE PATH SPINE
   ========================================================================== */

.path {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
  padding-top: 6px;
}

.path::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 44px;
  height: 8px;
  border-radius: 4px;
  background: var(--line);
}

.path .rail {
  position: absolute;
  left: 10%;
  top: 44px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--a1), var(--a2) 25%, var(--b1) 50%, var(--b2) 75%, var(--tcf));
  width: 0;
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  max-width: 80%;
}

.station {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0 4px;
  min-width: 0;
  text-decoration: none;
}

.ring {
  width: 84px;
  height: 84px;
  position: relative;
  display: grid;
  place-items: center;
}

.ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.ring .core {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--c);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 1.3rem;
  color: var(--c-ink);
  position: relative;
  z-index: 1;
}

.station.full .core {
  background: var(--c);
  color: #fff;
}

.station .txt {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.station .nm {
  font-weight: 700;
  font-size: 0.9rem;
}

.station .pc {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.station .here {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  padding: 2px 8px;
  border-radius: 999px;
  z-index: 2;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .path {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .path::before, .path .rail {
    display: none;
  }
  .station {
    flex-direction: row;
    text-align: left;
    gap: 12px;
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 10px 14px;
  }
  .ring {
    width: 58px;
    height: 58px;
  }
  .ring .core {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }
  .station .txt {
    align-items: flex-start;
  }
  .station .here {
    position: static;
    transform: none;
    margin-left: auto;
    order: 3;
  }
}

.gradbar {
  height: 12px;
  border-radius: 6px;
  background: var(--line);
  overflow: hidden;
  position: relative;
}

.gradbar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--a1), var(--a2) 33%, var(--b1) 60%, var(--b2));
  background-size: var(--full, 100%) 100%;
  border-radius: 6px;
  transition: width 0.8s;
}

/* ==========================================================================
   DASHBOARD STATS & HERO
   ========================================================================== */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 18px;
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.statgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 560px) {
  .statgrid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.statbox {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.statbox b {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}

.statbox span {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.continue {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 5px solid var(--c, var(--ink));
}

.tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.tool {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.tool:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(29, 42, 92, 0.08);
}

.tool b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.1rem;
}

.tool span {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ==========================================================================
   LEVEL OVERVIEW & MODULE GRIDS
   ========================================================================== */

.lvhead {
  border-left: 6px solid var(--c);
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lvtag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--c-ink);
  font-size: 0.9rem;
}

.lvtag i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
}

.mods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.mod {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}

.mod:hover {
  border-color: var(--c);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(29, 42, 92, 0.08);
}

.mod .num {
  font-family: var(--display);
  font-size: 0.95rem;
  color: var(--c-ink);
}

.mod h3 {
  font-size: 1.15rem;
}

.mod .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mod .chips span {
  font-size: 0.75rem;
  background: var(--chip);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--ink-soft);
}

.mod .foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--c);
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1.5px solid currentColor;
  white-space: nowrap;
}

.badge.done {
  color: var(--good);
}

.badge.prog {
  color: var(--c-ink);
}

.badge.new {
  color: var(--ink-soft);
}

/* ==========================================================================
   MODULE VIEW & LESSON CONTENT
   ========================================================================== */

.crumb {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.crumb a, .crumb button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.modhead {
  border-top: 6px solid var(--c);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toc button, .toc a {
  border: 1px solid var(--line-strong);
  background: var(--chip);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.84rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  transition: all 0.12s;
}

.toc button:hover, .toc a:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.sec {
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-margin-top: 140px;
}

.sec > p {
  margin: 0;
  max-width: 74ch;
  line-height: 1.6;
}

.sec b {
  color: var(--ink);
}

.ex {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.say {
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: var(--chip);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  min-width: 0;
  width: 100%;
  transition: border-color 0.12s, background 0.12s;
}

.say:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--chip) 70%, #ffffff);
}

.say .t {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  align-items: baseline;
  min-width: 0;
}

.say .fr {
  font-family: var(--display);
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.say .en {
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.say.playing {
  border-color: var(--margin);
  background: var(--card);
}

.say.playing .ic {
  background: var(--margin);
}

.ic {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--play);
  color: var(--on-play);
  display: grid;
  place-items: center;
}

.ic svg {
  width: 10px;
  height: 10px;
  margin-left: 2px;
}

.vocab {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}

.vocab .say .t {
  flex-direction: column;
  gap: 0;
}

.pairs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.pair .vs {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.tblwrap {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: var(--chip);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.conjs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.conj {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}

.conj header {
  background: var(--chip);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.conj header b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.15rem;
}

.conj header span {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.conj ul {
  list-style: none;
  margin: 0;
  padding: 4px;
}

.conj li button {
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--display);
  font-size: 1.02rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.conj li button:hover {
  background: var(--chip);
}

.conj li button.playing {
  background: var(--chip);
  color: var(--margin);
}

.conj li button::after {
  content: "▸";
  color: var(--ink-soft);
  font-family: var(--body);
  font-size: 0.8rem;
}

.dlg {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dlg .say .who {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-ink);
  min-width: 4.8em;
}

.reading {
  background: var(--chip);
  border-radius: 8px;
  padding: 16px 18px;
  font-family: var(--display);
  font-size: 1.06rem;
  line-height: 1.7;
  white-space: pre-line;
  max-width: 75ch;
}

.tip {
  background: var(--chip);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.92rem;
}

.links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.links a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  background: var(--chip);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid transparent;
  transition: all 0.12s;
}

.links a:hover {
  border-color: var(--line-strong);
  background: var(--card);
}

.links a b {
  font-family: var(--display);
  font-weight: 400;
}

.links a span {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.modnav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
}

/* ==========================================================================
   QUIZ & TESTING ENGINE (ENGLISH PROMPTS & EXPLANATIONS)
   ========================================================================== */

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

.qmeta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.qmeta .bar {
  max-width: none;
}

.qtext {
  font-family: var(--display);
  font-size: clamp(1.15rem, 3.4vw, 1.4rem);
  line-height: 1.35;
  margin: 0;
  color: var(--ink);
}

.qtext i {
  font-style: normal;
  color: var(--c-ink, var(--ink));
}

.listen {
  display: flex;
  gap: 10px;
  align-items: center;
}

.disc {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  background: var(--play);
  color: var(--on-play);
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
  flex: none;
  transition: transform 0.12s;
}

.disc:hover {
  transform: scale(1.04);
}

.disc svg {
  width: 22px;
  height: 22px;
  margin-left: 4px;
}

.disc.playing::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--margin);
  animation: pulse 1s ease-out infinite;
}

@keyframes pulse {
  from { opacity: 1; transform: scale(0.95); }
  to { opacity: 0; transform: scale(1.15); }
}

.linkbtn {
  border: 0;
  background: none;
  padding: 2px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.88rem;
  color: var(--ink);
}

.opts {
  display: grid;
  gap: 8px;
}

.opt {
  text-align: left;
  border: 1.5px solid transparent;
  background: var(--chip);
  border-radius: 8px;
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: baseline;
  transition: all 0.12s ease;
}

.opt .k {
  font-size: 0.75rem;
  color: var(--ink-soft);
  flex: none;
  font-weight: 700;
}

.opt:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--card);
}

.opt:disabled {
  cursor: default;
}

.opt.right {
  background: var(--good-bg);
  border-color: var(--good);
  color: var(--good);
  font-weight: 700;
}

.opt.wrong {
  background: var(--bad-bg);
  border-color: var(--bad);
  color: var(--bad);
}

.opt.dim {
  opacity: 0.5;
}

.typerow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.typerow input {
  flex: 1 1 220px;
  font-size: 1.1rem;
  font-family: var(--display);
  padding: 9px 12px;
}

.typerow input.right {
  border-color: var(--good);
  background: var(--good-bg);
}

.typerow input.wrong {
  border-color: var(--bad);
  background: var(--bad-bg);
}

.fb {
  border-top: 1px dashed var(--line-strong);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fb h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.15rem;
}

.fb h4.ok {
  color: var(--good);
}

.fb h4.no {
  color: var(--bad);
}

.fb p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.fb p b {
  color: var(--ink);
}

.result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.bigscore {
  font-family: var(--display);
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.bigscore small {
  font-size: 0.4em;
  color: var(--ink-soft);
}

/* ==========================================================================
   INTERACTIVE TOOLS (NUMBERS, DICTEE, SHADOW, WRITING, SPEAKING, MOCK)
   ========================================================================== */

.toolbox {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  padding: 18px;
  background: color-mix(in srgb, var(--chip) 45%, var(--card));
}

.diff {
  font-family: var(--display);
  font-size: 1.1rem;
  line-height: 1.9;
}

.diff span {
  padding: 1px 4px;
  border-radius: 4px;
  margin-right: 2px;
}

.diff .ok {
  background: var(--good-bg);
  color: var(--good);
}

.diff .miss {
  background: var(--bad-bg);
  color: var(--bad);
  text-decoration: line-through;
}

.diff .near {
  background: var(--warn-bg);
  color: var(--b1-ink);
}

.diff .extra {
  color: var(--bad);
  font-style: italic;
}

.timer {
  font-family: var(--display);
  font-size: 2.6rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer.low {
  color: var(--bad);
}

.wc {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.wc.in {
  color: var(--good);
  font-weight: 700;
}

.wc.out {
  color: var(--bad);
}

textarea {
  width: 100%;
  min-height: 200px;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  padding: 12px;
}

.prompt {
  background: var(--chip);
  border-radius: 8px;
  padding: 12px 14px;
  white-space: pre-line;
  font-size: 0.98rem;
  line-height: 1.5;
}

.plan {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.6;
}

.found {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.found span {
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--good-bg);
  color: var(--good);
  font-weight: 700;
}

.daily {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.dcard {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dcard .top2 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.dcard b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.1rem;
}

.dcard .min {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.heat {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
}

.heat i {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--line);
  max-width: 100%;
}

.heatlab {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.mistake {
  background: var(--chip);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.92rem;
}

.mistake .a {
  color: var(--ink-soft);
}

.mistake .a b {
  color: var(--good);
}

.catrow {
  display: grid;
  grid-template-columns: minmax(0, 8rem) 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}

.spark {
  width: 100%;
  height: 80px;
}

.confirm {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 50;
  pointer-events: none;
  max-width: calc(100% - 32px);
  text-align: center;
  box-shadow: 0 8px 24px rgba(29, 42, 92, 0.25);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 49;
}

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 40px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

/* ==========================================================================
   ICON UTILITIES & GRAPHIC ELEMENTS
   ========================================================================== */
.svg-icon {
  display: inline-block;
  vertical-align: -0.15em;
  fill: currentColor;
  flex-shrink: 0;
}

.icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--ink);
  flex-shrink: 0;
  vertical-align: -5px;
}

.icon-inline {
  display: inline-flex;
  align-items: center;
  vertical-align: -0.15em;
}

.tool b {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   MOBILE & RESPONSIVE DESIGN SYSTEM
   ========================================================================== */
@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  main {
    padding: 16px 12px 48px;
    gap: 16px;
  }

  /* Header on Mobile */
  .top-in {
    padding: 8px 12px;
    gap: 8px 10px;
    justify-content: space-between;
  }

  .brand {
    font-size: 1.15rem;
    gap: 6px;
  }

  .lvnav {
    order: 3;
    flex-basis: 100%;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    gap: 6px;
    padding: 4px 0 2px;
  }

  .lvnav::-webkit-scrollbar {
    display: none;
  }

  .lvbtn {
    padding: 6px 11px;
    font-size: 0.82rem;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .stats {
    gap: 6px;
    margin-left: auto;
  }

  .stat {
    padding: 4px 8px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .iconbtn {
    padding: 5px 9px;
    font-size: 0.8rem;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  /* Cards & Sections */
  .card {
    padding: 16px 14px;
    border-radius: 8px;
  }

  /* Stats Grid on Mobile: 2x2 */
  .statgrid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .statbox {
    padding: 10px 12px;
  }

  .statbox b {
    font-size: 1.35rem;
  }

  /* Tools Grid on Mobile: 1 Column */
  .tools {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .tool {
    padding: 12px 14px;
  }

  /* Level Overview Modules */
  .mods {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mod {
    padding: 14px;
  }

  /* Pair Comparison */
  .pair {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .pair .vs {
    display: none;
  }

  /* Say Audio Buttons on Mobile */
  .say {
    padding: 9px 12px;
    font-size: 0.92rem;
    min-height: 44px;
  }

  .btn {
    min-height: 42px;
    padding: 8px 16px;
  }

  /* Tables with Horizontal Scroll */
  .tblwrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px -4px;
    border-radius: 8px;
  }
}

@media (max-width: 420px) {
  main {
    padding: 12px 10px 40px;
    gap: 14px;
  }

  .card {
    padding: 14px 12px;
  }

  .brand span {
    font-size: 1.05rem;
  }

  .statgrid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .statbox {
    padding: 8px 10px;
  }

  .statbox b {
    font-size: 1.25rem;
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

