/* Student app layout. Tokens and shared components are in styles.css. */

/* ── Sign in ────────────────────────────────────────────── */

.login { display: flex; flex-direction: column; gap: 24px; padding-top: max(6vh, 24px); }
.brand { font-size: 2rem; letter-spacing: -0.02em; }

/* ── Top bar ────────────────────────────────────────────── */

.topbar { display: flex; align-items: center; gap: 4px; min-height: 52px; margin-bottom: 8px; }
.wordmark {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em;
}
.topbar a.icon-btn { color: inherit; }

/* ── Home ───────────────────────────────────────────────── */

.hero { display: flex; align-items: center; gap: 16px; margin: 8px 0 20px; }
.hero h1 { font-size: clamp(1.4rem, 5vw, 2rem); }
.streak {
  display: grid; justify-items: center; gap: 0; padding: 10px 14px; min-width: 76px;
  border-radius: var(--radius-m); background: var(--surface-2); color: var(--ink-3); line-height: 1.1;
}
.streak b { font-size: 1.6rem; font-weight: 700; color: var(--ink); }
.streak.lit { background: var(--gold-soft); color: var(--gold-strong); }
.streak.lit b { color: var(--gold-ink); }
.streak.risk { outline: 2px dashed var(--gold); outline-offset: 2px; }

.home-grid { display: grid; gap: 16px; }
@media (min-width: 860px) {
  .home-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
}

.mission { display: flex; flex-direction: column; gap: 16px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.step {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  border-radius: var(--radius-m); border: 1.5px solid var(--line); background: var(--surface);
}
.step.next { border-color: var(--gold); background: var(--gold-soft); }
.step.done { background: var(--surface-2); border-color: transparent; }
.step-mark {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: var(--surface-3); color: var(--ink-2);
}
.step.next .step-mark { background: var(--gold); color: var(--on-gold); }
.step.done .step-mark { background: var(--green); color: #fff; }
.step-title { font-weight: 650; font-size: 1.05rem; }
.step .btn { flex: none; padding: 0 18px; }
@media (max-width: 420px) { .step { gap: 10px; padding: 12px; } .step-title { font-size: 1rem; } }

.week {
  list-style: none; margin: 0; padding: 12px 0 0; display: flex; justify-content: space-between;
  border-top: 1px solid var(--line);
}
.week li { display: grid; justify-items: center; gap: 4px; flex: 1; }
.week .dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: #fff;
}
.week li.done .dot { background: var(--green); }
.week li.today .dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }
.week .wd { font-size: 0.7rem; font-weight: 600; color: var(--ink-3); }
.week li.today .wd { color: var(--ink); }

.level { display: flex; flex-direction: column; gap: 10px; }
.rank { font-size: 1.25rem; font-weight: 700; }

.tile-link { display: flex; align-items: center; gap: 14px; text-decoration: none; padding: 16px; }
.tile-link:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.tile-icon {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2);
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px;
  font-weight: 500; font-size: 0.95rem; box-shadow: var(--shadow-2); max-width: calc(100vw - 32px);
}

/* ── Practice session ───────────────────────────────────── */

