/* kazakhtili.com — modern minimalist light
 *
 * Design rules:
 * - One typeface: Inter (good Cyrillic). Display sizes get tighter tracking.
 * - Hairline borders only (1px). No drop shadows. Subtle hover lift.
 * - Single accent: indigo. Lesson tags use a per-lesson color.
 * - 8pt grid. clamp() for responsive type. Generous whitespace.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* surfaces */
  --bg:        #FFFFFF;
  --bg-soft:   #FAFAFA;
  --bg-2:      #F4F4F5;
  --line:      #E4E4E7;
  --line-2:    #F4F4F5;

  /* text */
  --ink:       #09090B;
  --ink-2:     #27272A;
  --muted:     #71717A;
  --muted-2:   #A1A1AA;

  /* accent */
  --accent:    #4F46E5;        /* indigo */
  --accent-w:  #EEF2FF;
  --accent-d:  #3730A3;

  /* feedback */
  --good:      #16A34A;
  --warn:      #D97706;
  --bad:       #DC2626;

  /* sizing */
  --radius:    8px;
  --radius-lg: 14px;
  --max-w:     820px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg:        #09090B;
  --bg-soft:   #18181B;
  --bg-2:      #27272A;
  --line:      #27272A;
  --line-2:    #1F1F23;
  --ink:       #FAFAFA;
  --ink-2:     #E4E4E7;
  --muted:     #A1A1AA;
  --muted-2:   #71717A;
  --accent:    #818CF8;
  --accent-w:  #1E1B4B;
  --accent-d:  #C7D2FE;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-feature-settings: 'cv11', 'ss01', 'tnum';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
  font-size: 16px;
  transition: background-color .2s ease, color .2s ease;
}

/* ---- header ---- */
.site-header {
  position: sticky;
  top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line-2);
}
.site-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: .9rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand {
  display: flex; align-items: baseline; gap: .55rem;
  text-decoration: none; color: var(--ink);
  font-weight: 700; letter-spacing: -0.02em;
}
.brand-en { font-size: 1.05rem; }
.brand-kk { font-size: .95rem; color: var(--accent); font-weight: 600; }
.site-header nav {
  margin-left: auto;
  display: flex; align-items: center; gap: .25rem;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  padding: .4rem .65rem;
  border-radius: 6px;
  transition: color .15s ease, background-color .15s ease;
}
.site-header nav a:hover { color: var(--ink); background: var(--bg-2); }
.site-header nav a.active { color: var(--accent); }

.streak-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .25rem .65rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
}
.streak-pill .flame { color: var(--warn); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .95rem;
  padding: 0;
  transition: all .15s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-2); }

/* ---- main ---- */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ---- typography ---- */
h1, h2, h3 {
  letter-spacing: -0.02em;
  font-weight: 700;
  line-height: 1.15;
  margin-top: 0;
}
h1 { font-size: clamp(1.85rem, 4.5vw, 2.6rem); margin-bottom: .65rem; }
h2 { font-size: 1.4rem; font-weight: 600; margin-bottom: 1rem; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: .5rem; }
p  { margin: .65rem 0; }
a  { color: var(--accent); }

.kk { color: var(--accent); }
.muted   { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small   { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- hero ---- */
.hero { padding: 1rem 0 3rem; border-bottom: 1px solid var(--line-2); margin-bottom: 2.5rem; }
.hero h1 { line-height: 1.1; }
.hero h1 .kk { font-weight: 700; }
.hero .lede { font-size: 1.05rem; color: var(--muted); max-width: 56ch; margin-bottom: 1.75rem; }
.hero-actions { display: flex; gap: .65rem; flex-wrap: wrap; }
.hero-stats {
  margin-top: 2rem; padding-top: 1.5rem;
  border-top: 1px solid var(--line-2);
  display: flex; gap: 2rem; flex-wrap: wrap;
}
.hero-stats > div { display: flex; flex-direction: column; gap: .15rem; }
.hero-stats .num { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.hero-stats .lbl { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-d); border-color: var(--accent-d); color: white; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn-sm  { padding: .35rem .7rem; font-size: .8rem; }
.btn-lg  { padding: .75rem 1.4rem; font-size: 1rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

.badge {
  display: inline-flex; align-items: center;
  background: var(--accent);
  color: white;
  font-size: .7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0;
}

/* ---- cat tag ---- */
.tag {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-2);
  padding: .15rem .55rem;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }

/* ---- lesson list ---- */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 0 1rem;
}
.section-head h2 { margin: 0; }
.section-head .small { color: var(--muted); }

.lesson-search {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: .65rem .9rem;
  font-family: inherit;
  font-size: .9rem;
  color: var(--ink);
  margin-bottom: 1rem;
}
.lesson-search:focus { outline: none; border-color: var(--accent); background: var(--bg); }

.cat-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.25rem; }
.cat-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .75rem; font-weight: 600;
  padding: .25rem .65rem; border-radius: 999px;
  cursor: pointer; user-select: none;
  text-transform: uppercase; letter-spacing: .04em;
}
.cat-chip:hover { color: var(--ink); }
.cat-chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cat-chip .dot { width: 6px; height: 6px; border-radius: 50%; }

.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.lesson-list a.lesson-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s ease, transform .12s ease;
}
.lesson-list a.lesson-row:hover { border-color: var(--ink-2); }
.lesson-row .num {
  font-weight: 700; font-size: .85rem;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.lesson-row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.lesson-row .title { font-weight: 600; font-size: .95rem; color: var(--ink); }
.lesson-row .meta { color: var(--muted); font-size: .78rem; display: flex; gap: .75rem; align-items: center; }
.lesson-row .meta .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.lesson-row .ring {
  --p: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p)*1%), var(--bg-2) 0);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lesson-row .ring::before {
  content: '';
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
}
.lesson-row .ring .pct {
  position: absolute;
  font-size: .65rem; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lesson-row .ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }

/* ---- lesson page ---- */
.lesson-header { margin-bottom: 1.5rem; }
.lesson-header .breadcrumb { font-size: .8rem; color: var(--muted); margin-bottom: .65rem; }
.lesson-header .breadcrumb a { color: var(--muted); text-decoration: none; }
.lesson-header .breadcrumb a:hover { color: var(--ink); }
.lesson-header h1 { font-weight: 700; }
.lesson-intro { color: var(--muted); font-size: .98rem; max-width: 60ch; margin-bottom: 1.5rem; }

.play-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: .65rem;
  margin: 1.5rem 0 2.5rem;
}
.play-tile {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1.1rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  text-decoration: none;
  color: var(--ink);
  transition: all .15s ease;
}
.play-tile:hover { border-color: var(--accent); background: var(--accent-w); }
[data-theme="dark"] .play-tile:hover { background: var(--bg-soft); }
.play-tile .ico { font-size: 1.4rem; line-height: 1; }
.play-tile .name { font-weight: 600; font-size: .95rem; }
.play-tile .desc { font-size: .78rem; color: var(--muted); }

/* ---- word/sentence cards ---- */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex; align-items: center; gap: 1rem;
  transition: border-color .15s ease;
}
.card:hover { border-color: var(--ink-2); }
.card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.card-kk {
  display: flex; align-items: baseline; gap: .5rem;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
  word-break: break-word;
}
.card-en { color: var(--muted); font-size: .9rem; }
.card-note { color: var(--muted-2); font-size: .8rem; font-style: italic; }
.sentence-card .card-kk { font-size: 1rem; font-weight: 500; }

.play-btn {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  font-size: .7rem;
  transition: all .15s ease;
}
.play-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.play-btn:active { transform: scale(.95); }
.play-btn.lg { width: 44px; height: 44px; font-size: .9rem; }

.tap-hint { color: var(--muted-2); font-size: .75rem; margin-bottom: 1rem; }

