/* ==========================================================================
   CoachVocab — layout & components
   Desktop translation of the mobile mock: the jpeg's two side-by-side phone
   screens become the dashboard column + deck panel column.
   ========================================================================== */

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

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

button { font: inherit; color: inherit; cursor: pointer; }

/* Decorative plus-sign motif from the mock's background */
.plus-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.plus-field span {
  position: absolute;
  color: var(--primary);
  opacity: .16;
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
}

/* ==========================================================================
   App shell
   ========================================================================== */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  gap: 0;
}

/* --------------------------------------------------------------------------
   Left rail — replaces the mock's bottom pill nav
   -------------------------------------------------------------------------- */

.rail {
  display: flex;
  flex-direction: column;
  padding: 26px 18px 132px;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
}

.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--gradient);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
  box-shadow: var(--shadow-primary);
}
.brand__mark svg { width: 20px; height: 20px; }

.brand__name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.brand__name em {
  font-style: normal;
  color: var(--primary-ink);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  border-radius: 14px;
  color: var(--ink-muted);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  transition: background .16s, color .16s;
}
.nav__item svg { width: 19px; height: 19px; flex: none; }

.nav__item:hover { background: rgba(1, 105, 246, .07); color: var(--primary-ink); }

.nav__item.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.nav__badge {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--tile-peach);
  color: var(--tile-peach-ink);
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.nav__item.is-active .nav__badge {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

/* Light / dark switch, directly under the nav */
.theme-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--toggle-bg);
}

.theme-toggle__opt {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 8px;
  border: 0;
  background: transparent;
  border-radius: 20px;
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 600;
  transition: background .16s, color .16s, box-shadow .16s;
}
.theme-toggle__opt svg { width: 15px; height: 15px; flex: none; }
.theme-toggle__opt:hover { color: var(--ink-soft); }

.theme-toggle__opt.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* --------------------------------------------------------------------------
   Session bar — the mock's orange FAB, scaled up to span the bottom
   -------------------------------------------------------------------------- */

.session-bar {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;

  padding: 22px 32px;
  border: 0;
  border-radius: var(--r-pill);
  /* horizontal, not 135deg — a diagonal washes out across a wide element */
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-to) 100%);
  color: #fff;
  text-align: left;
  text-decoration: none;

  box-shadow: 0 14px 34px rgba(245, 136, 58, .40);
  transition: transform .16s, box-shadow .16s;
}
.session-bar:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(245, 136, 58, .48);
}
.session-bar:active { transform: translateY(0); }

.session-bar__icon {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  display: grid;
  place-items: center;
}
.session-bar__icon svg { width: 20px; height: 20px; margin-left: 2px; }

.session-bar__text { display: flex; flex-direction: column; gap: 2px; }

.session-bar__title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.session-bar__meta {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, .86);
}

/* --------------------------------------------------------------------------
   Main area
   -------------------------------------------------------------------------- */

.main {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  gap: 24px;
  /* bottom padding clears the fixed session bar */
  padding: 26px 26px 132px 6px;
  align-items: start;
}

.col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

/* Page head */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 0;
}

.page-head h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 14px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--tile-peach);
  display: grid;
  place-items: center;
  font-size: 21px;
  flex: none;
  box-shadow: var(--shadow);
}

/* --------------------------------------------------------------------------
   Stat tiles — pastel, alternating like the mock
   -------------------------------------------------------------------------- */

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

.stat {
  padding: 16px 16px 14px;
  border-radius: var(--r-tile);
  background: var(--tile-lavender);
  min-width: 0;
}

.stat__value {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--tile-lavender-ink);
}

