/* Recards — layout and components. Every color, radius and font comes from
   css/theme.css (RECALL_DESIGN_SPEC.md, section 2). Mobile first: the base rules are
   the phone layout, @media (min-width: 768px) is the laptop layout. */

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  /* The scrollbar appearing/disappearing must not shift the page sideways. */
  scrollbar-gutter: stable;
}

body { -webkit-tap-highlight-color: transparent; }

/* No 300 ms tap delay and no double-tap zoom on buttons and links. */
button, a, .btn, input[type="checkbox"], label { touch-action: manipulation; }

/* ---------- motion (docs/improvements-v1.2.md, этап 5) ----------
   One easing and three durations for the whole site:
   fast 120 ms (hover, press), base 180 ms (screens, blocks), slow 300 ms (progress). */
:root {
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
  --t-slow: 300ms;
  --tabbar-h: 64px;
  --shadow-pop: 0 24px 60px rgb(0 0 0 / 0.28);
}
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* A new screen (route change, next card, summary). */
#view.view-enter { animation: enter var(--t-base) var(--ease); }
/* A block that appears on the same screen (answer, Claude's result). */
.fade-in { animation: enter var(--t-base) var(--ease) both; }
/* Shows only if it's still there after 0.4 s: fast loads/saves never flash. */
.appear-late { animation: fade var(--t-base) var(--ease) 0.4s both; }

@media (prefers-reduced-motion: reduce) {
  #view.view-enter, .fade-in { animation-name: fade; }
  *, *::before, *::after { transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- page shell ---------- */
main {
  padding: calc(env(safe-area-inset-top) + var(--s6)) var(--s4)
    calc(var(--tabbar-h) + max(24px, env(safe-area-inset-bottom)) + var(--s6));
}
@media (min-width: 768px) {
  main { max-width: 600px; margin: 0 auto; padding: var(--s8) 0 64px; }
}

h1 { font-size: 26px; line-height: 32px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 var(--s5); }
h2 { font-size: 17px; line-height: 1.3; font-weight: 600; margin: 0 0 var(--s3); }
h3 { font-size: 13px; font-weight: 500; margin: 0 0 var(--s2); color: var(--muted); }
p { margin: 0 0 var(--s3); }
@media (min-width: 768px) {
  h1 { font-size: 24px; line-height: 30px; }
  h2 { font-size: 16px; }
  body { font-size: 14px; line-height: 20px; }
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

kbd {
  font: 500 11px/1 var(--mono);
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--muted);
  margin: 0 2px;
}

/* ---------- navigation (4.1 tab bar on phone, 4.2 navbar on laptop) ---------- */
#nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: var(--bar);
  border-top: 1px solid var(--edge);
  padding: 6px 4px max(24px, env(safe-area-inset-bottom));
}
#nav .brand, #nav .nav-balance { display: none; }
#nav nav { display: grid; grid-template-columns: repeat(3, 1fr); }
#nav nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  min-height: 52px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--r-md);
}
.tab-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 30px;
  padding: 4px 17px;
  border-radius: var(--r-pill);
  transition: background var(--t-fast) var(--ease);
}
#nav svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#nav nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
#nav nav a[aria-current="page"] .tab-pill { background: var(--accent-soft); }

/* Practice is a focus mode on the phone: no tab bar, just the card. */
body[data-route="practice"] #nav { display: none; }
body[data-route="practice"] main { padding-bottom: var(--s6); }

@media (min-width: 768px) {
  #nav {
    position: sticky;
    top: 0;
    bottom: auto;
    height: 52px;
    padding: 0 var(--s6);
    border-top: 0;
    border-bottom: 1px solid var(--edge);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }
  #nav[hidden] { display: none; }
  #nav .brand, #nav .nav-balance { display: block; }
  #nav .brand { font-size: 15px; font-weight: 700; color: var(--ink); justify-self: start; }
  #nav .brand:hover { text-decoration: none; }
  #nav nav { display: flex; gap: var(--s1); }
  #nav nav a {
    flex-direction: row;
    min-height: 0;
    padding: 7px 14px;
    border-radius: var(--r-pill);
    font-size: 13px;
    transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  }
  #nav .tab-pill { display: none; }
  #nav nav a:hover { color: var(--ink); }
  #nav nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
  /* On a laptop the navbar stays during Practice (Today is active). */
  body[data-route="practice"] #nav { display: grid; }
}

.offline {
  background: var(--red-bg);
  color: var(--red);
  border-bottom: 1px solid var(--red-line);
  text-align: center;
  padding: 6px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- building blocks ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  padding: var(--s4);
  margin-bottom: var(--s4);
}
.card.narrow { max-width: 360px; margin: 10vh auto 0; }
.card > :last-child { margin-bottom: 0; }
@media (min-width: 768px) {
  .card { border-radius: var(--r-md); padding: var(--s5); }
}

.eyebrow { color: var(--muted); font-size: 13px; margin: 0 0 2px; }
.eyebrow::first-letter { text-transform: uppercase; }
.section-title { margin: 28px 4px 8px; text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; font-weight: 600; }
.section-title:first-of-type { margin-top: 0; }
.small-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s2); }
@media (min-width: 768px) { .small-label { font-size: 11px; } }

