/* FlashCampus — mêmes couleurs que l'appli Android (Material 3). */
:root {
  --accent: #2563EB;
  --success: #16A34A;
  --danger: #DC2626;
  --star: #F59E0B;
  --bg: #F6F7FB;
  --fg: #151923;
  --muted: #5B6475;
  --card: #FFFFFF;
  --surface: #F1F3F9;
  --surface-2: #E6E9F2;
  --line: #DDE1EA;
  --shadow: 0 1px 2px rgb(20 25 40 / .06), 0 6px 20px rgb(20 25 40 / .07);
  --radius: 20px;
  --tabs-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1016;
  --fg: #E8EAF0;
  --muted: #AEB5C4;
  --card: #1A1E28;
  --surface: #151821;
  --surface-2: #222633;
  --line: #2E3442;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0 0 .6em; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
[hidden] { display: none !important; }

#view {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px);
}
.page { padding: 8px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); }

/* ---- Barres ------------------------------------------------------------------ */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  min-height: 56px;
  padding: env(safe-area-inset-top) 8px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.bar h1 { flex: 1; font-size: 20px; font-weight: 650; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn.star.on { color: var(--star); }
.icon-btn.star.on svg { fill: currentColor; }

.hero {
  display: flex; align-items: center; gap: 14px;
  padding: calc(env(safe-area-inset-top) + 20px) 20px 8px;
}
.hero img { border-radius: 12px; box-shadow: var(--shadow); }
.hero h1 { font-size: 26px; font-weight: 750; letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--muted); }

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
#tabs a {
  flex: 1; max-width: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600;
}
#tabs a span { display: grid; place-items: center; width: 60px; height: 30px; border-radius: 15px; transition: background .2s; }
#tabs a.on { color: var(--fg); }
#tabs a.on span { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
body[data-tab="play"] #tabs { display: none; }

/* ---- Boutons ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 24px;
  background: var(--accent); color: #fff;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 20px; height: 20px; }
.btn.wide { display: flex; width: 100%; margin-top: 12px; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.outline { background: none; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.text { background: none; color: var(--accent); }
.btn.success { background: var(--success); }
.btn.danger { background: var(--danger); }
.btn.outline.danger { background: none; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.btn.text.danger { background: none; color: var(--danger); }

/* ---- Panneaux, listes ------------------------------------------------------------ */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.section { font-size: 15px; font-weight: 700; color: var(--muted); margin: 22px 4px 10px; text-transform: none; }
.list > * + * { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 2px; padding: 4px 6px 4px 4px; }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; color: inherit; text-decoration: none; }
.row-main > span:not(.tile-icon):not(.has-img) { min-width: 0; flex: 1; }
.row b, .row-btn b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.row small, .row-btn small { display: block; color: var(--muted); font-size: 13.5px; }
.clamp { display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .tile-icon { width: 40px; height: 40px; font-size: 22px; }
.has-img { color: var(--muted); }
.box-chip { min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; margin-right: 6px; }
.row-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border: 0; background: none; text-align: left; color: inherit; text-decoration: none; cursor: pointer;
}
.row-btn > svg:first-child, .row-btn > img { color: var(--accent); }
.row-btn > span { flex: 1; min-width: 0; }
.row-btn > svg:last-child:not(:first-child) { color: var(--muted); width: 18px; }
.row-btn:hover:not(.static):not(:disabled) { background: var(--surface); }
.row-btn:disabled { opacity: .45; cursor: default; }
.row-btn.danger, .row-btn.danger > svg { color: var(--danger); }
.row-btn.static { cursor: default; }
.row-btn > img { border-radius: 9px; }
.row-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 14px; padding: 16px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--star) 14%, var(--card)); color: inherit; font-weight: 600; text-decoration: none;
}
.note { font-size: 14px; color: var(--muted); margin: 0 6px 6px; }

