:root {
  --bg:       #ffffff;
  --bg-2:     #f5f5f7;
  --bg-3:     #e8e8ed;
  --accent:   #f56300;
  --accent-h: #ff7200;
  --purple:   #8b3dff;
  --gradient: linear-gradient(135deg, #f56300 0%, #8b3dff 100%);
  --correct:  #34c759;
  --wrong:    #ff3b30;
  --warning:  #ff9f0a;
  --text-1:   #1d1d1f;
  --text-2:   #6e6e73;
  --text-3:   #aeaeb2;
  --border:   #d2d2d7;
  --r-s:      10px;
  --r-m:      16px;
  --r-l:      22px;
}

*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
html { height: -webkit-fill-available; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', system-ui, sans-serif;
  background: var(--bg); color: var(--text-1);
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  overflow-x: hidden; overscroll-behavior-y: none; -webkit-font-smoothing: antialiased;
}

/* ── HEADER  (Apple-style nav) ── */
.header {
  position: sticky; top: 0; z-index: 100; width: 100%;
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
/* 3-column grid: logo | nav (centered) | end — like Apple */
.header__inner {
  max-width: 1200px; margin: 0 auto; padding: 0 22px;
  height: 44px;
  display: flex;
  align-items: center;
}
.header__logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; height: 44px;
}
.header__logo-icon {
  width: 26px; height: 26px; flex-shrink: 0; display: block;
}
.header__logo-text {
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #1d1d1f; white-space: nowrap;
}
/* Nav — hidden on mobile, visible ≥600px */
.header__nav {
  display: none;
  align-items: center;
}
@media (min-width: 600px) {
  .header__nav { display: flex; }
}
.header__nav-link {
  display: flex; align-items: center;
  height: 44px; padding: 0 14px;
  font-size: 12px; font-weight: 400;
  color: #1d1d1f; text-decoration: none;
  opacity: 0.72; white-space: nowrap;
  transition: opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.header__nav-link:hover { opacity: 1; }
.header__nav-link--active { opacity: 1; font-weight: 500; }
.header__end { justify-self: end; }
.header__back {
  background: none; border: none; font-family: inherit;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  cursor: pointer; height: 44px; padding: 0 4px;
  display: flex; align-items: center; gap: 4px;
  transition: color 0.15s; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  margin-left: auto;
}
.header__back:hover { color: var(--text-1); }

/* ── SCREENS ── */
.screen { display: none; width: 100%; max-width: 960px; padding: 0 20px 52px; animation: fadeUp 0.32s cubic-bezier(.25,.46,.45,.94); }
.screen.active { display: block; }
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ── HERO ── */
.hero { padding: 52px 0 40px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.hero__eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.hero__title   { font-size: clamp(36px,8vw,60px); font-weight: 800; letter-spacing: -2px; line-height: 1.02; }
.hero__sub     { font-size: clamp(15px,3.5vw,18px); color: var(--text-2); line-height: 1.55; max-width: 420px; font-weight: 400; }

/* ── NEON STATS (тёмные карточки с неон-метриками) ── */
.neon-stats {
  display: flex; flex-direction: column;
  width: 100%; margin-bottom: 20px;
  background: #0f1117;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--r-l); overflow: hidden;
}
.neon-stat {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.neon-stat:last-child { border-bottom: none; }
.neon-stat__icon { font-size: 22px; flex-shrink: 0; line-height: 1; }
.neon-stat__body { display: flex; flex-direction: column; gap: 3px; }
.neon-stat__val {
  font-size: clamp(20px,5vw,24px); font-weight: 800; letter-spacing: -0.5px;
  color: #3dff91;
  text-shadow: 0 0 14px rgba(61,255,145,0.65), 0 0 28px rgba(61,255,145,0.30);
}
.neon-stat__lbl {
  font-size: 12px; color: rgba(255,255,255,0.42);
  line-height: 1.4; font-weight: 400;
}

/* ── STAT STRIP (устаревший, оставлен для совместимости) ── */
.stat-strip {
  display: grid; grid-template-columns: repeat(4,1fr);
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-l); overflow: hidden;
}
.stat-strip__item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 18px 8px; border-right: 1px solid var(--border); }
.stat-strip__item:last-child { border-right: none; }
.stat-strip__val { font-size: clamp(15px,3.8vw,20px); font-weight: 700; color: var(--accent); white-space: nowrap; }
.stat-strip__lbl { font-size: clamp(9px,2vw,11px); color: var(--text-2); text-align: center; line-height: 1.3; font-weight: 500; }

/* ── TWO-COL ── */
.two-col { display: flex; flex-direction: column; gap: 16px; width: 100%; }
@media (min-width: 720px) {
  .two-col { flex-direction: row; align-items: flex-start; gap: 24px; }
  .two-col .col-main { flex: 3; min-width: 0; }
  .two-col .col-side { flex: 2; min-width: 0; position: sticky; top: 68px; }
}


/* ── CARD ── */
.card { width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-m); padding: 20px; }
.card__label { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-2); margin-bottom: 14px; }
.card--accent { border-color: rgba(139,61,255,0.35); box-shadow: 0 0 0 3px rgba(139,61,255,0.07), 0 0 14px rgba(245,99,0,0.06); }

