:root {
  --snow: #f4f7fb;
  --card: #ffffff;
  --ink: #1b2330;
  --muted: #5b6676;
  --verte: #2e9d4a;
  --bleue: #1f6fd1;
  --rouge: #d63b3b;
  --noire: #1b1b1f;
  --line: #dde3ec;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--snow); color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
.loading { text-align: center; color: var(--muted); margin-top: 40vh; }
.hidden { display: none; }

.top { text-align: center; margin: 12px 0 20px; }
.top h1 { margin: 0; font-size: 2rem; color: var(--bleue); letter-spacing: -0.5px; }
.sub { margin: 2px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 6px; text-align: center; display: flex; flex-direction: column; }
.stat .n { font-size: 1.8rem; font-weight: 700; }
.stat .fr { font-weight: 600; }
.stat .en { font-size: 0.8rem; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.kicker { margin: 0; text-transform: uppercase; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 1px; color: var(--bleue); }
.prompt { margin: 0; color: var(--muted); }
.fr { margin: 0; font-weight: 600; }
.fr.big { font-size: 1.6rem; }
.en { margin: 0; color: var(--muted); }
.sentence { font-size: 1.2rem; }
.gap { display: inline-block; min-width: 4ch; border-bottom: 2px solid var(--bleue); color: var(--bleue); }
.context { border-left: 4px solid var(--verte); padding-left: 12px; display: flex; flex-direction: column; gap: 6px; }

button { font: inherit; cursor: pointer; border-radius: 12px; border: 0; }
button:disabled { cursor: default; }
.btn-primary { background: var(--bleue); color: #fff; padding: 14px; font-weight: 700; }
.btn-primary.big { width: 100%; font-size: 1.2rem; padding: 18px; }
.btn-primary:disabled { background: var(--line); color: var(--muted); }
.btn-secondary { background: var(--card); color: var(--bleue); border: 2px solid var(--bleue); padding: 12px; font-weight: 700; }
.btn-link { background: none; color: var(--muted); padding: 10px; text-decoration: underline; width: 100%; }
.quit { width: auto; display: block; margin: 0 0 6px auto; }

.audio-row { display: flex; gap: 8px; }
.btn-audio { background: #e7effb; color: var(--bleue); padding: 10px 14px; font-weight: 700; }
.btn-audio.slow { background: #eef1f5; color: var(--muted); }

.options { display: flex; flex-direction: column; gap: 10px; }
.option { background: var(--card); border: 2px solid var(--line); padding: 14px; text-align: left; color: var(--ink); }
.option.right { border-color: var(--verte); background: #e8f6ec; }
.option.wrong { border-color: var(--rouge); background: #fdecec; }

.feedback { border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.feedback.ok { background: #e8f6ec; color: #1e6b33; }
.feedback.bad { background: #fdecec; color: #9b2525; }

.big { font-size: 1.6rem; margin: 0; }
.type-in { font: inherit; font-size: 1.15rem; padding: 12px; border: 2px solid var(--line); border-radius: 12px; width: 100%; }
.type-in:focus { outline: none; border-color: var(--bleue); }
.accent-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.accent { background: #eef1f5; color: var(--ink); min-width: 40px; padding: 8px; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.btn-mic { background: var(--rouge); color: #fff; padding: 16px; font-weight: 700; font-size: 1.1rem; }
.btn-mic:disabled { background: #e48a8a; }
.mic-status { margin: 0; color: var(--muted); min-height: 1.4em; }
.feedback.neutral { background: #eef1f5; color: var(--ink); }
.grade-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pic { width: 160px; height: 160px; align-self: center; }

.tier-card { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-left: 8px solid var(--tier); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.tier-badge { width: 72px; height: 72px; border-radius: 50%; background: var(--tier); color: #fff; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 0.95rem; }
.tier-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tier-name { margin: 0; font-weight: 700; font-size: 1.15rem; }
.promo { background: var(--tier); color: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  display: flex; flex-direction: column; align-items: center; font-size: 1.2rem; }
.week { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.week-head { display: flex; justify-content: space-between; }
.meter { height: 14px; background: var(--line); border-radius: 7px; overflow: hidden; }
.meter .fill { height: 100%; transition: width 0.4s; }
.catchup { margin: 0; color: var(--rouge); font-weight: 600; font-size: 0.9rem; }
.ghost { width: 100%; height: auto; }
.ghost .axis { font-size: 10px; fill: var(--muted); }
.ghost .target-line { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1; }
.ghost .ghost-line { fill: none; stroke: #c3cbd6; stroke-width: 2; }
.ghost .ghost-line.recent { stroke: #8a96a8; stroke-dasharray: 6 4; }
.ghost .current-line { fill: none; stroke-width: 3.5; stroke-linejoin: round; }
.ghost-note { font-size: 0.9rem; }
.session-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.session-top .progress { flex: 1; margin: 0; }
.session-top .quit { width: auto; margin: 0; }
.xp-pill { font-weight: 700; color: var(--verte); white-space: nowrap; }
.xp-big { font-size: 2rem; font-weight: 800; color: var(--verte); margin: 0; }

.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.progress .bar { height: 100%; background: var(--verte); transition: width 0.3s; }

.done { text-align: center; }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.side-card .btn-link { text-align: left; padding: 6px 0; }
.scene-btn { text-align: left; }
.scene-btn:disabled { color: var(--muted); border-color: var(--line); }
.spacer { flex: 1; }
.goal { font-size: 0.9rem; }
.convo { display: flex; flex-direction: column; gap: 10px; }
.bubble { border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; max-width: 92%; }
.bubble.them { background: #e7effb; align-self: flex-start; }
.bubble.me { background: #e8f6ec; align-self: flex-end; }
.bubble .who { margin: 0; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.bubble .audio-row { flex-wrap: wrap; }
.bubble .btn-audio { padding: 6px 10px; font-size: 0.85rem; }
.hidden-text { filter: blur(6px); user-select: none; }
.reply { font-weight: 600; }
details summary { cursor: pointer; color: var(--muted); }
.update-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; background: var(--card);
  border: 2px solid var(--bleue); border-radius: 12px; padding: 10px 12px; display: flex;
  align-items: center; justify-content: space-between; gap: 10px; z-index: 9; }
.update-banner .btn-primary { padding: 10px 14px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; background: var(--noire); color: #fff;
  padding: 12px 16px; border-radius: 12px; z-index: 10; }