.stat__label {
  margin-top: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat--lavender { background: var(--tile-lavender); }
.stat--lavender .stat__value { color: var(--tile-lavender-ink); }
.stat--peach { background: var(--tile-peach); }
.stat--peach .stat__value { color: var(--tile-peach-ink); }
.stat--mint { background: var(--tile-mint); }
.stat--mint .stat__value { color: var(--tile-mint-ink); }
.stat--rose { background: var(--tile-rose); }
.stat--rose .stat__value { color: var(--tile-rose-ink); }

/* --------------------------------------------------------------------------
   Section headings
   -------------------------------------------------------------------------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 0;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.link {
  border: 0;
  background: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-ink);
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Card + "Continue learning" rows (the mock's Classes list)
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: var(--pad-card);
}

.card--flush { padding: 8px; }

.lesson-list { display: flex; flex-direction: column; }

.lesson {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 16px 14px;
  border-radius: var(--r-tile);
  color: inherit;
  text-decoration: none;
  transition: background .16s;
}
.lesson + .lesson { box-shadow: inset 0 1px 0 var(--hairline); }
.lesson:hover { background: var(--surface-sunken); box-shadow: none; }
.lesson:hover + .lesson { box-shadow: none; }

.lesson__tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-ink);
  letter-spacing: .01em;
}
.lesson__tag--amber { color: var(--tile-peach-ink); }
.lesson__tag--violet { color: var(--tile-lavender-ink); }
.lesson__tag--mint { color: var(--tile-mint-ink); }

.lesson__title {
  display: block;
  margin: 6px 0 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.lesson__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.lesson__chip {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: var(--surface-sunken);
  flex: none;
}

.lesson__sub {
  font-size: 12.5px;
  color: var(--ink-muted);
  font-weight: 500;
}

.lesson__count {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Deck panel — the mock's gradient-header screen
   -------------------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel__head {
  background: var(--gradient);
  color: #fff;
  padding: 22px 24px 0;
}

.panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background .16s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .28); }
.icon-btn svg { width: 16px; height: 16px; }

.panel__title {
  margin: 16px 0 0;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.18;
}

.panel__sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, .78);
}

.tabs {
  display: flex;
  gap: 26px;
  margin-top: 18px;
}

.tab {
  border: 0;
  background: none;
  padding: 0 0 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, .68);
  position: relative;
  transition: color .16s;
}
.tab:hover { color: #fff; }

.tab.is-active { color: #fff; font-weight: 700; }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent-to);
}

.panel__body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel-body);
}

/* Deck rows — white card, title, thin progress bar, count on the right */
.deck {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--surface);
  border-radius: var(--r-tile);
  box-shadow: var(--shadow);
  padding: 15px 17px;
  color: inherit;
  text-decoration: none;
  transition: transform .16s, box-shadow .16s;
}
.deck:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.deck__main { min-width: 0; }

.deck__name {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0 0 11px;
}

.deck__count {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: var(--track);
  overflow: hidden;
}
.bar__fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--gradient);
  transition: width .3s ease;
}

/* ==========================================================================
   Study screens — layout variants
   ========================================================================== */

/* Single centred column: flashcards, test, settings */
.main--single {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  padding-right: 26px;
}
.main--single .study { width: 100%; max-width: 660px; }

/* Wider two-column split for stats */
.main--wide { grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); }

.study {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* -------------------------------------------------- session header + progress */

.study__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 4px 2px 0;
}

.study__count {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-bottom: 7px;
  text-align: center;
}
.study__count span { color: var(--ink-muted); font-weight: 600; }

.icon-btn--quiet {
  background: var(--surface);
  color: var(--ink-muted);
  box-shadow: var(--shadow);
}
.icon-btn--quiet:hover { background: var(--surface); color: var(--ink); }
.icon-btn--quiet.is-on { color: var(--tile-peach-ink); }
.icon-btn--quiet.is-on svg { fill: currentColor; }

.pill {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.pill--new      { background: var(--tile-lavender); color: var(--tile-lavender-ink); }
.pill--learning { background: var(--tile-peach);    color: var(--tile-peach-ink); }
.pill--review   { background: var(--tile-mint);     color: var(--tile-mint-ink); }

/* Countdown */
.timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.timer svg { width: 15px; height: 15px; color: var(--ink-muted); }
.timer.is-low { background: var(--bad-soft); color: var(--bad); }
.timer.is-low svg { color: var(--bad); }

/* ------------------------------------------------------------- the flashcard */

.flashcard {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
  padding: 40px 32px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  text-align: center;
  transition: transform .16s;
}
.flashcard:hover { transform: translateY(-2px); }
.flashcard:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

.flashcard__face { width: 100%; }
.flashcard__face--back { display: none; }
.flashcard.is-flipped .flashcard__face--front { display: none; }
.flashcard.is-flipped .flashcard__face--back { display: block; }

.flashcard__tools {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
}

.flashcard__word {
  margin: 0;
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.flashcard__pos {
  margin: 12px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: lowercase;
}

.flashcard__prompt {
  margin: 26px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
}

.flashcard__answer {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--primary-ink);
}

.flashcard__example {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
}
.flashcard__example-es {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.flashcard__example-en {
  margin: 6px 0 0;
  font-size: 14.5px;
  color: var(--ink-muted);
}

/* ------------------------------------------------------------------ grading */

.study__foot { display: flex; flex-direction: column; gap: 12px; }
.study__foot--right { align-items: flex-end; }

.study__ask {
  margin: 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-muted);
}

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

.grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 8px 11px;
  border: 0;
  border-radius: var(--r-tile);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .16s, box-shadow .16s;
}
.grade:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.grade__label { font-size: 14.5px; font-weight: 700; }
.grade__hint  { font-size: 11.5px; color: var(--ink-muted); }

