:root {
  --blue: #1f3a8a; --blue-2: #2f56c9; --red: #c0262d; --green: #1e7a3c; --orange: #b45309;
  --bg: #f6f7fb; --card: #ffffff; --text: #16181d; --muted: #555b66; --line: #d9dde6;
  --radius: 16px; --fs: 20px;
}
html { font-size: var(--fs); }
html[data-size="l"] { --fs: 23px; }
html[data-size="xl"] { --fs: 27px; }
html[data-contrast="high"] { --bg: #ffffff; --text: #000; --muted: #222; --line: #000; --blue: #001a66; --card: #fff; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.5; -webkit-text-size-adjust: 100%; }
main { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 4rem; }
h1 { font-size: 1.6rem; margin: .4rem 0 1rem; line-height: 1.25; }
h2 { font-size: 1.3rem; margin: 1.4rem 0 .6rem; }
h3 { font-size: 1.1rem; margin: 1rem 0 .4rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .85rem; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  background: var(--blue); color: #fff; padding: .4rem .7rem; padding-top: max(.4rem, env(safe-area-inset-top)); }
.brand { font-weight: 700; font-size: 1.1rem; }
.icon-btn { background: rgba(255,255,255,.15); border: 0; color: #fff; font-size: 1.3rem; border-radius: 12px; min-width: 52px; min-height: 52px; cursor: pointer; }

.btn { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; min-height: 64px; padding: .8rem 1rem;
  font-size: 1.05rem; font-weight: 650; border-radius: var(--radius); border: 2px solid transparent; cursor: pointer;
  background: var(--blue); color: #fff; margin: .55rem 0; text-align: center; text-decoration: none; }
.btn:focus-visible, .choice:focus-visible, .key:focus-visible { outline: 4px solid #f59e0b; outline-offset: 2px; }
.btn.secondary { background: var(--card); color: var(--blue); border-color: var(--blue); }
.btn.ghost { background: transparent; color: var(--blue); border-color: var(--line); }
.btn.big { min-height: 84px; font-size: 1.2rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.row { display: flex; gap: .6rem; }
.row > * { flex: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin: .8rem 0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.tile { display: flex; gap: .9rem; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin: .6rem 0; width: 100%; text-align: left; font-size: 1.05rem; color: var(--text); cursor: pointer; min-height: 72px; }
.tile .ico { font-size: 1.8rem; width: 2.2rem; text-align: center; flex: none; }
.tile .grow { flex: 1; }
.tile .title { font-weight: 650; }
.bar { height: 12px; background: #e5e7ef; border-radius: 99px; overflow: hidden; margin-top: .35rem; }
.bar > i { display: block; height: 100%; background: var(--green); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chip { font-size: .8rem; padding: .2rem .65rem; border-radius: 99px; background: #e8edfb; color: var(--blue); font-weight: 600; }
.chip.toulouse { background: #fde8e8; color: var(--red); }
.chip.warn { background: #fff3d6; color: var(--orange); }

.question { font-size: 1.35rem; font-weight: 700; line-height: 1.35; margin: .2rem 0 1rem; }
.answer { border-left: 6px solid var(--green); background: #eef8f1; padding: .9rem 1rem; border-radius: 10px; font-size: 1.08rem; }
.detail { background: #f3f5fa; padding: .9rem 1rem; border-radius: 10px; margin-top: .7rem; }
.tips { border-left: 6px solid var(--orange); background: #fff7e8; padding: .9rem 1rem; border-radius: 10px; margin-top: .7rem; }
.volatile { border-left: 6px solid var(--orange); background: #fff3d6; padding: .6rem 1rem; border-radius: 10px; margin-top: .7rem; font-size: .92rem; }
details summary { cursor: pointer; font-weight: 650; color: var(--blue); padding: .5rem 0; min-height: 44px; }

.grades { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.grade { min-height: 76px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--card); font-size: 1rem; font-weight: 700; cursor: pointer; color: var(--text); }
.grade small { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; }
.grade.g1 { border-color: var(--red); } .grade.g2 { border-color: var(--orange); } .grade.g3 { border-color: var(--blue-2); } .grade.g4 { border-color: var(--green); }

textarea, input[type=text] { width: 100%; font-size: 1.05rem; padding: .8rem; border-radius: 12px; border: 2px solid var(--line); font-family: inherit; background: #fff; color: var(--text); }
textarea { min-height: 9rem; resize: vertical; }
label { font-weight: 650; display: block; margin: .8rem 0 .3rem; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; max-width: 360px; margin: 1rem auto; }
.key { min-height: 72px; font-size: 1.6rem; font-weight: 700; border-radius: var(--radius); border: 2px solid var(--line); background: var(--card); cursor: pointer; color: var(--text); }
.pin-dots { display: flex; justify-content: center; gap: .8rem; margin: 1rem 0; }
.pin-dots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--blue); }
.pin-dots i.on { background: var(--blue); }

.choice { display: block; width: 100%; text-align: left; min-height: 64px; padding: .8rem 1rem; margin: .5rem 0; font-size: 1.05rem; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--card); cursor: pointer; color: var(--text); }
.choice.right { border-color: var(--green); background: #eef8f1; font-weight: 700; }
.choice.wrong { border-color: var(--red); background: #fdeeee; }

.progress-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .9rem; margin-bottom: .3rem; }
.course h2 { color: var(--blue); }
.course ul { padding-left: 1.2rem; } .course li { margin: .35rem 0; }
.stat { display: flex; justify-content: space-around; text-align: center; }
.stat b { display: block; font-size: 1.6rem; color: var(--blue); }
.err { color: var(--red); font-weight: 650; }
.speak { background: #e8edfb; border: 0; border-radius: 12px; min-height: 48px; min-width: 48px; font-size: 1.2rem; cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.say-label { font-weight: 700; color: var(--green); margin: .6rem 0 .3rem; }
.say { border-left: 6px solid var(--green); background: #eef8f1; padding: 1rem 1.1rem; border-radius: 10px; font-size: 1.15rem; line-height: 1.6; }
mark.blank { background: #fde68a; color: #7c2d12; padding: 0 .2em; border-radius: 4px; font-weight: 650; }
details .answer { margin-top: .4rem; font-size: 1rem; border-left-color: var(--blue-2); background: #eef2fd; }
@media print {
  .topbar, .no-print, .btn { display: none !important; }
  body { background: #fff; } main { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; border: 1px solid #999; }
  .say { background: #fff; }
}
.mic { background: var(--red); }
.mic.rec { background: #7f1d1d; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(192,38,45,.18); } }
.transcript { background: #fff; border: 2px dashed var(--line); border-radius: 12px; padding: .9rem 1rem; font-size: 1.1rem; min-height: 3rem; margin: .5rem 0; }
.score { font-size: 1.2rem; font-weight: 700; padding: .7rem 1rem; border-radius: 12px; margin: .6rem 0; }
.score.good { background: #eef8f1; color: var(--green); } .score.mid { background: #eef2fd; color: var(--blue); } .score.low { background: #fff3d6; color: var(--orange); }
.chip.ok { background: #e3f4e8; color: var(--green); } .chip.ko { background: #fde8e8; color: var(--red); }
.grade.suggested { box-shadow: 0 0 0 4px rgba(245,158,11,.55); }
.rdv-top { display: flex; justify-content: space-between; align-items: center; }
.rdv-days { font-size: 2rem; color: var(--blue); }
.ready { text-align: center; } .ready b { display: block; font-size: 1.7rem; color: var(--green); }
.rdv-cta { border: 2px dashed var(--blue-2); }
.advice { background: #fff7e8; border-left: 6px solid var(--orange); border-radius: 10px; padding: .7rem 1rem; margin: .4rem 0; font-weight: 600; }
input[type=date] { width: 100%; font-size: 1.1rem; padding: .8rem; border-radius: 12px; border: 2px solid var(--line); font-family: inherit; }