/* ---- review (drill) ---- */
.review-shell { max-width: 560px; margin: 1rem auto; text-align: center; }
.review-progress {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; color: var(--muted); margin-bottom: 1rem;
}
.progress-bar {
  height: 4px; background: var(--bg-2);
  border-radius: 4px; overflow: hidden;
  margin: .5rem 0 1.5rem;
}
.progress-bar-fill { height: 100%; background: var(--accent); transition: width .3s ease; }
.big-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  margin: 1.25rem 0;
  font-weight: 600;
  font-size: 1.8rem;
  min-height: 9rem;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  word-break: break-word;
  text-align: center;
  gap: 1rem;
}
.big-card.answer { color: var(--accent); border-color: var(--accent); }
.big-card .audio-play {
  background: var(--accent); color: white;
  border: none; border-radius: 50%;
  width: 56px; height: 56px;
  font-size: 1.2rem; cursor: pointer;
}
#answer-note { font-size: .85rem; font-weight: 400; color: var(--muted); }
.rate-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-top: 1rem; }
.rate-buttons .btn { display: flex; flex-direction: column; gap: .15rem; padding: .65rem .5rem; }
.rate-buttons .btn .key { font-size: .7rem; color: var(--muted-2); font-weight: 500; }
.rate[data-rating="0"]:hover { border-color: var(--bad); color: var(--bad); }
.rate[data-rating="3"]:hover { border-color: var(--warn); color: var(--warn); }
.rate[data-rating="4"]:hover { border-color: var(--accent); color: var(--accent); }
.rate[data-rating="5"]:hover { border-color: var(--good); color: var(--good); }

/* ---- memory game ---- */
.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin: 1rem 0;
  max-width: 720px;
}
.memory-board.cols-3 { grid-template-columns: repeat(3, 1fr); }
.memory-board.cols-4 { grid-template-columns: repeat(4, 1fr); }
.memory-card {
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: .5rem;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;
  transition: background .15s, border-color .15s, transform .15s;
  color: var(--ink);
}
.memory-card .memory-back,
.memory-card .memory-front {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: .35rem;
  word-break: break-word; overflow-wrap: anywhere;
  line-height: 1.2;
  transition: opacity .15s ease;
}
.memory-card .memory-back { font-size: 1.6rem; font-weight: 700; color: var(--muted-2); opacity: 1; }
.memory-card .memory-front { opacity: 0; }
.memory-card.flipped .memory-back,
.memory-card.matched .memory-back { opacity: 0; }
.memory-card.flipped .memory-front,
.memory-card.matched .memory-front { opacity: 1; }
.memory-card.face-down { background: var(--bg-2); }
.memory-card.face-down:hover { transform: translateY(-2px); border-color: var(--accent); }
.memory-card.flipped { background: var(--bg); }
.memory-card.matched {
  background: color-mix(in srgb, var(--good) 12%, var(--bg));
  border-color: var(--good); cursor: default;
}
.memory-card.kk .memory-front { font-size: 1rem; font-weight: 600; color: var(--ink); }
.memory-card.en .memory-front { font-size: .82rem; color: var(--muted); }
.memory-card.matched .memory-front { color: var(--good); }

@media (max-width: 600px) {
  .memory-board { grid-template-columns: repeat(3, 1fr); gap: .35rem; }
  .memory-card .memory-back  { font-size: 1.3rem; }
  .memory-card.kk .memory-front { font-size: .92rem; }
  .memory-card.en .memory-front { font-size: .74rem; }
}
@media (max-width: 380px) {
  .memory-board { grid-template-columns: repeat(2, 1fr); }
}

/* ---- multiple choice ---- */
.mc-options { display: grid; gap: .5rem; margin: 1rem 0; }
.mc-option {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: all .15s ease;
}
.mc-option:hover:not(:disabled) { border-color: var(--accent); }
.mc-option.correct {
  background: color-mix(in srgb, var(--good) 10%, var(--bg));
  border-color: var(--good); color: var(--good);
}
.mc-option.wrong {
  background: color-mix(in srgb, var(--bad) 10%, var(--bg));
  border-color: var(--bad); color: var(--bad);
}
.mc-option:disabled { cursor: default; }

/* ---- typing game ---- */
.type-input {
  width: 100%;
  font-family: inherit;
  font-size: 1.4rem;
  padding: .9rem 1.1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  font-weight: 500;
  color: var(--ink);
  margin: 1rem 0;
}
.type-input:focus { outline: none; border-color: var(--accent); }
.type-input.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 5%, var(--bg)); }
.type-input.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 5%, var(--bg)); }
.type-correct {
  font-size: 1.5rem;
  color: var(--good);
  margin: 1rem 0;
  text-align: center;
  font-weight: 600;
}
.type-correct.actual {
  color: var(--bad);
  text-decoration: line-through;
}
.kk-helper {
  font-size: .75rem; color: var(--muted-2); text-align: center; margin-top: .5rem;
}

/* ---- scoreboard ---- */
.scoreboard {
  display: flex; justify-content: space-around;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem;
  margin-bottom: 1.25rem;
}
.scoreboard div { text-align: center; }
.scoreboard .v { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.scoreboard .l { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---- stats page ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .6rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.stat-card .v { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-card .l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .sub { font-size: .8rem; color: var(--muted-2); margin-top: .25rem; }

/* ---- prose ---- */
.prose { max-width: 65ch; }
.prose h2 { margin-top: 2rem; }
.prose ul { padding-left: 1.5rem; }
.prose li { margin: .35rem 0; }

/* ---- footer ---- */
.site-footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--line-2);
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
}
.site-footer a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.site-footer a:hover { color: var(--ink); }

/* ---- mobile ---- */
@media (max-width: 600px) {
  main { padding: 1.5rem 1rem 3rem; }
  .site-header-inner { padding: .8rem 1rem; gap: .5rem; }
  .site-header nav a { padding: .35rem .45rem; font-size: .82rem; }
  .brand-en { font-size: 1rem; }
  .brand-kk { display: none; }
  .big-card { font-size: 1.4rem; padding: 2.5rem 1.25rem; min-height: 7rem; }
  .play-grid { grid-template-columns: 1fr 1fr; }
  .memory-board.cols-4 { grid-template-columns: repeat(3, 1fr); }
  .hero-stats { gap: 1.25rem; }
  .hero-stats .num { font-size: 1.3rem; }
}

/* ---- empty / done ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state h2 { color: var(--ink); }
/* ============================================================
   v3 additions — append to style.css
   ============================================================ */

/* ---- card with picture ---- */
.card-pic {
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1.6rem;
  flex-shrink: 0;
  overflow: hidden;
}
.card-pic img { width: 100%; height: 100%; object-fit: cover; }

/* ---- tap-the-picture game ---- */
.prompt-strip {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  margin: 1rem 0 1.5rem;
}
.prompt-strip .audio-play {
  background: var(--accent); color: white; border: none;
  border-radius: 50%; width: 48px; height: 48px;
  font-size: 1rem; cursor: pointer; flex-shrink: 0;
}
.prompt-strip .prompt-text { display: flex; flex-direction: column; gap: .15rem; }
.prompt-strip .prompt-text .kk { font-size: 1.4rem; font-weight: 600; line-height: 1.2; }

.picture-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .65rem;
}
.pic-tile {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .75rem;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  aspect-ratio: 1 / 1;
  justify-content: center;
  transition: all .15s ease;
}
.pic-tile:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.pic-tile .emoji { font-size: clamp(2.5rem, 7vw, 3.5rem); line-height: 1; }
.pic-tile img { width: 80%; height: 60%; object-fit: cover; border-radius: 6px; }
.pic-tile .pic-label { font-size: .8rem; color: var(--muted); text-align: center; }
.pic-tile.correct { background: color-mix(in srgb, var(--good) 12%, var(--bg)); border-color: var(--good); }
.pic-tile.correct .pic-label { color: var(--good); }
.pic-tile.wrong { background: color-mix(in srgb, var(--bad) 12%, var(--bg)); border-color: var(--bad); }
.pic-tile.wrong .pic-label { color: var(--bad); }
.pic-tile:disabled { cursor: default; }

/* ---- scenes index ---- */
.scene-list { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: .75rem; grid-template-columns: 1fr; }
.scene-card {
  display: flex; gap: 1rem; align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition: border-color .15s ease;
}
.scene-card:hover { border-color: var(--ink-2); }
.scene-thumb {
  width: 140px; flex-shrink: 0;
  background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.scene-thumb img { width: 100%; height: 100%; object-fit: cover; }
.scene-thumb-empty {
  font-size: .7rem; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 1rem; text-align: center;
}
.scene-meta { padding: .85rem 1rem; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: .25rem; }
.scene-meta h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }

