/* Habla Loudr · Loudr Resources
   Calm by default: one thing per screen, generous space, extra help folded away.
   Palette: deep plum ink, jacaranda purple for actions, sun yellow for the main step and the mic. */
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 500; font-display: swap; src: url("fonts/fredoka-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
:root {
  --bg: #FBF6F4;
  --card: #FFFFFF;
  --ink: #2A1E3B;
  --ink-soft: #6E6380;
  --ink-faint: #A69CB3;
  --jacaranda: #6C4AD6;
  --jacaranda-deep: #4E31AE;
  --jacaranda-soft: #EFEAFD;
  --sun: #FFC53D;
  --sun-deep: #E09B00;
  --sun-soft: #FFF4D6;
  --mint: #1F9A68;
  --mint-soft: #E1F5EC;
  --coral: #D9434A;
  --coral-soft: #FDECEC;
  --mint-text: #167A52;   /* green and red for TEXT: 4.5:1 or more on white and on the soft tints */
  --coral-text: #B8323A;
  --line: #EDE5E3;
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 18px; line-height: 1.5;
  min-height: 100vh; -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--jacaranda-deep); }
:focus-visible { outline: 3px solid var(--jacaranda); outline-offset: 3px; }
main:focus, main:focus-visible { outline: none; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(28px, 7vw, 36px); }
h2 { font-size: 24px; }
small { display: block; font-size: 15px; color: var(--ink-soft); font-weight: 400; }
.center { text-align: center; }
.stack { display: grid; gap: 12px; }

/* ---------- Top bar ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 600px; margin: 0 auto; padding: 14px 20px 6px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px 11px 11px 3px;
  background: var(--ink); color: var(--sun);
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 16px;
}
.brand-name { font-family: var(--display); font-weight: 600; font-size: 20px; }
.bar-right { display: flex; align-items: center; gap: 8px; }
.streak { background: var(--sun-soft); border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: 16px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body[data-mode="player"] .bar { display: none; }

main { max-width: 600px; margin: 0 auto; padding: 8px 20px 48px; }

/* ---------- Generic screens ---------- */
.screen { display: grid; gap: 18px; padding-top: 8px; }
.center-screen { justify-items: center; text-align: center; padding-top: 28px; gap: 16px; }
.center-screen .btn.block { max-width: 420px; }
.hello-mark { font-size: 56px; line-height: 1; }
.lead { font-size: 19px; color: var(--ink-soft); margin: 0; max-width: 34ch; }
.tr-strong { color: var(--ink); font-weight: 700; }
.fine { font-size: 15px; color: var(--ink-soft); margin: 0; }
.kicker { margin: 0; font-weight: 700; font-size: 15px; color: var(--jacaranda-deep); }
.back {
  justify-self: start; display: inline-flex; align-items: center; min-height: 44px; padding: 6px 0;
  color: var(--ink-soft); font-weight: 700; font-size: 16px; text-decoration: none;
}
.center-screen .back { justify-self: center; }
.as-btn { background: none; border: none; }
.danger { color: var(--coral-text) !important; }

/* Translations under English */
.tr, .tr-title, .tr-say { display: block; color: var(--ink-soft); font-size: .85em; font-weight: 400; }
.tr-title { font-size: 18px; margin-top: -10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 12px 24px;
  border: none; border-radius: 16px;
  background: var(--jacaranda); color: #fff;
  font-weight: 700; font-size: 19px; text-decoration: none; text-align: center;
  box-shadow: 0 4px 0 var(--jacaranda-deep);
  transition: transform .06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--jacaranda-deep); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:active { box-shadow: inset 0 0 0 2px var(--line); }
.btn.sun { background: var(--sun); color: var(--ink); box-shadow: 0 4px 0 var(--sun-deep); }
.btn[disabled], .btn.disabled { opacity: .35; pointer-events: none; }
.text-btn { background: none; border: none; color: var(--jacaranda-deep); font-weight: 700; font-size: 16px; padding: 10px 0; min-height: 44px; justify-self: center; }
.hear {
  display: inline-grid; place-items: center; vertical-align: middle;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--jacaranda-soft); font-size: 18px; margin-left: 4px;
}