/* ── BUTTONS ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 980px; font-family: inherit; font-weight: 600;
  cursor: pointer; touch-action: manipulation; transition: background 0.18s, transform 0.12s, opacity 0.15s;
  -webkit-appearance: none; white-space: nowrap;
}
.btn--primary { background: var(--gradient); color: #fff; font-size: clamp(15px,3.5vw,16px); padding: 14px 36px; min-height: 50px; width: 100%; box-shadow: 0 4px 18px rgba(245,99,0,0.30), 0 4px 22px rgba(139,61,255,0.28); transition: box-shadow 0.2s, transform 0.12s, opacity 0.15s; }
@media (hover:hover) { .btn--primary:hover { box-shadow: 0 6px 28px rgba(245,99,0,0.40), 0 6px 32px rgba(139,61,255,0.36); opacity: 0.93; } }
.btn--primary:active { transform: scale(0.97); opacity: 0.88; }
.btn--ghost { background: var(--bg-2); color: var(--text-1); font-size: clamp(14px,3.2vw,15px); padding: 12px 28px; min-height: 44px; width: 100%; border: 1px solid var(--border); }
@media (hover:hover) { .btn--ghost:hover { background: var(--bg-3); } }
.btn--ghost:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.hidden { display: none !important; }

/* ── SECTION HEAD ── */
.section-head { padding: 36px 0 20px; display: flex; flex-direction: column; gap: 4px; }
.section-head span { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.section-head h2   { font-size: clamp(20px,5vw,26px); font-weight: 800; letter-spacing: -0.5px; }

/* ── STEPS / TIPS ── */
.steps { display: flex; flex-direction: column; gap: 14px; }
.step  { display: flex; align-items: flex-start; gap: 12px; }
.step__icon { width: 34px; height: 34px; flex-shrink: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.step__text { display: flex; flex-direction: column; gap: 2px; padding-top: 5px; }
.step__text strong { font-size: 13px; font-weight: 600; }
.step__text span   { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.tips { display: flex; flex-direction: column; gap: 8px; }
.tip  { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; color: var(--text-2); line-height: 1.5; }
.tip::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 5px; }

/* ── LEVELS ── */
.levels-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; width: 100%; margin-bottom: 16px; }
@media (min-width: 720px) { .levels-grid { grid-template-columns: repeat(3,1fr); } }
.level-card { background: var(--bg-2); border: 1.5px solid var(--border); border-radius: var(--r-m); padding: 16px; cursor: pointer; touch-action: manipulation; transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s; display: flex; flex-direction: column; gap: 6px; }
@media (hover:hover) { .level-card:hover { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,61,255,0.12), 0 0 14px rgba(139,61,255,0.10); } }
.level-card:active { transform: scale(0.97); }
.level-card.active-level { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,61,255,0.14), 0 0 16px rgba(139,61,255,0.12); }
.level-card__num   { font-size: 26px; font-weight: 900; color: var(--accent); line-height: 1; letter-spacing: -0.5px; }
.level-card__title { font-size: 13px; font-weight: 600; }
.level-card__badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; padding: 3px 10px; border-radius: 980px; background: rgba(0,113,227,0.1); color: var(--accent); width: fit-content; }
.level-card__badge.medium { background: rgba(88,86,214,0.1); color: #5856d6; }
.level-card__badge.hard   { background: rgba(255,59,48,0.09); color: var(--wrong); }
.level-card__meta { font-size: 11px; color: var(--text-2); line-height: 1.5; }

/* ── READING ── */
.reading-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-m); padding: 24px; }
.reading-card p { font-size: clamp(15px,3.5vw,17px); color: var(--text-1); line-height: 1.8; font-weight: 400; }