/* ---- scene reader ---- */
.scene-page { max-width: 720px; margin: 0 auto; }
.scene-image {
  margin: 1rem 0 2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.scene-image img { width: 100%; height: auto; display: block; }
.scene-fallback {
  padding: 4rem 1rem;
  text-align: center;
  color: var(--muted-2);
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--bg-soft);
}
.scene-fallback span { font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: .8rem; }
.scene-fallback small { font-size: .75rem; }
.scene-fallback code { background: var(--bg-2); padding: 1px 6px; border-radius: 4px; font-size: .75rem; }

.dialogue-controls { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.dialogue-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.dialogue-line {
  display: flex; gap: .85rem;
  padding: .85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all .2s ease;
}
.dialogue-line.active { border-color: var(--accent); background: var(--accent-w); }
[data-theme="dark"] .dialogue-line.active { background: var(--bg-soft); }
.speaker-tag {
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: white;
  background: var(--speaker-color, var(--accent));
  padding: .2rem .55rem;
  border-radius: 999px;
  flex-shrink: 0;
  align-self: flex-start;
}
.dialogue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.dialogue-kk { font-size: 1.05rem; font-weight: 500; }
.dialogue-en { color: var(--muted); font-size: .9rem; }
.play-btn.sm {
  width: 24px; height: 24px;
  font-size: .55rem;
  display: inline-flex; align-items: center; justify-content: center;
  margin-right: .35rem;
  vertical-align: middle;
}

/* ---- clock game ---- */
.clock-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .65rem;
  margin: 1.5rem 0;
}
.clock-btn {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s ease;
}
.clock-btn:hover:not(:disabled) { border-color: var(--accent); }
.clock-btn:disabled { cursor: default; }
.clock-btn.correct { background: color-mix(in srgb, var(--good) 12%, var(--bg)); border-color: var(--good); color: var(--good); }
.clock-btn.wrong { background: color-mix(in srgb, var(--bad) 12%, var(--bg)); border-color: var(--bad); color: var(--bad); }
.clock-face { width: 100px; height: 100px; }

/* ---- mobile ---- */
@media (max-width: 600px) {
  .picture-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .pic-tile .emoji { font-size: 2.6rem; }
  .scene-card { flex-direction: column; }
  .scene-thumb { width: 100%; height: 160px; }
  .clock-grid { grid-template-columns: 1fr 1fr; }
  .clock-face { width: 80px; height: 80px; }
}
/* ============================================================
   v4 additions — scene blocks
   ============================================================ */

.scene-subtitle { margin: 0 0 .5rem; color: var(--accent); font-size: 1rem; font-weight: 500; }

/* Block frame */
.block {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line-2);
}
.block:first-of-type { border-top: 0; }
.block-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  padding-top: .25rem;
}
.block-body { min-width: 0; }
.block-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 .65rem;
  letter-spacing: -0.01em;
}
.prose-block p { margin: .5rem 0; }
.prose-block { color: var(--ink-2); }

/* Phrases block */
.phrase-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.phrase-row {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .8rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.phrase-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.phrase-kk { font-size: 1.05rem; font-weight: 500; }
.phrase-en { font-size: .9rem; }
.phrase-when { font-style: italic; }

/* Question block */
.q-prompt {
  font-size: 1.05rem;
  font-weight: 500;
  margin: 0 0 .75rem;
  color: var(--ink);
}
.q-options { display: grid; gap: .45rem; }
.q-option {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  font-family: inherit;
  font-size: .95rem;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s ease;
}
.q-option:hover:not(:disabled) { border-color: var(--accent); }
.q-option:disabled { cursor: default; }
.q-option.correct {
  background: color-mix(in srgb, var(--good) 10%, var(--bg));
  border-color: var(--good); color: var(--good);
}
.q-option.wrong {
  background: color-mix(in srgb, var(--bad) 10%, var(--bg));
  border-color: var(--bad); color: var(--bad);
}
.q-option .q-explain { display: none; }

.q-feedback {
  margin-top: .85rem;
  padding: .85rem 1rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--ink-2);
  line-height: 1.55;
}
.q-feedback .ok { color: var(--good); margin-right: .25rem; }
.q-feedback .bad { color: var(--bad); margin-right: .25rem; }

/* Mobile */
@media (max-width: 600px) {
  .block { grid-template-columns: 1fr; gap: .5rem; padding: 1.25rem 0; }
  .block-label { padding-top: 0; }
}
/* ============================================================
   v5 — modern button refresh + color swatch + scene polish
   ============================================================ */

/* ---- Buttons (override v2) ---- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
  transition: background-color .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:hover {
  background: var(--bg-2);
  border-color: var(--line);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}
.btn-primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
  color: var(--bg);
}
[data-theme="dark"] .btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink-2);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--bg-2);
  color: var(--ink);
  border-color: transparent;
}
.btn-sm  { padding: .4rem .8rem; font-size: .82rem; }
.btn-lg  { padding: .8rem 1.5rem; font-size: 1rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ---- Color swatches in tap-the-picture ---- */
.pic-tile .swatch {
  width: 70%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
}
[data-theme="dark"] .pic-tile .swatch { border-color: rgba(255,255,255,0.08); }

/* ---- Tap game prompt strip — softer ---- */
.prompt-strip {
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
  box-shadow: none;
}
.prompt-strip .audio-play {
  background: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.prompt-strip .prompt-text .kk { font-size: 1.6rem; }

/* ---- Pic tile polish (no labels now) ---- */
.pic-tile {
  padding: 1rem;
  gap: 0;
  border-radius: 14px;
  background: var(--bg);
}
.pic-tile:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.pic-tile .emoji { font-size: clamp(2.8rem, 9vw, 4rem); }
.pic-tile img {
  width: 86%; height: 86%;
  object-fit: cover;
  border-radius: 10px;
}

/* ---- Scene page polish ---- */
.scene-page { max-width: 760px; }
.scene-header { margin-bottom: 1.75rem; }
.scene-image {
  margin: 1.25rem 0 2.5rem;
  border-radius: 18px;
  border: 0;
  background: var(--bg-soft);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
}
[data-theme="dark"] .scene-image {
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.3);
}
.scene-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
}

/* Scene block label as subtle tag rather than left rail */
.block {
  grid-template-columns: 1fr;
  gap: .5rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line-2);
}
.block-label {
  align-self: flex-start;
  display: inline-flex;
  font-size: .68rem;
  letter-spacing: .08em;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
  padding: .2rem .55rem;
  border-radius: 999px;
  width: max-content;
  margin-bottom: .25rem;
}
.block-body h3 { font-size: 1.15rem; margin-bottom: .5rem; }

/* Question buttons — tighter, more visible feedback */
.q-options { gap: .5rem; }
.q-option {
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: .95rem;
  line-height: 1.4;
  transition: all .15s ease;
}
.q-option:hover:not(:disabled) {
  border-color: var(--ink-2);
  background: var(--bg);
  transform: translateY(-1px);
}
.q-feedback {
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
}

/* Phrases rows softer */
.phrase-row {
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
}
.phrase-row:hover { border-color: var(--line); }

/* Dialogue lines softer */
.dialogue-line {
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
}

/* Scoreboard refresh */
.scoreboard {
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--bg-soft);
}

/* Big card refresh */
.big-card { border-radius: 18px; border: 1px solid var(--line-2); background: var(--bg-soft); }
.big-card.answer { border-color: var(--accent); background: var(--accent-w); }