label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: var(--s4) 0 6px; }
label.check { display: inline-flex; align-items: center; gap: var(--s2); color: var(--ink); font-weight: 400; margin: 0; cursor: pointer; min-height: 44px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* phone: 16 px or iOS zooms in on focus */
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  padding: 10px 12px;
  min-height: 44px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
@media (min-width: 768px) {
  input[type="text"], input[type="email"], input[type="password"], input[type="number"],
  input[type="search"], input[type="date"], select, textarea {
    font-size: 14px; border-radius: var(--r-sm); min-height: 36px; padding: 7px 10px;
  }
}
/* chevron drawn with two gradients: no image, so it follows the theme */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-size: 5px 5px, 5px 5px;
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-repeat: no-repeat;
}
textarea { resize: vertical; min-height: 7em; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }

/* ---------- buttons (4.3) ---------- */
.btn {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  min-height: 52px;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    filter var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
    opacity var(--t-fast) var(--ease), transform 80ms var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.danger { background: var(--red); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); min-height: 44px; padding: 8px 10px; }
.btn.small { padding: 6px 14px; min-height: 44px; font-size: 14px; }
.btn.big { width: 100%; margin-top: var(--s6); min-height: 52px; font-size: 16px; font-weight: 600; }
.btn.danger-outline { color: var(--red); border-color: var(--red-line); }
.btn.link, button.link {
  background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; font: inherit; text-align: left;
}
.icon-btn {
  background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer;
  width: 44px; height: 44px; border-radius: var(--r-pill); display: grid; place-items: center;
}
.file-btn { position: relative; overflow: hidden; margin: 0; color: var(--ink); font-size: 15px; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

@media (hover: hover) {
  .btn:hover:not(:disabled) { background: var(--card); }
  .btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
  .btn.danger:hover:not(:disabled) { background: var(--red); filter: brightness(1.08); }
  .btn.ghost:hover:not(:disabled) { background: var(--code-bg); color: var(--ink); }
  .btn.danger-outline:hover:not(:disabled) { background: var(--red-bg); }
  .icon-btn:hover { background: var(--code-bg); color: var(--ink); }
}

@media (min-width: 768px) {
  .btn { min-height: 40px; font-size: 14px; border-radius: 10px; padding: 8px 16px; }
  .btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: var(--r-sm); }
  .btn.ghost { min-height: 32px; padding: 6px 10px; }
  .btn.big { min-height: 44px; font-size: 15px; }
  .icon-btn { width: 36px; height: 36px; }
}

.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s4); }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; }
.error { color: var(--red); font-size: 14px; }
.center { text-align: center; }
.notice {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-line);
  border-radius: var(--r-md);
  padding: var(--s3) var(--s4);
  margin: 0 0 var(--s4);
  font-size: 14px;
}
.notice a { color: inherit; font-weight: 600; text-decoration: underline; }
.quiet-note { text-align: center; color: var(--muted); font-size: 13px; margin: var(--s2) 0 0; }
.quiet-note a { color: var(--accent); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state p:first-child { color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.empty-state .btn { margin-top: var(--s3); }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--code-bg);
  color: var(--muted);
  vertical-align: middle;
}
.badge.new { color: var(--accent); background: var(--accent-soft); }
.badge.warn, .badge.rate-hard { color: var(--amber); background: var(--amber-bg); }
.badge.rate-forgot { color: var(--red); background: var(--red-bg); }
.badge.rate-good { color: var(--green); background: var(--green-bg); }
.badge.rate-easy { color: var(--blue); background: var(--blue-bg); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--code-bg);
  color: var(--muted);
  font-size: 13px;
}

/* show/hide by layout */
@media (max-width: 767px) { .laptop-only { display: none !important; } }
@media (min-width: 768px) { .phone-only { display: none !important; } }
@media (pointer: coarse) { .desktop-only { display: none !important; } }

/* ---------- Sign in ---------- */
.signin { text-align: center; padding: var(--s8) var(--s6); }
.signin .logo { font-size: 40px; line-height: 1; margin-bottom: var(--s3); }
.signin h1 { margin-bottom: 4px; }
.signin .subtitle { margin-bottom: var(--s2); }
.signin label { text-align: left; }

/* ---------- page header (Today, Cards, Progress) ---------- */
.page-head { margin-bottom: var(--s5); }
.page-head h1 { margin: 0; }
.page-head .eyebrow { margin-bottom: var(--s1); }
.page-sub { color: var(--muted); font-size: 13px; margin: var(--s1) 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin: var(--s6) 0 var(--s2); }
.section-head h2 { margin: 0; }