/* ---- Accueil -------------------------------------------------------------------- */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 6px 12px 16px; margin-bottom: 12px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
}
.banner-text { flex: 1; min-width: 0; }
.banner-text b { display: block; }
.banner-text span { font-size: 14px; color: var(--muted); }

.goal { padding: 16px; }
.goal-top { display: flex; align-items: center; gap: 16px; }
.goal-text { display: flex; flex-direction: column; }
.goal-text b { font-size: 17px; }
.goal-text span { color: var(--muted); font-size: 14.5px; }
.goal-text .streak { color: var(--fg); font-weight: 600; margin-top: 2px; }
.mini-ring { position: relative; width: 64px; height: 64px; flex: none; }
.mini-ring svg, .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mini-ring .track, .ring .track { stroke: var(--surface-2); stroke-width: 8; }
.mini-ring .value { stroke: var(--accent); stroke-width: 8; transition: stroke-dashoffset .8s ease; }
.mini-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 750; font-size: 18px; }
.week { display: flex; gap: 8px; height: 86px; margin: 16px 0 4px; }
.week > div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.week i { display: block; width: 100%; max-width: 30px; min-height: 4px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 35%, var(--surface-2)); }
.week .today i { background: var(--accent); }
.week span { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.week .today span { color: var(--fg); font-weight: 700; }
.done { margin: 14px 0 0; color: var(--muted); }

.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stats3 div { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 12px; text-align: center; }
.stats3 b { display: block; font-size: 22px; }
.stats3 span { font-size: 13px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; }
.tile-theme {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  padding: 14px; border-radius: var(--radius); min-height: 150px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 20%, var(--card)), var(--card) 70%);
  box-shadow: var(--shadow); color: inherit; text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
  transition: transform .15s;
}
.tile-theme:active { transform: scale(.98); }
.tile-theme b { font-size: 16.5px; line-height: 1.25; overflow-wrap: anywhere; }
.tile-theme .muted { font-size: 13.5px; }
.tile-icon {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 14px; font-size: 24px; background: color-mix(in srgb, var(--c) 18%, var(--card));
}
.tile-icon.big { width: 64px; height: 64px; font-size: 36px; border-radius: 20px; background: rgb(255 255 255 / .2); }
.meter { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--c) 15%, var(--surface-2)); overflow: hidden; margin-top: auto; }
.meter i { display: block; height: 100%; background: var(--c); border-radius: 3px; }
.meter.light { background: rgb(255 255 255 / .25); margin-top: 8px; }
.meter.light i { background: #fff; }
.badge { position: absolute; top: 12px; right: 12px; padding: 2px 9px; border-radius: 10px; background: var(--c); color: #fff; font-size: 12px; font-weight: 700; }
.exam { font-size: 12.5px; font-weight: 600; color: var(--c); }
[data-theme="dark"] .exam { color: color-mix(in srgb, var(--c) 55%, #fff); }

.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .emoji { font-size: 64px; }
.empty h2 { font-size: 22px; }
.empty p { color: var(--muted); max-width: 420px; }
.empty .btn { min-width: 240px; }
.empty.small { padding: 24px; }

/* ---- Thème -------------------------------------------------------------------- */
.theme-hero {
  display: flex; align-items: center; gap: 16px; padding: 18px; margin-bottom: 12px;
  border-radius: var(--radius); background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 70%, #000)); color: #fff;
}
.theme-hero > div { flex: 1; min-width: 0; }
.theme-hero > div > b, .theme-hero > div > span { display: block; }
.theme-hero > div > span:not(.meter) { opacity: .9; font-size: 14.5px; }
.options { padding: 2px 0; }
.switch-row, .range-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.switch-row > span, .range-row > span { flex: 1; }
.switch-row b, .range-row b { display: block; font-weight: 600; }
.switch-row small, .range-row small { color: var(--muted); font-size: 13.5px; }
.panel > .switch-row + .switch-row, .panel > .range-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { position: relative; width: 52px; height: 32px; flex: none; border-radius: 16px; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line); transition: background .2s; }
.switch-row i::after { content: ""; position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch-row input:checked + i { background: var(--accent); box-shadow: none; }
.switch-row input:checked + i::after { transform: translateX(20px); background: #fff; }
.switch-row input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.range-row { flex-wrap: wrap; }
.range-row input { width: 100%; accent-color: var(--accent); }
.modes { display: grid; gap: 10px; }
.mode {
  display: flex; align-items: center; gap: 14px; padding: 14px 12px 14px 14px;
  border-radius: 18px; background: var(--card); box-shadow: var(--shadow); color: inherit; text-decoration: none;
}
.mode > span:nth-child(2) { flex: 1; }
.mode b { display: block; }
.mode small { color: var(--muted); font-size: 13.5px; }
.mode > svg { color: var(--muted); width: 18px; }
.mode-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; font-size: 22px; background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--card)); }
.mode.off { opacity: .5; box-shadow: none; background: var(--surface); }

/* ---- Formulaires ------------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .field-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.field-label { display: block; margin: 14px 0 8px; }
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--card); font-size: 16px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
.card-form .preview { padding: 12px 16px; }
.card-form .preview .field-label { margin-top: 0; }
.hint-format { font-size: 13px; color: var(--muted); margin: -6px 2px 14px; }
.image-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.image-preview:not(:empty) { width: 100%; }
.image-preview img { max-width: 100%; max-height: 220px; border-radius: 16px; display: block; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.form-actions .btn { flex: 1 1 200px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.toolbar .btn { flex: 1 1 auto; min-height: 44px; padding: 0 14px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 0 0 14px; margin-bottom: 12px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); color: var(--muted); }
.search input { border: 0 !important; padding-left: 0 !important; background: none !important; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches label, .swatches button { position: relative; cursor: pointer; border: 0; padding: 0; background: none; }
.swatches input { position: absolute; opacity: 0; }
.swatches i { display: block; width: 38px; height: 38px; border-radius: 50%; background: var(--c); transition: transform .15s; }
.swatches input:checked + i, .swatches .on i { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--c); }
.swatches input:focus-visible + i { outline: 2px solid var(--fg); outline-offset: 4px; }
.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 196px; overflow-y: auto; padding: 2px; }
.icons label { cursor: pointer; }
.icons input { position: absolute; opacity: 0; }
.icons span { display: grid; place-items: center; height: 44px; border-radius: 12px; font-size: 22px; background: var(--surface); }
.icons input:checked + span { background: color-mix(in srgb, var(--accent) 22%, var(--card)); box-shadow: inset 0 0 0 2px var(--accent); }
.segmented { display: flex; padding: 4px; border-radius: 16px; background: var(--surface); }
.segmented button { flex: 1; min-height: 40px; border: 0; border-radius: 12px; background: none; font-weight: 600; cursor: pointer; color: var(--muted); }
.segmented button.on { background: var(--card); color: var(--fg); box-shadow: var(--shadow); }
.donate > p { margin: 0; }
.donate > p.muted { font-size: 13.5px; }
.don-emoji { font-size: 26px; flex: none !important; }
.don-price { flex: none !important; padding: 6px 12px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); font-weight: 700; }
.privacy p { margin-bottom: 8px; }

/* ---- Aide CSV ---------------------------------------------------------------------- */
.prose > p { margin: 0 4px 12px; }
.code { margin: 0 0 12px; padding: 14px; border-radius: 14px; background: var(--surface-2); font: 14px/1.5 ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.cols { margin: 0 0 8px; padding-left: 22px; }
.cols li { margin-bottom: 6px; }
.table-wrap { overflow-x: auto; margin-bottom: 12px; border-radius: 14px; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; background: var(--card); font-size: 14px; }
th, td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); white-space: pre-line; }
th { background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.steps { padding: 14px 16px; }

/* ---- Session de révision ---------------------------------------------------------------- */
.view-play { display: flex; flex-direction: column; height: 100dvh; min-height: 0 !important; padding-bottom: 0 !important; overflow: hidden; position: relative; }
.play-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }
.progress { height: 6px; margin: 0 16px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; width: 0; border-radius: 3px; background: var(--accent); transition: width .3s; }
.counter { display: flex; gap: 12px; padding: 10px 2px; font-size: 14px; font-weight: 600; color: var(--muted); }
.counter span:first-child { flex: 1; }
.counter .ok { color: var(--success); }
.counter .ko { color: var(--danger); }
.run.flash { display: flex; flex-direction: column; height: 100%; }
.stage { position: relative; flex: 1; min-height: 300px; margin: 6px 0 12px; }
.ghost { position: absolute; inset: 0; border-radius: 28px; background: var(--surface-2); transform: translateY(14px) scale(.93); }
.flip { position: absolute; inset: 0; touch-action: pan-y; perspective: 1600px; cursor: grab; outline: none; user-select: none; -webkit-user-select: none; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .52s cubic-bezier(.4, 0, .2, 1); transform-style: preserve-3d; }
.flip-inner.flipped { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  border-radius: 28px; overflow: hidden; background: var(--card); box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.face.back { transform: rotateY(180deg); background: color-mix(in srgb, var(--c) 9%, var(--card)); }
.face-head { display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 18px; background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); }
[data-theme="dark"] .face-head { color: color-mix(in srgb, var(--c) 50%, #fff); }
.face.back .face-head { background: var(--c); color: #fff; }
.face.back .icon-btn.star.on { color: #FDE68A; }
.theme-label { flex: 1; min-width: 0; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.face-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; justify-content: safe center; align-items: center; padding: 24px; text-align: center; }
.face-foot { text-align: center; font-size: 13px; color: var(--muted); padding-bottom: 14px; }
.term { font-size: clamp(24px, 6vw, 32px); font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.term.small { font-size: 22px; }
.def { font-size: 19px; line-height: 1.5; text-align: left; width: 100%; overflow-wrap: anywhere; }
.def.center { text-align: center; }
.li { display: block; padding-left: 1.1em; text-indent: -1.1em; }
.li::before { content: "•  "; }
.card-img { max-width: 100%; max-height: 200px; border-radius: 18px; margin-bottom: 18px; object-fit: contain; }
.swipe-label { position: absolute; top: 20px; padding: 8px 14px; border-radius: 12px; color: #fff; font-weight: 700; opacity: 0; pointer-events: none; box-shadow: var(--shadow); z-index: 2; }
.swipe-label.ok { left: 20px; background: var(--success); }
.swipe-label.ko { right: 20px; background: var(--danger); }
.actions { display: flex; gap: 12px; }
.actions .btn { flex: 1; min-height: 56px; }
.hint { text-align: center; font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }

.prompt { border-radius: 24px; background: var(--card); box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent); overflow: hidden; }
.prompt .face-head { padding: 2px 4px 2px 18px; min-height: 44px; }
.prompt-body { padding: 16px 20px 20px; }
.prompt .term { font-size: 24px; }
.prompt .def { font-size: 18px; }
.label { font-size: 14px; font-weight: 600; color: var(--muted); margin: 20px 2px 10px; }
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 14px 16px;
  border-radius: 18px; border: 1.5px solid var(--line); background: var(--card); text-align: left; cursor: pointer; transition: background .2s, opacity .2s;
}
.choice > span { flex: 1; overflow-wrap: anywhere; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice.right { background: color-mix(in srgb, var(--success) 16%, var(--card)); border-color: var(--success); }
.choice.right svg { color: var(--success); }
.choice.wrong { background: color-mix(in srgb, var(--danger) 16%, var(--card)); border-color: var(--danger); }
.choice.wrong svg { color: var(--danger); }
.choice.dim { opacity: .5; }
.choice:disabled { cursor: default; color: inherit; }
.proposed { padding: 18px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); font-size: 17px; margin-bottom: 16px; overflow-wrap: anywhere; }
.row2 { display: flex; gap: 12px; margin-top: 4px; }
.row2 .btn { flex: 1; min-height: 54px; }
.feedback { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 16px; margin-bottom: 12px; }
.feedback.ok { background: color-mix(in srgb, var(--success) 13%, var(--card)); }
.feedback.ok svg { color: var(--success); }
.feedback.ko { background: color-mix(in srgb, var(--danger) 13%, var(--card)); }
.feedback.ko svg { color: var(--danger); }
.write-form { margin-top: 20px; }
.match { display: grid; grid-template-columns: 42fr 58fr; gap: 10px; }
.match > div { display: grid; gap: 10px; align-content: start; }
.tile {
  min-height: 76px; padding: 12px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card);
  text-align: left; font-size: 14px; cursor: pointer; overflow-wrap: anywhere; transition: background .2s, opacity .3s;
}
.term-tile { font-weight: 650; font-size: 15px; }
.tile.selected { background: color-mix(in srgb, var(--accent) 16%, var(--card)); border-color: var(--accent); }
.tile.wrong { background: color-mix(in srgb, var(--danger) 18%, var(--card)); border-color: var(--danger); animation: shake .35s; }
.tile.matched { background: color-mix(in srgb, var(--success) 14%, var(--card)); border-color: var(--success); opacity: .4; color: inherit; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.summary { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 20px 0 8px; }
.summary h2 { font-size: 24px; margin-top: 4px; }
.summary .row2 { width: 100%; margin: 16px 0 4px; }
.emoji.big { font-size: 64px; }
.ring { position: relative; width: 150px; height: 150px; margin-top: 18px; }
.ring .track { stroke-width: 12; }
.ring .value { stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.4, 0, .2, 1); fill: none; }
.ring.good .value { stroke: var(--success); }
.ring.bad .value { stroke: var(--danger); }
.ring circle { fill: none; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; font-weight: 700; }
.pill { flex: 1; padding: 12px; border-radius: 18px; font-size: 14px; font-weight: 600; }
.pill b { display: block; font-size: 24px; }
.pill.ok { background: color-mix(in srgb, var(--success) 13%, var(--card)); color: var(--success); }
.pill.ko { background: color-mix(in srgb, var(--danger) 13%, var(--card)); color: var(--danger); }
.missed { width: 100%; text-align: left; padding: 16px; margin-top: 16px; }
.missed h3 { font-size: 17px; margin-bottom: 8px; }
.missed div + div { margin-top: 10px; }
.missed p { margin: 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.summary .btn.wide { margin-top: 10px; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }

/* ---- Dialogues, messages ------------------------------------------------------------------ */
dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 0; border-radius: 28px; background: var(--card); color: var(--fg); box-shadow: 0 20px 60px rgb(0 0 0 / .3);
}
dialog::backdrop { background: rgb(10 12 20 / .45); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.dlg-box { padding: 22px; }
.dlg-box h2 { font-size: 21px; margin-bottom: 10px; }
.dlg-box p { color: var(--muted); }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 18px; }
.dlg-actions .left { margin-right: auto; }
.paste { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px !important; }
.install-steps p { color: var(--fg) !important; }
.kbd { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 8px; background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.kbd svg { width: 18px; height: 18px; color: var(--accent); }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px); z-index: 50;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 12px 10px 12px 18px; border-radius: 16px; background: #232733; color: #fff; box-shadow: 0 10px 30px rgb(0 0 0 / .3);
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: transform .25s, opacity .25s;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
#toast span { flex: 1; }
#toast button { border: 0; background: none; color: #93C5FD; font-weight: 700; padding: 8px 10px; cursor: pointer; }
#toast:not(:has(button)) { padding-right: 18px; }
body[data-tab="play"] #toast { bottom: calc(env(safe-area-inset-bottom) + 18px); }

@media (min-width: 700px) {
  .page { padding-left: 24px; padding-right: 24px; }
  .stage { min-height: 380px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
