/* Mise en page : une colonne étroite pensée pour le téléphone, barre d'onglets en bas,
   la phrase libanaise est toujours le plus gros élément de l'écran. */
:root {
  --bg: #F2F4F1; --surface: #FFFFFF; --ink: #14211C; --muted: #5B6B64; --line: #D6DDD8;
  --cedar: #1E5B45; --on-cedar: #FFFFFF; --cedar-soft: #DDEAE3; --red: #C2313B; --warn: #8A5E00;
  --display: "Space Grotesk", "Avenir Next", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0F1714; --surface: #17221D; --ink: #E8EEEA; --muted: #9AAAA2; --line: #2A3A33;
  --cedar: #6FC2A0; --on-cedar: #0F1714; --cedar-soft: #1D3329; --red: #F0767E; --warn: #E0B450; color-scheme: dark } }

body { background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--body); }
.wrap { max-width: 34rem; margin: 0 auto; padding-block: 20px 110px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 20px; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 700; } h2 { font-size: 1.15rem; font-weight: 600; } h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; } .muted { color: var(--muted); } .small { font-size: .875rem; }
.label { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 12px; } .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.lb { font-family: var(--display); font-weight: 600; font-size: 1.15rem; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; font-family: var(--display); font-weight: 700; }

button { font: 500 1rem var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--cedar); outline-offset: 2px; }
button.primary { background: var(--cedar); color: var(--on-cedar); border-color: var(--cedar); font-weight: 600; }
button.on { background: var(--cedar-soft); border-color: var(--cedar); font-weight: 600; }
button.plain { border: 0; background: none; padding: 6px 0; min-height: 0; color: var(--cedar); text-align: left; }
a { color: var(--cedar); }
.chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.chips.three { grid-template-columns: repeat(3, 1fr); } .chips button { padding-inline: 6px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stats .num { font-size: 1.5rem; display: block; } .streak .num { color: var(--red); }
.bar { height: 8px; background: var(--cedar-soft); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--cedar); border-radius: 99px; }
.step { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; padding-top: 0; } .step:last-child { padding-bottom: 0; }
.step .grow { flex: 1; min-width: 0; } .step.done { opacity: .55; }
.tag { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--cedar-soft); color: var(--ink); white-space: nowrap; }
.tag.warn { background: none; border: 1px solid var(--warn); color: var(--warn); }
table { border-collapse: collapse; width: 100%; } td, th { text-align: left; padding: 8px 8px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
.scroll { overflow-x: auto; }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; } details[open] > summary { margin-bottom: 8px; }
audio { width: 100%; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
nav.tabs button { flex: 1; max-width: 7rem; border: 0; border-radius: 0; background: none; font-size: .8rem; padding: 12px 2px; color: var(--muted); border-top: 3px solid transparent; }
nav.tabs button.on { color: var(--cedar); border-top-color: var(--cedar); background: none; }

.session { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; }
.session .wrap { min-height: 100%; width: 100%; margin-inline: auto; padding-block: calc(16px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)); box-sizing: border-box; }
.card { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; text-align: center; padding: 24px 0; }
.card .fr { font-size: 1.25rem; } .card .lb { font-size: 2rem; line-height: 1.2; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; } .grades button { padding-inline: 4px; font-size: .9rem; }
.note { color: var(--warn); font-size: .875rem; }
@media (prefers-reduced-motion: no-preference) { .bar > i { transition: width .3s; } }

/* ajouts PWA */
html { -webkit-text-size-adjust: 100%; } body { margin: 0; overscroll-behavior-y: none; }
[hidden] { display: none !important; } img { max-width: 100%; }
.wrap { padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
input[type=text], input[type=password], input[type=time], input[type=url] { font: 400 1rem var(--body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; box-sizing: border-box; width: 100%; }
button.icon { min-width: 44px; padding: 8px; } button.rec { border-color: var(--red); color: var(--red); } button.rec.on { background: var(--red); color: var(--on-cedar); }
button:disabled { opacity: .5; cursor: default; }
.phrase { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); } .phrase:first-child { border-top: 0; }
.phrase .grow { flex: 1; min-width: 0; }
.video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--cedar-soft); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.big { font-family: var(--display); font-weight: 700; font-size: 2.2rem; font-variant-numeric: tabular-nums; }
.star { color: var(--warn); }