/* ---------- Today (6) ---------- */
.hero { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: var(--s4); padding: var(--s5); }
.hero-text h2 { margin: 0 0 2px; }
.hero-text p { margin: 0; font-size: 13px; }
.hero-btn { grid-column: 1 / -1; width: 100%; }
@media (min-width: 768px) {
  .hero { grid-template-columns: 64px 1fr auto; }
  .hero-btn { grid-column: auto; width: auto; }
}
.ring { position: relative; width: 64px; height: 64px; }
.ring svg { width: 64px; height: 64px; display: block; }
.ring circle { fill: none; stroke-width: 7; }
.ring-track { stroke: var(--track); }
.ring-arc { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset var(--t-slow) var(--ease); }
.ring-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- list rows (4.5): topics, cards, settings ---------- */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list > li { border-top: 1px solid var(--edge); }
.row-list > li:last-child { border-bottom: 1px solid var(--edge); }
.list-row {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; min-height: 60px; padding: var(--s2) 0;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.row-meta { font-size: 13px; color: var(--muted); }
.chev { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .list-row:hover .row-title { color: var(--accent); } }
@media (min-width: 768px) {
  /* on a laptop rows sit in a card: only inner dividers */
  .row-list { background: var(--card); border: 1px solid var(--edge); border-radius: var(--r-md); overflow: hidden; }
  .row-list > li:first-child { border-top: 0; }
  .row-list > li:last-child { border-bottom: 0; }
  .list-row { min-height: 56px; padding: var(--s2) var(--s4); }
  .row-title { font-size: 14px; }
  .row-meta { font-size: 12px; }
}

/* Topic strength bar (4.8) */
.strength { display: inline-flex; align-items: center; gap: var(--s2); flex: none; }
.strength-track { width: 80px; height: 6px; border-radius: var(--r-pill); background: var(--track); overflow: hidden; }
.strength-fill { display: block; height: 100%; border-radius: var(--r-pill); }
.strength-pct { min-width: 4ch; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.strength.weak .strength-fill { background: var(--red); }
.strength.medium .strength-fill { background: var(--amber); }
.strength.strong .strength-fill { background: var(--green); }
.strength.none .strength-pct { color: var(--muted); font-weight: 400; }
@media (min-width: 768px) { .strength-track { width: 140px; } }

.topics-title { margin: var(--s6) 0 var(--s1); font-size: 13px; font-weight: 600; color: var(--muted); }
.topics-section .row-list > li:first-child { border-top: 0; }
.topics-section .row-list > li:last-child { border-bottom: 0; }
.topic-row .row-title { font-size: 15px; }
.topic-row .row-meta { font-size: 15px; }
.topic-pct { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.topic-pct.weak { color: var(--red); }
.topic-pct.medium { color: var(--amber); }
.topic-pct.strong { color: var(--green); }

/* Session summary reuses these. */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--s4); margin: 0 0 var(--s6); }
.stat-num { font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 12px; }

/* ---------- Practice (5) ---------- */
/* Phone: the screen is one column as tall as the viewport, so the textarea can
   grow into free space and the grade block can sit at the bottom. */
.practice-screen { display: flex; flex-direction: column; min-height: calc(100dvh - env(safe-area-inset-top) - 48px); }
@media (min-width: 768px) { .practice-screen { min-height: 0; } }

.practice-head { margin-bottom: var(--s4); }
.practice-top { display: flex; align-items: center; gap: var(--s3); min-height: 44px; margin: 0 0 var(--s2) -10px; }
.practice-top .badge { white-space: nowrap; }
.end-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.practice-count { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.practice-count strong { color: var(--ink); font-weight: 600; }

.card.question { padding: var(--s5) var(--s4); }
.card.question .q-text { font-size: 20px; font-weight: 600; line-height: 28px; overflow-wrap: anywhere; }
/* word cards: the word, then the sentence it appears in */
.card.question .word-context { margin: var(--s2) 0 0; font-style: italic; color: var(--muted); }
.word-ref h4 { margin: 10px 0 4px; font-size: 13px; color: var(--green-text); font-weight: 600; }
.word-examples { margin: 0; padding-left: 20px; }
.word-rel { margin: 6px 0 0; }
/* pronunciation: a speaker next to the word and to each example */
.q-row { display: flex; align-items: center; gap: var(--s2); }
.q-row .q-text { flex: 1; min-width: 0; }
.speak-btn {
  flex: none; display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0; margin: -6px -6px -6px 0;
  background: none; border: 1px solid transparent; border-radius: 50%;
  color: var(--muted); cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.speak-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.speak-btn:hover { background: var(--track); color: var(--ink); }
.speak-btn:active { transform: scale(0.94); }
.speak-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the example keeps its list bullet; the speaker follows the text */
.example-row .speak-btn { display: inline-grid; vertical-align: middle; width: 36px; height: 36px; margin: -8px 0 -6px 2px; }
.example-row .speak-btn svg { width: 18px; height: 18px; }
.audio-credit { margin: calc(-1 * var(--s2)) var(--s1) var(--s3); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

textarea.answer-input {
  flex: 1 0 auto;
  min-height: 160px;
  border: 1px solid var(--focus);
  border-radius: 14px;
  padding: 14px 16px;
  resize: none;
}
.answer-actions { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); }
/* Check answer, then "I don't know" as a quiet line under it */
.answer-actions .btn.primary { width: 100%; }
@media (min-width: 768px) {
  .practice-top { margin-left: -10px; }
  .card.question { padding: var(--s6); }
  .card.question .q-text { font-size: 19px; line-height: 27px; }
  textarea.answer-input { flex: none; min-height: 180px; border-radius: var(--r-md); resize: vertical; }
  .answer-actions { align-items: center; margin-top: var(--s4); }
  .answer-actions .btn.primary { width: 100%; max-width: 360px; }
}

.compare { display: grid; grid-template-columns: 1fr; }
.compare .card.ref { background: var(--green-bg); border-color: var(--green-line); }
.no-answer { font-style: italic; margin: 0; }
.card-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: var(--s1); }
.compare .card.ref .card-label { color: var(--green-text); }
.practice-screen.checked .compare .card, .practice-screen.checked .card.teach { border-radius: 14px; padding: 14px var(--s4); margin-bottom: var(--s2); font-size: 15px; line-height: 22px; }
@media (min-width: 768px) {
  .practice-screen.checked .compare .card, .practice-screen.checked .card.teach { border-radius: var(--r-md); font-size: 14px; line-height: 20px; }
}
@media (min-width: 768px) {
  .compare { grid-template-columns: 1fr 1fr; gap: var(--s3); }
  .compare .card { margin-bottom: var(--s3); }
}

.resource { margin: 0 0 var(--s4); overflow-wrap: anywhere; padding: 8px 12px; border-radius: var(--r-md); font-size: 14px; }
.resource.flash { background: var(--amber-bg); color: var(--amber); transition: background var(--t-slow); }

.practice-tools { display: flex; justify-content: flex-end; margin: -8px 0 8px; }

.rate-box { margin-top: var(--s2); }
.rate-q { text-align: center; color: var(--ink); font-size: 14px; font-weight: 600; margin-bottom: var(--s3); }
.ratings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.btn.rate { flex-direction: column; gap: 2px; min-height: 64px; font-size: 15px; font-weight: 600; padding: 8px 4px; }
.btn.rate .rate-sub { font-size: 12px; font-weight: 400; color: var(--muted); }
.btn.rate-forgot { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.btn.rate-hard { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.btn.rate-good { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.btn.rate-easy { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-line); }
@media (hover: hover) {
  .btn.rate:hover:not(:disabled) { filter: brightness(1.12); }
  .btn.rate-forgot:hover:not(:disabled) { background: var(--red-bg); }
  .btn.rate-hard:hover:not(:disabled) { background: var(--amber-bg); }
  .btn.rate-good:hover:not(:disabled) { background: var(--green-bg); }
  .btn.rate-easy:hover:not(:disabled) { background: var(--blue-bg); }
}
@media (min-width: 768px) {
  .ratings { grid-template-columns: repeat(4, 112px); justify-content: center; gap: var(--s2); }
  .btn.rate { min-height: 56px; border-radius: 10px; font-size: 14px; }
}

/* Pressed rating while it saves: highlighted, others stay calm (no grey flash). */
.ratings.is-busy .btn:disabled { opacity: 1; cursor: progress; }
.ratings.is-busy .btn:not(.chosen) { filter: saturate(0.6); }
.btn.rate.chosen, .btn.rate.suggested { box-shadow: 0 0 0 2px currentColor; }

/* Rated state: grade chip + what happens next + Reread / Next */
.outcome-text { margin: 0; font-size: 14px; line-height: 26px; color: var(--muted); text-align: center; }
.outcome-text .grade-chip { margin-right: var(--s1); vertical-align: baseline; }
.grade-chip { font-size: 13px; padding: 4px 10px; line-height: 1.2; }
.outcome-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s2); margin-top: var(--s3); }
.outcome .hint { margin: var(--s2) 0 0; }
@media (min-width: 768px) { .outcome-actions { display: flex; justify-content: center; } }

/* Fixed-height status under the buttons: text can come and go without a jump. */
.status-line { min-height: 1.5em; margin: var(--s2) 0 0; text-align: center; font-size: 13px; }

/* Grade block: pushed to the bottom on the phone, sticky so the buttons never
   move under the finger when Claude's result appears above them. */
.practice-foot {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: auto -8px 0;
  padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 16px);
}

/* AI check */
.ai-box { margin-top: var(--s3); }
.ai-box.loading { color: var(--muted); min-height: 120px; }
.ai-loading-line { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.skeleton { height: 12px; border-radius: 6px; background: var(--track); margin-top: 10px; animation: pulse 1.4s ease-in-out infinite; }
.skeleton.short { width: 60%; }
@keyframes pulse { 50% { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.ai-box.error-box p { margin: 0 0 8px; }
.ai-box.error-box p:last-child { margin: 0; }
.ai-head { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.ai-score { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ai-score.rate-forgot { color: var(--red); }
.ai-score.rate-hard { color: var(--amber); }
.ai-score.rate-good { color: var(--green); }
.ai-score.rate-easy { color: var(--blue); }
.ai-comment { margin: 8px 0 0; }
.ai-box h4 { margin: 12px 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.ai-box ul { margin: 0; padding-left: 20px; }
.ai-reread { margin: 12px 0 0; overflow-wrap: anywhere; }
.spinner { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--edge); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.breakdown, .forgot-list { list-style: none; padding: 0; margin: 0; }
.breakdown li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--edge); }
.breakdown li:last-child { border-bottom: 0; }
.breakdown .rate-forgot span { color: var(--red); }
.breakdown .rate-hard span { color: var(--amber); }
.breakdown .rate-good span { color: var(--green); }
.breakdown .rate-easy span { color: var(--blue); }
.forgot-list li { padding: 8px 0; border-bottom: 1px solid var(--edge); }
.forgot-list li:last-child { border-bottom: 0; }

/* ---------- Cards (7) ---------- */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); }
.title-row h1 { margin: 0; }
.title-actions { display: flex; gap: var(--s2); flex: none; }

.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s3); }
.filters select { flex: 1 1 140px; width: auto; }
.filters label { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.filters label.check { padding: 0 4px; }
.filters input[type="date"] { width: auto; }
.toolbar-rest { display: flex; align-items: center; gap: var(--s3); }
.toolbar-rest select { width: auto; min-width: 140px; }

/* Search (4.10): icon + borderless input inside one bordered box */
.search {
  flex: 1 1 100%;
  display: flex; align-items: center; gap: var(--s2);
  min-height: 48px; padding: 0 var(--s3);
  background: var(--card); border: 1px solid var(--edge); border-radius: var(--r-md);
  margin: 0; cursor: text;
}
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input[type="search"] { border: 0; background: transparent; box-shadow: none; padding: 0; min-height: 0; flex: 1; }
.search input[type="search"]:focus { box-shadow: none; }
@media (min-width: 768px) {
  .filters { flex-wrap: nowrap; }
  .search { flex: 1; min-height: 36px; border-radius: var(--r-sm); padding: 0 10px; }
  .search svg { width: 16px; height: 16px; }
}

/* Tag chips (phone): one scrollable line */
.chip-scroll { display: flex; gap: var(--s2); overflow-x: auto; margin: 0 calc(-1 * var(--s4)) var(--s3); padding: 0 var(--s4) 2px; scrollbar-width: none; }
.chip-scroll::-webkit-scrollbar { display: none; }
/* soft fade at the edge that has more chips behind it (cards.js toggles the classes) */
.chip-scroll { --fade: 40px; --fade-l: 0px; --fade-r: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%); }
.chip-scroll.fade-start { --fade-l: var(--fade); }
.chip-scroll.fade-end { --fade-r: var(--fade); }
.chip-scroll .chip-btn { flex: none; white-space: nowrap; }

.list-toolbar { display: flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 16px; margin-bottom: 4px; font-size: 14px; }
.list-toolbar label.check { color: var(--muted); gap: 12px; }

.bulk-bar {
  display: flex; align-items: center; gap: var(--s2);
  padding: 6px 6px 6px var(--s4); margin-bottom: var(--s2);
  background: var(--accent-soft); color: var(--accent); border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
}

.card-list { list-style: none; margin: 0; padding: 0; }
.card-list > li { display: flex; align-items: center; gap: var(--s3); border-top: 1px solid var(--edge); }
.card-list > li:last-child { border-bottom: 1px solid var(--edge); }
.card-list li.archived .card-q { color: var(--muted); }
.card-list li.selected { background: var(--accent-soft); }
.bulk-actions { display: contents; }

/* Phone: "N cards · Select" above the list; while selecting, the bar floats above the tab bar. */
.select-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s1); font-size: 13px; }
@media (max-width: 767px) {
  .bulk-bar.selecting {
    position: fixed; z-index: 11;
    left: var(--s3); right: var(--s3);
    bottom: calc(var(--tabbar-h) + max(24px, env(safe-area-inset-bottom)) + var(--s2));
    flex-wrap: wrap; margin: 0; padding: var(--s2) var(--s3);
    background: var(--card); color: var(--ink); border: 1px solid var(--edge); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  }
  .bulk-bar.selecting .bulk-count { flex: 1; padding-left: var(--s1); }
  .bulk-bar.selecting .bulk-actions { display: flex; gap: var(--s2); flex-basis: 100%; }
  .bulk-bar.selecting .bulk-actions .btn { flex: 1; }
  /* room for the floating bar below the last row */
  .card-table.selecting { padding-bottom: 120px; }
  .card-table.selecting .card-list > li { padding-left: var(--s1); }
  .card-table.selecting .card-list input[type="checkbox"] { width: 22px; height: 22px; }
}
.card-row { flex: 1; min-width: 0; }
.card-q { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-q .code-inline { font-weight: 500; font-size: 0.88em; }
.card-row .row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; color: var(--muted); }