.session {
  height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) var(--gutter) max(12px, env(safe-area-inset-bottom));
}
.session-bar { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.session-title { font-size: 0.8rem; font-weight: 600; color: var(--ink-3); margin-bottom: 6px; }
.counter { min-width: 3.2em; text-align: right; font-weight: 700; font-size: 1.05rem; }
.session.timed .counter { font-size: 1.3rem; }
.session.timed .meter > i { background: var(--blue); transition: none; }

.stage {
  flex: 1 1 auto; min-height: 0; display: grid; place-items: center; overflow-y: auto;
  padding: 8px 0;
}
.pad { flex: none; padding-top: 8px; }

.card-face {
  position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 20px 12px; border-radius: var(--radius-l); text-align: center;
  transition: background 160ms ease;
}
.card-face > .problem { font-size: clamp(3rem, 15vw, 5.2rem); }
.card-face > .problem.stack-mul, .card-face > .problem.bracket { font-size: clamp(2.8rem, 13vw, 4.6rem); }
.card-face.good { background: var(--green-soft); }
.card-face.good .slot { color: var(--green); border-color: var(--green); }
.card-face.bad { background: var(--red-soft); }
.card-face.bad .slot { color: var(--red); border-color: var(--red); }
.card-face.fix > .problem, .card-face .reveal ~ .problem { font-size: clamp(2rem, 9vw, 3rem); }
.speed {
  display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-weight: 700;
  position: absolute; top: 10px; right: 14px;
}
.reveal { font-size: clamp(1.6rem, 7vw, 2.4rem); font-weight: 700; }
.tip { background: var(--gold-soft); color: var(--gold-ink); padding: 10px 14px; border-radius: var(--radius-s); font-size: 0.95rem; max-width: 34ch; }

.picture { margin: 0; display: grid; justify-items: center; gap: 8px; }
.picture figcaption { font-size: 0.875rem; color: var(--ink-2); max-width: 32ch; text-align: center; }
.array { width: 100%; height: auto; max-height: 22dvh; }
.array .dot { fill: var(--gold); }
.array .group { fill: var(--surface-2); }
.array .ghost { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-dasharray: 6 5; }

.lesson {
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  padding: 12px 4px; max-width: 30rem;
}
.lesson .rule { font-size: 1.3rem; font-weight: 650; }
.countdown { font-size: clamp(4rem, 22vw, 7rem); font-weight: 700; line-height: 1; }

/* The timed test borrows the look of the paper sheet. */
.session.paper .card-face { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); padding: 28px 12px; }

@media (max-height: 640px) {
  .card-face { gap: 8px; padding: 10px; }
  .array { max-height: 16dvh; }
}

/* ── Results ────────────────────────────────────────────── */

.results { display: flex; flex-direction: column; gap: 16px; padding-top: 24px; }
.score { font-size: clamp(3.4rem, 18vw, 5rem); font-weight: 700; line-height: 1; }
.score small { font-size: 0.35em; font-weight: 600; color: var(--ink-3); }
.celebrate { padding: 8px 0; }
.missed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.missed li { background: var(--surface-2); border-radius: var(--radius-s); padding: 10px 12px; display: grid; gap: 2px; font-size: 1.05rem; }
.sheet-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sheet-cell {
  position: relative; display: grid; place-items: center; min-height: 58px; padding: 8px 2px;
  border-radius: 8px; background: var(--surface-2); font-size: clamp(0.62rem, 2.6vw, 0.9rem); overflow: hidden;
}
.sheet-cell .problem .slot { min-width: 1.1em; }
.sheet-cell.right { background: var(--green-soft); }
.sheet-cell.wrong { background: var(--red-soft); }
.sheet-cell.wrong .slot { color: var(--red); text-decoration: line-through; }
.sheet-cell.blank { opacity: 0.6; }
.sheet-cell .fixed { position: absolute; top: 2px; right: 5px; font-size: 0.75em; font-weight: 700; color: var(--green); }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 24%); }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100dvh; pointer-events: none; z-index: 60; }

/* ── Fact board and help ────────────────────────────────── */

.tabs { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 999px; align-self: flex-start; }
.tab {
  min-height: 40px; padding: 0 18px; border-radius: 999px; border: 0; background: transparent;
  font-weight: 600; color: var(--ink-2); cursor: pointer; touch-action: manipulation;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.board-layout { display: grid; gap: 16px; }
@media (min-width: 900px) { .board-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } }
.fact-detail { display: flex; flex-direction: column; gap: 12px; }
.chip[data-status="learning"] { background: var(--st-learning); color: var(--st-learning-ink); }
.chip[data-status="practicing"] { background: var(--st-practicing); color: var(--st-practicing-ink); }
.chip[data-status="fluent"] { background: var(--st-fluent); color: var(--st-fluent-ink); }
.chip[data-status="mastered"] { background: var(--st-mastered); color: var(--st-mastered-ink); }
.group-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.group-row:last-child { border-bottom: 0; }

.help-grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .help-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.big-problem { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 420px) { .big-problem { grid-template-columns: minmax(0, 1fr) auto minmax(0, 0.7fr); } }
.video { width: 100%; border-radius: var(--radius-m); background: #000; aspect-ratio: 16 / 9; }
.video-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; text-align: left;
  border: 0; border-radius: var(--radius-s); background: transparent; cursor: pointer; font-weight: 500;
}
.video-row:hover { background: var(--surface-2); }
.video-row .tile-icon { width: 36px; height: 36px; border-radius: 10px; }
