/* ============================================================
   APP / PLAYER — интерактив и анимации
   ============================================================ */

/* ---------- course rail (разноцветный прогресс всех тем) ---------- */
.rail { display: flex; gap: 5px; align-items: center; }
.rail .seg {
  height: 5px; flex: 1; border-radius: 4px; background: #2a2e3b;
  transition: background .3s, box-shadow .3s, transform .2s; cursor: pointer;
}
.rail .seg:hover { transform: scaleY(1.6); }
.rail .seg.simple      { background: var(--simple); }
.rail .seg.continuous  { background: var(--continuous); }
.rail .seg.perfect     { background: var(--perfect); }
.rail .seg.perfcont    { background: var(--perfcont); }
.rail .seg.dim { opacity: .28; }
.rail .seg.here { box-shadow: 0 0 12px -1px currentColor; transform: scaleY(1.8); }

/* ---------- player shell ---------- */
.player { max-width: 860px; margin: 0 auto; padding: var(--s-6) 0 var(--s-8); }

.player-top { display: flex; align-items: center; gap: 16px; margin-bottom: var(--s-6); }
.back-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--hairline);
  display: grid; place-items: center; color: var(--text-soft); background: var(--bg-1);
  transition: .18s; flex: none; cursor: pointer;
}
.back-btn:hover { background: var(--bg-2); color: var(--text); transform: translateX(-2px); }

/* lesson title block */
.deck-head { text-align: center; margin-bottom: var(--s-5); }
.deck-head .pill { margin-bottom: 16px; }
.deck-head h1 { font-size: clamp(30px, 4.4vw, 50px); margin: 0 0 8px; animation: rise .5s ease both; }
.deck-head .lesson-sub { animation: rise .5s .05s ease both; }

/* ---------- card stage ---------- */
.stage {
  position: relative; min-height: 440px;
  display: flex; align-items: center; justify-content: center;
}
.step { width: 100%; }
.step.in  { animation: cardIn .45s cubic-bezier(.2,.7,.2,1) both; }
.step.out { animation: cardOut .28s ease both; position: absolute; inset: 0; }