/* Status label (4.9): color plus words, never color alone */
.status-overdue { color: var(--red); font-weight: 600; }
.status-today { color: var(--amber); font-weight: 600; }
.status-new { color: var(--accent); font-weight: 600; }
.status-tomorrow, .status-later { color: var(--muted); }

@media (min-width: 768px) {
  .card-table { background: var(--card); border: 1px solid var(--edge); border-radius: var(--r-md); overflow: hidden; }
  .card-table-head { display: flex; align-items: center; gap: var(--s3); min-height: 40px; padding: 0 var(--s4); font-size: 12px; color: var(--muted); }
  .card-table-head > span:nth-child(2) { flex: 1; }
  .card-list > li { padding-left: var(--s4); }
  .card-list > li:last-child { border-bottom: 0; }
  .card-row.list-row { padding-left: 0; }
  .card-q { font-weight: 400; font-size: 14px; }
  .col-next { width: 110px; flex: none; text-align: right; font-size: 13px; }
  @media (hover: hover) { .card-row:hover .row-title { color: var(--ink); } .card-list > li:hover { background: var(--code-bg); } }
}

/* tables: progress, log */
.table-box { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--edge); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
table.log { background: var(--card); border: 1px solid var(--edge); border-radius: var(--r-md); border-collapse: separate; border-spacing: 0; }
table.log th:first-child, table.log td:first-child { padding-left: 16px; }
table.log td { vertical-align: top; font-size: 13px; }
table.log td.details { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; color: var(--muted); }