.grade--again .grade__label { color: var(--bad); }
.grade--hard  .grade__label { color: var(--warn); }
.grade--good  .grade__label { color: var(--primary-ink); }
.grade--easy  .grade__label { color: var(--good); }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-top: 3px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--surface-sunken);
  color: var(--ink-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 22px;
  border: 0;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .16s, box-shadow .16s, background .16s;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-2px); }
.btn--wide { width: 100%; }

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}
.btn--primary kbd { background: rgba(255, 255, 255, .22); color: #fff; margin: 0; }

.btn--ghost {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.btn--danger { background: var(--bad-soft); color: var(--bad); }

/* --------------------------------------------------------- quiz / test card */

.card--center { text-align: center; padding: 36px 30px; }
.card--quiz   { padding: 40px 32px; text-align: center; }

.quiz__label {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.quiz__word {
  margin: 16px 0 0;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -.03em;
}

.quiz__pos {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.quiz__form {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

.input {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  border: 2px solid var(--track);
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  color: var(--ink);
  font: inherit;
  font-size: 15.5px;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}

/* ------------------------------------------------------------------ results */

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

.done__mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good);
}
.done__mark svg { width: 28px; height: 28px; }
.done__mark--blue { background: var(--primary-soft); color: var(--primary-ink); }

.done__title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.done__sub {
  margin: 10px 0 0;
  max-width: 44ch;
  color: var(--ink-muted);
  font-size: 14.5px;
}

.done__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

.score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: left;
}
.score__meta .done__sub { margin-top: 8px; }

.ring { width: 118px; height: 118px; flex: none; }
.ring__track {
  fill: none;
  stroke: var(--track);
  stroke-width: 11;
}
.ring__fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 11;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset .6s ease;
}
.ring__text {
  fill: var(--ink);
  font-size: 27px;
  font-weight: 700;
}

.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.results th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-muted);
}
.results td {
  padding: 13px 14px;
  border-top: 1px solid var(--hairline);
  vertical-align: middle;
}
.results__es { font-weight: 700; }
.results__given.is-wrong { color: var(--bad); text-decoration: line-through; }
.results__blank { color: var(--ink-faint); font-style: italic; }

.verdict {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.verdict--good { background: var(--good-soft); color: var(--good); }
.verdict--warn { background: var(--warn-soft); color: var(--warn); }
.verdict--bad  { background: var(--bad-soft);  color: var(--bad); }

/* ======================================================================
   Stats
   ====================================================================== */

.streak {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--tile-peach);
  color: var(--tile-peach-ink);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.streak svg { width: 17px; height: 17px; }
.streak b { font-weight: 700; }

.section-head--tight { padding: 0 0 14px; }

/* Scales proportionally — stretching the viewBox would turn the dots into
   ellipses and squash the axis labels */
.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart__legend { font-size: 12px; color: var(--ink-muted); }

.chart__empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin: 0;
  padding: 0 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-muted);
}
.chart__grid { stroke: var(--hairline); stroke-width: 1; }
.chart__axis { stroke: var(--track); stroke-width: 1; }
.chart__tick { fill: var(--ink-faint); font-size: 10px; }
.chart__line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.chart__area { fill: var(--primary); opacity: .10; stroke: none; }
.chart__dot  { fill: var(--surface); stroke: var(--primary); stroke-width: 2;
               vector-effect: non-scaling-stroke; }
.chart__bar  { fill: var(--primary); opacity: .78; }

/* Weakest-words rows */
.weak { padding: 15px 16px; }
.weak + .weak { border-top: 1px solid var(--hairline); }

.weak__pair { display: flex; align-items: baseline; gap: 9px; }
.weak__es { font-size: 14.5px; font-weight: 700; }
.weak__en { font-size: 13px; color: var(--ink-muted); }

.weak__meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.weak__lapses { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.weak__pct {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}

.bar--slim { height: 4px; }
.bar__fill--warn { background: var(--warn); }

/* ======================================================================
   Settings
   ====================================================================== */

.field-group__title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.field { padding: 18px 0; }
.field + .field { border-top: 1px solid var(--hairline); }

.field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.field__label { font-size: 14.5px; font-weight: 600; }

.field__value {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-ink);
  font-variant-numeric: tabular-nums;
}

.field__note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.field__note--loose { margin: 4px 0 18px; }

.field__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Range slider — needs per-engine thumb rules, hence the duplication */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--track);
  outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: var(--shadow-primary);
  cursor: pointer;
}
.range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--toggle-bg);
}