@keyframes cardIn  { from { opacity: 0; transform: translateX(36px) } to { opacity: 1; transform: none } }
@keyframes cardInBack { from { opacity: 0; transform: translateX(-36px) } to { opacity: 1; transform: none } }
@keyframes cardOut { to { opacity: 0; transform: translateX(-24px) } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
.step.back.in { animation-name: cardInBack; }

/* step inner elements stagger */
.step .lead { font-size: clamp(22px, 3vw, 30px); font-weight: 700; letter-spacing: -.02em; margin: 0 0 12px; }
.step .lead.simple{color:var(--simple)} .step .lead.continuous{color:var(--continuous)}
.step .lead.perfect{color:var(--perfect)} .step .lead.perfcont{color:var(--perfcont)}
.step .body { font-size: 18px; color: var(--text-soft); max-width: 60ch; }
.step .stitle { font-family: var(--font-mono); font-size: 12px; letter-spacing:.2em; text-transform:uppercase;
  color: var(--text-dim); margin-bottom: 16px; }

.fade-seq > * { animation: rise .5s ease both; }
.fade-seq > *:nth-child(1){ animation-delay:.05s } .fade-seq > *:nth-child(2){ animation-delay:.12s }
.fade-seq > *:nth-child(3){ animation-delay:.19s } .fade-seq > *:nth-child(4){ animation-delay:.26s }
.fade-seq > *:nth-child(5){ animation-delay:.33s } .fade-seq > *:nth-child(6){ animation-delay:.40s }

/* ---------- controls ---------- */
.controls { display: flex; align-items: center; gap: 16px; margin-top: var(--s-6); }
.nav-btn {
  flex: 1; padding: 15px 20px; border-radius: var(--r-md); border: 1px solid var(--hairline);
  background: var(--bg-1); color: var(--text); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: .16s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.nav-btn:hover:not(:disabled) { background: var(--bg-2); border-color: var(--hairline-2); }
.nav-btn:disabled { opacity: .35; cursor: default; }
.nav-btn.primary { background: var(--accent); border-color: transparent; color: #06070c; }
.nav-btn.primary:hover { filter: brightness(1.08); }

/* step progress dots */
.step-dots { display: flex; gap: 7px; justify-content: center; margin-top: 22px; }
.step-dots i { width: 22px; height: 4px; border-radius: 3px; background: var(--bg-3); cursor: pointer; transition: .25s; }
.step-dots i.on  { background: var(--accent); }
.step-dots i.done{ background: color-mix(in oklab, var(--accent) 55%, var(--bg-3)); }

/* ---------- TIMELINE (animated SVG) ---------- */
.tl { width: 100%; max-width: 720px; margin: 8px auto 0; display: block; overflow: visible; }
.tl .axis-line { stroke: var(--hairline-2); stroke-width: 2; }
.tl .glow { animation: nowpulse 2.6s ease-in-out infinite; transform-origin: center; }
@keyframes nowpulse { 0%,100%{ opacity:.35 } 50%{ opacity:.8 } }
.tl .nowdot { stroke: var(--now); stroke-width: 2; stroke-dasharray: 2 4; }
.tl .lbl-now { fill: var(--now); font-family: var(--font-mono); font-size: 15px; letter-spacing: 3px; }
.tl .lbl-end { fill: var(--text-faint); font-family: var(--font-mono); font-size: 13px; letter-spacing: 3px; }
.tl .cap { font-family: var(--font-mono); font-size: 16px; }

/* draw-in: paths use pathLength="1" */
.tl .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s .15s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* diamonds / dots pop */
.tl .pop { opacity: 0; transform: scale(0); transform-box: fill-box; transform-origin: center; animation: pop .4s ease forwards; }
@keyframes pop { to { opacity: 1; transform: scale(1); } }
.tl .checkmark { opacity: 0; animation: fadein .4s .9s forwards; }
@keyframes fadein { to { opacity: 1; } }

/* ---------- FORMULA / TABS / EXAMPLES already partly in design.css; extras ---------- */
.tabbar { display: inline-flex; gap: 6px; background: var(--bg-1); padding: 5px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); margin-bottom: 18px; }
.tabbar button {
  font-family: var(--font-mono); font-size: 16px; min-width: 46px; padding: 8px 16px; border: 0; cursor: pointer;
  background: transparent; color: var(--text-dim); border-radius: var(--r-pill); transition: .18s; font-weight: 600;
}
.tabbar button.active { background: var(--accent); color: #06070c; }
.tab-panel { animation: rise .3s ease both; }
.tab-panel .en { font-family: var(--font-mono); font-size: clamp(20px,2.6vw,26px); color: var(--text); }
.tab-panel .en b { color: var(--accent); font-weight: 700; }
.tab-panel .ru { color: var(--text-dim); font-style: italic; margin-top: 10px; }

/* reveal example (tap to show RU) */
.rev {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1)); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 22px 24px; cursor: pointer; transition: border-color .2s; text-align: center;
}
.rev:hover { border-color: var(--hairline-2); }
.rev .en { font-family: var(--font-mono); font-size: clamp(19px,2.4vw,26px); color: var(--text-soft); }
.rev .en u { color: var(--accent); text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 2px; font-weight: 600; }
.rev .en b { color: var(--text); font-weight: 600; }
.rev .ru {
  color: var(--text-dim); font-style: italic; font-size: 16px;
  max-height: 0; opacity: 0; overflow: hidden; transition: max-height .35s ease, opacity .35s ease, margin .35s;
}
.rev.open .ru { max-height: 80px; opacity: 1; margin-top: 12px; }
.rev .tap { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); letter-spacing:.1em; margin-top: 10px; }
.rev.open .tap { display: none; }

/* produce (RU -> EN active recall) */
.rev.produce { text-align: center; }
.rev.produce .prompt { font-size: clamp(18px,2.4vw,24px); color: var(--text); font-style: italic; }
.rev .answer {
  max-height: 0; opacity: 0; overflow: hidden; transition: max-height .35s ease, opacity .35s ease, margin .35s;
  font-family: var(--font-mono); font-size: clamp(18px,2.3vw,24px); color: var(--accent); font-weight: 600;
}
.rev.open .answer { max-height: 120px; opacity: 1; margin-top: 14px; }
.rev .tip-line {
  max-height: 0; opacity: 0; overflow: hidden; transition: .35s;
  font-size: 13px; color: var(--text-dim);
}
.rev.open .tip-line { max-height: 60px; opacity: 1; margin-top: 8px; }

