/* HSK Trainer — student cabinet (premium + warm, kitai-school.ru) */
:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2c2c2a;
  --ink-soft: #888780;
  --ink-faint: #aba9a3;
  --accent: #c0392b;
  --accent-soft: #f9edeb;
  --accent-border: #e8a49b;
  --green: #27ae60;
  --green-soft: #e8f8ef;
  --blue: #2980b9;
  --blue-soft: #ebf5fb;
  --gold: #f39c12;
  --gold-soft: #fef5e7;
  --gold-ink: #b7791f;
  --line: rgba(0, 0, 0, 0.06);
  --line-2: rgba(0, 0, 0, 0.04);
  --new: #d6d3cf;
  --learning: #f4c248;
  --reviewing: #4f7fc2;
  --mastered: #27ae60;
  /* 6.2 design system — brand colors (Wine + Gold accents) */
  --brand-wine: #A41E3A;
  --brand-wine-hover: #7E152C;
  --brand-gold: #B8860B;
  --brand-milk: #FAF7F2;
  --brand-milk-2: #F1ECE0;
  --brand-ink: #2C2C2A;
  --brand-ink-soft: #5F5E5A;
  --brand-soft-grey: #8B7D6B;
  --brand-border: #E8E2D8;
  /* "shadow" is repurposed as a hairline border via inset box-shadow,
     so existing rules using var(--shadow) get the new look automatically */
  --shadow: inset 0 0 0 0.5px var(--line);
  --shadow-elev: 0 2px 12px rgba(0, 0, 0, .04);
  --radius: 16px;
  --radius-inner: 14px;
  --radius-trainer: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Roboto', sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
.zh { font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif; }

#app { max-width: 720px; margin: 0 auto; padding: 16px; }
.screen { display: none; }
.screen.visible { display: block; }