/* Audio play button cleaner */
.audio-play, .play-btn-big {
  background: var(--ink) !important;
  color: var(--bg) !important;
  border: 0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Lesson row polish */
.lesson-list a.lesson-row {
  border-radius: 12px;
  background: var(--bg-soft);
  border-color: var(--line-2);
}
.lesson-list a.lesson-row:hover { background: var(--bg); border-color: var(--line); }

/* Play tiles polish */
.play-tile {
  border-radius: 14px;
  background: var(--bg-soft);
  border-color: var(--line-2);
}
.play-tile:hover {
  background: var(--bg);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

/* Cards (word/sentence) polish */
.card {
  border-radius: 12px;
  background: var(--bg-soft);
  border-color: var(--line-2);
}
.card:hover { background: var(--bg); border-color: var(--line); }

/* Scene list items */
.scene-card {
  border-radius: 14px;
  border-color: var(--line-2);
  background: var(--bg-soft);
}
.scene-card:hover { background: var(--bg); border-color: var(--line); transform: translateY(-1px); }

/* Stat cards */
.stat-card {
  border-radius: 12px;
  background: var(--bg-soft);
  border-color: var(--line-2);
}

/* Memory game cards */
.memory-card { border-radius: 12px; }

/* Multiple choice option */
.mc-option {
  border-radius: 12px;
  background: var(--bg-soft);
  border-color: var(--line);
}
.mc-option:hover:not(:disabled) { background: var(--bg); border-color: var(--ink-2); }

/* Type input */
.type-input { border-radius: 12px; background: var(--bg-soft); border-color: var(--line); }
.type-input:focus { background: var(--bg); }

/* Clock face — make it readable */
.clock-face { width: 130px; height: 130px; color: var(--ink); }
.clock-btn {
  border-radius: 14px;
  background: var(--bg-soft);
  border-color: var(--line-2);
  padding: .85rem;
}
.clock-btn:hover:not(:disabled) { background: var(--bg); border-color: var(--accent); transform: translateY(-2px); }

/* Mobile clock smaller */
@media (max-width: 600px) {
  .clock-face { width: 100px; height: 100px; }
}

/* Picture grid — slightly bigger gap on desktop */
.picture-grid { gap: .75rem; }
@media (min-width: 600px) {
  .picture-grid { grid-template-columns: repeat(3, 1fr); }
}
/* ============================================================
   v6 — site-wide breadcrumbs + difficulty picker + color swatch in card
   ============================================================ */

/* Breadcrumbs in header */
.crumbs {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: .5rem 1.25rem .75rem;
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line-2);
}
.crumbs a { color: var(--muted); text-decoration: none; padding: .15rem .25rem; border-radius: 4px; }
.crumbs a:hover { color: var(--ink); background: var(--bg-2); }
.crumbs .sep { color: var(--muted-2); font-size: .85rem; }
.crumbs span:not(.sep) { color: var(--ink); font-weight: 500; }

/* Hide the old in-page breadcrumb (we kept it in some templates) */
.scene-page > .breadcrumb,
.lesson > .breadcrumb,
article.lesson > .breadcrumb,
main > .breadcrumb,
p.breadcrumb { display: none; }

/* But the inline one inside lesson-header should also hide */
.lesson-header .breadcrumb { display: none; }

@media (max-width: 600px) {
  .crumbs { padding: .4rem 1rem .65rem; font-size: .75rem; }
}

/* Color swatch in lesson card-pic */
.card-pic .card-swatch {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
}
[data-theme="dark"] .card-pic .card-swatch { border-color: rgba(255,255,255,0.08); }

/* Difficulty picker on clock game */
.difficulty-picker {
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.difficulty-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}
.difficulty-options .btn {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  text-align: center;
  align-items: center;
  padding: 1rem;
  line-height: 1.3;
}
.difficulty-options .btn-primary .small { color: rgba(255,255,255,0.7); }
@media (max-width: 480px) {
  .difficulty-options { grid-template-columns: 1fr; }
}
/* ============================================================
   v7 — color grid tap mode
   ============================================================ */
.picture-grid.grid-mode {
  grid-template-columns: repeat(4, 1fr);
  gap: .55rem;
}
.picture-grid.grid-mode .pic-tile {
  padding: .55rem;
  border-radius: 12px;
  aspect-ratio: 1 / 1;
}
.picture-grid.grid-mode .pic-tile .swatch {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}
@media (max-width: 600px) {
  .picture-grid.grid-mode { grid-template-columns: repeat(3, 1fr); gap: .45rem; }
}
/* ============================================================
   v8 — numbers / months / compass game styles
   ============================================================ */

/* Numbers — big numeral tiles */
.numeral-tile { aspect-ratio: 1 / 1; padding: .5rem; }
.numeral-tile .big-num {
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* Months grid */
.month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .55rem;
  margin: 1rem 0;
}
.month-tile {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem .75rem;
  display: flex; flex-direction: column; gap: .35rem;
  align-items: center; justify-content: center;
  font-family: inherit;
  cursor: pointer;
  color: var(--ink);
  aspect-ratio: 4 / 3;
  transition: all .15s ease;
}
.month-tile:hover:not(:disabled) { background: var(--bg); border-color: var(--accent); transform: translateY(-2px); }
.month-tile:disabled { cursor: default; }
.month-tile .month-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.month-tile .month-name {
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink);
  text-align: center;
}
.month-tile.correct { background: color-mix(in srgb, var(--good) 12%, var(--bg)); border-color: var(--good); color: var(--good); }
.month-tile.wrong   { background: color-mix(in srgb, var(--bad)  12%, var(--bg)); border-color: var(--bad);  color: var(--bad);  }
.month-tile.correct .month-num,
.month-tile.correct .month-name { color: var(--good); }
.month-tile.wrong   .month-num,
.month-tile.wrong   .month-name { color: var(--bad); }

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

/* Compass rose */
.compass-rose {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows:    repeat(3, 1fr);
  gap: .5rem;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  margin: 1.5rem auto;
}
.compass-cell { display: flex; align-items: center; justify-content: center; }
.compass-btn {
  width: 100%; height: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s ease;
  letter-spacing: 0.02em;
}
.compass-btn:hover:not(:disabled) { background: var(--bg); border-color: var(--accent); transform: scale(1.04); }
.compass-btn:disabled { cursor: default; }
.compass-btn.correct { background: color-mix(in srgb, var(--good) 14%, var(--bg)); border-color: var(--good); color: var(--good); }
.compass-btn.wrong   { background: color-mix(in srgb, var(--bad) 14%, var(--bg)); border-color: var(--bad); color: var(--bad); }
.compass-center {
  font-size: 1.8rem;
  color: var(--muted-2);
  user-select: none;
}