/* ---------- Choices (onboarding) ---------- */
.choices { display: grid; gap: 12px; width: 100%; }
.choice {
  width: 100%; text-align: left;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  background: var(--card); border: none; border-radius: var(--r);
  padding: 18px 18px; box-shadow: 0 0 0 1px var(--line);
}
.choice:hover { box-shadow: 0 0 0 2px var(--ink); }
.choice .ic { font-size: 32px; line-height: 1; }
.choice strong { font-size: 19px; }
.num {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--jacaranda-soft); color: var(--jacaranda-deep);
  font-family: var(--display); font-weight: 700; font-size: 22px;
}
.chev { width: 22px; height: 22px; fill: none; stroke: var(--ink-faint); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; transition: transform .15s; }

/* ---------- Home ---------- */
.hero-emoji { font-size: 60px; line-height: 1.1; }
.hero-emoji.small { font-size: 48px; }

/* ---------- Folds (expandable sections) ---------- */
.folds { display: grid; gap: 10px; margin-top: 22px; }
.screen .folds { margin-top: 0; }
.fold { background: var(--card); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); }
.fold > summary, .link-fold {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 16px 18px; min-height: 64px;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold[open] > summary .chev { transform: rotate(90deg); }
.link-fold { text-decoration: none; color: inherit; }
.fold-ic { font-size: 24px; line-height: 1; }
.fold-title { font-weight: 700; font-size: 18px; }
.fold-body { padding: 0 18px 18px; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row-btn {
  width: 100%; text-align: left; text-decoration: none; color: inherit;
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 14px;
  background: var(--card); border: none; border-radius: 16px; padding: 10px 14px 10px 10px;
  box-shadow: 0 0 0 1px var(--line);
}
.fold .row-btn { box-shadow: none; background: var(--bg); }
.row-btn strong { font-size: 18px; line-height: 1.25; display: block; }
.row-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: var(--sun-soft); }
.stone {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; justify-self: center;
  font-family: var(--display); font-weight: 700; font-size: 20px;
  background: var(--jacaranda-soft); color: var(--jacaranda-deep);
}
.level.current .stone { background: var(--jacaranda); color: #fff; }
.level.done .stone { background: var(--mint); color: #fff; }
.level.locked .stone, .level.locked .tag { opacity: .55; }
.level.locked .row-text strong { color: var(--ink-soft); }
.tag { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.stars { white-space: nowrap; letter-spacing: 1px; font-size: 18px; }
.stars .on { color: var(--sun-deep); }
.stars .off { color: var(--line); }
.center-screen .stars { font-size: 52px; letter-spacing: 6px; }
.panel { background: var(--card); border-radius: var(--r); padding: 18px; display: grid; gap: 10px; box-shadow: 0 0 0 1px var(--line); }
.check-panel { margin-top: 4px; }

/* ---------- Player ---------- */
body[data-mode="player"] main { padding-top: 14px; padding-bottom: 0; min-height: 100vh; display: flex; flex-direction: column; }
.player-top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.close-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent; font-size: 20px; color: var(--ink-soft); }
.progress { flex: 1; height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; background: var(--jacaranda); border-radius: 999px; transition: width .3s ease; }
.step { flex: 1; display: grid; gap: 18px; align-content: start; padding-bottom: 20px; }
.player-foot {
  position: sticky; bottom: 0; z-index: 3;
  background: linear-gradient(to bottom, rgba(251,246,244,0), var(--bg) 22%);
  padding: 18px 0 calc(16px + env(safe-area-inset-bottom));
}
.foot-row { display: flex; gap: 10px; }
.foot-row .btn { flex: 1; }
.feedback { min-height: 26px; margin: 0 0 10px; font-weight: 700; font-size: 18px; text-align: center; }
/* Answer banner: after an answer the bottom bar fills edge to edge with green or red */
.player-foot[data-kind="good"], .player-foot[data-kind="try"] { margin-inline: -20px; padding-inline: 20px; border-radius: 22px 22px 0 0; }
.player-foot[data-kind="good"] { background: var(--mint-soft); box-shadow: inset 0 3px 0 var(--mint); }
.player-foot[data-kind="try"] { background: var(--coral-soft); box-shadow: inset 0 3px 0 var(--coral); }
.player-foot[data-kind] .feedback { font-size: 20px; text-align: left; }
.player-foot[data-kind="good"] #next:not([disabled]) { background: var(--mint-text); box-shadow: 0 4px 0 #0F5A3C; }
.player-foot[data-kind="try"] #next:not([disabled]) { background: var(--coral-text); box-shadow: 0 4px 0 #8A2329; }
.fb-ic { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; font-size: 17px; margin-right: 4px; vertical-align: middle; }
.feedback.good .fb-ic { background: var(--mint-text); }
.feedback.try .fb-ic { background: var(--coral-text); }
.feedback.good { color: var(--mint-text); }
.feedback.try { color: var(--coral-text); }

.prompt { font-size: 24px; margin: 0; }

.speaker { display: flex; gap: 12px; align-items: flex-start; }
.avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.bubble { background: var(--card); border-radius: 6px 22px 22px 22px; padding: 12px 16px; box-shadow: 0 0 0 1px var(--line); }
.bubble .who { display: block; font-size: 14px; color: var(--ink-soft); }
.bubble .en { display: block; font-size: 22px; font-weight: 700; line-height: 1.3; }
.bubble .tr { margin-top: 4px; font-size: 17px; }

.play-pair { display: flex; gap: 8px; flex-wrap: wrap; }
.speaker + .play-pair { margin: -6px 0 0 64px; }
.center .play-pair { justify-content: center; }
.play {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: var(--jacaranda-soft); color: var(--jacaranda-deep);
  border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 16px;
}

.options { display: grid; gap: 10px; }
.option {
  text-align: left; background: var(--card); border: none; border-radius: 16px;
  padding: 16px 18px; font-size: 19px; font-weight: 700; line-height: 1.3;
  box-shadow: 0 0 0 2px var(--line);
}
.option .en { display: block; }
.opt-tr { display: none; margin-top: 2px; font-size: 16px; }
.options.show-tr .opt-tr { display: block; }
.option:hover:not([disabled]), .pic:hover:not([disabled]) { box-shadow: 0 0 0 2px var(--ink); }
.option.right, .pic.right { box-shadow: 0 0 0 3px var(--mint); background: var(--mint-soft); }
.option.wrong, .pic.wrong { box-shadow: 0 0 0 3px var(--coral); background: var(--coral-soft); animation: shake .35s; }
.option.picked, .pic.picked { box-shadow: 0 0 0 3px var(--jacaranda); background: var(--jacaranda-soft); }
.option[disabled], .pic[disabled] { cursor: default; }

.pics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pic {
  background: var(--card); border: none; border-radius: 20px; box-shadow: 0 0 0 2px var(--line);
  padding: 18px 8px 14px; display: grid; justify-items: center; gap: 6px; font-size: 17px; font-weight: 700;
}
.pic .emo { font-size: 56px; line-height: 1.1; }

/* Say: the phrase, how it sounds, then the sun mic */
.say-card { display: grid; justify-items: center; gap: 10px; text-align: center; }
.say-phrase { font-family: var(--display); font-weight: 600; font-size: clamp(28px, 7.5vw, 38px); line-height: 1.15; margin: 0; }
.tr-say { font-size: 18px; }
.mic-zone { display: grid; justify-items: center; gap: 10px; padding-top: 6px; }
.mic {
  width: 120px; height: 120px; border-radius: 50%; border: none;
  background: var(--sun);
  box-shadow: 0 7px 0 var(--sun-deep), 0 0 0 10px var(--sun-soft);
  display: grid; place-items: center; transition: transform .1s, box-shadow .1s;
}
.mic:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--sun-deep), 0 0 0 10px var(--sun-soft); }
.mic svg { width: 50px; height: 50px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mic.listening { animation: pulse 1.1s ease-in-out infinite; }
.mic-label { font-weight: 700; color: var(--ink-soft); }
.heard { background: var(--card); border-radius: 14px; padding: 8px 14px; font-size: 17px; box-shadow: 0 0 0 1px var(--line); }
.heard.good { background: var(--mint-soft); box-shadow: 0 0 0 2px var(--mint); }
.heard.close { box-shadow: 0 0 0 2px var(--sun); }

/* How it sounds */
.sounds > summary { min-height: 56px; padding: 12px 16px; }
.sounds .fold-body { padding: 0 16px 16px; }
.sound-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sound-list li {
  display: grid; grid-template-columns: minmax(96px, auto) 1fr; align-items: center; gap: 12px;
  background: var(--bg); border-radius: 14px; padding: 8px 10px;
}
.word-btn { border: none; background: transparent; text-align: left; font-weight: 700; font-size: 18px; padding: 4px 2px; min-height: 44px; white-space: nowrap; }
.syls { display: flex; flex-wrap: wrap; gap: 6px; }
.syl {
  background: var(--card); border-radius: 10px; padding: 4px 10px;
  font-family: var(--display); font-size: 19px; font-weight: 500; color: var(--ink-soft);
  box-shadow: 0 0 0 1px var(--line);
}
.syl.stress { background: var(--sun); color: var(--ink); font-weight: 700; box-shadow: none; }
.hint { margin: 10px 0 0; font-size: 15px; color: var(--ink-soft); }

/* Build */
.build-cue { display: grid; gap: 2px; background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: 0 0 0 1px var(--line); }
.build-cue strong { font-size: 21px; }
.answer-row {
  min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; align-content: center;
  padding: 10px 12px; border-radius: 16px; border: 2px dashed var(--line);
}
.answer-hint { color: var(--ink-soft); font-size: 16px; }
.answer-row.right { border: 2px solid var(--mint); background: var(--mint-soft); }
.answer-row.wrong { border: 2px solid var(--coral); animation: shake .35s; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile { border: none; background: var(--card); border-radius: 12px; padding: 9px 14px; min-height: 44px; font-size: 19px; font-weight: 700; box-shadow: 0 0 0 2px var(--line), 0 3px 0 var(--line); }
.tile.used { visibility: hidden; }
.answer-row .tile { background: var(--jacaranda-soft); box-shadow: none; }

/* ---------- Results, backup, settings ---------- */
.score-ring { width: 160px; height: 160px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--jacaranda) calc(var(--p) * 1%), var(--line) 0); }
.score-ring > div { width: 126px; height: 126px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; align-content: center; }
.score-ring b { font-family: var(--display); font-size: 46px; line-height: 1; }
.score-ring span { color: var(--ink-soft); font-size: 15px; }
.dots { display: flex; gap: 6px; }
.dots span { width: 28px; height: 6px; border-radius: 999px; background: var(--line); }
.dots span.on { background: var(--jacaranda); }
.qr { display: grid; place-items: center; background: #fff; border-radius: 20px; padding: 14px; box-shadow: 0 0 0 1px var(--line); }
.qr img { width: min(260px, 72vw); height: auto; image-rendering: pixelated; }
#backupStep { display: grid; gap: 16px; }
.cert-preview { width: 100%; border-radius: 14px; box-shadow: 0 0 0 1px var(--line); }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch { position: relative; width: 58px; height: 34px; flex: none; border-radius: 999px; border: none; background: var(--line); }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch[aria-checked="true"] { background: var(--jacaranda); }
.switch[aria-checked="true"]::after { left: 28px; }
textarea, input[type="text"] {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg);
  border: 2px solid var(--line); border-radius: 12px; padding: 12px;
}
textarea { min-height: 96px; resize: vertical; word-break: break-all; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 18px;
  font-weight: 700; z-index: 20; max-width: calc(100% - 32px);
}

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pulse {
  0%, 100% { box-shadow: 0 7px 0 var(--sun-deep), 0 0 0 10px var(--sun-soft); }
  50% { box-shadow: 0 7px 0 var(--sun-deep), 0 0 0 24px rgba(255, 197, 61, 0); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 400px) {
  body { font-size: 17px; }
  main { padding-left: 16px; padding-right: 16px; }
  .bubble .en { font-size: 20px; }
  .option { font-size: 18px; }
  .speaker + .play-pair { margin-left: 0; }
}

/* =========================================================
   Portal (home), progress, tour, my data, listening
   ========================================================= */
.portal { display: grid; gap: 16px; padding-top: 4px; }
.hello-row { display: grid; gap: 2px; }
.card { background: var(--card); border-radius: 24px; padding: 18px; display: grid; gap: 12px; box-shadow: 0 0 0 1px var(--line); }

.bar-track { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar-track > div { height: 100%; border-radius: 999px; background: var(--jacaranda); transition: width .4s ease; }
.bar-track.sun > div { background: var(--sun-deep); }
.bar-track.thin { height: 7px; margin-top: 6px; }

.plan { background: var(--ink); color: #fff; box-shadow: none; }
.plan-head { display: grid; gap: 8px; }
.plan-head strong { font-family: var(--display); font-weight: 600; font-size: 21px; }
.plan .bar-track { background: rgba(255,255,255,.15); }
.plan-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plan-step {
  display: grid; grid-template-columns: 34px 40px 1fr auto; align-items: center; gap: 10px;
  text-decoration: none; color: #fff; background: rgba(255,255,255,.07); border-radius: 16px; padding: 12px;
}
.plan-step.next { background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 2px var(--sun); }
.plan-step.done .plan-text strong { color: var(--ink-soft); }
.plan-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 16px; background: rgba(255,255,255,.16); }
.plan-step.done .plan-num { background: var(--mint); }
.plan-step.next .plan-num { background: var(--sun); color: var(--ink); }
.plan-ic { font-size: 28px; line-height: 1; text-align: center; }
.plan-text strong { display: block; font-size: 17px; line-height: 1.25; }
.plan-text small { color: #CFC5EA; font-size: 14px; }
.plan-text .bar-track { height: 6px; margin-top: 6px; }
.plan-text .bar-track > div { background: var(--sun); }
.plan .chev { stroke: rgba(255,255,255,.5); }

.pc-head { display: flex; justify-content: space-between; align-items: baseline; }
.pc-head strong { font-family: var(--display); font-weight: 600; font-size: 21px; }
.pc-pct { font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--jacaranda-deep); }
.progress-card .fine { margin-top: -6px; }

/* Level path picture: five stops on a line */
.lvl-path { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); }
.lp { position: relative; display: grid; justify-items: center; gap: 6px; }
.lp::before { content: ""; position: absolute; top: 19px; left: -50%; width: 100%; height: 5px; background: var(--line); z-index: 0; }
.lp:first-child::before { display: none; }
.lp-fill { position: absolute; top: 19px; left: 50%; width: calc(var(--p) * 1); max-width: 100%; height: 5px; background: var(--jacaranda); z-index: 0; }
.lp:last-child .lp-fill { display: none; }
.lp-dot {
  position: relative; z-index: 1; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 18px;
  background: var(--card); color: var(--ink-soft); box-shadow: 0 0 0 3px var(--line);
}
.lp.current .lp-dot { background: var(--jacaranda); color: #fff; box-shadow: 0 0 0 4px var(--jacaranda-soft); }
.lp.done .lp-dot { background: var(--mint); color: #fff; box-shadow: none; }
.lp.done .lp-fill { width: 100%; background: var(--mint); }
.lp.locked .lp-dot { font-size: 14px; }
.lp-name { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.lp.current .lp-name { color: var(--jacaranda-deep); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.stats > div { background: var(--bg); border-radius: 16px; padding: 10px 8px; text-align: center; }
.stats b { display: block; font-family: var(--display); font-size: 20px; }
.stats small { font-size: 13px; line-height: 1.2; }
.level-meter { display: grid; gap: 6px; }

/* Tour */
.tour { gap: 18px; }
.tour-pic { font-size: 84px; line-height: 1; padding: 8px 0; }
.big-symbol { font-family: var(--display); font-weight: 700; color: var(--jacaranda-deep); }
.flow { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.flow-item { display: grid; justify-items: center; gap: 4px; background: var(--card); border-radius: 16px; padding: 12px 10px; min-width: 88px; box-shadow: 0 0 0 1px var(--line); font-weight: 700; font-size: 15px; }
.flow-ic { font-size: 30px; line-height: 1; }
.flow-arrow { color: var(--ink-faint); font-size: 22px; font-weight: 700; }
.sample { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 16px; padding: 12px 14px; box-shadow: 0 0 0 1px var(--line); }
.lvl-path.demo { width: 100%; max-width: 420px; }

/* My data */
.data-hero { grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; }
.dh-side { display: grid; justify-items: center; gap: 2px; }
.dh-ic { font-size: 44px; line-height: 1.1; }
.dh-mid { position: relative; width: 70px; height: 40px; display: grid; place-items: center; }
.dh-line { position: absolute; left: 0; right: 0; top: 50%; border-top: 3px dashed var(--line); }
.dh-x { position: relative; width: 32px; height: 32px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center; font-weight: 700; }
.proof-row { display: flex; align-items: center; gap: 14px; }
.proof-num { width: 60px; height: 60px; flex: none; border-radius: 18px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 34px; background: var(--mint-soft); color: var(--mint-text); }
.proof-num.bad { background: var(--coral-soft); color: var(--coral-text); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 16px; }
.checks li { color: var(--ink); }
.fold.inner { box-shadow: none; background: var(--bg); }
.fold.inner > summary { min-height: 48px; padding: 10px 14px; grid-template-columns: 1fr auto; }
.kv { margin: 0; display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: none; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; font-weight: 700; text-align: right; }
.small-kv { font-size: 15px; padding: 4px 12px 8px; background: var(--bg); border-radius: 12px; margin-top: 6px; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.log summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.log summary::-webkit-details-marker { display: none; }
.log-time { font-size: 13px; color: var(--ink-soft); font-weight: 700; white-space: nowrap; }
.log-what { font-size: 16px; }
.raw { font-size: 12px; line-height: 1.4; white-space: pre-wrap; word-break: break-all; background: var(--bg); border-radius: 12px; padding: 12px; max-height: 360px; overflow: auto; margin: 0; }

/* Listening */
.listen-progress > div { background: var(--sun-deep); }
.listen-min { font-weight: 700; font-size: 15px; color: var(--ink-soft); white-space: nowrap; }
.phase-tabs { display: flex; gap: 8px; margin: -8px 0 18px; }
.phase-tabs span { flex: 1; text-align: center; font-size: 14px; font-weight: 700; color: var(--ink-soft); padding: 6px 0; border-bottom: 3px solid var(--line); }
.phase-tabs span.on { color: var(--jacaranda-deep); border-color: var(--jacaranda); }
.listen-head { display: flex; gap: 14px; align-items: center; }
.listen-emoji { font-size: 48px; line-height: 1; }
.script { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.script li { background: var(--card); border-radius: 16px; padding: 10px 14px; box-shadow: 0 0 0 1px var(--line); transition: transform .2s, box-shadow .2s; }
.script li.m { margin-left: 28px; }
.script li.f { margin-right: 28px; }
.script .who { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.script .en { font-size: 18px; font-weight: 700; }
.script .dots-line { display: none; color: var(--ink-soft); letter-spacing: 2px; }
.script.hidden-text .en { display: none; }
.script.hidden-text .dots-line { display: block; }
.script li.speaking { box-shadow: 0 0 0 3px var(--sun); transform: scale(1.02); }

/* ---------- No dead ends: storage warning, leave confirm ---------- */
.storage-warn {
  background: var(--coral-soft); color: var(--ink); border-bottom: 2px solid var(--coral);
  padding: 10px 16px; text-align: center; font-weight: 700; font-size: 16px;
}
.ask-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(42, 30, 59, .45);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
.ask {
  background: var(--card); border-radius: var(--r); padding: 22px 20px; width: 100%; max-width: 440px;
  display: grid; gap: 10px; box-shadow: 0 10px 40px rgba(42, 30, 59, .25);
}
.ask h2 { margin: 0; font-family: var(--display); font-size: 26px; }
.ask p { margin: 0 0 6px; color: var(--ink-soft); }
#codeText { margin-top: 4px; }
.voice-warn {
  margin: 8px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--sun-soft); color: var(--ink);
  font-size: 15px; line-height: 1.4;
}

/* ---------- Accessibility helpers ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mark { display: inline-flex; align-items: center; margin-left: 8px; font-weight: 700; font-size: 18px; }
.mark.ok { color: var(--mint-text); }
.mark.no { color: var(--coral-text); }
.pic .mark { position: absolute; top: 6px; right: 8px; margin: 0; }
.pic { position: relative; }
/* Headings get focus only so screen readers start there; they are not controls, so no focus ring */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible, h2[tabindex="-1"]:focus-visible { outline: none; }

/* ---------- Information pages ---------- */
.legal-sec h2 { margin: 0 0 6px; font-family: var(--display); font-size: 22px; }
.legal-sec p { margin: 0 0 8px; }
.legal-sec ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.legal-links { text-align: center; font-size: 15px; color: var(--ink-soft); line-height: 2.6; }
.legal-links a { display: inline-block; min-height: 44px; line-height: 44px; }

/* ---------- My data: where exactly ---------- */
.where { display: grid; gap: 8px; }
.where-mine { margin: 6px 0 0; }
.where-steps { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.option { position: relative; padding-right: 52px; }
.option .mark { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); margin: 0; }

/* ---------- Listening: repeat 3 times, your turn ---------- */
.play[aria-pressed="true"] { background: var(--jacaranda); color: #fff; }
.your-turn { margin: 0; min-height: 28px; font-weight: 700; font-size: 18px; text-align: center; }
.your-turn.go { color: var(--jacaranda-deep); }
.your-turn.done { color: var(--mint-text); }
.turn-bar { display: block; height: 6px; margin-top: 8px; border-radius: 999px; background: var(--jacaranda); transform-origin: left; animation: turnbar linear forwards; }
@keyframes turnbar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .turn-bar { animation: none; } }