/* ── SUMMARY ROWS ── */
.summary-label { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-2); margin-bottom: 12px; display: block; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.summary-row:last-of-type { border-bottom: none; padding-bottom: 0; }
#stats-section .summary-row { border-bottom: none; padding: 4px 0; }
.summary-row__key { color: var(--text-2); font-weight: 500; }
.summary-row__val { color: var(--text-1); font-weight: 600; }

/* ── WORD DISPLAY ── */
.word-display {
  width: 100%; min-height: 140px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1.5px solid rgba(139,61,255,0.22); border-radius: var(--r-l);
  padding: 28px 20px; font-size: clamp(32px,9vw,48px); font-weight: 900; letter-spacing: -1.5px;
  color: var(--text-1); text-align: center;
  transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 0 3px rgba(139,61,255,0.07), 0 2px 12px rgba(0,0,0,0.06);
}
.word-display.flash-correct { border-color: var(--correct); background: rgba(52,199,89,0.06);  color: var(--correct); }
.word-display.flash-wrong   { border-color: var(--wrong);   background: rgba(255,59,48,0.06);  color: var(--wrong);   animation: shake 0.32s ease; }
.word-display.flash-timeout { border-color: var(--warning); background: rgba(255,159,10,0.06); color: var(--warning); animation: shake 0.32s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

/* ── TIMER BAR ── */
.timer-wrap { width: 100%; height: 6px; background: var(--bg-3); border-radius: 999px; overflow: visible; }
.timer-bar  { height: 100%; width: 100%; border-radius: 999px; background: var(--gradient); box-shadow: 0 0 10px rgba(245,99,0,0.45), 0 0 18px rgba(139,61,255,0.30); transition: background 0.4s, box-shadow 0.4s; }
.timer-bar.warn   { background: var(--warning); box-shadow: 0 0 10px rgba(255,159,10,0.55); }
.timer-bar.danger { background: var(--wrong);   box-shadow: 0 0 10px rgba(255,59,48,0.55); }

/* ── ANSWER BUTTONS ── */
.answer-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.btn-answer {
  border-radius: var(--r-m); font-family: inherit; font-size: clamp(14px,3.8vw,16px); font-weight: 700;
  padding: 18px 12px; min-height: 64px; cursor: pointer; touch-action: manipulation;
  transition: background 0.15s, transform 0.1s; border: none; color: #fff; -webkit-appearance: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.btn-answer .key-hint { font-size: 11px; font-weight: 500; opacity: 0.75; letter-spacing: 0.3px; }
.btn-yes { background: var(--correct); box-shadow: 0 3px 14px rgba(52,199,89,0.28); }
@media (hover:hover) { .btn-yes:hover { background: #28b04e; } }
.btn-yes:active { transform: scale(0.97); }
.btn-no  { background: var(--wrong); box-shadow: 0 3px 14px rgba(255,59,48,0.25); }
@media (hover:hover) { .btn-no:hover { background: #e0332a; } }
.btn-no:active { transform: scale(0.97); }
.btn-answer:disabled { opacity: 0.4; pointer-events: none; }

/* ── LIVES / PROGRESS ── */
.lives-row { display: flex; gap: 7px; }
.life { width: 12px; height: 12px; border-radius: 50%; background: var(--wrong); transition: background 0.3s, transform 0.2s; }
.life.used { background: var(--border); transform: scale(0.8); }
.progress-bar-wrap { width: 100%; height: 5px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.progress-bar-fill { height: 100%; background: var(--gradient); border-radius: 999px; transition: width 0.35s ease; box-shadow: 0 0 6px rgba(139,61,255,0.35); }
.warning-banner { background: rgba(255,159,10,0.1); border: 1px solid rgba(255,159,10,0.35); border-radius: var(--r-s); padding: 11px 14px; font-size: 12px; font-weight: 600; color: #a05a00; animation: slideDown 0.26s ease; }
.warning-banner.hidden { display: none; }
@keyframes slideDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

/* ── RESULT GAINS (прирост от тренировки) ── */
.result-gains {
  background: var(--bg-2);
  border-radius: var(--r-m);
  overflow: hidden;
  border: 1px solid var(--border);
  width: 100%;
}
.result-gains__header {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-2);
  padding: 14px 18px 6px;
}
.result-gain {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.result-gain__icon { font-size: 20px; flex-shrink: 0; line-height: 1; }
.result-gain__body { display: flex; flex-direction: column; gap: 2px; }
.result-gain__lbl  { font-size: 11px; color: var(--text-2); line-height: 1.3; }
.result-gain__val  {
  font-size: 20px; font-weight: 800; letter-spacing: -0.3px;
  color: var(--correct);
}

/* ── RESULT ── */
.result-head { padding: 48px 0 32px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.result-head__icon  { font-size: clamp(52px,12vw,68px); line-height: 1; }
.result-head__title { font-size: clamp(26px,6.5vw,36px); font-weight: 800; letter-spacing: -1px; }
.result-score-card  { background: var(--bg-2); border: 1.5px solid var(--accent); border-radius: var(--r-l); padding: 30px 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 0 0 4px rgba(0,113,227,0.07); }
.result-score-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-2); }
.result-score-big   { font-size: clamp(42px,11vw,60px); font-weight: 900; letter-spacing: -2px; color: var(--accent); line-height: 1.1; }
.result-score-sub   { font-size: 14px; color: var(--text-2); font-weight: 500; }
.result-message     { font-size: clamp(13px,3.2vw,15px); color: var(--text-2); line-height: 1.6; }
.result-actions     { display: flex; flex-direction: column; gap: 10px; width: 100%; }

/* ── РАЗБОР СЛОВ ── */
.breakdown { width: 100%; margin-top: 28px; }
.breakdown__title { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-2); margin-bottom: 14px; }
.breakdown__grid  { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 980px; font-size: 14px; font-weight: 600;
  border: 1.5px solid transparent;
}
.word-chip--correct { background: rgba(52,199,89,0.1);  border-color: rgba(52,199,89,0.4);  color: #1a7a37; }
.word-chip--wrong   { background: rgba(255,59,48,0.09); border-color: rgba(255,59,48,0.35); color: #c0281f; }
.word-chip--timeout { background: rgba(255,159,10,0.1); border-color: rgba(255,159,10,0.4); color: #a05a00; }
.word-chip__icon { font-size: 12px; }
.breakdown__legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); font-weight: 500; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-dot--correct { background: var(--correct); }
.legend-dot--wrong   { background: var(--wrong); }
.legend-dot--timeout { background: var(--warning); }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .screen { padding: 0 16px 36px; }
  .stat-strip__item { padding: 14px 5px; }
}
@media (max-width: 360px) {
  .screen { padding: 0 12px 28px; }
  .answer-btns { grid-template-columns: 1fr; gap: 8px; }
  .levels-grid { gap: 8px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding: 20px 0 16px; gap: 8px; }
  .word-display { min-height: 90px; }
}
@media (hover: none) { .key-hint { display: none; } }

/* ── ЛИЧНЫЙ ПРОГРЕСС ── */
.stat-levels-grid {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.stat-level-row {
  display: flex; align-items: center; gap: 10px;
}
.stat-level-name {
  font-size: 11px; font-weight: 700; color: var(--text-2);
  width: 36px; flex-shrink: 0;
}
.stat-level-topic {
  font-size: 11px; color: var(--text-2); font-weight: 500;
  width: 60px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-level-bar-wrap {
  flex: 1; height: 6px; background: var(--bg-3);
  border-radius: 999px; overflow: hidden;
}
.stat-level-bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 999px; transition: width 0.6s ease;
  min-width: 0;
}
.stat-level-bar-fill.perfect { background: var(--correct); }
.stat-level-score {
  font-size: 11px; font-weight: 700; color: var(--text-1);
  width: 30px; text-align: right; flex-shrink: 0;
}
.stat-level-unplayed .stat-level-name,
.stat-level-unplayed .stat-level-topic,
.stat-level-unplayed .stat-level-score { color: var(--text-3); }
.stat-level-unplayed .stat-level-bar-fill { background: transparent; }