.import-result { margin-top: var(--s3); }
.import-result .errors { color: var(--red); font-size: 14px; }
input[type="file"] { max-width: 100%; margin: 8px 0; font: inherit; font-size: 14px; color: var(--muted); }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 500; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 14px; margin-right: 12px;
  background: transparent; color: var(--ink); cursor: pointer;
}

.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.meta .chip { font-size: 12px; padding: 2px 10px; }

.secondary-actions { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--edge); gap: 4px; }

ol.history { list-style: none; padding: 0; margin: 16px 0 0; }
ol.history li { padding: 12px 0; border-top: 1px solid var(--edge); }
.history-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; margin-bottom: 4px; }

.chip-btn {
  border: 1px solid var(--edge); background: var(--card); color: var(--ink);
  border-radius: var(--r-pill); padding: 0 14px; font: inherit; font-size: 14px; cursor: pointer; min-height: 40px;
}
.chip-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
@media (min-width: 768px) { .chip-btn { min-height: 32px; font-size: 13px; padding: 0 12px; } }

/* ---------- Settings ---------- */
.card.form { padding: 4px 20px 16px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: 12px 0; border-bottom: 1px solid var(--edge); }
.field-row label { margin: 0; color: var(--ink); font-weight: 400; font-size: 15px; }
.field-row input[type="number"] { width: 96px; flex: none; text-align: right; }
.field-text { min-width: 0; }
.field-text .hint { margin: 4px 0 0; }
.field-text .hint.warn { color: var(--amber); }
.card.form .row { margin-top: 12px; }