.segmented__opt {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 10px;
  border: 0;
  background: transparent;
  border-radius: 20px;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  transition: background .16s, color .16s, box-shadow .16s;
}
.segmented__opt svg { width: 15px; height: 15px; flex: none; }
.segmented__opt:hover { color: var(--ink-soft); }
.segmented__opt.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* ======================================================================
   Placement pass (first run)
   ====================================================================== */

/* No rail during placement — nothing to navigate to yet */
.app--bare { grid-template-columns: minmax(0, 1fr); }
.app--bare .main--single { padding: 26px; }

.known {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 16px;
  border: 0;
  background: transparent;
  border-radius: var(--r-tile);
  text-align: left;
  transition: background .16s;
}
.known + .known { box-shadow: inset 0 1px 0 var(--hairline); }
.known:hover { background: var(--surface-sunken); box-shadow: none; }
.known:hover + .known { box-shadow: none; }

.known__check {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--track);
  color: transparent;
  transition: background .16s, color .16s;
}
.known__check svg { width: 15px; height: 15px; }

.known.is-on .known__check { background: var(--good); color: #fff; }
.known.is-on .known__es { color: var(--ink-muted); text-decoration: line-through; }

.known__pair { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.known__es { font-size: 15px; font-weight: 700; }
.known__en { font-size: 13px; color: var(--ink-muted); }

/* Word count badge on the deck panel header */
.panel__badge {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .18);
  font-size: 12px;
  font-weight: 700;
}

/* Caught-up variant of the session bar */
.session-bar--done {
  background: linear-gradient(90deg, var(--good) 0%, var(--tile-mint-ink) 100%);
}

/* --------------------------------------------------------------------------
   Responsive — collapse to the mock's single-column phone layout
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main--wide { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 16px 205px;
  }

  /* Rail becomes the mock's floating bottom pill */
  .rail {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 40;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    width: calc(100% - 32px);
    max-width: 420px;
    padding: 8px;
    border-radius: var(--r-pill);
    background: var(--primary);
    box-shadow: 0 12px 30px rgba(1, 105, 246, .34);
  }
  .brand { display: none; }

  /* Session bar stacks above the pill nav rather than colliding with it */
  .session-bar {
    left: 16px;
    right: 16px;
    bottom: 104px;
    gap: 14px;
    padding: 16px 22px;
    justify-content: flex-start;
  }
  .session-bar__icon { width: 40px; height: 40px; }
  .session-bar__icon svg { width: 17px; height: 17px; }
  .session-bar__title { font-size: 17px; }
  .session-bar__meta { font-size: 12.5px; }
  /* keep the meta on one line so the bar can't grow into the nav pill */
  .session-bar__time { display: none; }

  .nav {
    flex-direction: row;
    flex: 1;
    gap: 2px;
  }
  .nav__item {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 8px 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, .72);
    border-radius: 18px;
  }
  .nav__item:hover { background: rgba(255, 255, 255, .14); color: #fff; }
  .nav__item.is-active {
    background: rgba(255, 255, 255, .18);
    color: #fff;
    box-shadow: none;
  }
  .nav__badge { display: none; }

  /* Inside the blue pill the toggle goes icon-only and inherits the pill */
  .theme-toggle {
    flex: none;
    gap: 0;
    padding: 0;
    background: transparent;
  }
  .theme-toggle__opt {
    width: 38px;
    padding: 10px 0;
    border-radius: 50%;
    color: rgba(255, 255, 255, .68);
  }
  .theme-toggle__opt span { display: none; }
  .theme-toggle__opt:hover { color: #fff; }
  .theme-toggle__opt.is-active {
    background: rgba(255, 255, 255, .18);
    color: #fff;
    box-shadow: none;
  }

  .page-head { padding-top: 22px; }
  .page-head h1 { font-size: 25px; }

  /* Study screens: immersive routes have no session bar, so they only need
     to clear the pill nav */
  .main--single, .main--wide { padding: 0 16px 108px; }
  .study__head { padding-top: 18px; }

  .flashcard { min-height: 260px; padding: 34px 22px; }
  .flashcard__word { font-size: 36px; }
  .flashcard__answer { font-size: 27px; }

  .quiz__word { font-size: 34px; }
  .quiz__form { flex-direction: column; }
  .card--quiz { padding: 30px 22px; }

  .grades { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .score { flex-direction: column; gap: 18px; text-align: center; }
  .score__meta .done__sub { margin-inline: auto; }

  /* The results table can't shrink further — let it scroll on its own */
  .card--flush:has(.results) { overflow-x: auto; }
  .results { min-width: 460px; }
}

@media (max-width: 460px) {
  .stats { gap: 10px; }
  .stat { padding: 13px 13px 11px; }
  .stat__value { font-size: 23px; }
  .panel__title { font-size: 21px; }
  .tabs { gap: 18px; }
}
