:root {
  --ink: #1d2340; --ink2: #4a5072; --muted: #7b8098; --line: #e4e0d8; --bg: #faf7f2; --card: #fff;
  --accent: #d9475f; --accent-ink: #fff; --teal: #17807e; --gold: #b8860b; --gold-bg: #fdf3d7;
  --ok: #1d7a4c; --ok-bg: #e4f4ea; --no: #b3261e; --no-bg: #fbe9e7; --warn-bg: #fff4d6;
  --radius: 14px; --shadow: 0 1px 2px rgba(29,35,64,.06), 0 6px 20px rgba(29,35,64,.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.5; -webkit-text-size-adjust: 100%; }
a { color: var(--teal); }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .3rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: .875rem; }
[lang="fr"] { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; font-size: 1.06em; }

#top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--ink); color: #fff; }
#top .brand { color: #fff; text-decoration: none; font-size: 1.05rem; letter-spacing: .01em; white-space: nowrap; }
#top .brand b { color: #ffd166; font-weight: 700; }
#nav { margin-left: auto; display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; font-size: .85rem; text-decoration: none; border: 0; cursor: pointer; font: inherit; font-size: .85rem; }
.pill.gold { background: #ffd166; color: var(--ink); font-weight: 600; }
.pill.on { background: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 1.1rem 1rem 7rem; outline: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: .9rem 0; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.hero { background: var(--ink); color: #fff; border-color: var(--ink); }
.card.hero .muted { color: #b9bdd6; } .card.hero a { color: #ffd166; }
.card.gold { background: var(--gold-bg); border-color: #efd9a0; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: .6rem; }

button, .btn { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .6rem 1rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; }
button:hover, .btn:hover { border-color: var(--ink2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(.95); }
button.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
button.quiet { border-color: transparent; background: transparent; color: var(--teal); padding: .4rem .5rem; min-height: 36px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.big, .btn.big { width: 100%; padding: .85rem 1rem; font-size: 1.05rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], textarea, select { font: inherit; width: 100%; padding: .65rem .75rem; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 3px solid rgba(23,128,126,.35); outline-offset: 1px; border-color: var(--teal); }
label { display: block; font-size: .875rem; color: var(--ink2); margin: .6rem 0 .2rem; }

/* progress bars */
.bar { height: 10px; border-radius: 999px; background: #ebe6dc; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .4s; }
.bar.gold > i { background: #e0a82e; }
.stat { font-size: 1.6rem; font-weight: 700; line-height: 1.1; } .stat small { font-size: .8rem; font-weight: 500; color: var(--muted); display: block; }

/* the week */
.day { border-top: 1px solid var(--line); padding: .7rem 0; } .day:first-of-type { border-top: 0; }
.day > .row { gap: .5rem; } .day h3 { margin: 0; font-size: .95rem; }
.day.done h3 { color: var(--ok); } .day.locked { opacity: .5; }
.steps { list-style: none; padding: 0; margin: .4rem 0 0; }
.steps li { display: flex; align-items: center; gap: .6rem; padding: .3rem 0; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: 0 0 auto; display: grid; place-items: center; font-size: .75rem; color: #fff; }
.dot.done { background: var(--ok); border-color: var(--ok); } .dot.open { border-color: var(--accent); } .dot.later { background: var(--gold); border-color: var(--gold); }
.tag { font-size: .72rem; padding: .1rem .45rem; border-radius: 999px; background: var(--gold-bg); color: #7a5a00; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.no { background: var(--no-bg); color: var(--no); } .tag.plain { background: #eef0f6; color: var(--ink2); }

/* lesson */
.ex { display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; align-items: start; padding: .45rem 0; border-top: 1px dashed var(--line); }
.ex:first-child { border-top: 0; } .ex .en { grid-column: 2; color: var(--muted); font-size: .9rem; }
.say { width: 34px; min-height: 34px; height: 34px; padding: 0; border-radius: 50%; grid-row: span 2; }
.tip { background: var(--warn-bg); border-radius: 10px; padding: .55rem .75rem; font-size: .92rem; }

/* exercises */
.q { font-size: 1.12rem; margin: .2rem 0 .8rem; }
.opts { display: grid; gap: .5rem; } .opts button { justify-content: flex-start; text-align: left; }
.opts button.sel { border-color: var(--teal); background: #e6f3f2; }
.opts button.right { border-color: var(--ok); background: var(--ok-bg); } .opts button.wrong { border-color: var(--no); background: var(--no-bg); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; min-height: 48px; padding: .4rem; border: 1.5px dashed var(--line); border-radius: 10px; }
.chips.bank { border-style: solid; background: #f4f1ea; }
.chip { padding: .35rem .7rem; min-height: 38px; border-radius: 8px; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; } .match button { min-height: 46px; }
.match button.sel { border-color: var(--teal); background: #e6f3f2; } .match button.gone { visibility: hidden; }
.fb { border-radius: 10px; padding: .6rem .8rem; margin-top: .8rem; } .fb.ok { background: var(--ok-bg); color: #145a38; } .fb.no { background: var(--no-bg); color: #7d1a14; } .fb.warn { background: var(--warn-bg); }
.inrow { display: flex; gap: .5rem; } .inrow input { flex: 1; } .mic { width: 46px; padding: 0; flex: 0 0 46px; } .mic.live { background: var(--accent); color: #fff; border-color: var(--accent); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: .2rem .6rem; border-radius: 8px; background: var(--ink); color: #fff; } .timer.low { background: var(--no); }
.heard mark { background: var(--no-bg); color: var(--no); border-radius: 4px; padding: 0 .15rem; } .heard .hit { color: var(--ok); }

/* results */
table.marks { width: 100%; border-collapse: collapse; font-size: .92rem; } table.marks td, table.marks th { padding: .4rem .35rem; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.shot { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; text-align: center; } .scores div { background: #f4f1ea; border-radius: 10px; padding: .5rem .2rem; } .scores b { display: block; font-size: 1.3rem; }

/* chat */
.chat { display: flex; flex-direction: column; gap: .5rem; max-height: 52vh; overflow-y: auto; padding: .2rem; }
.bubble { max-width: 85%; padding: .55rem .8rem; border-radius: 14px; } .bubble.tutor { background: #eef0f6; align-self: flex-start; border-bottom-left-radius: 4px; } .bubble.me { background: var(--teal); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

/* flash cards */
.flash { min-height: 190px; display: grid; place-items: center; text-align: center; font-size: 1.5rem; cursor: pointer; user-select: none; }
.flash small { display: block; font-size: .85rem; color: var(--muted); margin-top: .6rem; }

/* accent bar */
#accentbar { position: fixed; z-index: 50; background: var(--ink); color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
#accentbar button { min-height: 38px; min-width: 38px; padding: 0 .3rem; border-radius: 8px; background: rgba(255,255,255,.1); border: 0; color: #fff; font-size: 1.1rem; font-family: Georgia, serif; }
#accentbar button:hover, #accentbar button.on { background: var(--accent); }
#accentbar.side { right: 0; top: 30%; border-radius: 12px 0 0 12px; display: flex; align-items: flex-start; }
#accentbar.side .handle { writing-mode: vertical-rl; min-height: 86px; min-width: 30px; font-family: system-ui, sans-serif; font-size: .8rem; border-radius: 12px 0 0 12px; letter-spacing: .05em; }
#accentbar.side .keys { display: grid; grid-template-columns: repeat(3, 38px); gap: 4px; padding: 6px; }
#accentbar.side.closed .keys { display: none; }
#accentbar.bottom { left: 0; right: 0; bottom: 0; display: flex; padding: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
#accentbar.bottom .handle { display: none; } #accentbar.bottom .keys { display: flex; gap: 4px; overflow-x: auto; width: 100%; } #accentbar.bottom .keys button { flex: 0 0 38px; }
.holdpop { position: fixed; z-index: 60; background: var(--ink); border-radius: 10px; padding: 5px; display: flex; gap: 4px; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.holdpop button { min-width: 40px; min-height: 44px; background: rgba(255,255,255,.12); border: 0; color: #fff; font-size: 1.15rem; font-family: Georgia, serif; flex-direction: column; gap: 0; padding: .1rem; } .holdpop small { font-size: .62rem; opacity: .7; font-family: system-ui; }

/* toasts and overlays */
#toasts { position: fixed; top: 64px; left: 0; right: 0; display: grid; justify-items: center; gap: .4rem; z-index: 70; pointer-events: none; padding: 0 1rem; }
.toast { background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 12px; box-shadow: var(--shadow); max-width: 520px; animation: pop .25s ease-out; } .toast.gold { background: #ffd166; color: var(--ink); font-weight: 600; } .toast.err { background: var(--no); }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; } @keyframes spin { to { transform: rotate(360deg); } }

/* map */
.road { width: 100%; height: auto; display: block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr 1fr; } .scores { grid-template-columns: 1fr 1fr; } h1 { font-size: 1.35rem; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
