/* The lesson player's styles (aag-2564). COPIED from the old app's study page and trimmed;
 * nothing here links to web/. Sources, by block:
 *   header        web/static/css/phaseb.css:58-107 and the phone rules at 1485-1498
 *   shell         web/static/css/phaseb.css:42-56 and its phone rules at 1485-1498; the
 *                 landscape is _atmosphere.html with atmosphere.css and atmosphere.js
 *   card (r52)    web/static/css/phaseb.css: paper 185-247, front 274-410, back 448-660,
 *                 kanji and role tooltip 686-816, phone rules 1485-1515
 *   panel (r54)   web/static/js/lib/session_wait.js:66-74 (layout) and phaseb.css done screen
 *                 1278-1335, 1397-1414 (ring, count, heading, button)
 *   controls (r53) phaseb.css reveal and rating 829-1097, 1516; card report menu 2498-2606
 *   primer (r60)  phaseb.css grammar primers 1524-1933
 * Files, linked in this order: tokens.css (the look values, with the --lav-* bridge the
 * phaseb.css rules read), player.css (this one: page, header), player-card.css
 * (the card), player-panel.css (message panel, reveal and rating, the "..." menu, the plain
 * button rule), player-primer.css (the primer, one page at a time). */

/* ── Page: the landscape (atmosphere.css) behind the shell ── */
html { font-size: 16px; -webkit-font-smoothing: antialiased; background: #e4e3de; }
body {
  color: var(--ink);
  font-family: var(--font-display);
  margin: 0;
}
button { font-family: inherit; }
.hidden { display: none; }
#particles, #fireflyCanvas { display: none; }  /* phaseb.css:16-17: none during a lesson */

/* ── Shell (phaseb.css .dk-shell 42-56): header on top, the card centred, its buttons held at
   the bottom; above the scene (z-index 55), which takes the pointer around the shell's parts. ── */
.dk-shell {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 60px 36px;
  padding-top: calc(28px + env(safe-area-inset-top, 0px));
  padding-right: calc(60px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(36px + var(--safe-bottom));
  padding-left: calc(60px + env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  position: relative;
  z-index: 55;
  pointer-events: none;
}
.dk-shell :is(.dk-head, .dk-modal, .dk-actions) { pointer-events: auto; }
main { flex: 1; display: flex; flex-direction: column; }
#card:not(.hidden) { flex: 1; display: flex; flex-direction: column; }
#panel { margin: auto; }

/* ── Header (phaseb.css .dk-head 58-68, .dk-quit 170-181, atmosphere.css .brand 354-358).
   Three fixed columns, so Quit stays top right whatever else shows (the old row spaced its
   items apart, and Quit moved left when the progress was hidden on a phone). ── */
.dk-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 0 24px;
}
.dk-brand {
  grid-column: 1;
  justify-self: start;
  font: var(--fw-light) var(--fs-lead)/1 var(--font-en);
  color: var(--ink-faint);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 1.4s ease;
}
.dk-progress { grid-column: 2; }
.dk-quit {
  grid-column: 3;
  justify-self: end;
  font-family: var(--lav-ui);
  font-size: 11px;
  font-weight: 700;
  color: var(--lav-ink-muted);
  text-decoration: none;
  border: 1px solid var(--lav-hairline);
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.8);
}
.dk-quit:hover { border-color: var(--lav-purple); color: var(--lav-purple); }
.atmosphere.is-caught-up ~ .dk-shell .dk-brand { color: rgba(235,232,245,0.92); }
.atmosphere.is-night ~ .dk-shell .dk-brand { color: rgba(210,205,230,0.88); }
/* The text that sits on the sky: at dusk (a lit sky) a deeper dark ink with a light halo, at
   night a light ink (the old done screen's dusk and night inks, phaseb.css:2451-2489; the old
   study page left this text dark on both). */
.atmosphere.is-caught-up ~ .dk-shell :is(.dk-phase-label, .dk-progress__num, .dk-reveal-prompt,
                                         .dk-already-know) {
  color: #0e0a1c;
  text-shadow: 0 1px 2px rgba(255,255,255,0.45);
}
.atmosphere.is-caught-up ~ .dk-shell .dk-phase-label {
  background: color-mix(in srgb, var(--phase-tint) 30%, rgba(255,255,255,0.22));
  border-color: rgba(22,18,42,0.26);
}
.atmosphere.is-night ~ .dk-shell :is(.dk-phase-label, .dk-progress__num, .dk-reveal-prompt,
                                     .dk-already-know) {
  color: rgba(230,225,245,0.9);
}
.atmosphere.is-night ~ .dk-shell .dk-progress__bar { background: rgba(230,225,245,0.14); }
.atmosphere.is-night ~ .dk-shell .dk-phase-label {
  background: color-mix(in srgb, var(--phase-tint) 34%, rgba(230,225,245,0.14));
}
.dk-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dk-progress__bar {
  width: 140px;
  height: 4px;
  background: rgba(74,72,120,0.14);
  border-radius: 2px;
  overflow: hidden;
}
.dk-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--lav-purple), #b08cff);
  transition: width 0.3s ease;
}
.dk-progress__num {
  font-family: var(--lav-ui);
  font-size: 12px;
  font-weight: 800;
  color: var(--lav-ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dk-phase-label {
  --phase-tint: var(--stone);
  --phase-ink: color-mix(in srgb, var(--stone) 85%, var(--ink));
  font-family: var(--lav-ui);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--phase-ink);
  background: color-mix(in srgb, var(--phase-tint) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--phase-tint) 45%, transparent);
  border-radius: 6px;
  padding: 3px 10px;
}
.dk-phase-label.is-learning {
  --phase-tint: var(--gold);
  --phase-ink: color-mix(in srgb, var(--gold) 55%, #3d2a05);
}
/* Off the card (primer, finish, errors) the row keeps its height, so nothing below jumps. */
.dk-progress.is-off { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .dk-progress__fill { transition: none; }
}
@media (max-width: 900px) {
  .dk-shell {
    padding: 16px 16px 24px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(24px + var(--safe-bottom));
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    max-width: 540px;
  }
  .dk-head { padding: 6px 0 12px; }
  .dk-progress__bar { width: 80px; }
  .dk-progress__num { font-size: 11px; }
}
/* With the brand hidden, Quit keeps its own width and the progress bar gives way to it. */
@media (max-width: 540px) {
  .dk-brand { display: none; }
  .dk-head { grid-template-columns: 1fr minmax(0, auto) 1fr; }
}

/* ── The primer and the finish panel keep the 640px column they had (the primer's paper panel
   inside it is 520px wide, r60). ── */
#primer { width: 100%; max-width: 640px; margin-left: auto; margin-right: auto; }