/* Settings: a full-width field (time zone) between the label/value rows */
.field-stack { padding: 12px 0; border-bottom: 1px solid var(--edge); }
.field-stack label { margin-top: 0; }
.field-stack .hint { margin: 6px 0 0; }

.list-card { padding: 0; overflow: hidden; }
.list-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 52px; padding: 12px 20px;
  background: none; border: 0; border-bottom: 1px solid var(--edge);
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.list-link:last-child { border-bottom: 0; }
a.list-link:hover, button.list-link:hover { background: var(--code-bg); text-decoration: none; }
.list-link.static { cursor: default; }
.list-link .chev { color: var(--muted); font-size: 20px; line-height: 1; }
.danger-text { color: var(--red); }
.list-text { display: flex; flex-direction: column; gap: 2px; }
.list-text .hint { font-size: 12px; }

/* Segmented control (Theme: Dark / Light) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--code-bg); border-radius: var(--r-pill); }
.segmented button {
  min-height: 38px; min-width: 64px; padding: 0 14px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
@media (min-width: 768px) { .segmented button { min-height: 30px; font-size: 13px; } }
.back-link { display: inline-block; color: var(--muted); font-size: 14px; margin-bottom: 8px; }

/* ---------- modal & toast ---------- */
dialog.modal {
  border: 1px solid var(--edge);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  padding: 0;
  width: 100%;
  max-width: 100%;
  max-height: 92dvh;
  margin: auto 0 0;
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: rgb(0 0 0 / 0.45); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: enter var(--t-base) var(--ease); }
dialog.modal[open]::backdrop { animation: fade var(--t-base) var(--ease); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 12px 8px 16px; position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.modal-body > label:first-child, .modal-body > .meta:first-child { margin-top: 4px; }
@media (min-width: 768px) {
  dialog.modal { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto; border-radius: 16px; }
  dialog.modal.wide { width: min(680px, calc(100vw - 24px)); }
  .modal-head { padding: 16px 16px 8px 24px; }
  .modal-body { padding: 0 24px 24px; }
}

.toast {
  /* undo the browser's popover defaults (centered box with a border) */
  inset: auto;
  margin: 0;
  border: 0;
  overflow: visible;
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + max(24px, env(safe-area-inset-bottom)) + 16px);
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transition: opacity var(--t-base), transform var(--t-base);
  z-index: 100;
  max-width: calc(100vw - 32px);
  font-size: 14px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--red); color: var(--accent-ink); }