/* ───── Header ───── */
.hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px 20px;
}
.hdr-greet { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.hdr-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.streak {
  background: var(--gold-soft);
  color: var(--gold-ink);
  border-radius: 20px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 13px;
  border: 0.5px solid rgba(183, 121, 31, 0.18);
  display: inline-flex; align-items: center; gap: 4px;
}

/* ───── Progress ───── */
.progress-summary {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 18px; border: 0.5px solid var(--line);
}
.progress-bar {
  height: 8px; background: rgba(0,0,0,0.06); border-radius: 999px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: var(--accent);
  width: 0%; transition: width .4s ease;
}
.progress-text {
  margin-top: 10px; font-weight: 500; font-size: 13px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.progress-legend {
  margin-top: 12px; display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-soft);
}
.dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.dot-new { background: var(--new); }
.dot-learning { background: var(--learning); }
.dot-reviewing { background: var(--reviewing); }
.dot-mastered { background: var(--mastered); }

/* ───── Audio button (🔊) ───── */
.audio-btn {
  background: transparent;
  border: 1.5px solid #ece7e0;
  border-radius: 999px;
  padding: 4px 8px;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  vertical-align: middle;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s ease, background .15s ease;
}
.audio-btn:hover { background: #f5f1ec; }
.audio-btn:active { transform: scale(.92); }
.audio-btn-sm { padding: 2px 6px; font-size: 13px; }
.audio-btn-lg { padding: 8px 12px; font-size: 22px; }
.fc-char-row {
  display: flex; align-items: center; justify-content: center; gap: 14px;
}
.fc-char-row-sm {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 8px;
}
.order-reveal {
  margin-top: 14px; padding: 12px;
  background: rgba(76,175,80,.08); border-radius: 12px;
  text-align: center;
}
.order-correct {
  font-family: 'Noto Sans SC'; font-size: 22px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 12px;
}

/* ───── Search box ───── */
.search-box {
  position: relative;
  margin-bottom: 14px;
}
.search-box input[type="search"] {
  width: 100%;
  background: var(--card);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  font: inherit; font-weight: 500; font-size: 15px; color: var(--ink);
  outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box input[type="search"]::placeholder {
  color: var(--ink-soft); font-weight: 500;
}
.search-box input[type="search"]:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--card); border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 60vh; overflow-y: auto;
  z-index: 20;
  padding: 4px;
}
.search-result {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer;
}
.search-result:hover, .search-result:active { background: #f5f1ec; }
.search-result .sr-char {
  font-family: 'Noto Sans SC'; font-size: 28px;
  min-width: 44px; text-align: center;
}
.search-result .sr-text { flex: 1; min-width: 0; }
.search-result .sr-pinyin { color: var(--ink-soft); font-size: 13px; }
.search-result .sr-meaning {
  font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-result .sr-status {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; background: var(--new);
}
.search-result .sr-status.learning { background: var(--learning); }
.search-result .sr-status.reviewing { background: var(--reviewing); }
.search-result .sr-status.mastered { background: var(--mastered); }
.search-results .sr-empty {
  padding: 14px 12px; color: var(--ink-soft); font-size: 14px; text-align: center;
}

/* ───── Word detail modal ───── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(31,29,26,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-card {
  background: var(--card); border-radius: var(--radius);
  padding: 28px 22px; box-shadow: var(--shadow);
  max-width: 420px; width: 100%; text-align: center;
  position: relative;
}
.modal-close {
  position: absolute; top: 10px; right: 12px;
  background: transparent; border: none; font-size: 22px;
  color: var(--ink-soft); cursor: pointer;
}

/* ───── Quick check ───── */
.quick-card {
  background: var(--card); border-radius: var(--radius-trainer);
  padding: 40px 24px 28px;
  box-shadow: var(--shadow-elev);
  border: 0.5px solid var(--line);
  text-align: center; margin-bottom: 18px; min-height: 280px;
  display: flex; flex-direction: column; justify-content: center;
}
.quick-char {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 96px; font-weight: 500; line-height: 1;
  margin-bottom: 18px;
}
.quick-reveal { color: var(--ink-soft); margin-bottom: 8px; min-height: 56px; }
.quick-reveal .fc-pinyin { font-size: 16px; }
.quick-reveal .fc-meaning { font-size: 15px; color: var(--ink); font-weight: 500; }

/* ───── Mode tiles ───── */
.modes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 18px;
}
.mode-btn {
  background: var(--card); border: 0.5px solid var(--line); border-radius: 14px;
  padding: 20px 16px; cursor: pointer;
  min-height: 80px;
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left; gap: 6px; font: inherit; color: inherit;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
  position: relative;          /* keep stacking context predictable */
  z-index: 1;                   /* above any decorative ::before/::after siblings */
  -webkit-tap-highlight-color: rgba(192,57,43,.15);
  touch-action: manipulation;   /* avoid 300ms tap delay on mobile */
}
.mode-btn:hover { background: #fdfbf8; border-color: rgba(0,0,0,0.1); }
.mode-btn:active { transform: scale(.97); }
.mode-icon { font-size: 32px; }
.mode-title { font-weight: 500; font-size: 15px; color: var(--ink); }
.mode-sub { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.4px; }
/* 6 tiles → clean 3×2 grid, no spanning */

/* ───── Map ───── */
.map-block {
  background: var(--card); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow); margin-bottom: 24px;
}
.map-block summary { cursor: pointer; font-weight: 600; }
.map-grid {
  display: grid; grid-template-columns: repeat(auto-fill, 14px);
  gap: 4px; margin-top: 12px;
}
.map-cell {
  width: 14px; height: 14px; border-radius: 3px; background: var(--new);
}
.map-cell.learning { background: var(--learning); }
.map-cell.reviewing { background: var(--reviewing); }
.map-cell.mastered { background: var(--mastered); }

/* ───── Session bar ───── */
.session-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0 16px;
}
.btn-back {
  background: var(--card); border: 0.5px solid var(--line); border-radius: 999px;
  width: 40px; height: 40px; font-size: 18px; cursor: pointer;
  color: var(--ink);
  transition: background 0.15s ease;
}
.btn-back:hover { background: #f5f1ec; }
.session-progress {
  flex: 0; padding: 7px 14px; background: var(--card);
  border-radius: 999px; font-weight: 500; font-size: 13px;
  border: 0.5px solid var(--line);
}
.session-mode { flex: 1; text-align: right; color: var(--ink-soft); font-size: 13px; }
.session-body { padding-bottom: 32px; }

/* ROADMAP 4.6 R4 — progress bar */
.sess-progress-track {
  width: 100%; height: 3px; background: #ece6dc; border-radius: 2px;
  margin: -8px 0 14px; overflow: hidden;
}
.sess-progress-fill {
  height: 100%; width: 0%; background: var(--accent, #C0392B);
  border-radius: 2px; transition: width 300ms ease;
}

/* ───── Card (flashcard / common) ───── */
.card-q {
  background: var(--card); border-radius: var(--radius-trainer);
  padding: 32px 24px; box-shadow: var(--shadow-elev);
  border: 0.5px solid var(--line); margin-bottom: 18px;
}
.flashcard {
  perspective: 1200px; min-height: 280px; cursor: pointer;
}
.flashcard-inner {
  position: relative; width: 100%; min-height: 280px;
  transition: transform .55s cubic-bezier(.4,.2,.2,1);
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  background: var(--card); border-radius: var(--radius-trainer); padding: 32px 24px;
  box-shadow: var(--shadow-elev); border: 0.5px solid var(--line);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.flashcard-face.back { transform: rotateY(180deg); }
.fc-char { font-family: 'Noto Sans SC'; font-size: 56px; font-weight: 500; line-height: 1; }
.fc-pinyin { color: var(--ink-soft); font-size: 16px; margin-top: 12px; letter-spacing: .02em; }
.fc-meaning { font-size: 15px; font-weight: 500; margin-top: 8px; color: var(--ink); }
.fc-example {
  margin-top: 18px; padding-top: 14px; border-top: 0.5px solid var(--line);
  font-size: 13px; color: var(--ink-soft);
}
.fc-example .zh { font-size: 16px; color: var(--ink); }
.fc-hint { color: var(--ink-faint); font-size: 11px; margin-top: 16px;
  text-transform: uppercase; letter-spacing: 0.5px; }

/* ───── Action buttons ───── */
.actions { display: flex; gap: 12px; }
.actions > button { flex: 1; }
.btn-primary, .btn-secondary, .btn-danger, .btn-success {
  border: none; border-radius: 14px; padding: 14px 18px;
  font: inherit; font-weight: 500; font-size: 14px; cursor: pointer;
  transition: transform .1s ease, filter .15s ease, background .15s ease;
}
.btn-primary:active, .btn-secondary:active,
.btn-danger:active, .btn-success:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--card); color: var(--ink); border: 0.5px solid var(--line); }
.btn-secondary:hover { background: #f5f1ec; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }

/* ───── Fill / dialog options ───── */
.q-sentence {
  font-family: 'Noto Sans SC'; font-size: 24px; line-height: 1.6;
  background: var(--card); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); margin-bottom: 18px;
}
.q-sentence .blank {
  display: inline-block; min-width: 60px; border-bottom: 2px solid var(--accent);
  text-align: center; padding: 0 6px; color: var(--accent); font-weight: 600;
}
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt-btn {
  background: var(--card); border: 2px solid transparent; border-radius: 12px;
  padding: 18px; font: inherit; font-family: 'Noto Sans SC'; font-size: 22px;
  cursor: pointer; box-shadow: var(--shadow); text-align: center;
  transition: transform .1s ease;
}
.opt-btn:active { transform: scale(.96); }
.opt-btn.correct { background: var(--mastered); color: #fff; border-color: var(--mastered); }
.opt-btn.wrong { background: var(--accent); color: #fff; border-color: var(--accent); }

.skip-row { display: flex; justify-content: center; margin-top: 16px; }
.btn-skip {
  background: transparent; border: 1px solid var(--accent); color: var(--ink-soft);
  border-radius: 999px; padding: 10px 24px; font-size: 14px; cursor: pointer;
  transition: background 0.15s ease;
}
.btn-skip:hover:not(:disabled) { background: rgba(192,57,43,0.06); }
.btn-skip:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 480px) {
  .skip-row { width: 100%; }
  .btn-skip { width: 100%; }
}

/* ───── Order mode ───── */
.order-target {
  min-height: 60px; background: var(--card); border-radius: 12px;
  padding: 14px; box-shadow: var(--shadow); margin-bottom: 16px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.token-chip {
  background: var(--card); border-radius: 10px; padding: 12px 16px;
  font-family: 'Noto Sans SC'; font-size: 20px; cursor: pointer;
  box-shadow: var(--shadow); border: 2px solid transparent;
}
.token-chip.placed { opacity: .35; pointer-events: none; }
.token-chip.in-target { background: var(--accent-soft); border-color: var(--accent); }

/* ───── Dialog ───── */
.dialog-line {
  display: flex; gap: 10px; margin-bottom: 12px;
  padding: 12px 14px; background: var(--card); border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.dialog-line.B { flex-direction: row-reverse; }
.dialog-line.B .dialog-text { background: var(--accent-soft); }
.dialog-speaker {
  width: 32px; height: 32px; border-radius: 50%;
  background: #ece7e0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.dialog-text { font-family: 'Noto Sans SC'; font-size: 18px; line-height: 1.5; flex: 1; }

/* ───── Writing (two-pane) ───── */
.write-card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); text-align: center; margin-bottom: 16px;
}
.write-meaning { font-weight: 600; font-size: 18px; margin-bottom: 4px; }
.write-pinyin { color: var(--ink-soft); font-size: 14px; margin-bottom: 8px; }
.write-target-char {
  font-family: 'Noto Sans SC'; font-size: 36px; font-weight: 500; line-height: 1;
  margin-bottom: 16px;
}
.write-grid {
  display: flex; gap: 18px; justify-content: center; align-items: flex-start;
  flex-wrap: wrap;
}
.write-pane {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  flex: 0 0 auto; max-width: 100%;
}
.write-pane-label {
  font-size: 11px; font-weight: 700; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .08em;
}
.write-video-wrap {
  width: 280px; height: 280px;
  background: var(--bg);
  border: 2px dashed #d8d2ca; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.stroke-video {
  width: 100%; height: 100%; object-fit: contain;
  cursor: pointer; background: transparent; display: block;
}
.write-no-video {
  color: var(--ink-soft); font-size: 13px;
}
.write-canvas {
  width: 280px; height: 280px;
  background:
    linear-gradient(#ece7e0, #ece7e0) center/100% 1px no-repeat,
    linear-gradient(#ece7e0, #ece7e0) center/1px 100% no-repeat,
    var(--bg);
  border: 2px dashed #d8d2ca; border-radius: 12px;
  touch-action: none;
  -ms-touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: crosshair;
  display: block;
}
.write-actions {
  display: flex; gap: 8px; width: 280px;
}
.write-actions button {
  flex: 1 1 0; min-width: 0; padding: 10px 6px; font-size: 14px;
}
.wc-replay { width: 280px; }

/* ───── Result ───── */
.result-card {
  background: var(--card); border-radius: var(--radius-trainer);
  padding: 36px 24px;
  border: 0.5px solid var(--line); box-shadow: var(--shadow-elev);
  text-align: center;
}
.result-emoji { font-size: 56px; margin-bottom: 8px; }
.result-title { font-size: 20px; font-weight: 500; margin-bottom: 24px; color: var(--ink); }
.result-stats {
  display: flex; justify-content: space-around; margin-bottom: 28px;
}
.result-stats > div { display: flex; flex-direction: column; gap: 4px; }
.result-stats b { font-size: 28px; font-weight: 600; color: var(--ink); }
.result-stats span { font-size: 11px; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.5px; }
.result-card .btn-primary { width: 100%; margin-bottom: 10px; }
.result-card .btn-secondary { width: 100%; }

/* ───── Cabinet shell (header / sections / nav) ───── */
#app { padding-bottom: 84px; }  /* clear bottom nav on mobile */
.cab-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px 14px;
}
.cab-main { padding: 0; }
.cab-section { display: none; }
.cab-section.active { display: block; }

.cab-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--card); border-top: 0.5px solid var(--line);
  padding: 6px 2px calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
}
.cab-nav-btn {
  background: transparent; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 8px 2px; font: inherit; color: var(--ink-soft);
  border-radius: 12px;
  transition: color .15s ease, background .15s ease;
}
.cab-nav-btn span:first-child,
.cab-nav-btn .cab-nav-emoji { font-size: 22px; line-height: 1; }
/* Mobile: icons only */
.cab-nav-btn span:last-child { display: none; }
.cab-nav-btn:hover { color: var(--ink); }
.cab-nav-btn.active { color: var(--accent); background: var(--accent-soft); }
.cab-nav-emoji { position: relative; display: inline-block; }
.cab-nav-badge {
  position: absolute; top: -4px; right: -10px;
  background: var(--accent, #c0392b); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 2px 5px; border-radius: 10px; min-width: 16px; text-align: center;
}

/* ───── Chat (student) ───── */
/* Make sure HTML hidden attribute always wins over our display:flex */
[hidden] { display: none !important; }

/* CSS variable for nav offset — overridden by desktop media query below */
:root { --nav-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); --nav-left: 0px; --sidebar-w: 0px; }

#sec-chat {
  display: none;
  position: fixed;
  left: var(--nav-left); right: 0; top: 0;
  bottom: var(--nav-bottom);
  background: var(--bg, #faf6f0);
  z-index: 40;
  overflow: hidden;
}
#sec-chat.active { display: flex; flex-direction: column; }

/* ───── Desktop sidebar layout (>720px) ───── */
@media (min-width: 720px) {
  :root { --nav-bottom: 0px; --nav-left: 72px; --sidebar-w: 72px; }
  #app { padding-bottom: 0; padding-left: 72px; }
  .cab-nav {
    position: fixed; top: 0; bottom: 0; left: 0; right: auto;
    width: 72px;
    display: flex; flex-direction: column; gap: 2px;
    grid-template-columns: none; grid-template-rows: none;
    border-top: none; border-right: 0.5px solid var(--line);
    padding: 14px 6px env(safe-area-inset-bottom, 0px);
    align-items: stretch;
  }
  .cab-nav-btn {
    padding: 10px 4px;
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    border-radius: 12px;
  }
  /* Desktop: show 10px label under icon */
  .cab-nav-btn span:last-child {
    display: block;
    font-size: 10px; line-height: 1.1; font-weight: 500;
    letter-spacing: 0.2px;
  }
  .cab-nav-btn .cab-nav-emoji,
  .cab-nav-btn span:first-child { font-size: 18px; }
  .cab-hdr { padding-left: 16px; padding-right: 16px; }
}
.chat-tabs {
  flex: 0 0 auto;
  display: flex; gap: 6px; padding: 10px 14px 8px;
  background: var(--card, #fff);
  border-bottom: 1px solid #ece7e0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chat-tabs::-webkit-scrollbar { display: none; }
.chat-tab {
  background: transparent; border: 1px solid transparent;
  padding: 7px 14px; border-radius: 18px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink-soft, #888);
  white-space: nowrap;
  flex: 0 0 auto;
}
.chat-tab.active {
  background: var(--accent-soft, #f8d7d4); color: var(--accent, #c0392b);
}
.chat-tab-badge {
  display: inline-block; min-width: 18px; padding: 1px 6px;
  background: #c0392b; color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 9px; margin-left: 4px; line-height: 1.4;
}
.chat-head {
  flex: 0 0 auto;
  padding: 12px 16px 10px;
  background: var(--card, #fff);
  border-bottom: 1px solid #ece7e0;
  min-width: 0;
}
.chat-head-title {
  font-weight: 700; font-size: 15px;
  line-height: 1.3;
}
.chat-head-sub {
  font-size: 12px; color: var(--ink-soft, #888); margin-top: 2px;
  line-height: 1.3;
}
.chat-feed-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 8px;
  -webkit-overflow-scrolling: touch;
}
.chat-load-more {
  display: block; margin: 0 auto 10px; padding: 6px 14px;
  background: #fff; border: 1px solid #ddd5c8; border-radius: 14px;
  cursor: pointer; font-size: 12px; color: var(--ink-soft, #888);
}
.chat-feed { display: flex; flex-direction: column; gap: 8px; }
.chat-day-sep {
  align-self: center; padding: 4px 12px; background: rgba(0,0,0,.06);
  border-radius: 12px; font-size: 11px; color: var(--ink-soft, #666);
  margin: 6px 0;
}
.bubble {
  max-width: 78%; padding: 8px 12px; border-radius: 16px;
  font-size: 14px; line-height: 1.4; word-wrap: break-word;
  position: relative; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.bubble-meta {
  font-size: 10px; color: var(--ink-soft, #999);
  margin-top: 3px; display: flex; gap: 6px; align-items: center;
}
.bubble.mine { align-self: flex-end; background: #dcf8c6; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px;
  border: 1px solid #ece7e0; }
.bubble.admin { align-self: center; background: #d4edff; max-width: 90%;
  border: 1px solid #b3dafa; }
.bubble.is-hw { background: #fff4c8 !important; border: 1px solid #ecd982; }
.mention { color: #0066cc; font-weight: 600; }
.bubble.has-contact { outline: 2px dashed #d97e29; }
.bubble-sender { font-size: 11px; font-weight: 700; color: #888; margin-bottom: 2px; }
.bubble.admin .bubble-sender { color: #b58300; }
.bubble-text { white-space: pre-wrap; }
.bubble-img { max-width: 100%; max-height: 320px; border-radius: 10px;
  margin-top: 4px; display: block; cursor: pointer; }
.bubble-file {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px; background: rgba(0,0,0,.04); border-radius: 10px;
  margin-top: 4px; text-decoration: none; color: inherit; cursor: pointer;
}
.bubble-file-ico { font-size: 22px; }
.bubble-file-name { font-size: 13px; font-weight: 600; word-break: break-all; }
.bubble-file-size { font-size: 11px; color: var(--ink-soft, #888); }
.bubble-voice {
  display: flex; gap: 8px; align-items: center;
  padding: 6px 10px; background: rgba(0,0,0,.04); border-radius: 14px;
  margin-top: 4px; min-width: 180px;
}
.bubble-voice audio { flex: 1; height: 32px; }
.bubble-voice-dur { font-size: 11px; color: var(--ink-soft, #888); }

.chat-toast {
  margin: 0 12px; padding: 8px 12px; font-size: 13px;
  background: #fff4c8; border: 1px solid #ecd982; color: #6e5300;
  border-radius: 10px;
}
.chat-rec-bar {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 12px; background: #fff;
  border-top: 1px solid #ece7e0;
}
.chat-rec-dot { color: #c0392b; font-size: 14px; animation: chatpulse 1s infinite; }
@keyframes chatpulse { 50% { opacity: .3; } }
.chat-rec-cancel, .chat-rec-stop {
  border: none; background: transparent; cursor: pointer;
  padding: 6px 10px; border-radius: 10px; font: inherit;
}
.chat-rec-stop { background: #c0392b; color: #fff; margin-left: auto; }
.chat-rec-cancel { color: var(--ink-soft, #666); }
.chat-rec-inline {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--accent, #c0392b); font-weight: 600;
  padding: 0 8px; flex: 0 0 auto;
}
.chat-btn-voice.recording {
  background: var(--accent, #c0392b); color: #fff !important;
  border-radius: 50%; width: 38px; height: 38px;
}
.mention-popup {
  position: absolute;
  background: var(--card, #fff); border: 1px solid #ece7e0;
  border-radius: 10px; max-height: 200px; overflow-y: auto;
  z-index: 60; box-shadow: 0 -4px 16px rgba(0,0,0,.15);
  min-width: 200px;
}
.mention-item {
  padding: 8px 14px; cursor: pointer;
  font-size: 14px; border-bottom: 1px solid #f4f0e8;
}
.mention-item:last-child { border-bottom: none; }
.mention-item:hover, .mention-item.active { background: #faf6f0; }

.chat-input {
  flex: 0 0 auto;
  display: flex; gap: 6px; align-items: flex-end;
  padding: 8px 10px;
  background: var(--card, #fff); border-top: 1px solid #ece7e0;
}
.chat-reply-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: #fff; border-top: 1px solid #ece7e0;
  border-left: 3px solid var(--accent, #c0392b);
}
.chat-reply-bar-content { flex: 1; min-width: 0; font-size: 12px; line-height: 1.3; }
.chat-reply-bar-name { font-weight: 700; color: var(--accent, #c0392b); font-size: 11px; }
.chat-reply-bar-text {
  color: var(--ink, #1f1d1a); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.chat-reply-bar-cancel {
  background: transparent; border: none; cursor: pointer;
  font-size: 18px; color: var(--ink-soft, #888);
  padding: 4px 8px; border-radius: 6px;
}
.bubble-quote {
  background: rgba(0,0,0,.06); border-left: 3px solid rgba(0,0,0,.25);
  padding: 4px 8px; margin-bottom: 4px; border-radius: 4px;
  font-size: 12px; line-height: 1.3; cursor: pointer;
}
.bubble.mine .bubble-quote { background: rgba(0,0,0,.05); border-left-color: #2e7d32; }
.bubble.them .bubble-quote { background: #f4f0e8; border-left-color: var(--accent, #c0392b); }
.bubble-quote-name { font-weight: 700; font-size: 11px; color: #555; }
.bubble-quote-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #555;
}
.bubble.selected { outline: 2px solid var(--accent, #c0392b); }
.bubble.is-deleted { opacity: .6; }
.bubble-forward {
  font-size: 11px; color: var(--accent, #c0392b); font-weight: 600;
  margin-bottom: 4px;
}
.bubble-quote-fwd { margin-top: 0; }
.bubble-actions {
  display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap;
  font-size: 11px;
  padding-top: 4px; border-top: 1px solid rgba(0,0,0,.08);
}
.bubble-action-btn {
  background: rgba(255,255,255,.7); border: none; cursor: pointer;
  color: rgba(0,0,0,.7); padding: 4px 8px; border-radius: 8px;
  font-size: 11px; font-weight: 600;
}
.bubble-action-btn:hover { background: rgba(255,255,255,1); }
.bubble.mine .bubble-action-btn { background: rgba(255,255,255,.6); }
.bubble-action-danger { color: #c0392b !important; }
.flash-target { animation: flash-bg .8s ease-out; }
@keyframes flash-bg {
  0% { background-color: #fff8c4; }
  100% { background-color: transparent; }
}

/* ───── Forward modal (chat) ───── */
.fwd-modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.fwd-modal {
  background: var(--card, #fff); border-radius: 14px;
  width: 100%; max-width: 380px; max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.fwd-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid #ece7e0; background: #faf6f0;
  font-weight: 700;
}
.fwd-modal-close {
  background: none; border: none; font-size: 22px; cursor: pointer; color: #888;
}
.fwd-modal-source {
  padding: 10px 14px; background: #fff7d6; border-bottom: 1px solid #ecd982;
  font-size: 12px;
}
.fwd-modal-source-text { font-style: italic; color: #555; margin-top: 4px; }
.fwd-modal-list {
  flex: 1; overflow-y: auto; padding: 8px 0;
}
.fwd-target {
  padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f4f0e8;
  display: flex; align-items: center; gap: 10px;
}
.fwd-target:hover { background: #faf6f0; }
.fwd-target-icon { font-size: 22px; }
.fwd-target-name { font-weight: 600; font-size: 14px; }
.fwd-target-sub { font-size: 11px; color: var(--ink-soft, #888); margin-top: 1px; }
.fwd-modal-foot {
  padding: 10px 14px; border-top: 1px solid #ece7e0;
  display: flex; justify-content: flex-end; gap: 8px;
  font-size: 12px; color: var(--ink-soft, #888);
}
.chat-input-text {
  flex: 1; resize: none; max-height: 120px;
  border: 1px solid #ddd5c8; border-radius: 16px;
  padding: 8px 12px; font: inherit; font-size: 14px;
  background: #faf6f0;
}
.chat-input-text:focus { outline: 2px solid var(--accent, #c0392b); border-color: transparent; }
.chat-btn-attach, .chat-btn-voice, .chat-btn-send {
  border: none; background: transparent; cursor: pointer;
  font-size: 22px; padding: 4px 6px; border-radius: 10px;
}
.chat-btn-send {
  background: var(--accent, #c0392b); color: #fff; font-size: 18px;
  width: 38px; height: 38px;
}
.chat-btn-send:disabled { opacity: .4; }
.bubble-pending { opacity: .55; }
.chat-empty {
  text-align: center; color: var(--ink-soft, #888);
  padding: 32px 16px; font-size: 13px;
}

/* ───── Schedule (lessons section) ───── */
.schedule-block { margin-bottom: 14px; }
.sched-card {
  background: var(--card, #fff); border-radius: var(--radius, 12px);
  box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.05));
  padding: 14px 16px; margin-bottom: 10px;
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  align-items: center;
}
.sched-today {
  background: var(--card);
  border: 0.5px solid var(--line);
  border-left: 3px solid var(--accent);
  color: var(--ink);
  position: relative;
}
.sched-today .sched-line1::before {
  content: ""; display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-right: 8px;
  vertical-align: middle;
  animation: sched-pulse 1.6s ease-in-out infinite;
}
@keyframes sched-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
}
.sched-today .sched-meta { color: var(--ink-soft); }
.sched-card .sched-line1 {
  font-weight: 500; font-size: 14px; line-height: 1.3;
}
.sched-card .sched-meta {
  font-size: 12px; color: var(--ink-soft, #888); margin-top: 4px;
}
.sched-zoom-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue); color: #fff; padding: 8px 16px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  border: none;
  transition: filter .15s ease;
}
.sched-today .sched-zoom-btn { background: var(--blue); color: #fff; }
.sched-zoom-btn:hover { filter: brightness(1.08); }
.sched-no-zoom {
  font-size: 11px; color: rgba(0,0,0,.4); padding: 4px 8px;
  border: 1px dashed #ccc; border-radius: 10px;
}
.sched-upcoming {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 8px;
}
.sched-row {
  display: grid; grid-template-columns: 80px 1fr auto; gap: 10px;
  padding: 6px 12px; font-size: 12px;
  background: rgba(0,0,0,.02); border-radius: 8px;
  align-items: center;
}
.sched-row-detailed { padding: 8px 12px; }
.sched-row-time { color: var(--ink-soft, #888); font-weight: 600; }
.sched-row-topic {
  color: var(--ink, #1f1d1a); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.sched-row-zoom {
  display: inline-flex; align-items: center; gap: 4px;
  background: #2196f3; color: #fff; padding: 4px 10px;
  border-radius: 12px; font-size: 11px; font-weight: 700;
  text-decoration: none; white-space: nowrap;
}
.sched-row-nozoom { color: #ccc; font-size: 11px; }
.sched-row-group {
  background: linear-gradient(90deg, rgba(92,184,92,.12) 0%, rgba(0,0,0,.02) 100%);
  border-left: 3px solid #5cb85c;
}

/* Collapsible schedule tree */
.coll {
  background: var(--card, #fff); border-radius: 10px;
  margin-bottom: 6px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.coll-month { border-left: 3px solid var(--accent, #c0392b); }
.coll-week { background: rgba(0,0,0,.02); margin: 6px 8px; box-shadow: none; }
.coll-day { background: #fff; margin: 4px 8px; box-shadow: none; }
.coll-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; cursor: pointer;
  font-weight: 600; font-size: 13px;
  user-select: none;
}
.coll-month > .coll-head { font-size: 14px; }
.coll-day > .coll-head { padding: 8px 12px; font-size: 13px; }
.coll-arrow {
  display: inline-block; transition: transform .15s;
  font-size: 10px; color: var(--ink-soft, #888);
}
.coll.open > .coll-head > .coll-arrow { transform: rotate(90deg); }
.coll-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coll-count {
  background: rgba(0,0,0,.08); color: var(--ink-soft, #666);
  padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 700;
}
.coll-body { padding: 0 8px 8px; display: none; }
.coll.open > .coll-body { display: block; }
.coll-day .coll-body { padding: 0 6px 6px; display: flex; flex-direction: column; gap: 4px; }

/* ───── Homework (student) ───── */
.hw-block { margin-bottom: 14px; }
.hw-empty {
  background: var(--card, #fff); border-radius: var(--radius, 12px);
  padding: 18px 16px; text-align: center; color: var(--ink-soft, #888);
  font-size: 13px;
}
.hw-card {
  background: var(--card, #fff); border-radius: var(--radius, 12px);
  box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.05));
  padding: 14px 16px; margin-bottom: 10px;
  border-left: 4px solid #ccc;
}
.hw-card.s-assigned { border-left-color: #f0ad4e; }
.hw-card.s-submitted { border-left-color: #5bc0de; }
.hw-card.s-reviewed { border-left-color: #5cb85c; }
.hw-card.s-redo { border-left-color: #d9534f; }
.hw-card.due-soon {
  background: #fff5f5; border-left-color: #d9534f;
  animation: hw-pulse 2s infinite;
}
@keyframes hw-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(217,83,79,.0); } 50% { box-shadow: 0 0 0 4px rgba(217,83,79,.15); } }

.hw-head {
  display: flex; justify-content: space-between; gap: 10px;
  align-items: flex-start; margin-bottom: 6px;
}
.hw-status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.hw-status-pill.s-assigned { background: #fff3cd; color: #856404; }
.hw-status-pill.s-submitted { background: #d1ecf1; color: #0c5460; }
.hw-status-pill.s-reviewed { background: #d4edda; color: #155724; }
.hw-status-pill.s-redo { background: #f8d7da; color: #721c24; }
.hw-topic { font-weight: 700; font-size: 14px; line-height: 1.3; }
.hw-deadline { font-size: 12px; color: var(--ink-soft, #888); margin-top: 2px; }
.hw-deadline.urgent { color: #d9534f; font-weight: 600; }
.hw-desc {
  font-size: 13px; line-height: 1.4; color: var(--ink, #1f1d1a);
  margin-top: 6px; white-space: pre-wrap;
}
.hw-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.hw-file {
  display: flex; gap: 8px; align-items: center;
  padding: 6px 10px; background: rgba(0,0,0,.04); border-radius: 8px;
  text-decoration: none; color: inherit; font-size: 12px;
}
.hw-file img { max-width: 80px; max-height: 80px; border-radius: 6px; display: block; }
.hw-meta { display: flex; gap: 10px; font-size: 11px; color: var(--ink-soft, #888); margin-top: 8px; flex-wrap: wrap; }
.hw-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.hw-btn {
  padding: 7px 14px; border-radius: 16px; font-size: 13px;
  border: none; cursor: pointer; font-weight: 600;
}
.hw-btn-primary { background: var(--accent, #c0392b); color: #fff; }
.hw-btn-secondary { background: #fff; border: 1px solid #ddd5c8; color: var(--ink, #1f1d1a); }

.hw-form {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ddd5c8;
  display: flex; flex-direction: column; gap: 8px;
}
.hw-form textarea {
  width: 100%; min-height: 60px; resize: vertical;
  padding: 8px 12px; border: 1px solid #ddd5c8; border-radius: 10px;
  font: inherit; font-size: 13px; background: #faf6f0;
}
.hw-form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hw-attached-list { font-size: 12px; color: var(--ink-soft, #888); }
.hw-rec-status { font-size: 12px; color: var(--ink-soft, #888); }
.hw-review-block {
  margin-top: 10px; padding: 10px 12px; background: #f3f8f4;
  border-radius: 10px; border-left: 3px solid #5cb85c;
}
.hw-review-block-h {
  font-size: 11px; font-weight: 700; color: #155724;
  text-transform: uppercase; margin-bottom: 4px;
}
.hw-review-block audio { width: 100%; margin-top: 6px; height: 32px; }
.hw-score { font-size: 14px; font-weight: 700; color: #155724; }

/* ───── Dashboard ───── */
.dash-card {
  background: var(--card); border-radius: var(--radius-inner);
  padding: 16px; border: 0.5px solid var(--line);
}

/* 3 stat cards in a row */
.dash-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 18px;
}
.dash-card.dash-stat {
  text-align: center; padding: 16px 10px;
}
.dash-stat-icon {
  font-size: 22px; line-height: 1;
  width: 36px; height: 36px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.dash-stat-vocab .dash-stat-icon { background: var(--green-soft); }
.dash-stat-prog  .dash-stat-icon { background: var(--blue-soft); }
.dash-stat-acc   .dash-stat-icon { background: var(--gold-soft); }
.dash-stat-value { font-size: 22px; font-weight: 600; line-height: 1; color: var(--ink); }
.dash-stat-label { font-size: 11px; font-weight: 500; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 6px; }

/* Section labels */
.dash-section { margin-bottom: 18px; }
.dash-section-label {
  font-size: 11px; font-weight: 500; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 0 2px 8px;
}

/* Ближайший урок */
.dash-near {
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
}
.dash-near-row { display: flex; align-items: center; gap: 12px; }
.dash-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: dash-dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dash-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50%      { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0.08); }
}
.dash-near-text { flex: 1; min-width: 0; }
.dash-near-title {
  font-weight: 500; font-size: 14px; color: var(--ink); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-near-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.dash-zoom-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--blue); color: #fff;
  padding: 7px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  transition: filter 0.15s ease;
}
.dash-zoom-btn::before { content: '🎥'; font-size: 12px; }
.dash-zoom-btn:hover { filter: brightness(1.08); }
.dash-zoom-btn.dash-near-locked {
  background: var(--rd-neutral-soft, #F5EDE0);
  color: var(--rd-ink-3, #8B7D6B);
  cursor: default;
  pointer-events: none;
  font-weight: 500;
}
.dash-zoom-btn.dash-near-locked::before { content: '🔒'; }
.dash-zoom-btn.dash-near-locked:hover { filter: none; }

/* После урока */
.dash-after {
  border-left: 3px solid var(--green);
  padding: 14px 16px;
}
.dash-after-meta {
  font-size: 11px; color: var(--ink-soft); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.dash-after-text {
  font-size: 14px; line-height: 1.55; color: var(--ink);
  margin-bottom: 8px; white-space: pre-wrap;
}
.dash-after-tip {
  font-size: 13px; color: var(--ink-soft); line-height: 1.5;
  padding-top: 10px; border-top: 0.5px solid var(--line);
  margin-top: 4px;
}
.dash-after-tip::before { content: '💡 '; }
.dash-after-link {
  background: transparent; border: none; cursor: pointer;
  color: var(--accent); font: inherit; font-size: 12px; font-weight: 500;
  padding: 8px 0 0; margin: 0;
  display: inline-flex; align-items: center; gap: 4px;
}
.dash-after-link:hover { text-decoration: underline; }

/* ───── Lessons block ───── */
.lessons-block { margin-bottom: 18px; }
.lessons-block-head {
  font-size: 11px; font-weight: 500; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 4px 2px 10px;
}
.lessons-divider {
  height: 0.5px; background: var(--line); margin: 14px 0 18px;
}

/* ───── After lesson ───── */
.lesson-head {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  border: 0.5px solid var(--line); margin-bottom: 14px;
}
.lesson-head-title { font-weight: 500; font-size: 16px; margin-bottom: 4px; color: var(--ink); }
.lesson-head-sub { color: var(--ink-soft); font-size: 12px; }
.reco-card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px 16px 14px;
  border: 0.5px solid var(--line);
  border-left: 3px solid var(--green);
  margin-bottom: 14px;
}
.reco-icon { font-size: 22px; margin-bottom: 8px; }
.reco-comment { font-size: 14px; line-height: 1.55; margin-bottom: 10px; color: var(--ink); }
.reco-tip { font-size: 13px; color: var(--ink-soft); line-height: 1.55;
  padding-top: 10px; border-top: 0.5px solid var(--line); margin-top: 4px; }
.reco-tip::before { content: "💡 "; }
.reco-action { font-size: 14px; font-weight: 600;
  padding-top: 10px; border-top: 1px solid #ece7e0; margin-top: 10px; }
.reco-action::before { content: "👉 "; }

/* Server-rendered fallback card (renders without JS) */
.reco-card-ssr {
  background: linear-gradient(135deg, #fdfaf3 0%, #fff 100%);
  border-left: 3px solid var(--accent, #c0392b);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.reco-ssr-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-soft, #888);
  margin-bottom: 8px;
}
.reco-ssr-icon { font-size: 16px; }
.reco-ssr-meta { font-weight: 500; }
.reco-ssr-comment { font-size: 14px; line-height: 1.55; color: var(--ink, #1f1d1a); }
.reco-ssr-tip {
  margin-top: 10px; padding-top: 10px;
  border-top: 0.5px solid var(--line, #ece7e0);
  font-size: 13px; line-height: 1.5; color: var(--ink-soft, #555);
}
.reco-ssr-action {
  margin-top: 10px; padding: 8px 12px;
  background: rgba(192, 57, 43, .08);
  border-radius: 8px;
  font-size: 13px; line-height: 1.5; font-weight: 600;
  color: var(--accent, #c0392b);
}

.hw-strip {
  border-radius: 12px; padding: 12px 16px; margin-bottom: 14px;
  font-weight: 600; font-size: 14px;
}
.hw-strip.hw-done { background: rgba(76,175,80,.15); color: var(--mastered); }
.hw-strip.hw-not { background: rgba(192,57,43,.12); color: var(--accent); }
.hw-strip.hw-partial { background: rgba(244,194,72,.18); color: #b88200; }
.hw-strip.hw-unknown { background: #ece7e0; color: var(--ink-soft); }

.lesson-words {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; border: 0.5px solid var(--line);
}
.lesson-words-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.lesson-words-list {
  display: grid; gap: 6px; max-height: 280px; overflow-y: auto;
  margin-bottom: 12px;
}
.lw-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; background: var(--bg);
}
.lw-char { font-family: 'Noto Sans SC'; font-size: 22px;
  min-width: 36px; text-align: center; }
.lw-text { flex: 1; min-width: 0; }
.lw-pinyin { color: var(--ink-soft); font-size: 12px; }
.lw-meaning { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lw-status { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--new); }
.lw-status.learning { background: var(--learning); }
.lw-status.reviewing { background: var(--reviewing); }
.lw-status.mastered { background: var(--mastered); }
.lesson-words-btn { width: 100%; }

.empty-state {
  text-align: center; padding: 64px 20px; color: var(--ink-soft);
}
.empty-emoji { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.empty-sub { font-size: 14px; }

.filter-strip {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent-soft); padding: 10px 14px;
  border-radius: 10px; margin-bottom: 14px; font-size: 13px;
}
.filter-strip span { color: var(--ink-soft); }
.filter-chip { color: var(--accent); font-weight: 600; }
.filter-clear {
  margin-left: auto; background: transparent; border: none;
  font-size: 18px; cursor: pointer; color: var(--ink-soft);
  width: 24px; height: 24px; line-height: 1;
}

/* ───── My words (3 tabs) ───── */
.words-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--card); border-radius: var(--radius);
  padding: 6px; border: 0.5px solid var(--line); margin-bottom: 14px;
}
.words-tab {
  background: transparent; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px; border-radius: 10px;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.words-tab.active { background: var(--accent-soft); color: var(--accent); }
.words-tab-icon { font-size: 20px; line-height: 1; }
.words-tab-count {
  background: rgba(31,29,26,.06); border-radius: 999px;
  padding: 1px 8px; font-size: 11px; font-weight: 700; margin-top: 2px;
}
.words-tab.active .words-tab-count { background: rgba(192,57,43,.15); color: var(--accent); }

.words-list {
  display: flex; flex-direction: column; gap: 6px;
}
.mw-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 10px;
  padding: 12px 14px; box-shadow: 0 2px 6px rgba(0,0,0,.04);
  cursor: pointer; border-left: 3px solid var(--new);
}
.mw-item.mw-mastered { border-left-color: var(--mastered); }
.mw-item.mw-reviewing { border-left-color: var(--reviewing); }
.mw-item.mw-learning { border-left-color: var(--learning); }
.mw-item:active { transform: scale(.99); }
.mw-char { font-family: 'Noto Sans SC'; font-size: 26px;
  min-width: 44px; text-align: center; line-height: 1; }
.mw-text { flex: 1; min-width: 0; }
.mw-pinyin { color: var(--ink-soft); font-size: 12px; }
.mw-meaning { font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw-meta {
  font-size: 11px; color: var(--ink-soft); white-space: nowrap;
  text-align: right; flex-shrink: 0;
}

/* ───── My path ───── */
.path-summary {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; border: 0.5px solid var(--line); margin-bottom: 14px;
}
.path-bar { height: 8px; background: rgba(0,0,0,0.06); border-radius: 999px; overflow: hidden; }
.path-bar-fill { height: 100%; background: linear-gradient(90deg, var(--learning), var(--mastered)); width: 0%; }
.path-text { font-weight: 600; margin-top: 8px; font-size: 14px; }
.timeline {
  position: relative;
  padding-left: 28px;
  border-left: 2px solid #ece7e0;
  margin-left: 14px;
}
.tl-item {
  position: relative; padding: 8px 12px 14px; margin-bottom: 4px;
  background: var(--card); border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 14px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--new);
  border: 3px solid var(--bg);
}
.tl-item.tl-done::before { background: var(--mastered); }
.tl-item.tl-current::before {
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.tl-item.tl-current { border-left: 3px solid var(--accent); }
.tl-item.tl-milestone::before { background: var(--learning); }
.tl-date { font-size: 12px; color: var(--ink-soft); }
.tl-title { font-weight: 600; font-size: 14px; margin-top: 2px; }
.tl-fact { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.tl-emoji { float: right; font-size: 16px; }

/* ───── Mobile ───── */
@media (max-width: 600px) {
  body { font-size: 15px; }
  #app { padding: 12px 12px 100px; }
  .modes {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    overflow: visible;             /* не отрезаем тени/правый край */
  }
  .mode-btn {
    padding: 14px 12px;            /* меньше горизонтальный padding на мобиле */
    min-width: 0;                  /* критично: позволить сжаться внутри grid */
    min-height: 88px;
    flex-direction: column;        /* иконка сверху, текст снизу — компактнее */
    align-items: flex-start;
    gap: 4px;
  }
  .mode-btn .mode-icon {
    width: 32px; height: 32px;     /* меньше плитка иконки */
    font-size: 18px;
    border-radius: 8px;
  }
  .mode-btn .mode-title {
    font-size: 13px;
    line-height: 1.25;
    word-break: break-word;        /* «Заполни пропуск» теперь уместится в 2 строки */
  }
  .mode-btn .mode-sub {
    font-size: 10px;
    line-height: 1.2;
  }
  /* 6 tiles → clean 3×2 grid, no spanning */
  .fc-char { font-size: 64px; }
  .opts { grid-template-columns: 1fr 1fr; }
  .write-grid { flex-direction: column; align-items: center; }
  .write-video-wrap, .write-canvas, .write-actions, .wc-replay { width: min(280px, 80vw); }
  .write-video-wrap, .write-canvas { height: min(280px, 80vw); }
}

/* Touch-устройства: убрать hover, чтобы первый тап не уходил на :hover */
@media (hover: none) {
  .mode-btn:hover {
    background: var(--card);
    border-color: var(--line);
  }
  .mode-btn:active {
    background: #fdfbf8;
    transform: scale(.98);
  }
}

/* (Desktop sidebar layout consolidated above at line 481) */

/* ─── Audio recorder (Phase 2) ────────────────────────────── */
.rec {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}
.rec-btn {
  appearance: none;
  border: 1px solid #d0d0d0;
  background: #f8f8f8;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.rec-btn:hover { background: #efefef; }
.rec-btn:disabled { opacity: 0.5; cursor: default; }
.rec-toggle.rec-recording {
  background: #e74c3c;
  color: #fff;
  border-color: #c0392b;
  animation: rec-pulse 1.1s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}
.rec-timer {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: #555;
  min-width: 2.5em;
  text-align: center;
}
.rec-status {
  font-size: 13px;
  color: #666;
  margin-left: 4px;
}
.rec-compact .rec-btn { width: 32px; height: 32px; font-size: 15px; }
.rec-compact .rec-timer { font-size: 12px; }

/* Audio assignments in Lessons section */
.assignments-block {
  background: #fffaf0;
  border: 1px solid #f0d090;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 10px 0;
}
.assignments-block-head {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 10px;
  color: #6a4a00;
}
.assignment-card {
  background: #fff;
  border: 1px solid #ead8b0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
}
.assignment-card.reviewed {
  background: #f0fff4;
  border-color: #9fd9b3;
}
.ac-head {
  font-weight: 600;
  color: #6a4a00;
  font-size: 13px;
  margin-bottom: 4px;
}
.ac-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}
.ac-desc {
  font-size: 14px;
  color: #555;
  margin-bottom: 8px;
}
.ac-reading {
  background: #f7f3ea;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
}
.ac-reading-h {
  font-size: 12px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.ac-reading .zh {
  font-size: 18px;
  line-height: 1.6;
}
.ac-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: #777;
  margin-bottom: 10px;
}
.ac-deadline { color: #b85a00; }
.ac-status {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.ac-status.pending { background: #f5e9d0; color: #7a5500; }
.ac-status.sent    { background: #d9eaff; color: #1a5fa8; }
.ac-status.ok      { background: #d0f0d8; color: #1f7d3f; }
.ac-recorder { margin-top: 6px; }
.ac-feedback {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #cce0d3;
}
.ac-feedback-h {
  font-size: 13px;
  color: #1f7d3f;
  font-weight: 600;
  margin-bottom: 6px;
}
.ac-feedback-text {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
}
.ac-feedback-audio, .ac-own-audio {
  display: block;
  width: 100%;
  margin-top: 6px;
}
.assignments-subhead {
  font-size: 13px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 14px 0 4px;
}

/* Recorder embedded inside flashcard / writing / modal */
.fc-rec, .write-rec, .mw-rec { margin-top: 8px; display: inline-flex; }
.flashcard-face .rec { margin-top: 8px; }

/* ===== Мой рост ===== */
.growth-header { padding: 4px 0; }
.growth-h1 { font-size: 20px; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; }
.growth-h-sub { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.growth-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 12px 0;
}
.growth-stat {
  background: var(--card);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.growth-stat-icon { font-size: 22px; }
.growth-stat-title { font-size: 11px; color: var(--ink-soft); margin-top: 6px;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
.growth-stat-value { font-size: 22px; font-weight: 600; color: var(--ink); margin-top: 6px; line-height: 1; }
.growth-stat-sub { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }

.growth-bar {
  height: 6px; background: rgba(0,0,0,0.06); border-radius: 999px; overflow: hidden; margin-top: 10px;
}
.growth-bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 999px; transition: width 0.3s;
}
.growth-spark { width: 100%; height: 38px; margin-top: 8px; display: block; }
.growth-spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.growth-spark circle { fill: var(--accent); }

.growth-block { padding: 14px 0; }
.growth-block-h {
  font-size: 11px; font-weight: 500; color: var(--ink-soft); margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.growth-feedback-list { display: flex; flex-direction: column; gap: 10px; }
.growth-fb-card {
  background: var(--card);
  border: 0.5px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.growth-fb-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--ink-soft); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.growth-fb-topic { color: var(--accent); font-weight: 500; text-transform: none; letter-spacing: 0; }
.growth-fb-text {
  font-size: 13px; line-height: 1.55; color: var(--ink); white-space: pre-wrap;
}
.growth-fb-tip {
  font-size: 13px; line-height: 1.55; color: var(--ink-soft);
  padding-top: 10px; margin-top: 10px;
  border-top: 0.5px solid var(--line);
  white-space: pre-wrap;
}
.growth-fb-tip::before { content: '💡 '; }
.growth-fb-action {
  font-size: 13px; line-height: 1.55; color: var(--ink); font-weight: 500;
  padding-top: 10px; margin-top: 10px;
  border-top: 0.5px solid var(--line);
  white-space: pre-wrap;
}
.growth-fb-action::before { content: '👉 '; }
.growth-fb-summary { font-size: 12px; color: var(--ink-soft); font-style: italic; margin-top: 6px; }

.growth-tips-list { display: flex; flex-direction: column; gap: 8px; }
.growth-tip-card {
  background: var(--gold-soft);
  border: 0.5px solid rgba(183, 121, 31, 0.18);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}
.growth-tip-date { font-size: 11px; color: #aa8a55; margin-bottom: 4px; }
.growth-empty { padding: 16px; color: #888; text-align: center; }
.growth-empty-emoji { font-size: 36px; margin-bottom: 6px; }

/* ===== Pronunciation modal ===== */
.pron-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pron-modal[hidden] { display: none; }
.pron-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.pron-modal-card {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 22px 22px 18px;
  max-width: 460px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.pron-modal-x {
  position: absolute; top: 12px; right: 12px;
  background: #f0f0f0; border: none; width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; font-size: 14px;
}
.pron-modal-h { font-size: 17px; font-weight: 600; color: #c0392b; margin-bottom: 14px; text-align: center; }
.pron-target { text-align: center; padding: 12px 0; }
.pron-target-zh { font-family: 'Noto Sans SC', system-ui; font-size: 56px; font-weight: 500; line-height: 1; }
.pron-target-pinyin { font-size: 22px; color: #555; margin-top: 8px; font-weight: 500; }
.pron-target-meaning { font-size: 14px; color: #888; margin-top: 4px; }
.pron-target-audio {
  margin-top: 10px; background: #f5f5f5; border: 1px solid #ddd; border-radius: 8px;
  padding: 6px 12px; font-size: 14px; cursor: pointer;
}
.pron-controls { display: flex; align-items: center; gap: 10px; padding: 14px 0 8px; flex-wrap: wrap; justify-content: center; }
.pron-rec-btn {
  background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
  color: #fff; border: none; border-radius: 12px;
  padding: 12px 22px; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
  transition: transform 0.15s;
}
.pron-rec-btn:hover { transform: translateY(-1px); }
.pron-rec-btn.rec-active { background: #e74c3c; animation: pron-pulse 1s infinite; }
@keyframes pron-pulse { 0%,100% { box-shadow: 0 4px 12px rgba(192,57,43,0.3); } 50% { box-shadow: 0 4px 24px rgba(231,76,60,0.7); } }
.pron-rec-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pron-rec-timer { font-variant-numeric: tabular-nums; font-size: 15px; color: #c0392b; font-weight: 600; }
.pron-rec-hint { font-size: 12px; color: #999; flex-basis: 100%; text-align: center; }

.pron-result { padding-top: 10px; }
.pron-overall { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pron-overall-bg { flex: 1; height: 10px; background: #f0f0f0; border-radius: 5px; overflow: hidden; }
.pron-overall-bar {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, #e74c3c 0%, #f0ad4e 50%, #27ae60 100%);
  transition: width 0.4s;
}
.pron-overall-num { font-size: 18px; font-weight: 700; }

.pron-syllables { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.pron-syll {
  border: 2px solid; border-radius: 12px; padding: 8px 12px; min-width: 60px; text-align: center;
}
.pron-syll-zh { font-family: 'Noto Sans SC'; font-size: 22px; font-weight: 500; line-height: 1; }
.pron-syll-py { font-size: 13px; color: #555; margin-top: 4px; font-weight: 500; }
.pron-syll-score { font-size: 11px; margin-top: 2px; opacity: 0.8; }
.pron-syll-tone { font-size: 11px; margin-top: 2px; }
.pron-syll.ok { border-color: #27ae60; background: #f0faf3; }
.pron-syll.partial { border-color: #f0ad4e; background: #fffaf0; }
.pron-syll.wrong_tone { border-color: #f0ad4e; background: #fff5e6; }
.pron-syll.mispronounced { border-color: #e74c3c; background: #fdecea; }

.pron-advice {
  background: var(--bg);
  border-radius: 14px; padding: 12px 14px;
  font-size: 13px; line-height: 1.55; color: var(--ink);
  margin-bottom: 14px;
}
.pron-advice::before { content: '💡 '; font-size: 14px; }
.pron-retry-btn { width: 100%; }

.pron-error {
  background: #fdecea; color: #c0392b; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-top: 12px;
}

/* 🎯 button next to 🔊 in flashcard / writing / modal */
.pron-mini-btn {
  background: #fff; border: 1.5px solid #c0392b; color: #c0392b;
  border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; font-weight: 600;
  margin-left: 6px;
  transition: background 0.15s, color 0.15s;
}
.pron-mini-btn:hover { background: #c0392b; color: #fff; }
.pron-mini-btn-lg { padding: 8px 14px; font-size: 14px; border-radius: 10px; }



/* ===== Toggles + visibility ===== */
.trainer-toggles { display: flex; gap: 8px; padding: 8px 0 12px; flex-wrap: wrap; }
.trainer-toggle {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 6px 14px; font-size: 12px; font-weight: 500; cursor: pointer;
  color: var(--ink-soft);
  display: inline-flex; gap: 6px; align-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.trainer-toggle .toggle-icon { font-size: 13px; }
.trainer-toggle:hover { color: var(--ink); border-color: rgba(0,0,0,0.12); }
.trainer-toggle.toggle-on {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-border);
}
.trainer-toggle.toggle-on .toggle-icon::before { content: '✓'; }
.trainer-toggle.toggle-on .toggle-icon { font-size: 0; }
.trainer-toggle.toggle-on .toggle-icon::before { font-size: 13px; }

/* Hide pinyin/translation conditionally on FRONT face only — back face always shows */
#app[data-show-pinyin="0"] .fc-pinyin-front,
#app[data-show-pinyin="0"] .lw-pinyin,
#app[data-show-pinyin="0"] .write-pinyin,
#app[data-show-pinyin="0"] .sr-pinyin { display: none; }

#app[data-show-translation="0"] .fc-meaning-front,
#app[data-show-translation="0"] .lw-meaning,
#app[data-show-translation="0"] .write-meaning,
#app[data-show-translation="0"] .sr-meaning { display: none; }

/* Style for front-face pinyin/translation when shown */
.fc-pinyin-front { font-size: 22px; color: #555; margin-top: 14px; font-weight: 500; text-align: center; }
.fc-meaning-front { font-size: 16px; color: #888; margin-top: 6px; text-align: center; }


/* ===== Mini-test ===== */
.mini-test {
  background: #f9f9fb; border: 1px solid #ececec; border-radius: 14px;
  padding: 16px; margin: 14px 0;
}
.mini-test-h { font-size: 15px; font-weight: 600; color: #2c1810; margin-bottom: 4px; }
.mini-test-progress { font-size: 12px; color: #888; margin-bottom: 12px; }
.mini-test-body { display: flex; flex-direction: column; gap: 10px; }
.mt-question { font-size: 14px; color: #555; }
.mt-prompt { font-size: 28px; font-weight: 600; text-align: center; padding: 14px 0 6px; color: #2c1810; }
.mt-prompt.zh { font-family: 'Noto Sans SC', sans-serif; font-size: 44px; }
.mt-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mt-option {
  background: #fff; border: 1.5px solid #ddd; border-radius: 10px;
  padding: 12px 10px; cursor: pointer; font-size: 14px; transition: all 0.15s;
  text-align: center;
}
.mt-option.zh { font-family: 'Noto Sans SC'; font-size: 22px; }
.mt-option:hover { border-color: #c0392b; }
.mt-option.correct { background: #f0faf3; border-color: #27ae60; color: #27ae60; }
.mt-option.wrong { background: #fdecea; border-color: #e74c3c; color: #e74c3c; }
.mt-option:disabled { cursor: default; }
.mt-input-row { display: flex; gap: 8px; }
.mt-input {
  flex: 1; border: 1.5px solid #ddd; border-radius: 10px; padding: 12px;
  font-size: 22px; font-family: 'Noto Sans SC', sans-serif; text-align: center;
}
.mt-input:focus { outline: none; border-color: #c0392b; }
.mt-input.correct { border-color: #27ae60; background: #f0faf3; color: #27ae60; }
.mt-input.wrong { border-color: #e74c3c; background: #fdecea; color: #e74c3c; }
.mt-submit-btn {
  background: #c0392b; color: #fff; border: none; border-radius: 10px;
  padding: 12px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.mt-skip-btn {
  background: none; border: none; color: #888; cursor: pointer;
  font-size: 12px; text-decoration: underline; padding: 4px;
}
.mt-feedback { font-size: 13px; color: #888; margin-top: 6px; text-align: center; }
.mt-summary { text-align: center; padding: 14px 0; }
.mt-summary-emoji { font-size: 48px; }
.mt-summary-text { font-size: 18px; font-weight: 600; color: #2c1810; margin-top: 8px; }


/* ===== Gamification ===== */
.daily-goal-card {
  margin: 0 0 18px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, #ffffff 65%);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 0.5px solid var(--line);
  display: flex; align-items: center; gap: 14px;
}
.daily-goal-ring { flex-shrink: 0; width: 48px; height: 48px; }
.dg-ring { display: block; transform: rotate(-90deg); }
.dg-ring-bg {
  fill: none; stroke: rgba(192, 57, 43, 0.12); stroke-width: 4;
}
.dg-ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
  stroke-dasharray: 125.66; stroke-dashoffset: 125.66;
}
.dg-ring-text {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px; font-weight: 600; fill: var(--accent);
  transform: rotate(90deg); transform-origin: 24px 24px;
}
.daily-goal-text { flex: 1; min-width: 0; }
.daily-goal-title { font-weight: 500; color: var(--ink); font-size: 14px; }
.daily-goal-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.daily-goal-check {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}

.achievements-list {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.achievement {
  width: 56px; height: 56px;
  background: #f0ebe3;
  border-radius: 16px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  opacity: 0.4;
  transition: transform 0.15s;
}
.achievement.earned {
  background: var(--gold-soft);
  border: 0.5px solid rgba(183, 121, 31, 0.18);
  opacity: 1;
}
.achievement.earned:hover { transform: translateY(-2px); }
.achievement.locked { opacity: 0.4; filter: grayscale(1); }
.achievement-icon { font-size: 30px; line-height: 1; }
.achievement-title {
  position: absolute; left: 50%; bottom: -22px;
  transform: translateX(-50%);
  font-size: 10px; color: var(--ink-soft); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  background: var(--ink); color: #fff;
  padding: 3px 8px; border-radius: 6px; z-index: 5;
}
.achievement:hover .achievement-title { opacity: 1; }

/* Streak pulse */
.streak.streak-hot {
  animation: streak-pulse 1.4s ease-in-out infinite;
}
@keyframes streak-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 100, 0, 0.5)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 8px rgba(255, 100, 0, 0.8)); }
}

/* Toast for goal completion */
.goal-toast {
  position: fixed; left: 50%; top: 80px; transform: translateX(-50%);
  background: linear-gradient(135deg, #27ae60 0%, #16a34a 100%);
  color: #fff; padding: 14px 22px; border-radius: 14px;
  font-size: 15px; font-weight: 600; z-index: 2000;
  box-shadow: 0 10px 30px rgba(39, 174, 96, 0.35);
  animation: toast-in 0.4s ease-out;
}
@keyframes toast-in { from { transform: translate(-50%, -20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Achievement unlock toast */
.ach-toast {
  position: fixed; left: 50%; top: 80px; transform: translateX(-50%);
  background: linear-gradient(135deg, #c0392b 0%, #e67e22 100%);
  color: #fff; padding: 14px 22px; border-radius: 14px;
  font-size: 15px; font-weight: 600; z-index: 2000;
  box-shadow: 0 10px 30px rgba(192, 57, 43, 0.35);
  display: flex; gap: 10px; align-items: center;
  animation: toast-in 0.4s ease-out;
}
.ach-toast-icon { font-size: 26px; }

/* Confetti */
.confetti-piece {
  position: fixed; top: -10px; width: 8px; height: 14px; z-index: 1999;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); }
}


/* ===== Lesson flow ===== */
.lesson-flow-bar {
  display: flex; gap: 0; align-items: center; justify-content: center;
  padding: 10px 16px 6px; background: #fff; border-bottom: 1px solid #eee;
}
.lf-step {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: #aaa; min-width: 70px; flex: 1;
  transition: all 0.2s;
}
.lf-step-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: #f0f0f0; color: #aaa;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all 0.2s;
}
.lf-step.active { color: #c0392b; font-weight: 600; }
.lf-step.active .lf-step-icon { background: #c0392b; color: #fff; transform: scale(1.1); }
.lf-step.done { color: #27ae60; }
.lf-step.done .lf-step-icon { background: #27ae60; color: #fff; }
.lf-arrow {
  flex: 0 0 18px; height: 2px; background: #eee; margin: 0 -8px;
  align-self: center;
  position: relative; top: -8px;
}
.lf-arrow.done { background: #27ae60; }


/* ===== Pronunciation inline ===== */
.pron-inline {
  margin-top: 12px;
  padding: 14px;
  background: var(--bg);
  border-radius: 14px;
  display: block;
}
.pron-inline-controls {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
}
.pron-btn-listen, .pron-btn-rec, .pron-btn-rec-again {
  border-radius: 24px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s, transform 0.1s, border-color 0.15s;
  min-width: 140px;
  min-height: 42px;
}
.pron-btn-listen {
  background: #fff;
  border: 1.5px solid #d8d2ca;
  color: var(--ink);
}
.pron-btn-listen:hover {
  background: #f5f1ec;
  border-color: #aba9a3;
}
.pron-btn-rec, .pron-btn-rec-again {
  background: var(--accent-soft);
  border: 1.5px solid var(--accent-border);
  color: var(--accent);
}
.pron-btn-rec:hover, .pron-btn-rec-again:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pron-btn-listen:active,
.pron-btn-rec:active,
.pron-btn-rec-again:active { transform: translateY(1px); }
.pron-btn-rec.recording {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  animation: pron-rec-pulse 1.1s ease-in-out infinite;
}
@keyframes pron-rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(192, 57, 43, 0.05); }
}
.pron-btn-rec:disabled,
.pron-btn-rec-again:disabled { opacity: 0.6; cursor: wait; }

.pron-inline-result { margin-top: 12px; }
.pron-inline-syllables {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
}
.pron-inline-syll {
  border: 1.5px solid; border-radius: 20px;
  padding: 6px 12px; min-width: 50px; text-align: center;
  background: #fff;
}
.pron-inline-syll-zh { font-family: 'Noto Sans SC', sans-serif; font-size: 20px; font-weight: 500; line-height: 1; }
.pron-inline-syll-py { font-size: 11px; color: #555; margin-top: 3px; font-weight: 500; }
.pron-inline-syll-tone { font-size: 10px; margin-top: 2px; }
.pron-inline-syll.ok { border-color: #27ae60; background: #f0faf3; }
.pron-inline-syll.partial { border-color: #f0ad4e; background: #fffaf0; }
.pron-inline-syll.wrong_tone { border-color: #f0ad4e; background: #fff5e6; }
.pron-inline-syll.mispronounced { border-color: #e74c3c; background: #fdecea; }

.pron-inline-overall {
  font-size: 12px; color: #888; margin-top: 6px; text-align: center;
  display: block;
}
.pron-inline-advice {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 14px;
  font-size: 13px; line-height: 1.5; color: var(--ink);
  display: block;
}
.pron-inline-advice::before { content: '💡 '; }
.pron-inline-error {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fdecea; color: #c0392b;
  border-radius: 6px; font-size: 13px;
  display: block;
}
.pron-btn-rec-again {
  margin-top: 10px;
  display: inline-flex;
}

/* Compact variant — icon-only, larger circular buttons for word lists */
.pron-inline.compact {
  margin: 0 0 0 6px;
  padding: 0;
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.pron-inline.compact .pron-inline-controls {
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}
.pron-inline.compact .pron-btn-listen,
.pron-inline.compact .pron-btn-rec {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 18px;
  border-radius: 50%;
  border-width: 1.5px;
}
.pron-inline.compact .pron-inline-result {
  display: block;
  flex-basis: 100%;
  margin-top: 8px;
  padding: 8px;
  background: #fafbfc;
  border-radius: 10px;
}
.pron-inline.compact .pron-btn-rec-again {
  min-width: auto;
  padding: 6px 12px;
  font-size: 13px;
}

/* ============================================================ */
/* REDESIGN 2026-05-01 — TRAINER (kitai-school premium palette)  */
/* ============================================================ */
:root {
  --rd-bg: #FAF7F2;
  --rd-card: #FFFFFF;
  --rd-line: #E8E2D8;
  --rd-accent: #C0392B;
  --rd-gold: #D4A017;
  --rd-gold-soft: #FEF3E2;
  --rd-gold-ink: #8B6914;
  --rd-green: #2E7D32;
  --rd-green-soft: #E8F5E1;
  --rd-red-soft: #FCEAEA;
  --rd-ink: #2C2420;
  --rd-ink-2: #6B5E52;
  --rd-ink-3: #8B7D6B;
  --rd-neutral-soft: #F5EDE0;
}

/* ── Typography ───────────────────────────────────────────── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--rd-bg);
  color: var(--rd-ink);
}
.zh, .fc-char, .quick-char, .write-target-char,
.flashcard-face .zh, .order-correct, .q-sentence,
.dialog-text, .token-chip, .opt-btn, .mt-prompt.zh, .mt-input,
.lw-char, .sr-char, .mt-option.zh {
  font-family: 'Cormorant Garamond', 'Noto Sans SC', serif;
}
.hdr-greet, .result-title, .res-title,
.lesson-h, .growth-h1, .dash-stat-value, .result-stat-card .v,
.result-pct-circle, .lesson-title, .reco-card-title {
  font-family: 'Cormorant Garamond', 'Inter', serif;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* ── Header / streak ──────────────────────────────────────── */
.streak {
  background: transparent;
  border: none;
  padding: 4px 0;
  color: var(--rd-ink-2);
  font-weight: 500;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.streak .streak-flame {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: var(--rd-gold-soft);
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}
.streak #streak-num { color: var(--rd-gold); font-weight: 700; }
.streak .streak-suffix {
  color: var(--rd-ink-3);
  font-size: 11px;
  margin-left: 4px;
  font-weight: 400;
}
@media (max-width: 380px) { .streak .streak-suffix { display: none; } }

/* ── Card surfaces ────────────────────────────────────────── */
.flashcard-face,
.card-q, .quick-card, .write-card, .result-card {
  background: var(--rd-card);
  border: 0.5px solid var(--rd-line);
  border-radius: 20px;
  box-shadow: none;
}
.flashcard, .flashcard-inner { min-height: 300px; }
.flashcard-face {
  min-height: 300px;
  padding: 56px 24px 64px;
}

/* ── Flashcard — text ─────────────────────────────────────── */
.fc-char {
  font-family: 'Cormorant Garamond', 'Noto Sans SC', serif;
  font-size: 56px; font-weight: 600;
  color: var(--rd-ink);
  letter-spacing: -0.01em;
}
.fc-pinyin-front { font-size: 15px; color: var(--rd-ink-3); margin-top: 14px; font-weight: 400; }
.fc-meaning-front { font-size: 14px; color: var(--rd-ink-2); margin-top: 6px; font-weight: 400; }
.fc-pinyin { font-size: 15px; color: var(--rd-ink-3); }
.fc-meaning { font-size: 14px; color: var(--rd-ink-2); margin-top: 8px; }
.fc-hint { color: var(--rd-ink-3); font-weight: 400; letter-spacing: 0.4px; }
.fc-char-row { gap: 0; }

/* ── Flashcard — corner buttons ──────────────────────────── */
.fc-audio-corner, .fc-mic-corner {
  position: absolute; top: 12px;
  width: 32px; height: 32px;
  border: 0.5px solid var(--rd-line);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; padding: 0;
  cursor: pointer; z-index: 2;
  transition: transform .1s ease, background .15s ease;
}
.fc-audio-corner { right: 12px; background: var(--rd-neutral-soft); color: var(--rd-ink); }
.fc-mic-corner   { left: 12px;  background: var(--rd-red-soft);     color: var(--rd-accent); }
.fc-audio-corner:hover, .fc-mic-corner:hover { filter: brightness(1.04); }
.fc-audio-corner:active, .fc-mic-corner:active { transform: scale(.92); }

.fc-stroke-corner {
  position: absolute; right: 12px; bottom: 12px;
  width: 40px; height: 40px;
  background: var(--rd-bg);
  border: 0.5px solid var(--rd-line);
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; padding: 0;
  cursor: pointer; z-index: 2;
  transition: transform .1s ease, background .15s ease;
}
.fc-stroke-corner:hover { background: var(--rd-neutral-soft); }
.fc-stroke-corner:active { transform: scale(.94); }

/* ── SRS buttons (3-вариант) ─────────────────────────────── */
.actions.srs-3 {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.actions .btn-srs {
  border: none; border-radius: 12px;
  padding: 12px 8px;
  font: inherit; font-weight: 500; font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: transform .1s ease, filter .15s ease;
}
.actions .btn-srs:active { transform: scale(.96); }
.actions .btn-srs-hard { background: var(--rd-gold-soft); color: var(--rd-gold-ink); }
.actions .btn-srs-soft { background: var(--rd-neutral-soft); color: var(--rd-ink-2); }
.actions .btn-srs-know { background: var(--rd-accent); color: #fff; }
.actions .btn-srs-hard:hover, .actions .btn-srs-soft:hover { filter: brightness(0.97); }
.actions .btn-srs-know:hover { filter: brightness(1.06); }

/* ── Progress bar ─────────────────────────────────────────── */
.progress-summary {
  background: var(--rd-card);
  border: 0.5px solid var(--rd-line);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: none;
}
.progress-bar {
  height: 4px; background: var(--rd-line); border-radius: 2px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--rd-accent) 0%, var(--rd-gold) 100%);
}
.dot-mastered  { background: var(--rd-green); }
.dot-reviewing { background: var(--rd-gold); }
.dot-learning  { background: var(--rd-gold-ink); opacity: 0.55; }
.dot-new       { background: var(--rd-line); }

/* ── Mode tiles ───────────────────────────────────────────── */
.modes { gap: 10px; }
.mode-btn {
  background: var(--rd-card);
  border: 0.5px solid var(--rd-line);
  border-radius: 14px;
  padding: 20px 16px;
  min-height: 80px;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.mode-btn .mode-icon {
  width: 44px; height: 44px;
  background: var(--rd-neutral-soft);
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease;
}
.mode-btn .mode-title { color: var(--rd-ink-3); font-weight: 500; font-size: 15px; }
.mode-btn .mode-sub { color: var(--rd-ink-3); font-size: 12px; }
.mode-btn:hover .mode-title { color: var(--rd-ink); }
.mode-btn.is-active { border-color: rgba(192,57,43,0.25); }
.mode-btn.is-active .mode-title { color: var(--rd-accent); font-weight: 500; }
.mode-btn.is-active .mode-icon { background: var(--rd-accent); color: #fff; }

/* ── Result screen ───────────────────────────────────────── */
.result-card {
  padding: 28px 22px;
  text-align: center;
}
.result-pct-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600; font-size: 24px;
  background: var(--rd-green-soft); color: var(--rd-green);
}
.result-pct-circle.tier-good { background: var(--rd-green-soft); color: var(--rd-green); }
.result-pct-circle.tier-mid  { background: var(--rd-gold-soft);  color: var(--rd-gold-ink); }
.result-pct-circle.tier-low  { background: var(--rd-red-soft);   color: var(--rd-accent); }
.result-title {
  font-size: 22px; font-weight: 600; margin-bottom: 18px; color: var(--rd-ink);
}
.result-stat-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
  margin: 14px 0 6px;
}
.result-stat-card {
  background: var(--rd-bg);
  border: 0.5px solid var(--rd-line);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
}
.result-stat-card .v {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600; font-size: 22px; color: var(--rd-ink); line-height: 1;
}
.result-stat-card .l {
  font-size: 11px; color: var(--rd-ink-3);
  letter-spacing: 0.3px; text-transform: uppercase;
  margin-top: 6px;
}
.result-srs-bar {
  display: flex; height: 8px; border-radius: 4px; overflow: hidden;
  margin: 14px 0 6px;
  background: var(--rd-line);
}
.result-srs-bar > div { height: 100%; min-width: 0; transition: flex-grow .35s ease; }
.result-srs-bar .seg-mastered  { background: var(--rd-green-soft); }
.result-srs-bar .seg-reviewing { background: var(--rd-gold-soft); }
.result-srs-bar .seg-hard      { background: var(--rd-red-soft); }
.result-srs-bar .seg-rest      { background: var(--rd-line); }
.result-srs-legend {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--rd-ink-3);
  margin-bottom: 16px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.result-ach-pill {
  background: var(--rd-gold-soft);
  border: 0.5px solid rgba(212, 160, 23, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 14px;
  text-align: left;
}
.result-ach-pill .ach-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.result-ach-pill .ach-text {
  color: var(--rd-gold-ink); font-weight: 500; font-size: 13px;
  flex: 1; min-width: 0;
}

.result-card .btn-primary {
  background: var(--rd-accent); border-radius: 12px;
}
.result-card .btn-secondary {
  background: var(--rd-card); border: 0.5px solid var(--rd-line);
  color: var(--rd-ink-2); border-radius: 12px;
}

/* ── Mini-test option restyle ────────────────────────────── */
.mini-test {
  background: var(--rd-card);
  border: 0.5px solid var(--rd-line);
  border-radius: 14px;
}
.mini-test-h { color: var(--rd-ink); }
.mini-test-progress { color: var(--rd-ink-3); }
.mt-prompt { color: var(--rd-ink); }
.mt-option {
  background: var(--rd-card);
  border: 0.5px solid var(--rd-line);
  border-radius: 10px;
  color: var(--rd-ink);
  font-weight: 500;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.mt-option:hover {
  border-color: var(--rd-accent);
  background: #FFF9F5;
}
.mt-option.correct {
  border-color: var(--rd-green);
  background: var(--rd-green-soft);
  color: var(--rd-green);
}
.mt-option.wrong {
  border-color: var(--rd-accent);
  background: var(--rd-red-soft);
  color: var(--rd-accent);
}
.mt-input { border-color: var(--rd-line); border-width: 0.5px; }
.mt-input:focus { border-color: var(--rd-accent); }
.mt-input.correct { border-color: var(--rd-green); background: var(--rd-green-soft); color: var(--rd-green); }
.mt-input.wrong   { border-color: var(--rd-accent); background: var(--rd-red-soft);   color: var(--rd-accent); }
.mt-submit-btn { background: var(--rd-accent); border-radius: 12px; font-weight: 500; }
.mt-summary-text { color: var(--rd-ink); }

/* ── Fill / order — соответствие палитре ─────────────────── */
.opt-btn {
  background: var(--rd-card);
  border: 0.5px solid var(--rd-line);
  border-radius: 12px;
  box-shadow: none;
}
.opt-btn:hover { border-color: var(--rd-accent); background: #FFF9F5; }
.opt-btn.correct { background: var(--rd-green-soft); color: var(--rd-green); border-color: var(--rd-green); }
.opt-btn.wrong   { background: var(--rd-red-soft);   color: var(--rd-accent); border-color: var(--rd-accent); }
.q-sentence { background: var(--rd-card); border: 0.5px solid var(--rd-line); border-radius: 16px; box-shadow: none; }
.q-sentence .blank { border-bottom-color: var(--rd-accent); color: var(--rd-accent); }
.token-chip { background: var(--rd-card); border: 0.5px solid var(--rd-line); box-shadow: none; }
.token-chip.in-target { background: var(--rd-gold-soft); border-color: rgba(212,160,23,0.4); }

/* ── Nav active accent ───────────────────────────────────── */
.cab-nav-btn.active { color: var(--rd-accent); background: var(--rd-gold-soft); }
.cab-nav { background: var(--rd-card); border-top-color: var(--rd-line); }

/* ── Filter chip ─────────────────────────────────────────── */
.filter-chip { color: var(--rd-accent); }

/* ── Toggles soften ──────────────────────────────────────── */
.trainer-toggle.toggle-on {
  background: var(--rd-gold-soft);
  color: var(--rd-gold-ink);
  border-color: rgba(212, 160, 23, 0.35);
}

/* ── Session bar tweak ───────────────────────────────────── */
.btn-back { background: var(--rd-card); border-color: var(--rd-line); color: var(--rd-ink); }
.session-progress { background: var(--rd-card); border-color: var(--rd-line); color: var(--rd-ink); }

/* ── Lesson-flow bar palette ─────────────────────────────── */
.lesson-flow-bar { background: var(--rd-card); border-bottom-color: var(--rd-line); border-radius: 14px 14px 0 0; }
.lf-step.active { color: var(--rd-accent); }
.lf-step.active .lf-step-icon { background: var(--rd-accent); }
.lf-step.done { color: var(--rd-green); }
.lf-step.done .lf-step-icon { background: var(--rd-green); }
.lf-arrow.done { background: var(--rd-green); }

/* ============================================================ */
/* GRAMMAR CARDS 2026-05-01 — пассивные карточки между блоками  */
/* ============================================================ */
.grammar-card {
  background: #FFFFFF;
  border: 0.5px solid #E8E2D8;
  border-radius: 20px;
  padding: 24px 22px;
  margin-bottom: 18px;
  display: flex; flex-direction: column;
  text-align: left;
}
.grammar-badge {
  align-self: flex-start;
  background: #E6F1FB; color: #185FA5;
  font-size: 9px; font-weight: 600;
  padding: 3px 8px; border-radius: 8px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.grammar-title {
  font-size: 14px; font-weight: 500;
  color: #2C2420;
  margin-top: 10px; line-height: 1.35;
}
.grammar-pattern {
  font-size: 18px;
  text-align: center;
  background: #FAF7F2;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 14px 0 6px;
  font-family: 'Cormorant Garamond', 'Noto Sans SC', serif;
  font-weight: 600;
  color: #2C2420;
  line-height: 1.4;
}
.grammar-pattern .g-key {
  color: #C0392B;
  font-weight: 600;
}
.grammar-explanation {
  font-size: 13px;
  color: #6B5E52;
  line-height: 1.55;
  margin-top: 6px;
}
/* "Ты только что выучил: X, Y, Z" — связка с пройденными словами */
.grammar-learned {
  background: #F5EDE0;
  border-radius: 10px;
  padding: 10px;
  margin: 12px 0 6px;
  font-size: 13px;
  color: #6B5E52;
  line-height: 1.5;
}
.grammar-learned .gl-word {
  color: #C0392B;
  font-weight: 700;
  font-family: 'Noto Sans SC', serif;
}
.grammar-examples {
  margin-top: 12px;
  display: flex; flex-direction: column;
}
.grammar-examples .g-example {
  padding: 10px 0;
  border-top: 0.5px solid #F0EAE0;
  display: flex; flex-direction: column; gap: 2px;
}
.grammar-examples .g-example:first-child { border-top: none; }
.grammar-examples .ex-zh {
  font-family: 'Cormorant Garamond', 'Noto Sans SC', serif;
  font-size: 15px; font-weight: 600;
  color: #2C2420;
  letter-spacing: -0.005em;
}
.grammar-examples .ex-py {
  font-size: 11px; color: #8B7D6B;
  font-weight: 400;
}
.grammar-examples .ex-ru {
  font-size: 12px; color: #6B5E52;
}

/* Динамические примеры от Claude — «Составь с твоими словами» */
.grammar-dynamic {
  background: #E8F5E1;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 12px;
}
.grammar-dynamic-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: #3F6E2F;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.grammar-dynamic-icon { font-size: 14px; }
.grammar-dynamic-body { display: flex; flex-direction: column; }
.grammar-dynamic-body .g-example {
  padding: 8px 0;
  border-top: 0.5px solid #C5DDB8;
  display: flex; flex-direction: column; gap: 2px;
}
.grammar-dynamic-body .g-example:first-child { border-top: none; }
.grammar-dynamic-body .ex-zh {
  font-family: 'Cormorant Garamond', 'Noto Sans SC', serif;
  font-size: 15px; font-weight: 600; color: #2C2420;
}
.grammar-dynamic-body .ex-py { font-size: 11px; color: #6F8B65; }
.grammar-dynamic-body .ex-ru { font-size: 12px; color: #4F6943; }
.grammar-dynamic-loading {
  font-size: 12px; color: #6F8B65; font-style: italic;
}

.grammar-tip {
  background: #FEF3E2;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  color: #8B6914;
  line-height: 1.45;
  margin-top: 12px;
}
.grammar-tip::before { content: '💡 '; }
.grammar-personalized {
  margin-top: 10px;
  background: #F5EDE0;
  border: 0.5px solid #E8E2D8;
  border-radius: 10px;
  padding: 10px 12px;
}
.g-personalized-h {
  font-size: 11px; font-weight: 500;
  color: #8B7D6B;
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.g-personalized-body {
  font-size: 12px; color: #2C2420; line-height: 1.45;
  white-space: pre-wrap;
}
.g-next-btn {
  margin-top: 18px;
  width: 100%;
  background: #C0392B; color: #fff;
  border: none; border-radius: 12px;
  padding: 12px;
  font-weight: 500; font-size: 14px;
  cursor: pointer;
  transition: transform .1s ease, filter .15s ease;
}
.g-next-btn:hover  { filter: brightness(1.06); }
.g-next-btn:active { transform: scale(.96); }

/* Поток-индикатор Слова → Грамматика → Тест */
.lf-flow-dots {
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  margin: 6px 0 18px;
  font-size: 11px;
  color: #8B7D6B;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.lf-dot {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: transparent;
  transition: background .15s ease, color .15s ease;
}
.lf-dot.active {
  background: #FEF3E2;
  color: #8B6914;
  font-weight: 500;
}
.lf-dot.done {
  color: #2E7D32;
}
.lf-sep { color: #E8E2D8; }



/* === MOBILE MODE BUTTONS FIX v2 === */
@media (max-width: 600px) {
  .trainer-modes { grid-template-columns: 1fr !important; gap: 8px !important; }
  .mode-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 14px 16px !important;
    min-height: auto !important;
    text-align: left !important;
  }
  .mode-btn .mode-icon { flex-shrink: 0; }
  .mode-btn .mode-title {
    font-size: 15px !important;
    white-space: normal !important;
    
    
  }
  .mode-btn .mode-sub {
    font-size: 11px !important;
    white-space: normal !important;
    
    
  }
}
@media (hover: none), (pointer: coarse) {
  .mode-btn {
    -webkit-tap-highlight-color: rgba(192,57,43,0.15);
    touch-action: manipulation;
    cursor: pointer;
  }
  .mode-btn:hover { background: inherit !important; border-color: inherit !important; }
}

/* === FIX: flashcard overflow — face inherits inner height via grid stack ===
   Prevents tall back-face content (.pron-inline + .fc-example) from overlapping
   the SRS buttons that sit BELOW the card.  Both faces share one grid cell so
   the inner box auto-grows to max(front, back). */
.flashcard,
.flashcard-inner { min-height: 300px; height: auto; }
.flashcard-inner {
  display: grid;
  grid-template-areas: "face";
}
.flashcard-face {
  position: relative !important;
  inset: auto !important;
  grid-area: face;
  width: 100%;
  height: 100%;
  min-height: 300px;
}
/* Back face still rotated 180° (kept from earlier rules), but now sized via grid. */
.flashcard-face.back { padding-bottom: 24px; }
.flashcard-face .fc-pron-row { margin-top: 14px; width: 100%; }
.flashcard-face .pron-inline { width: 100%; max-width: 100%; }

/* Lesson tag on flashcard back face — small, subtle */
.fc-lesson-tag {
  color: #8B7D6B;
  font-size: 11px;
  margin-top: 4px;
  letter-spacing: 0.02em;
  font-weight: 400;
}


/* Сноска с объяснением после ответа в режиме fill */
.fill-feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fffbeb;
  border-left: 3px solid #d97706;
  font-size: 14px;
  line-height: 1.5;
  animation: fb-slide-in 0.3s ease;
}
@keyframes fb-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fill-feedback .fb-explain {
  color: #78350f;
}
.fill-feedback .fb-grammar-title {
  font-weight: 600;
  color: #78350f;
  margin-bottom: 4px;
  font-size: 14px;
}
.fill-feedback .fb-grammar-pattern {
  font-family: ui-monospace, monospace;
  background: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 6px;
  color: #92400e;
  font-size: 13px;
}
.fill-feedback .fb-grammar-text {
  color: #78350f;
  margin-bottom: 6px;
}
.fill-feedback .fb-example {
  margin-top: 6px;
  padding: 6px 8px;
  background: #fff;
  border-radius: 6px;
  color: #2c241d;
  font-size: 13px;
}
.fill-feedback .fb-example i {
  color: #6b5e52;
  font-style: italic;
}

/* 6.2.A2 hero */
.trainer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: stretch;
  padding: 36px 40px 32px;
  margin: 16px 0 28px;
  background: linear-gradient(135deg, #FFFFFF 0%, var(--brand-milk) 100%);
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}
.trainer-hero::after {
  content: '课';
  position: absolute;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 320px;
  line-height: 1;
  color: var(--brand-wine);
  opacity: 0.035;
  right: -40px;
  bottom: -80px;
  pointer-events: none;
}
.trainer-hero-main { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.trainer-hero-title {
  font-family: 'Cormorant Garamond', Georgia, 'Noto Serif', serif;
  font-size: 38px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--brand-ink);
  margin: 0 0 12px;
}
.trainer-hero-title em { font-style: italic; color: var(--brand-wine); }
.trainer-hero-subtitle {
  font-size: 15px;
  color: var(--brand-ink-soft);
  margin: 0 0 24px;
  line-height: 1.5;
}
.trainer-hero-subtitle b { color: var(--brand-ink); font-weight: 600; }
.trainer-cta {
  align-self: flex-start;
  background: var(--brand-wine);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  padding: 16px 36px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(164,30,58,0.22);
  transition: background .15s, transform .1s;
}
.trainer-cta:hover { background: var(--brand-wine-hover); }
.trainer-cta:active { transform: translateY(1px); }
.trainer-cta:disabled { background: var(--brand-soft-grey); cursor: not-allowed; box-shadow: none; }
.trainer-cta-hint {
  margin: 10px 0 0;
  font-size: 12px;
  font-style: italic;
  color: var(--brand-ink-soft);
}
.trainer-hero-aside { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.trainer-streak-card {
  background: #FFFCF5;
  border: 1px solid #C5B9A8;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--brand-ink);
}
.trainer-streak-card span:first-of-type { color: var(--brand-wine); font-weight: 600; font-size: 18px; }
@media (max-width: 768px) {
  .trainer-hero { grid-template-columns: 1fr; padding: 24px 20px; gap: 20px; }
  .trainer-hero::after { font-size: 200px; right: -30px; bottom: -50px; }
  .trainer-hero-title { font-size: 28px; }
  .trainer-hero-aside { flex-direction: row; gap: 10px; }
  .trainer-streak-card { flex: 1; }
}
/* /6.2.A2 hero */

/* 6.2.A3 collapsible + toast */
.modes-collapsible { margin-top: 24px; }
.modes-toggle {
  display: block;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brand-soft-grey);
  text-align: center;
  padding: 14px 0;
  cursor: pointer;
  user-select: none;
  list-style: none;
  border-top: 1px solid var(--brand-border);
  transition: color .15s;
}
.modes-toggle::-webkit-details-marker { display: none; }
.modes-toggle::marker { display: none; }
.modes-collapsible[open] .modes-toggle { color: var(--brand-ink); }
.modes-toggle:hover { color: var(--brand-ink); }

.kt-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--brand-ink);
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  max-width: 380px;
  font-size: 14px;
  line-height: 1.45;
  transform: translateX(120%);
  transition: transform .4s ease;
  z-index: 9999;
}
.kt-toast.kt-toast-show { transform: translateX(0); }
@media (max-width: 768px) {
  .kt-toast {
    top: auto;
    right: 16px;
    left: 16px;
    bottom: 24px;
    max-width: none;
    transform: translateY(120%);
  }
  .kt-toast.kt-toast-show { transform: translateY(0); }
}
/* /6.2.A3 collapsible + toast */

/* 6.2.F desktop layout: wider container + bigger mode cards on ≥1024px */
@media (min-width: 1024px) {
  #sec-trainer .modes,
  #sec-trainer .dm-modes,
  .modes-collapsible[open] .modes,
  .modes-collapsible[open] .dm-modes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
  #sec-trainer .mode-btn,
  #sec-trainer .dm-mode-btn {
    padding: 28px 24px;
    min-height: 140px;
  }
  #sec-trainer .mode-icon,
  #sec-trainer .dm-mode-icon { font-size: 36px; }
  #sec-trainer .mode-title,
  #sec-trainer .dm-mode-title { font-size: 17px; }
  #sec-trainer .mode-sub,
  #sec-trainer .dm-mode-sub { font-size: 13px; }
}

@media (min-width: 1280px) {
  #app { max-width: 1280px; }
}

@media (min-width: 1600px) {
  #app { max-width: 1440px; }
}
/* /6.2.F desktop layout */

/* 6.2.F2: rebalance hero (aside пустой до streak/B) */
.trainer-hero {
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: none !important;
  align-items: center;
  text-align: center;
  padding: 48px 56px;
}

.trainer-hero-main {
  align-items: center !important;
  max-width: 640px;
}

.trainer-hero-title {
  font-size: 44px !important;
  text-align: center;
}

.trainer-hero-subtitle {
  font-size: 16px !important;
  text-align: center;
  max-width: 480px;
}

.trainer-cta {
  align-self: center !important;
  font-size: 19px !important;
  padding: 18px 44px !important;
}

.trainer-hero-aside {
  width: 100%;
  max-width: 320px;
  margin-top: 16px;
}

.trainer-hero-aside:empty,
.trainer-hero-aside:has(:only-child[style*="display:none"]) {
  display: none;
}

.trainer-hero::after {
  right: 5% !important;
  bottom: 0 !important;
  font-size: 280px !important;
  opacity: 0.045;
}

@media (min-width: 1280px) {
  .trainer-hero { padding: 60px 80px; }
  .trainer-hero-title { font-size: 52px !important; }
  .trainer-cta { font-size: 20px !important; padding: 20px 52px !important; }
  .trainer-hero::after { font-size: 360px !important; right: 8% !important; }
}

@media (max-width: 768px) {
  .trainer-hero { padding: 24px 20px !important; }
  .trainer-hero-title { font-size: 28px !important; }
  .trainer-cta { font-size: 16px !important; padding: 14px 28px !important; }
  .trainer-hero::after { font-size: 200px !important; right: -30px !important; }
}
/* /6.2.F2 hero rebalance */

/* 6.2.B3a lessons hero styles */
.lesson-next-hero {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--brand-milk) 100%);
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  padding: 36px 40px 32px;
  margin: 16px 0 28px;
  position: relative;
  overflow: hidden;
}
.lesson-eyebrow {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--brand-soft-grey);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lesson-eyebrow-marker {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-wine);
}
.lesson-next-title {
  font-family: 'Cormorant Garamond', Georgia, 'Noto Serif', serif;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--brand-ink);
  margin: 0 0 8px;
}
.lesson-next-title em { font-style: italic; color: var(--brand-wine); }
.lesson-next-meta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--brand-ink-soft);
  margin: 0 0 24px;
  line-height: 1.5;
}
.lesson-next-meta b { color: var(--brand-ink); font-weight: 600; }
.lesson-checklist {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.lesson-checklist-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
  text-align: left;
}
.lesson-checklist-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-color: var(--brand-wine);
}
.lesson-checklist-icon {
  font-size: 22px; line-height: 1;
  flex-shrink: 0;
}
.lesson-checklist-body { flex: 1; min-width: 0; }
.lesson-checklist-title {
  font-size: 14px; font-weight: 600;
  color: var(--brand-ink);
  margin: 0 0 2px;
}
.lesson-checklist-sub {
  font-size: 12px;
  color: var(--brand-ink-soft);
  margin: 0;
}
.lesson-checklist-item.done .lesson-checklist-title {
  color: var(--brand-soft-grey);
  text-decoration: line-through;
}
.lesson-checklist-item.done::after {
  content: '✓';
  color: var(--brand-gold);
  font-size: 18px; font-weight: 600;
  margin-left: auto;
}
.lesson-secondary-actions {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 8px;
}
.lesson-link {
  font-size: 13px;
  color: var(--brand-ink-soft);
  text-decoration: none;
  cursor: pointer;
}
.lesson-link:hover { color: var(--brand-wine); }

/* Скрытие старого «Следующий урок» блока (JS навешивает класс) */
.b3a-old-next-hidden { display: none !important; }

@media (min-width: 1024px) {
  .lesson-checklist {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
  }
  .lesson-next-hero { padding: 44px 56px 36px; }
  .lesson-next-title { font-size: 36px; }
}
@media (max-width: 768px) {
  .lesson-next-hero { padding: 24px 20px; }
  .lesson-next-title { font-size: 24px; }
  .lesson-checklist-item { padding: 12px 14px; }
}
/* /6.2.B3a lessons hero styles */

/* 6.3.A unify trainer tiles */
.reading-tile, .personal-tile { display: none !important; }

@media (min-width: 1024px) {
  #sec-trainer .modes,
  .modes-collapsible[open] .modes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
  #sec-trainer .mode-btn,
  #sec-trainer .dm-mode-btn {
    padding: 22px 18px;
    min-height: 124px;
  }
  #sec-trainer .mode-icon,
  #sec-trainer .dm-mode-icon { font-size: 32px; }
  #sec-trainer .mode-title,
  #sec-trainer .dm-mode-title { font-size: 16px; }
  #sec-trainer .mode-sub,
  #sec-trainer .dm-mode-sub { font-size: 12px; }
}
/* /6.3.A unify trainer tiles */

/* 6.3.UX-1: compact last-lesson */
#sec-lessons .lessons-block .lessons-block-head {
  font-size: 14px;
  padding: 12px 0 8px;
  opacity: 0.85;
}
#sec-lessons .reco-card,
#sec-lessons .reco-card-ssr {
  padding: 14px 18px;
}
#sec-lessons .reco-ssr-comment,
#sec-lessons .reco-comment {
  font-size: 14px;
  line-height: 1.5;
}
#sec-lessons .reco-ssr-tip,
#sec-lessons .reco-ssr-action,
#sec-lessons .reco-tip,
#sec-lessons .reco-action {
  font-size: 13px;
  padding-top: 8px;
}
@media (max-width: 768px) {
  #sec-lessons .lessons-block .lessons-block-head { font-size: 13px; padding: 10px 0 6px; }
  #sec-lessons .reco-card,
  #sec-lessons .reco-card-ssr { padding: 12px 14px; }
  #sec-lessons .reco-ssr-comment,
  #sec-lessons .reco-comment { font-size: 13px; }
}
/* /6.3.UX-1: compact last-lesson */

/* 6.3.UX-2: schedule accordion */
.schedule-accordion-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 12px 0;
  margin: 8px 0 0;
  width: 100%;
  background: transparent;
  border: none;
  border-top: 1px solid var(--brand-border);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--brand-soft-grey);
  user-select: none;
  transition: color .15s;
}
.schedule-accordion-toggle:hover {
  color: var(--brand-ink);
}
#schedule-block.schedule-collapsed {
  display: none !important;
}
/* /6.3.UX-2 */

/* 6.3.UX-3-v7: rewrap both lessons-blocks */
/* PREV — last lesson */
.lessons-block.lesson-prev-rewrap .lesson-head { display: none; }
.lessons-block.lesson-prev-rewrap #after-reco { display: none; }
.lessons-block.lesson-prev-rewrap #after-hw { display: none; }
.lessons-block.lesson-prev-rewrap #after-words { display: none; }
.lessons-block.lesson-prev-rewrap #ssr-after-reco { display: none; }
.lessons-block.lesson-prev-rewrap.show-feedback #after-reco { display: block !important; margin-top: 8px; }
.lessons-block.lesson-prev-rewrap.show-feedback #ssr-after-reco { display: block !important; margin-top: 8px; }
.lessons-block.lesson-prev-rewrap.show-homework #after-hw { display: block !important; margin-top: 8px; }
.lessons-block.lesson-prev-rewrap.show-words #after-words { display: block !important; margin-top: 8px; }

/* NEXT — upcoming lesson */
.lessons-block.lesson-next-rewrap .lesson-head { display: none; }
.lessons-block.lesson-next-rewrap .lesson-words { display: none; }

/* B3a hero отключён через CSS (если он успел prepend'нуться) */
#lesson-next-hero { display: none !important; }

/* Hide #hw-block ниже секции если prev-rewrap активен */
.lessons-block.lesson-prev-rewrap ~ #hw-block { display: none !important; }

/* Wrapper styles — shared between prev + next */
.lesson-prev-wrapper, .lesson-next-wrapper {
  padding: 0 0 4px;
}
.lesson-prev-eyebrow, .lesson-next-eyebrow {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--brand-soft-grey);
  margin-bottom: 8px;
}
.lesson-prev-title, .lesson-next-title {
  font-family: 'Cormorant Garamond', Georgia, 'Noto Serif', serif;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--brand-ink);
  margin: 0 0 6px;
}
.lesson-prev-title em, .lesson-next-title em { font-style: italic; color: var(--brand-wine); }
.lesson-prev-meta, .lesson-next-meta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--brand-ink-soft);
  margin: 0 0 14px;
  line-height: 1.5;
}
.lesson-prev-meta b, .lesson-next-meta b { color: var(--brand-ink); font-weight: 600; }

.lesson-prev-checklist, .lesson-next-checklist {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}
.lesson-prev-checklist { grid-template-columns: repeat(3, 1fr); }
.lesson-next-checklist { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 768px) {
  .lesson-prev-checklist, .lesson-next-checklist { grid-template-columns: 1fr; }
  .lesson-prev-title, .lesson-next-title { font-size: 22px; }
}
.lesson-prev-item, .lesson-next-item {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-ink);
  transition: border-color .12s, background .12s;
  text-align: left;
  font-family: inherit;
}
.lesson-prev-item:hover:not(:disabled),
.lesson-next-item:hover:not(:disabled) {
  border-color: var(--brand-wine);
}
.lesson-prev-item.expanded {
  border-color: var(--brand-wine);
  background: var(--brand-milk);
}
.lesson-prev-item:disabled,
.lesson-next-item:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  background: #f5f3ee;
}
/* /6.3.UX-3-v7 */

/* 6.3.UX-3-v7-persistent: visual enhancement + hide #hw-block */
#hw-block.v7-hw-hidden { display: none !important; }

.lesson-prev-rewrap,
.lesson-next-rewrap {
  background: #fff;
  border: 1px solid var(--brand-border, #e5e7eb);
  border-radius: 16px;
  padding: 24px 24px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 2px 12px rgba(0,0,0,0.03);
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.lesson-prev-rewrap {
  border-left: 4px solid var(--brand-wine, #A41E3A);
}
.lesson-next-rewrap {
  border-left: 4px solid var(--brand-gold, #B8860B);
}
.lesson-prev-rewrap:hover,
.lesson-next-rewrap:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.06), 0 6px 20px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.lesson-prev-rewrap .lesson-prev-item,
.lesson-next-rewrap .lesson-next-item {
  background: var(--brand-milk, #FAF7F2);
  border: 1px solid var(--brand-border, #e5e7eb);
  padding: 12px 14px;
}
.lesson-prev-rewrap .lesson-prev-item:hover:not(:disabled),
.lesson-next-rewrap .lesson-next-item:hover:not(:disabled) {
  background: var(--brand-milk-2, #F1ECE0);
  border-color: var(--brand-wine, #A41E3A);
}
/* /6.3.UX-3-v7-persistent */

/* 6.3.UX-3-v11: override .b3a-old-*-hidden для rewrapped блоков (v7 переоформляет existing блок) */
.lessons-block.lesson-prev-rewrap,
.lessons-block.lesson-next-rewrap {
  display: block !important;
}
/* /6.3.UX-3-v11 */

/* 6.3.UX-3-v12: tighten layout + bright schedule toggle */
#sec-lessons {
  padding-top: 0 !important;
}

/* Скрыть полностью все B3a-hidden блоки (они занимают визуальное место через margin/border/height) */
#sec-lessons .b3a-old-after-hidden:not(.lesson-prev-rewrap):not(.lesson-next-rewrap),
#sec-lessons .b3a-old-next-hidden:not(.lesson-prev-rewrap):not(.lesson-next-rewrap) {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
  border: 0 !important;
}

/* Скрыть пустые divider / empty placeholders / lessons-block без wrapper */
#sec-lessons .lessons-divider:empty,
#sec-lessons > div:empty,
#sec-lessons .lessons-block:not(.lesson-prev-rewrap):not(.lesson-next-rewrap):not(:has(.lesson-prev-wrapper)):not(:has(.lesson-next-wrapper)) {
  display: none !important;
}

/* Подтянуть верхнее поле первого hero */
#sec-lessons .lesson-prev-rewrap:first-child,
#sec-lessons > *:first-child {
  margin-top: 0 !important;
}

/* 6.3.UX-3-v12: brighter schedule accordion toggle */
.schedule-accordion-toggle {
  background: var(--brand-milk, #FAF7F2) !important;
  color: var(--brand-wine, #A41E3A) !important;
  border: 1.5px solid var(--brand-wine, #A41E3A) !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  padding: 14px 20px !important;
  border-radius: 12px !important;
  margin: 16px 0 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
}
.schedule-accordion-toggle:hover {
  background: var(--brand-wine, #A41E3A) !important;
  color: #FFFFFF !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 8px rgba(164, 30, 58, 0.2) !important;
}
/* /6.3.UX-3-v12 */

/* 6.3.UX-4: swap border colors + mute prev title */
.lessons-block.lesson-prev-rewrap {
  border-left: 4px solid #B8860B !important;
}
.lessons-block.lesson-next-rewrap {
  border-left: 4px solid #A41E3A !important;
}
.lesson-prev-title,
.lesson-prev-title em {
  color: rgba(164, 30, 58, 0.55) !important;
}
.lesson-next-title,
.lesson-next-title em {
  color: var(--brand-wine, #A41E3A) !important;
}
/* /6.3.UX-4 */

/* 6.3.UX-6: settings accordion + hide JS-driven dash-after */
.dash-settings-accordion {
  background: #fff;
  border: 1px solid rgba(139, 47, 60, 0.12);
  border-radius: 16px;
  margin-bottom: 16px;
  overflow: hidden;
}
.dash-settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  color: #5a4a3f;
  user-select: none;
  transition: background 0.15s;
}
.dash-settings-toggle::-webkit-details-marker { display: none; }
.dash-settings-toggle:hover { background: #fafafa; }
.dash-settings-icon { font-size: 18px; }
.dash-settings-title { flex: 1; }
.dash-settings-arrow {
  font-size: 14px;
  color: #999;
  transition: transform 0.2s;
}
.dash-settings-accordion[open] .dash-settings-arrow {
  transform: rotate(180deg);
}
.dash-settings-body {
  padding: 4px 14px 16px;
  border-top: 1px solid #f5f5f5;
}
.dash-settings-body .tg-card,
.dash-settings-body #parent-card {
  margin-bottom: 12px;
  box-shadow: none;
  border: 1px solid rgba(139, 47, 60, 0.08);
}
.dash-settings-body .tg-card:last-child,
.dash-settings-body #parent-card:last-child {
  margin-bottom: 0;
}

/* 6.3.UX-6: hide duplicate JS-driven block (SSR версия #dash-after-section-ssr остаётся) */
#dash-after-section { display: none !important; }
/* /6.3.UX-6 */

/* 6.3.UX-7: hero styling + progress line */
.hdr-greet {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif !important;
  font-size: 26px !important;
  font-weight: 500 !important;
  color: #2c241d !important;
  line-height: 1.2 !important;
  letter-spacing: -0.01em !important;
}
.hdr-greet .hdr-name {
  color: #A41E3A !important;
  font-style: italic !important;
  font-weight: 600 !important;
}
.hdr-sub {
  font-size: 13px !important;
  color: #8b7d6b !important;
  margin-top: 4px !important;
  letter-spacing: 0.2px !important;
}
#hdr-progress-pct {
  color: #A41E3A;
  font-weight: 600;
  margin-left: 6px;
}
.hdr-progress-line {
  margin-top: 8px;
  height: 3px;
  background: rgba(164, 30, 58, 0.08);
  border-radius: 2px;
  overflow: hidden;
  max-width: 240px;
}
.hdr-progress-line-fill {
  height: 100%;
  background: linear-gradient(90deg, #A41E3A 0%, #B8860B 100%);
  transition: width 0.6s ease;
  width: 0%;
  border-radius: 2px;
}
@media (max-width: 540px) {
  .hdr-greet { font-size: 22px !important; }
  .hdr-progress-line { max-width: 100%; }
}
/* /6.3.UX-7 */

/* 6.3.UX-8: section headings */
.dash-section-heading {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif !important;
  font-size: 24px !important;
  font-weight: 500 !important;
  color: #2c241d !important;
  margin: 28px 0 12px !important;
  letter-spacing: -0.01em !important;
  line-height: 1.2 !important;
}
.dash-section-heading em {
  color: #A41E3A !important;
  font-style: italic !important;
  font-weight: 600 !important;
}
.dash-section-heading:first-of-type {
  margin-top: 16px !important;
}
@media (max-width: 540px) {
  .dash-section-heading {
    font-size: 20px !important;
    margin: 20px 0 10px !important;
  }
}
/* /6.3.UX-8 */