/* personal-mistake note */
.note.warn { background: #ff6b6b10; border-color: #ff6b6b33; }
.note.warn b { color: var(--bad); }

/* quiz */
.quiz .q { font-family: var(--font-mono); font-size: clamp(19px,2.4vw,24px); color: var(--text); margin-bottom: 18px; text-align:center; }
.quiz .opts { display: grid; gap: 10px; max-width: 520px; margin: 0 auto; }
.quiz .opt {
  font-family: var(--font-mono); font-size: 17px; padding: 15px 20px; border-radius: var(--r-md);
  border: 1px solid var(--hairline-2); background: var(--bg-1); color: var(--text); cursor: pointer;
  transition: .16s; text-align: left;
}
.quiz .opt:hover { border-color: var(--text-dim); background: var(--bg-2); }
.quiz .opt.correct { border-color: var(--good); background: #35d48818; color: var(--good); animation: goodpop .4s ease; }
.quiz .opt.wrong   { border-color: var(--bad);  background: #ff6b6b14; color: var(--bad); }
.quiz .opt:disabled { cursor: default; }
@keyframes goodpop { 0%{transform:scale(1)} 40%{transform:scale(1.03)} 100%{transform:scale(1)} }
.quiz .explain {
  max-width: 520px; margin: 16px auto 0; text-align: center; color: var(--text-soft); font-size: 15px;
  opacity: 0; transform: translateY(6px); transition: .3s;
}
.quiz .explain.show { opacity: 1; transform: none; }
.quiz .explain .ru { color: var(--text-dim); font-style: italic; display:block; margin-top: 4px; }

/* interactive tense switch */
.tense-switch {
  display: inline-flex; gap: 6px; background: var(--bg-1); border: 1px solid var(--hairline);
  padding: 6px; border-radius: var(--r-pill); margin-bottom: 30px;
}
.tense-switch button {
  font-family: var(--font-mono); font-size: 15px; font-weight: 600; padding: 9px 24px;
  border: 0; background: transparent; color: var(--text-dim); border-radius: var(--r-pill);
  cursor: pointer; transition: .18s;
}
.tense-switch button:hover { color: var(--text); }
.tense-switch button.active { background: var(--bg-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--hairline-2); }

/* interactive aspect rows in the map */
.aspect-row[data-aspect] {
  position: relative; cursor: pointer; border-radius: var(--r-md);
  padding-left: 14px; margin-left: -14px; padding-right: 84px; transition: background .16s;
}
.aspect-row[data-aspect]:hover { background: var(--bg-1); }
.aspect-row.active { background: var(--bg-2); }
.aspect-row.active::before {
  content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 3px;
}
.row-simple.active::before     { background: var(--simple); }
.row-continuous.active::before { background: var(--continuous); }
.row-perfect.active::before    { background: var(--perfect); }
.row-perfcont.active::before   { background: var(--perfcont); }
.row-open {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 12px; color: var(--text-dim);
  background: var(--bg-2); border: 1px solid var(--hairline-2); border-radius: var(--r-pill);
  padding: 6px 13px; cursor: pointer; transition: .16s;
}
.row-open:hover { color: var(--text); border-color: var(--text-dim); }
.row-soon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
}

/* home cards clickable pointer */
.card { cursor: pointer; }

/* completed badge on sidebar / cards */
.check { color: var(--good); }

/* keyboard hint */
.khint { text-align:center; font-family:var(--font-mono); font-size:11px; color:var(--text-faint); margin-top:18px; letter-spacing:.05em; }

/* done state celebration */
.done-card { text-align:center; padding: var(--s-7); animation: rise .5s ease both; }
.done-card .big { font-size: 56px; }
.done-card h3 { font-size: 26px; margin: 12px 0 8px; }
.done-card p { color: var(--text-dim); }

@media (max-width: 900px) {
  .player { padding: var(--s-5) 0; }
  .stage { min-height: 380px; }
}