body[data-route="practice"] .toast { bottom: 24px; }
@media (min-width: 768px) { .toast { bottom: 24px; } }

/* ---------- phone tweaks ---------- */
@media (max-width: 767px) {
  .row > .btn { flex: 1 1 auto; }
  .row.secondary-actions > .btn { flex: 0 1 auto; }
  .filters input[type="search"] { flex-basis: 100%; }
}

/* Rich card text: paragraphs, code blocks, inline code */
.rich-p { margin: 0 0 0.6em; white-space: pre-wrap; overflow-wrap: anywhere; }
.rich-p:last-child { margin-bottom: 0; }
.code-block {
  margin: 0.6em 0; padding: 12px 14px;
  background: var(--code-bg); border: 1px solid var(--edge); border-radius: var(--r-sm);
  overflow-x: auto; -webkit-overflow-scrolling: touch; tab-size: 4;
}
.code-block:first-child { margin-top: 0; }
.code-block:last-child { margin-bottom: 0; }
.code-block code, .code-inline, code { font-family: var(--mono); }
.code-block code {
  display: block; white-space: pre; overflow-wrap: normal;
  font-size: 13px; line-height: 1.55; font-weight: 400; letter-spacing: 0;
}
.code-inline { font-size: 0.9em; padding: 1px 5px; background: var(--code-bg); border-radius: 4px; }
.card.question .code-inline { font-weight: 500; }
.compare .card { min-width: 0; } /* long code lines scroll inside the block, not the page */
.compare .card.ref .code-block, .compare .card.ref .code-inline { background: var(--card); }

.tok-kw { color: var(--accent); font-weight: 600; }
.tok-type, .tok-ann { color: var(--blue); }
.tok-str { color: var(--green); }
.tok-num { color: var(--amber); }
.tok-com { color: var(--muted); font-style: italic; }

/* Tag box in the card dialogs: chips + an input, looks like one field */
.tag-editor {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 6px 8px; min-height: 44px;
  background: var(--card); border: 1px solid var(--edge); border-radius: var(--r-md);
  cursor: text;
}
.tag-editor:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.tag-chips { display: contents; }
.tag-chip {
  display: inline-flex; align-items: center;
  background: var(--code-bg); border: 1px solid var(--edge); border-radius: var(--r-pill);
  font-size: 14px; line-height: 1;
}
.tag-chip.main { background: var(--accent-soft); border-color: var(--accent); }
.tag-chip button { font: inherit; color: var(--ink); background: none; border: 0; cursor: pointer; min-height: 30px; }
.tag-chip .tag-name { padding: 4px 4px 4px 10px; }
.tag-chip.main .tag-name { color: var(--accent); font-weight: 600; cursor: default; }
.tag-chip .tag-x { padding: 4px 10px 4px 4px; color: var(--muted); font-size: 16px; }
.tag-chip .tag-x:hover { color: var(--red); }
.tag-input {
  flex: 1 1 120px; min-width: 120px; width: auto;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  padding: 6px 4px !important; outline: none;
}
.tag-error { margin: 6px 0 0; font-size: 13px; }

/* AI check: two grades side by side — Java (sets the schedule) and English */
.ai-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-score-cell { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--code-bg); }
.ai-score-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.ai-score-text { font-size: 13px; color: var(--muted); }
.ai-english { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--edge); }
.ai-english h4 { margin-top: 0; }
.ai-corrected { margin: 0 0 6px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--green-bg); }
.ai-fixes { margin: 0; padding-left: 20px; font-size: 14px; }
.ai-fixes s { color: var(--red); }
.ai-scores + .ai-comment { margin-top: 12px; }
.fix-type { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

/* Say it like this + Type it once (plan v1.2, 2.2); teach mode; nudge and fatigue (2.4–2.5) */
.say-it h4, .teach h4 { margin-top: 0; }
.say-it-text { margin: 0 0 8px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--green-bg); }
.terms { margin: 0 0 12px; padding-left: 20px; font-size: 14px; }
.say-it label { display: block; margin: 4px 0 6px; font-weight: 600; }
.say-it textarea { width: 100%; }
.say-it .row { margin-top: 8px; }
.type-it-ok { margin: 0; color: var(--green); font-weight: 600; }
.nudge p, .fatigue p { margin: 0 0 8px; }
.practice-foot .fatigue { margin-bottom: 8px; }

/* Fatigue check screen and break timer (js/lib/fatigue.js) */
.fatigue-screen { max-width: 520px; margin: 24px auto 0; }
.fatigue-reasons { margin: 0 0 16px; padding-left: 20px; }
.fatigue-reasons li { margin-bottom: 6px; }
.fatigue-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.fatigue-actions .btn { width: 100%; }
.break-time { font-size: 56px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; text-align: center; margin: 8px 0 16px; }
.fatigue-screen.break { text-align: center; }