/* clock game: visual feedback for selected mode toggle */
[data-mode].active { background: var(--accent); color: #fff; border-color: var(--accent); }
[data-mode].active .muted { color: rgba(255,255,255,0.8); }

/* ============================================================
   Mobile fixes — prevent horizontal scroll + wrap long Kazakh text
   ============================================================ */
html, body { overflow-x: hidden; max-width: 100%; }
* { min-width: 0; }
.kk, .pic-label, .big-num, .month-name, .month-num,
.numeral-tile, .month-tile, .compass-btn, .pic-tile,
.prompt-strip, .prompt-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.numeral-tile .big-num { line-height: 1.05; max-width: 100%; }
.prompt-strip { flex-wrap: wrap; }
.prompt-strip .prompt-text { flex: 1 1 auto; min-width: 0; }
.scoreboard { flex-wrap: wrap; }

@media (max-width: 600px) {
  body { -webkit-text-size-adjust: 100%; }
  /* tighter padding on small screens */
  main { padding-left: .9rem; padding-right: .9rem; }
  /* numerals can be very long; allow them to soft-wrap on multiple lines */
  .numeral-tile .big-num { font-size: clamp(1rem, 6vw, 2.4rem) !important; }
  /* Reverse-mode tiles in numbers game with long Kazakh strings */
  .pic-tile .kk { font-size: .9rem !important; line-height: 1.3; padding: 6px 4px !important; }
  /* Tap-the-picture: ensure label is fully visible (was being clipped) */
  .pic-tile { aspect-ratio: auto; min-height: 110px; padding: .5rem .35rem; }
  .pic-tile .emoji { font-size: clamp(2.2rem, 11vw, 3rem); }
  .pic-tile .pic-label { font-size: .78rem; line-height: 1.25; padding: 0 2px; }
  /* mode chip: don't overflow */
  #mode-chip { font-size: .68em !important; padding: 4px 9px !important; }
  /* Prompt-strip text on mobile shouldn't truncate */
  .prompt-strip .kk { font-size: 1.1rem; line-height: 1.35; }
}

/* ============================================================
   Top-nav: Practice dropdown
   ============================================================ */
.site-header nav { gap: .35rem; }
.nav-dropdown { position: relative; display: inline-flex; }
.nav-trigger {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .4rem .7rem;
  background: none; border: 0;
  color: var(--muted); font: inherit; font-size: .9rem;
  cursor: pointer; border-radius: 8px;
}
.nav-trigger:hover, .nav-dropdown.open .nav-trigger { color: var(--ink); background: var(--bg-2); }
.nav-trigger .chev { font-size: .7em; transition: transform .15s ease; }
.nav-dropdown.open .nav-trigger .chev { transform: rotate(180deg); }
.nav-menu {
  position: absolute; top: calc(100% + .35rem); left: 0;
  min-width: 240px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .35rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  display: none;
  z-index: 100;
}
.nav-dropdown.open .nav-menu { display: block; }
.nav-menu a {
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
  column-gap: .55rem;
  padding: .55rem .65rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  align-items: center;
}
.nav-menu a:hover { background: var(--bg-2); }
.nav-menu .nav-ico { grid-row: 1 / 3; font-size: 1.2rem; line-height: 1; }
.nav-menu .nav-name { font-weight: 600; font-size: .92rem; }
.nav-menu .nav-hint { color: var(--muted); font-size: .75rem; grid-column: 2; }

.streak-link { display: inline-flex; align-items: center; padding: 0; border-radius: 999px; }
.streak-link:hover { opacity: .85; }

@media (max-width: 600px) {
  .nav-menu { position: fixed; left: .8rem; right: .8rem; min-width: 0; top: 64px; }
}

/* ===== grammar topic + drill ===== */
.grammar-topic header { margin-bottom: 1.5rem; }
.grammar-topic .g-level {
  display: inline-block; font-size: 11px; font-weight: 600;
  background: #f3f4f6; color: #374151;
  padding: 3px 9px; border-radius: 999px;
  text-transform: capitalize; margin-bottom: 8px;
}
.block-explanation .prose-block {
  font-size: 1rem; line-height: 1.7;
}
.block-explanation .prose-block p:not(:last-child) { margin-bottom: 0.85rem; }
.block-explanation .prose-block strong { font-weight: 700; }

.block-examples .ex-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.block-examples .ex-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px; background: var(--bg-soft, #fafafa);
}
.block-examples .ex-text { flex: 1; min-width: 0; }
.block-examples .ex-kk { font-weight: 500; }
.block-examples .ex-en { margin-top: 2px; font-size: 0.92rem; }

/* Drill */
.block-drill .drill-host {
  margin-top: 12px; padding: 16px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  background: var(--bg-soft, #fafafa);
}
.drill { display: flex; flex-direction: column; gap: 14px; }
.drill-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted, #6b7280); text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 600;
}
.drill-prompt-wrap { position: relative; padding: 18px 16px; background: var(--bg, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 10px; }
.drill-prompt-label { font-size: 11px; color: var(--muted, #888); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-bottom: 6px; }
.drill-prompt { font-size: 1.2rem; font-weight: 500; line-height: 1.4; }
.drill-prompt-play { position: absolute; top: 14px; right: 14px; }
.drill-options { display: grid; gap: 8px; }
.drill-opt {
  text-align: left; padding: 14px 16px; font-size: 1rem;
  border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  background: var(--bg, #fff); color: inherit; cursor: pointer;
  font-family: inherit; transition: background .12s, border-color .12s;
}
.drill-opt:hover:not(:disabled) { border-color: var(--accent, #4F46E5); background: var(--bg-soft, #fafafa); }
.drill-opt:disabled { cursor: default; opacity: 0.85; }
.drill-opt.correct { background: #d1fae5; border-color: #10b981; color: #065f46; opacity: 1; }
.drill-opt.wrong { background: #fee2e2; border-color: #ef4444; color: #991b1b; opacity: 1; }
.drill-feedback { font-size: .92rem; min-height: 24px; padding-top: 4px; line-height: 1.5; }
.drill-feedback .ok { color: #065f46; font-weight: 600; }
.drill-feedback .bad { color: #991b1b; font-weight: 600; margin-right: 4px; }
.drill-next { margin-top: 10px; }
.drill-final { text-align: center; padding: 20px 0; }
.drill-final-score { font-size: 2.4rem; font-weight: 700; }
.drill-final-pct { font-size: 1rem; color: var(--muted, #6b7280); margin-top: -4px; }
.drill-final-msg { margin: 14px 0 18px; }

.related-lessons { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line, #e5e7eb); }
.related-lessons ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related-lessons li a {
  padding: 6px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 999px;
  font-size: 13px; text-decoration: none; text-transform: capitalize;
}

@media (max-width: 600px) {
  .drill-prompt { font-size: 1.05rem; }
  .drill-opt { padding: 12px 14px; font-size: 0.95rem; }
}

/* ===== auth nav (header) ===== */
.nav-signin {
  padding: .35rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  background: var(--bg);
}
.nav-signin:hover { background: var(--bg-soft); border-color: var(--ink-2); }
.nav-account .acct-dot { color: var(--good); font-size: 9px; vertical-align: middle; }
.nav-account .nav-acct-email {
  display: block;
  padding: .5rem .85rem .35rem;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  word-break: break-all;
}

/* ===== auth + suggest pages — shared form styling ===== */
.auth-page,
.suggest-page { max-width: 560px; margin: 1.5rem auto; }
.suggest-page { max-width: 640px; }

.auth-card,
.suggest-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
  display: block;
}
.auth-card-ok,
.suggest-ok { border-color: var(--good); background: var(--bg-soft); }
.auth-card-err,
.suggest-err { border-color: var(--bad); background: var(--bg-soft); }

.auth-card p,
.suggest-card p { margin: .35rem 0; }

.auth-label,
.suggest-label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin: .85rem 0 .4rem;
  color: var(--ink);
}
.auth-label:first-child,
.suggest-label:first-of-type { margin-top: 0; }

.auth-input,
.suggest-input {
  width: 100%;
  box-sizing: border-box;
  padding: .75rem .85rem;
  font-size: 16px;          /* prevents iOS zoom-on-focus */
  font-family: inherit;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.auth-input:focus,
.suggest-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
textarea.suggest-input { resize: vertical; min-height: 130px; }

.auth-submit,
.suggest-submit {
  width: 100%;
  margin-top: 1rem;
  justify-content: center;
  padding: .75rem 1rem;
  font-size: 1rem;
}

.auth-foot,
.suggest-foot { margin-top: 1rem; }

/* ===== suggestions: shared list/badge styling (used on /suggest + /admin/suggestions) ===== */
.suggest-roadmap-h { margin-top: 2rem; }
.suggest-list { list-style: none; padding: 0; margin: 1rem 0; }
.suggest-item {
  display: flex; gap: .65rem; align-items: center;
  padding: .65rem .85rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: .5rem;
  background: var(--bg);
}
.suggest-title { flex: 1; }

.badge[class*='badge-'] {
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
  display: inline-flex; align-items: center;
  background: var(--bg-soft); color: var(--ink);
}
.badge-planned     { background: #FEF3C7; color: #92400E; }
.badge-in_progress { background: #DBEAFE; color: #1E40AF; }
.badge-done        { background: #D1FAE5; color: #065F46; }
.badge-new         { background: var(--bg-soft); color: var(--muted); }
.badge-wontfix     { background: #FEE2E2; color: #991B1B; }
:root[data-theme='dark'] .badge-planned     { background:#3B2F0E; color:#FCD34D; }
:root[data-theme='dark'] .badge-in_progress { background:#1E2A4A; color:#93C5FD; }
:root[data-theme='dark'] .badge-done        { background:#0F2E22; color:#6EE7B7; }
:root[data-theme='dark'] .badge-wontfix     { background:#3B1313; color:#FCA5A5; }

/* ===== /admin/suggestions ===== */
.adminsug { max-width: var(--max-w); margin: 1rem auto; }
.adminsug-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: .5rem; flex-wrap: wrap;
}
.adminsug-filters { display: flex; flex-wrap: wrap; gap: .35rem; margin: .75rem 0 1.25rem; }
.filter-pill {
  padding: .3rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  text-transform: capitalize;
  color: var(--ink);
  background: var(--bg);
}
.filter-pill:hover { border-color: var(--ink-2); }
.filter-pill.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.sug-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .75rem .9rem;
  margin-bottom: .55rem;
  background: var(--bg);
}
.sug-card[open] { padding-bottom: 1.1rem; background: var(--bg-soft); }
.sug-card summary {
  display: flex; gap: .65rem; align-items: center;
  cursor: pointer; list-style: none;
  padding: .15rem 0;
}
.sug-card summary::-webkit-details-marker { display: none; }
.sug-card .sug-title { flex: 1; font-weight: 600; }
.sug-card .sug-meta { white-space: nowrap; }

.sug-body { margin-top: .85rem; }
.sug-text {
  white-space: pre-wrap;
  padding: .85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sug-form { margin-top: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.sug-flabel { display: flex; flex-direction: column; gap: .3rem; font-size: 13px; font-weight: 600; color: var(--ink); }
.sug-finput {
  padding: .65rem .8rem;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sug-finput:focus { outline: none; border-color: var(--accent); }
textarea.sug-finput { resize: vertical; min-height: 60px; }
.sug-actions { display: flex; gap: .5rem; margin-top: .25rem; }
.sug-actions .btn { flex: 1; justify-content: center; }
.btn-danger { background: var(--bg-soft); color: var(--bad); border-color: var(--line); }
.btn-danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }

@media (max-width: 600px) {
  .sug-card summary { flex-wrap: wrap; }
  .sug-actions { flex-direction: column; }
}

/* ===== admin pages — mobile polish ===== */
@media (max-width: 768px) {
  /* Prevent iOS zoom on focus by forcing 16px+ inputs across the admin */
  body.is-admin input[type=text],
  body.is-admin input[type=email],
  body.is-admin input[type=password],
  body.is-admin input[type=number],
  body.is-admin input:not([type]),
  body.is-admin textarea,
  body.is-admin select {
    font-size: 16px !important;
    padding: .75rem .85rem !important;
    min-height: 44px;
    box-sizing: border-box;
  }
  body.is-admin .row {
    padding: .75rem !important;
    gap: .5rem !important;
    margin-bottom: .75rem !important;
  }
  body.is-admin .col-label { font-size: 11px !important; margin-bottom: .25rem !important; }
  body.is-admin .del-btn {
    width: 100%; min-height: 44px;
    padding: .65rem .85rem !important; font-size: 18px !important;
  }
  body.is-admin .btn { min-height: 44px; padding: .65rem .85rem; font-size: 15px; }
  body.is-admin .tab-row .tab {
    padding: .65rem .85rem !important;
    font-size: 14px !important;
    min-height: 40px;
  }
  body.is-admin .lesson-card {
    padding: .85rem !important;
    min-height: 56px;
  }
  body.is-admin form > div[style*='sticky'] {
    padding-bottom: calc(0.9rem + env(safe-area-inset-bottom)) !important;
  }
  body.is-admin .gm-pill {
    padding: .5rem .85rem !important;
    font-size: 14px !important;
    min-height: 36px;
  }
  body.is-admin .gm-pill .x { padding: 4px 6px; }
  body.is-admin .sug-actions { flex-direction: column; }
  body.is-admin .sug-actions .btn { width: 100%; }
}

/* ===== /admin/grammar editor ===== */
.ag-flash {
  margin: 0 0 1rem; padding: .65rem .9rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: .92rem;
}
.ag-flash-ok  { border-color: var(--good); background: var(--bg-soft); color: var(--good); }
.ag-flash-err { border-color: var(--bad);  background: var(--bg-soft); color: var(--bad); }

.ag-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.ag-head h1 { margin: 0 0 .25rem; }
.ag-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.ag-form { display: flex; flex-direction: column; gap: 1rem; }

.ag-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.ag-h2 { margin: 1rem 0 .25rem; font-size: 1.1rem; }

.ag-label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin: .65rem 0 .3rem;
}
.ag-label:first-child { margin-top: 0; }

.ag-input {
  width: 100%; box-sizing: border-box;
  padding: .65rem .8rem;
  font-size: 16px; font-family: inherit; line-height: 1.4;
  color: var(--ink); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.ag-input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
textarea.ag-input { resize: vertical; min-height: 70px; }
.ag-input-title { font-size: 1.1rem; font-weight: 600; }

.ag-row2 { display: grid; gap: .75rem; grid-template-columns: 1fr 2fr; align-items: start; }
.ag-row3 { display: grid; gap: .75rem; grid-template-columns: 2fr 2fr 1fr; align-items: start; }
@media (max-width: 600px) {
  .ag-row2, .ag-row3 { grid-template-columns: 1fr; }
}

.ag-blocks { display: flex; flex-direction: column; gap: .75rem; }

.ag-block {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem 1rem;
}
.ag-block-explanation { border-left: 4px solid var(--accent); }
.ag-block-examples    { border-left: 4px solid var(--good); }
.ag-block-drill       { border-left: 4px solid var(--warn); }

.ag-block-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .65rem;
}
.ag-block-type {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.ag-block-ctrls { display: flex; gap: .25rem; }
.ag-btn-icon {
  width: 36px; height: 36px;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); border-radius: var(--radius);
  font-size: 1rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.ag-btn-icon:hover { border-color: var(--ink-2); }
.ag-btn-icon.ag-btn-del:hover { background: var(--bad); color: #fff; border-color: var(--bad); }

.ag-field { margin-top: .5rem; }
.ag-field:first-of-type { margin-top: 0; }

.ag-items { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .5rem; }
.ag-item {
  display: grid; gap: .5rem;
  grid-template-columns: 1.1fr 1.1fr 0.7fr 36px;
  align-items: center;
}
.ag-item:has(input[data-field='gloss']) { grid-template-columns: 1.1fr 1.1fr 0.7fr 36px; }
.ag-item:not(:has(input[data-field='gloss'])) { grid-template-columns: 1fr 1fr 36px; }
.ag-del-row {
  width: 36px; height: 36px;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--muted); border-radius: var(--radius); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.ag-del-row:hover { background: var(--bad); color: #fff; border-color: var(--bad); }

.ag-add-row { margin-top: .25rem; }

.ag-add-bar {
  display: flex; gap: .5rem; flex-wrap: wrap;
  margin: 1rem 0;
  padding: .75rem;
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--bg);
}
.ag-add { font-weight: 600; }

.ag-savebar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; gap: .5rem; justify-content: flex-end;
  padding: .75rem 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.ag-savebar-inline { position: static; border-top: 0; padding-top: 1rem; }

.ag-build-output { margin-top: 1.5rem; }
.ag-build-output summary { cursor: pointer; color: var(--muted); }
.ag-build-output pre {
  margin-top: .5rem; padding: .8rem 1rem;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: .78rem; line-height: 1.45;
  max-height: 340px; overflow: auto; white-space: pre-wrap;
}

.ag-new { max-width: 540px; margin: 1.5rem auto; }

@media (max-width: 600px) {
  .ag-item { grid-template-columns: 1fr 1fr 36px !important; }
  .ag-item input[data-field='gloss'] { grid-column: 1 / span 2; }
}

/* ===== drill type-mode + listen-mode ===== */
.drill-type-wrap { display: flex; gap: .5rem; margin-top: .25rem; }
.drill-type-input {
  flex: 1; padding: .85rem .9rem;
  font-size: 1.05rem; font-family: inherit;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--ink);
}
.drill-type-input:focus { outline: none; border-color: var(--accent); }
.drill-type-input.correct { border-color: var(--good); background: #d1fae5; color: #065f46; }
.drill-type-input.wrong   { border-color: var(--bad);  background: #fee2e2; color: #991b1b; }
.drill-type-submit { white-space: nowrap; }

.drill-prompt-listen { text-align: center; padding: 1.25rem; }
.drill-listen-play {
  font-size: 1.15rem; font-weight: 600;
  padding: .85rem 1.5rem; margin-top: .5rem;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: var(--radius); cursor: pointer;
}
.drill-listen-play:hover { background: var(--accent-d); border-color: var(--accent-d); }

@media (max-width: 600px) {
  .drill-type-wrap { flex-direction: column; }
  .drill-type-submit { width: 100%; }
}

/* ===== listen-mode player ===== */
.listen-page { max-width: 760px; margin: 0 auto; }
.listen-head { margin-bottom: 1.25rem; }
.listen-head h1 { margin-bottom: .25rem; }

.listen-controls {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5;
  padding: .75rem 0;
  background: var(--bg);
  margin-bottom: 1rem;
}
.listen-main-btn { font-weight: 600; min-width: 96px; }
.listen-icon-btn { min-width: 48px; padding: .55rem .75rem; }
#lp-progress { margin-left: auto; }

.listen-segments { list-style: none; padding: 0; margin: 0; counter-reset: seg; display: flex; flex-direction: column; gap: .5rem; }
.listen-seg {
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  display: grid; grid-template-columns: 64px 1fr; gap: .65rem;
  align-items: start;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.listen-seg:hover { border-color: var(--ink-2); }
.listen-seg.is-current { border-color: var(--accent); background: var(--bg-soft); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.seg-lang {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
  padding-top: 3px;
}
.listen-seg-en      .seg-lang { color: #1E40AF; }
.listen-seg-en-male .seg-lang { color: #1E40AF; }
.listen-seg-kk      .seg-lang { color: #065F46; }
.listen-seg-kk-male .seg-lang { color: #065F46; }
.seg-text { line-height: 1.55; }
.listen-seg-en .seg-text, .listen-seg-en-male .seg-text { color: var(--muted); font-size: .95rem; font-style: italic; }
.listen-seg-kk .seg-text, .listen-seg-kk-male .seg-text { font-size: 1.05rem; }
:root[data-theme='dark'] .listen-seg-en .seg-lang,
:root[data-theme='dark'] .listen-seg-en-male .seg-lang { color: #93C5FD; }
:root[data-theme='dark'] .listen-seg-kk .seg-lang,
:root[data-theme='dark'] .listen-seg-kk-male .seg-lang { color: #6EE7B7; }

@media (max-width: 600px) {
  .listen-seg { grid-template-columns: 50px 1fr; padding: .7rem .85rem; }
  .listen-icon-btn { min-width: 44px; }
}

/* ===== tap-game player + admin ===== */
.tap-grid {
  display: grid; gap: 12px; margin-top: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.tap-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-soft); text-decoration: none; color: inherit;
  transition: border-color .12s, transform .1s, background .12s;
}
.tap-card:hover { border-color: var(--accent); transform: translateY(-1px); background: var(--bg); }
.tap-card-img { width: 100%; height: 110px; border-radius: var(--radius);
  background-size: cover; background-position: center; background-color: var(--bg); }
.tap-card-title { font-weight: 600; }

.tap-page { max-width: 760px; margin: 0 auto; }

.tap-host { margin-top: 1rem; }
.tap-prompt-bar {
  display: flex; align-items: center; gap: .65rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg);
  position: sticky; top: 0; z-index: 5;
}
.tap-prompt-bar .tap-progress { min-width: 70px; }
.tap-prompt-bar .play-btn { min-width: 44px; min-height: 44px; }
.tap-prompt {
  font-size: 1.25rem; font-weight: 600;
  flex: 1; min-width: 0;
}

.tap-stage {
  position: relative; margin-top: .75rem;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; user-select: none;
}
.tap-stage img { display: block; width: 100%; height: auto; }
.tap-pins { position: absolute; inset: 0; pointer-events: none; }
.tap-ripple {
  position: absolute; width: 60px; height: 60px;
  border-radius: 50%; transform: translate(-50%, -50%);
  pointer-events: none;
  animation: tap-pop .9s ease-out forwards;
}
.tap-ripple.correct { background: rgba(16, 185, 129, .35); border: 3px solid #10b981; }
.tap-ripple.wrong   { background: rgba(239, 68, 68, .35);  border: 3px solid #ef4444; }
@keyframes tap-pop {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.5); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
}
.tap-target-marker {
  position: absolute; width: 28px; height: 28px;
  border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--good); box-shadow: 0 0 0 4px rgba(16, 185, 129, .35);
  pointer-events: none;
  animation: tap-pulse 1.1s ease-out;
}
@keyframes tap-pulse {
  0%   { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.tap-feedback {
  position: absolute; left: 50%; bottom: 12px;
  transform: translateX(-50%);
  padding: .5rem .85rem;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: .92rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
.tap-feedback .ok  { color: var(--good); font-weight: 600; }
.tap-feedback .bad { color: var(--bad);  font-weight: 600; margin-right: .25rem; }
.tap-controls {
  display: flex; align-items: center; gap: .5rem;
  margin-top: .85rem;
}
.tap-controls .tap-score { margin-left: auto; }

/* --- admin pin editor --- */
.at-image-upload { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.at-stage {
  position: relative; margin-top: .5rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; min-height: 120px;
}
.at-stage img { display: block; width: 100%; height: auto; }
.at-image-placeholder {
  padding: 2.5rem 1rem; text-align: center; color: var(--muted);
  font-size: .92rem;
}
.at-pins { position: absolute; inset: 0; }
.at-pin {
  position: absolute;
  width: 30px; height: 30px;
  transform: translate(-50%, -50%);
  background: var(--accent); color: #fff;
  border: 2px solid #fff; border-radius: 50%;
  font-size: 13px; font-weight: 700;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.25);
  display: inline-flex; align-items: center; justify-content: center;
}
.at-pin.empty  { background: var(--warn); }
.at-pin.active { box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgba(0,0,0,.3); transform: translate(-50%, -50%) scale(1.15); }
.at-pin-editor {
  margin-top: .85rem; padding: 1rem;
  background: var(--bg); border: 1px solid var(--accent); border-radius: var(--radius);
}

@media (max-width: 600px) {
  .tap-prompt { font-size: 1.05rem; }
  .at-pin { width: 28px; height: 28px; font-size: 12px; }
}

/* ===== home page — minimal tiles ===== */
.home-hero { padding: 1.5rem 0 1rem; }
.home-hero h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0; line-height: 1.2; }

.home-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 1rem 0 2rem;
}
.home-tile {
  --tile-accent: var(--accent);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .35rem;
  padding: 1.5rem 1rem;
  min-height: 130px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-top: 3px solid var(--tile-accent);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  text-align: center;
  transition: background .12s, transform .12s, border-color .12s, box-shadow .12s;
}
.home-tile:hover {
  background: var(--bg);
  border-color: var(--tile-accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .06);
}
.home-tile .ht-ico { font-size: 2rem; line-height: 1; }
.home-tile .ht-name { font-size: 1rem; font-weight: 600; }
.home-tile .ht-meta {
  font-size: .75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .home-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .home-tile { padding: 1.1rem .75rem; min-height: 110px; }
  .home-tile .ht-ico { font-size: 1.7rem; }
  .home-tile .ht-name { font-size: .95rem; }
}

/* ===== publish badge (used on /admin/lesson editor) ===== */
.pub-badge {
  display: inline-block;
  padding: .2rem .65rem;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  border-radius: 999px;
  vertical-align: middle;
}
.pub-published { background: #D1FAE5; color: #065F46; }
.pub-draft     { background: #FEF3C7; color: #92400E; }
:root[data-theme='dark'] .pub-published { background: #0F2E22; color: #6EE7B7; }
:root[data-theme='dark'] .pub-draft     { background: #3B2F0E; color: #FCD34D; }

/* ===== audio-review pill on admin lesson cards ===== */
.audio-pill {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  text-transform: none; letter-spacing: 0;
  white-space: nowrap;
}
.audio-pill.audio-good    { background: #D1FAE5; color: #065F46; }
.audio-pill.audio-partial { background: #FEF3C7; color: #92400E; }
.audio-pill.audio-bad     { background: #FEE2E2; color: #991B1B; }
:root[data-theme='dark'] .audio-pill.audio-good    { background: #0F2E22; color: #6EE7B7; }
:root[data-theme='dark'] .audio-pill.audio-partial { background: #3B2F0E; color: #FCD34D; }
:root[data-theme='dark'] .audio-pill.audio-bad     { background: #3B1313; color: #FCA5A5; }

/* ===== /admin top summary panel ===== */
.admin-summary {
  display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin: 1rem 0 1.5rem;
}
.as-box {
  display: flex; flex-direction: column; gap: 1px;
  padding: .65rem .85rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.as-num { font-size: 1.4rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.as-lbl { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.as-sub { font-size: .72rem; color: #92400E; margin-top: 2px; font-weight: 600; }
.as-sub.as-bad { color: #991B1B; }
.as-audio { border-left: 3px solid var(--accent); }

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

/* ===== shared-audio badge in /admin/lesson/<slug>/review ===== */
.ar-shared {
  font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
  background: var(--bg); color: var(--accent);
  border: 1px solid var(--accent);
  margin-left: .35rem; cursor: help;
}

/* ===== /admin lessons tab — group headers ===== */
.adm-group { margin-bottom: 1.25rem; }
.adm-group-head {
  display: flex; align-items: baseline; gap: .55rem;
  margin: 0 0 .55rem; padding: .15rem 0 .15rem .6rem;
  border-left: 4px solid var(--accent);
}
.adm-group-icon { font-size: 1.05rem; }
.adm-group-name { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.adm-group-count { color: var(--muted); font-size: .78rem; }

/* ===== /lessons public — group headers ===== */
.lg-section { margin: 1.25rem 0; }
.lg-head {
  display: flex; align-items: baseline; gap: .55rem;
  margin: 0 0 .5rem; padding: .15rem 0 .15rem .6rem;
  border-left: 4px solid var(--accent);
}
.lg-icon { font-size: 1.1rem; }
.lg-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.lg-count { color: var(--muted); font-size: .78rem; }
.lg-desc { color: var(--muted); font-size: .85rem; margin: 0 0 .55rem .85rem; }

/* ===== /tap two-section layout ===== */
.tap-h { margin: 1.5rem 0 .25rem; font-size: 1.15rem; }
.tap-card-emoji {
  width: 100%; aspect-ratio: 16/9;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  background: var(--bg);
  border-radius: var(--radius);
}
.tap-card-lesson .tap-card-emoji { background: linear-gradient(135deg, var(--bg), var(--bg-soft)); }

/* ===== tap-game emoji mode (player + admin) ===== */
.tap-emoji-grid {
  display: grid; gap: .65rem;
  grid-template-columns: repeat(2, 1fr);
  margin-top: .85rem;
}
.tap-emoji-opt {
  font-size: 3rem; line-height: 1;
  padding: 1.4rem .5rem;
  background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color .12s, transform .1s, background .12s;
}
.tap-emoji-opt:hover:not(:disabled) { border-color: var(--accent); background: var(--bg-soft); transform: translateY(-1px); }
.tap-emoji-opt:disabled { cursor: default; opacity: .85; }
.tap-emoji-opt.correct { background: #D1FAE5; border-color: #10B981; opacity: 1; }
.tap-emoji-opt.wrong   { background: #FEE2E2; border-color: #EF4444; opacity: 1; }
@media (max-width: 600px) {
  .tap-emoji-opt { font-size: 2.4rem; padding: 1.1rem .25rem; }
}

/* admin emoji-mode rows */
.ae-row {
  display: grid; gap: .5rem; align-items: center;
  grid-template-columns: 64px 1fr 1fr 36px;
  margin-bottom: .55rem;
}
.ae-row .ae-emoji { text-align: center; font-size: 1.4rem; }
@media (max-width: 600px) {
  .ae-row { grid-template-columns: 56px 1fr 36px; }
  .ae-row .ae-en { grid-column: 2 / span 2; }
}

/* ===== emoji-palette in admin tap-game editor ===== */
.ae-palette-wrap { margin: .85rem 0 1rem; }
.ae-palette-wrap > summary {
  cursor: pointer; font-size: .85rem; color: var(--muted);
  padding: .35rem 0; user-select: none;
}
.ae-palette {
  display: grid; gap: .25rem;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  max-height: 240px; overflow-y: auto;
  padding: .55rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.ae-pal-btn {
  font-size: 1.5rem; line-height: 1;
  width: 100%; aspect-ratio: 1;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
  transition: background .1s, border-color .1s, transform .08s;
}
.ae-pal-btn:hover { background: var(--bg-soft); border-color: var(--accent); transform: scale(1.1); }

/* ===== mode picker on /admin/tap-games/new ===== */
.ag-mode-picker {
  display: grid; gap: .65rem;
  grid-template-columns: 1fr 1fr;
  margin-top: .25rem;
}
.ag-mode-opt input[type='radio'] {
  position: absolute; opacity: 0; pointer-events: none;
}
.ag-mode-card {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1rem;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .12s, background .12s;
  height: 100%;
}
.ag-mode-opt:hover .ag-mode-card { border-color: var(--ink-2); }
.ag-mode-opt input:checked ~ .ag-mode-card {
  border-color: var(--accent);
  background: var(--bg-soft);
}
.ag-mode-icon { font-size: 1.4rem; line-height: 1; }
.ag-mode-name { font-weight: 700; font-size: 1rem; }
.ag-mode-desc { color: var(--muted); font-size: .85rem; line-height: 1.4; }
@media (max-width: 480px) {
  .ag-mode-picker { grid-template-columns: 1fr; }
}

/* ===== audio review pages (lesson + tap-game) ===== */
.ar-summary { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 1.25rem; }
.ar-pill {
  font-size: 12px; font-weight: 600; padding: .3rem .75rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg-soft);
}
.ar-pill.ar-good    { background: #D1FAE5; color: #065F46; border-color: #10B981; }
.ar-pill.ar-normal  { background: #FEF3C7; color: #92400E; border-color: #D97706; }
.ar-pill.ar-bad     { background: #FEE2E2; color: #991B1B; border-color: #EF4444; }
.ar-pill.ar-pending { background: var(--bg-soft); color: var(--muted); }

.ar-list { display: flex; flex-direction: column; gap: .65rem; }
.ar-clip {
  padding: .85rem 1rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
}
.ar-clip[data-status='good']   { border-left-color: #10B981; }
.ar-clip[data-status='normal'] { border-left-color: #D97706; }
.ar-clip[data-status='bad']    { border-left-color: #EF4444; }

.ar-row { display: flex; align-items: center; gap: .65rem; }
.ar-kind {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
  min-width: 60px;
}
.ar-text { font-size: 1.05rem; flex: 1; }
.ar-en { margin: .15rem 0 .55rem 60px; }
.ar-rate { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; padding-left: 60px; }
.ar-rate-btn {
  padding: .45rem .85rem;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: inherit; cursor: pointer;
  font-family: inherit;
}
.ar-rate-btn:hover { border-color: var(--ink-2); }
.ar-rate-btn.is-active.ar-rate-good   { background: #10B981; color: #fff; border-color: #10B981; }
.ar-rate-btn.is-active.ar-rate-normal { background: #D97706; color: #fff; border-color: #D97706; }
.ar-rate-btn.is-active.ar-rate-bad    { background: #EF4444; color: #fff; border-color: #EF4444; }
.ar-meta { margin-left: auto; }

.ar-shared {
  font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
  background: var(--bg); color: var(--accent);
  border: 1px solid var(--accent);
  margin-left: .35rem; cursor: help;
}

@media (max-width: 600px) {
  .ar-en, .ar-rate { padding-left: 0; }
}

/* Hide emoji palette on mobile — native keyboard handles emoji input there */
@media (max-width: 768px) {
  .ae-palette-wrap { display: none; }
}

/* ===== tab notification bell ===== */
.tab-bell {
  display: inline-flex; align-items: center;
  margin-left: .35rem;
  padding: 1px 7px;
  font-size: 11px; font-weight: 700;
  background: var(--warn); color: #fff;
  border-radius: 999px;
}
.tab.active .tab-bell { background: var(--bg); color: var(--warn); }

/* ===== game review cards in /admin Games tab ===== */
.gr-list { display: flex; flex-direction: column; gap: .65rem; }
.gr-card {
  padding: .85rem 1rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
}
.gr-card[data-status='good']   { border-left-color: #10B981; }
.gr-card[data-status='normal'] { border-left-color: #D97706; }
.gr-card[data-status='bad']    { border-left-color: #EF4444; }
.gr-head {
  display: flex; align-items: center; gap: .65rem;
}
.gr-icon { font-size: 1.5rem; line-height: 1; min-width: 32px; text-align: center; }
.gr-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gr-name { font-weight: 700; font-size: 1rem; }
.gr-desc { line-height: 1.4; }
.gr-rate { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; padding-top: .65rem; padding-left: 47px; }
@media (max-width: 600px) {
  .gr-rate { padding-left: 0; }
  .gr-head { flex-wrap: wrap; }
}