/* Import CSV: format help (Cards → Import) */
.csv-help { margin: 0 0 var(--s3); }
.csv-help summary { cursor: pointer; font-weight: 600; }
.csv-help ul { margin: var(--s2) 0; padding-left: 20px; }
.csv-help code { font-size: 12px; }
.csv-example { overflow-x: auto; white-space: pre; font-size: 12px; line-height: 18px; padding: var(--s2) var(--s3); border-radius: 8px; background: var(--track); margin: var(--s2) 0; }
.word-fields { margin: var(--s3) 0; }
.word-fields summary { cursor: pointer; color: var(--muted); font-weight: 600; }
/* one-click grading tags above the tag box */
.grade-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 6px; }
.grade-tag { padding: 0; border: 0; background: none; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.grade-tag:hover { color: var(--ink); }
.grade-tag[aria-pressed="true"] { color: var(--accent); font-weight: 600; }

/* Sign in: Google first, email + password folded below */
.signin .google { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); margin-top: var(--s4); }
.signin .google svg { background: #fff; border-radius: 50%; padding: 2px; box-sizing: content-box; }
.signin .hint { margin-top: var(--s3); }
.signin .email-signin { margin-top: var(--s5); text-align: left; }
.signin .email-signin summary { cursor: pointer; text-align: center; color: var(--muted); }
.signin .email-signin .btn { width: 100%; margin-top: var(--s4); }
/* Import CSV: the full rules, folded under the short example */
.csv-rules { margin: 0 0 var(--s3); font-size: 14px; }
.csv-rules summary { cursor: pointer; font-weight: 600; margin-bottom: var(--s2); }
.csv-rules-title { font-weight: 600; margin: var(--s3) 0 0; }
.csv-rules ul { margin: 4px 0 0; padding-left: 20px; }
.csv-rules li { margin-bottom: 4px; }
.csv-rules code { font-size: 12px; overflow-wrap: anywhere; }
/* Import CSV: pasted text */
textarea.csv-paste { width: 100%; font-family: var(--mono); font-size: 13px; white-space: pre; overflow-x: auto; }
/* Import CSV: "Copy prompt for Claude" */
.claude-prompt { align-items: center; gap: var(--s2); margin: var(--s2) 0 var(--s3); flex-wrap: wrap; }
.claude-prompt .hint { margin: 0; }

/* Admin page (#/admin) */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s3); margin: var(--s4) 0; }
.admin-stat { padding: var(--s4); }
.admin-stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.admin-note { margin: 0 4px var(--s3); }
.admin-users { display: flex; flex-direction: column; gap: var(--s3); }
.admin-user { padding: var(--s4); }
.admin-user p { margin: 4px 0; }
.admin-user-head { display: flex; align-items: center; gap: var(--s2); }
.admin-email { overflow-wrap: anywhere; }
.admin-ai { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin-top: var(--s2); }
.admin-limit-label { display: inline-flex; align-items: center; gap: var(--s2); margin: 0; font-weight: 400; }
input.admin-limit { width: 80px; }
.hint.block { display: block; font-weight: 400; }

/* Admin: access and backup (migration 018) */
.badge.danger { color: var(--red); background: var(--red-bg); }
.invite-list { list-style: none; margin: var(--s2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1, 4px); }
.invite-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-width: 0; }
.invite-list li span { overflow-wrap: anywhere; }
.card.form .row input[type="email"] { flex: 1; min-width: 0; }

/* Blocked or not invited: the only screen */
.no-access { max-width: 480px; margin: 64px auto 0; }
.no-access h1 { color: var(--ink); margin-bottom: var(--s2); }
.no-access p:first-of-type { color: var(--ink); font-weight: 400; }

/* Settings: site version, for information */
.app-version { text-align: center; margin-top: var(--s4); }

/* Cards → "?" guide: picture steps */
.guide-shots { display: grid; gap: var(--s3); }
.guide-shots img { display: block; width: 100%; height: auto; border-radius: 22px; }
/* "+ Add": the Import CSV link under the buttons */
.add-import { margin-top: var(--s4); }
/* a word of a phrase or an example: tap to hear it (dotted underline says it can be tapped) */
.tap-word {
  display: inline; padding: 0; margin: 0; border: 0; border-radius: 4px;
  background: none; color: inherit; font: inherit; letter-spacing: inherit; cursor: pointer;
  text-decoration: underline dotted; text-decoration-color: var(--muted); text-underline-offset: 3px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.tap-word:hover { color: var(--accent); }
.tap-word.is-on { background: var(--track); color: var(--accent); }
.tap-word:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.compare + .audio-credit { margin-top: var(--s2); }
/* Settings → What's new */
.whats-new h3 { margin: var(--s3) 0 var(--s1); font-size: 15px; }
.whats-new:first-child h3 { margin-top: 0; }
.whats-new ul { margin: 0; padding-left: 20px; }
.whats-new li { margin: 4px 0; }
/* learn screen: a new card, shown to study before the first test */
.learn-note { display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s3); font-size: 13px; color: var(--muted); }
.learn-btn { width: 100%; }
.answer-hint { margin: calc(-1 * var(--s1)) 0 var(--s3); }
