/* =========================================================
   QuizClasse — styles
   ========================================================= */

:root {
  color-scheme: light;
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --ink: #14152b;
  --ink-2: #3a3c58;
  --muted: #6b6e8c;
  --line: #e4e6f2;
  --line-strong: #d2d5e8;
  --primary: #5b5bd6;
  --primary-2: #8b5cf6;
  --primary-soft: #eeeefe;
  --primary-ink: #ffffff;
  --ok: #0e9f6e;
  --ok-soft: #e7f8f1;
  --bad: #df4a61;
  --bad-soft: #fdecef;
  --warn: #e0a13a;
  --team-2: #e8930c;
  --shadow-sm: 0 1px 2px rgba(20, 21, 43, .05), 0 2px 8px rgba(20, 21, 43, .04);
  --shadow-md: 0 10px 28px rgba(20, 21, 43, .09), 0 2px 8px rgba(20, 21, 43, .04);
  --shadow-lg: 0 28px 70px rgba(20, 21, 43, .14);
  --radius: 20px;
  --glow-1: rgba(139, 92, 246, .16);
  --glow-2: rgba(59, 130, 246, .12);
  --ring-bg: #e3e5f0;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d19;
  --surface: #151830;
  --surface-2: #1b1f3a;
  --ink: #eef0ff;
  --ink-2: #c9cce8;
  --muted: #979bbb;
  --line: #272c4a;
  --line-strong: #353b60;
  --primary: #7d7df5;
  --primary-2: #a78bfa;
  --primary-soft: rgba(125, 125, 245, .15);
  --primary-ink: #ffffff;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .13);
  --bad: #fb7185;
  --bad-soft: rgba(251, 113, 133, .13);
  --warn: #fbbf24;
  --team-2: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .2);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .5);
  --glow-1: rgba(125, 125, 245, .18);
  --glow-2: rgba(59, 130, 246, .10);
  --ring-bg: #272c4a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 8% -12%, var(--glow-1), transparent 62%),
    radial-gradient(900px 520px at 108% 4%, var(--glow-2), transparent 58%),
    var(--bg);
  background-attachment: fixed;
  font-family: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, p, ul, ol { margin: 0; }

::selection { background: var(--primary); color: #fff; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

code, kbd, pre {
  font-family: "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
}

/* ================= TOPBAR ================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 4px;
  background: none;
  border: 0;
  border-radius: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 6px 16px -6px var(--primary);
}

.brand-name {
  font-weight: 800;
  font-size: 1.06rem;
  letter-spacing: -.03em;
}
.brand-name span {
  background: linear-gradient(120deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1;
  transition: border-color .15s, transform .15s, background .15s, color .15s;
}
.icon-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.icon-btn.danger { color: var(--bad); }
.icon-btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }

.theme-icons { display: grid; place-items: center; width: 18px; height: 18px; }
.theme-icons svg { grid-area: 1 / 1; width: 18px; height: 18px; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

/* ================= LAYOUT ================= */

main { padding: 0 clamp(16px, 3vw, 32px) 64px; }

body[data-screen="game"] main { padding-bottom: 0; }
body[data-screen="game"] #bank-count { display: none; }

.screen { display: none; max-width: 1180px; margin: 0 auto; }
.screen.active { display: block; animation: fadeUp .35s ease both; }
.screen[data-screen="game"].active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 64px);
  padding-bottom: 8px;
}

.hero { padding: clamp(36px, 7vh, 76px) 0 clamp(28px, 5vh, 48px); max-width: 900px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--primary);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.eyebrow .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent);
}

.hero h1, .end-hero h1, .page-head h1 {
  font-size: clamp(2rem, 3.8vw, 3.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.page-head h1 { font-size: clamp(1.8rem, 2.6vw, 2.4rem); }

.accent {
  background: linear-gradient(110deg, var(--primary) 0%, var(--primary-2) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin-top: 18px;
  max-width: 62ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.15vw, 1.15rem);
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.micro { margin-top: 12px; color: var(--muted); font-size: .82rem; }

/* ================= CARDS & FORMS ================= */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(20px, 2.4vw, 28px);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -.02em;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 20px;
  align-items: start;
}

.setup-card { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 8px; }

.label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.segmented button {
  flex: 1;
  padding: 10px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: .92rem;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.team-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

input[type="text"], textarea, select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; min-height: 120px; font-family: "Cascadia Code", Consolas, monospace; font-size: .86rem; line-height: 1.5; }
select:disabled { opacity: .45; cursor: not-allowed; }
select { width: auto; min-width: 92px; cursor: pointer; }

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.field-row.toggles { justify-content: flex-start; gap: 20px; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .92rem;
  font-weight: 550;
  cursor: pointer;
  user-select: none;
}
.check input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.switch {
  position: relative;
  flex: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .18s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .18s cubic-bezier(.4, .1, .2, 1.4);
}
.check input:checked + .switch { background: var(--primary); }
.check input:checked + .switch::after { transform: translateX(18px); }
.check input:focus-visible + .switch { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ================= BUTTONS ================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: .93rem;
  font-weight: 650;
  white-space: nowrap;
  transition: transform .15s, border-color .15s, box-shadow .15s, background .15s, color .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 10px 24px -10px var(--primary), 0 2px 6px rgba(20, 21, 43, .12);
}
.btn.primary:hover { box-shadow: 0 16px 32px -12px var(--primary), 0 2px 6px rgba(20, 21, 43, .12); }

.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; box-shadow: none; }

.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }

.btn.sm { padding: 8px 12px; font-size: .85rem; border-radius: 10px; }

.btn-lg { padding: 15px 22px; font-size: 1rem; border-radius: 13px; }

.btn-start { width: 100%; margin-top: 2px; }

/* ================= HOME : BANQUE CARD ================= */

.bank-card { display: flex; flex-direction: column; gap: 16px; }
.bank-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.badge-count {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: .85rem;
  font-weight: 800;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: .9rem;
}
.feature-list li { display: flex; align-items: flex-start; gap: 10px; }
.feature-list .ico { flex: none; opacity: .9; }

.bank-card-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.bank-card-actions .btn { flex: 1; }

/* ================= GAME ================= */

.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 0 12px;
}

.game-top-left { display: flex; align-items: center; gap: 10px; }

.q-counter {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: .82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: .78rem;
  font-weight: 700;
}

.game-top-right { display: flex; align-items: center; gap: 20px; }

.scores { display: flex; align-items: center; gap: 8px; }

.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: .88rem;
  font-weight: 600;
  transition: border-color .15s, background .15s, box-shadow .15s, transform .15s;
}
.score-chip:hover { border-color: var(--line-strong); }
.score-chip.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--ink);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.score-chip.is-scored {
  border-color: var(--ok);
  background: var(--ok-soft);
}
.score-chip.is-scored .score-val { color: var(--ok); }
.score-chip.solo { cursor: default; }

.score-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--primary);
}
.score-dot.team-1 { background: var(--team-2); }

.score-name { max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.score-val {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
}

.timer {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: none;
  border-radius: 50%;
  cursor: pointer;
}
.timer:hover .ring-bg { stroke: var(--line-strong); }
.timer.is-paused .ring-fg { opacity: .35; }
.timer.is-paused .timer-value { opacity: .55; }
.timer-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--ring-bg); stroke-width: 5; }
.ring-fg {
  fill: none;
  stroke: var(--primary);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 175.93;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke .3s;
}
.timer.is-low .ring-fg { stroke: var(--bad); }
.timer.is-low .timer-value { color: var(--bad); }
.timer.is-expired .ring-fg { stroke: var(--bad); }
.timer.is-expired .timer-value { color: var(--bad); animation: pulse 1s ease infinite; }

.timer-value {
  position: relative;
  font-size: .95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.progress {
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .4s cubic-bezier(.2, .8, .2, 1);
}

.question-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(22px, 3.4vh, 38px);
  padding: clamp(20px, 4vh, 44px) 0;
}

.question {
  max-width: 26ch;
  margin: 0 auto;
  text-align: center;
  font-size: clamp(1.55rem, 2.9vw, 2.65rem);
  font-weight: 780;
  line-height: 1.18;
  letter-spacing: -.03em;
  text-wrap: balance;
  animation: fadeUp .3s ease both;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}
.answers .answer:last-child:nth-child(odd) { grid-column: 1 / -1; }

.answers-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}
.answers-wrap .answers { max-width: none; margin: 0; }

.answer-hint {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 550;
  animation: fadeUp .25s ease both;
}

.answer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 86px;
  padding: 16px 20px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s, opacity .2s;
}
.answer:hover:not(.is-locked) {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.answer:active:not(.is-locked) { transform: translateY(0); }

.answer-key {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 1.02rem;
  font-weight: 800;
  transition: background .15s, color .15s, border-color .15s;
}

.answer-text { min-width: 0; overflow-wrap: anywhere; }

/* Questions à 5 réponses ou plus : on resserre pour tenir à l'écran. */
.answers.is-dense .answer {
  min-height: 70px;
  padding: 12px 18px;
  font-size: clamp(.98rem, 1.25vw, 1.15rem);
}
.answers.is-dense .answer-key {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.answer-tag {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: right;
  white-space: nowrap;
}

.answer-marks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  max-width: 42%;
}

.pick-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 18ch;
  padding: 3px 9px 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}
.pick-dot {
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
}
.pick-badge.team-1 .pick-dot { background: var(--team-2); }
.pick-name { overflow: hidden; text-overflow: ellipsis; }
.pick-mark { font-weight: 900; }
.pick-badge.is-ok {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}
.pick-badge.is-bad {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
}

.answer.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.answer.is-selected .answer-key { background: var(--primary); border-color: transparent; color: #fff; }

.answer.is-correct {
  border-color: var(--ok);
  background: var(--ok-soft);
  animation: pop .38s cubic-bezier(.2, .9, .3, 1.3);
}
.answer.is-correct .answer-key { background: var(--ok); border-color: transparent; color: #fff; }
.answer.is-correct .answer-tag { color: var(--ok); }

.answer.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  animation: shake .4s ease;
}
.answer.is-wrong .answer-key { background: var(--bad); border-color: transparent; color: #fff; }
.answer.is-wrong .answer-tag { color: var(--bad); }

.answer.is-dim { opacity: .45; }
.answer.is-locked { cursor: default; }

.explain {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: var(--surface);
  animation: fadeUp .3s ease both;
}
.explain-label {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.explain p { color: var(--ink-2); font-size: .98rem; }

.game-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 6px;
  border-top: 1px solid var(--line);
}
.foot-left, .foot-right { display: flex; align-items: center; gap: 8px; }
.foot-right { justify-content: flex-end; }

.hint {
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
  flex: 1;
}
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: .72rem;
  text-align: center;
}

/* ================= END ================= */

.end-hero { padding: clamp(40px, 7vh, 72px) 0 clamp(24px, 4vh, 36px); text-align: center; }
.end-hero .eyebrow { justify-content: center; }
.end-hero .lede { margin-left: auto; margin-right: auto; }

.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.result-card {
  position: relative;
  padding: 24px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.result-card.is-winner { border-color: var(--primary); box-shadow: var(--shadow-md); }
.result-card.is-winner::before {
  content: "🏆";
  position: absolute;
  top: 14px; right: 18px;
  font-size: 1.5rem;
}
.result-team { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 650; font-size: .92rem; }
.result-score {
  margin-top: 10px;
  font-size: clamp(2.6rem, 5vw, 3.6rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}
.result-score small { font-size: .38em; font-weight: 700; color: var(--muted); letter-spacing: 0; }

.recap-card { padding: clamp(20px, 2.6vw, 30px); }
.recap-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.recap { list-style: none; padding: 0; display: flex; flex-direction: column; }
.recap-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.recap-item:first-child { border-top: 0; }

.recap-icon {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 800;
}
.recap-item.ok .recap-icon { background: var(--ok-soft); color: var(--ok); }
.recap-item.bad .recap-icon { background: var(--bad-soft); color: var(--bad); }
.recap-item.skip .recap-icon { background: var(--surface-2); color: var(--muted); }

.recap-q { font-weight: 650; font-size: .95rem; }
.recap-a { margin-top: 3px; color: var(--muted); font-size: .85rem; }
.recap-a strong { color: var(--ok); font-weight: 650; }
.recap-item.bad .recap-a strong { color: var(--ok); }

.end-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 28px; }

/* ================= BANQUE ================= */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: clamp(32px, 5vh, 56px) 0 22px;
}
.page-head .lede { margin-top: 10px; }
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 30px 20px;
  border-style: dashed;
  border-width: 2px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  margin-bottom: 14px;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.is-over { transform: scale(1.005); }
.dropzone-icon { font-size: 1.9rem; color: var(--primary); line-height: 1; margin-bottom: 6px; }
.dropzone p { color: var(--ink-2); font-size: .95rem; }

.paste-card, .format-card { margin-bottom: 14px; }
.paste-card summary, .format-card summary {
  cursor: pointer;
  font-weight: 700;
  font-size: .95rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.paste-card summary::-webkit-details-marker, .format-card summary::-webkit-details-marker { display: none; }
.paste-card summary::before, .format-card summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--primary);
  font-weight: 800;
  transition: transform .18s;
}
.paste-card[open] summary::before, .format-card[open] summary::before { transform: rotate(45deg); }

.paste-card summary + * { margin-top: 14px; }
.paste-card textarea { margin-top: 12px; }
.paste-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

.format-body { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.format-body p { color: var(--ink-2); font-size: .92rem; }
.code-block {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: .8rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}
.format-body code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: .85em;
}

.table-card { padding: 0; overflow: hidden; }
.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 20px clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
}
.table-tools { display: flex; align-items: center; gap: 8px; }

.table-wrap { max-height: min(58vh, 560px); overflow: auto; }

.bank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.bank-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.bank-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.bank-table tr:hover td { background: var(--surface-2); }
.bank-table .col-num, .bank-table .num { width: 46px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bank-table .col-act { width: 48px; }
.bank-table .cell-q { font-weight: 600; max-width: 34ch; }
.bank-table .cell-a { color: var(--ok); font-weight: 650; max-width: 22ch; }
.bank-table .cell-e { color: var(--muted); max-width: 34ch; }
.bank-table .cell-actions { text-align: right; padding-top: 8px; padding-bottom: 8px; }
.bank-table tr.is-empty td { text-align: center; padding: 40px 16px; color: var(--muted); }

.bank-table .icon-btn { width: 32px; height: 32px; border-radius: 9px; font-size: .8rem; }

/* ================= TOASTS ================= */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 84px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
  width: min(92vw, 620px);
}

.toast {
  max-width: 100%;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  font-weight: 550;
  text-align: center;
  opacity: 0;
  transform: translateY(10px) scale(.98);
  transition: opacity .22s ease, transform .22s ease;
}
.toast.is-in { opacity: 1; transform: translateY(0) scale(1); }
.toast-success { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.toast-error { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }

/* ================= ANIMATIONS ================= */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0% { transform: scale(.985); }
  55% { transform: scale(1.012); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ================= RESPONSIVE ================= */

@media (max-width: 960px) {
  .setup-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
  .game-top { gap: 12px; }
  .game-top-right { gap: 12px; }
  .question { max-width: 32ch; }
  .hint { display: none; }
}

@media (max-width: 760px) {
  .topbar { height: 58px; }
  .brand-name { display: none; }
  .answers { grid-template-columns: 1fr; }
  .answers .answer:last-child:nth-child(odd) { grid-column: auto; }
  .question-wrap { gap: 18px; padding: 16px 0; }
  .question { font-size: clamp(1.3rem, 5.4vw, 1.8rem); }
  .answer { min-height: 68px; padding: 12px 14px; gap: 12px; }
  .answer-key { width: 38px; height: 38px; border-radius: 10px; }
  .answer-tag { display: none; }
  .answer-marks { max-width: 58%; }
  .game-foot { flex-wrap: wrap; }
  .foot-right { flex: 1; }
  .foot-right .btn { flex: 1; }
  .foot-left .btn { padding: 8px 10px; }
  .page-head { align-items: flex-start; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; }
  .score-name { max-width: 10ch; }
  .team-inputs { grid-template-columns: 1fr; }
  .bank-table .cell-e { display: none; }
  .bank-table th:nth-child(4) { display: none; }
}

@media (max-width: 480px) {
  .topbar-actions .pill { display: none; }
  .score-chip { padding: 6px 9px; font-size: .8rem; }
  .timer { width: 48px; height: 48px; }
  .game-top-right { width: 100%; justify-content: space-between; }
}

/* Écrans peu hauts (portables 1366×768, projecteurs) : on compacte l'accueil
   puis le jeu pour garder les actions visibles sans défilement. */
@media (max-height: 820px) and (min-width: 961px) {
  .hero { padding: 14px 0 14px; }
  .hero h1 { font-size: clamp(1.6rem, 2.7vw, 2.35rem); }
  .lede { margin-top: 8px; font-size: .95rem; }
  .card { padding: 18px; }
  .setup-card { gap: 10px; }
  .field { gap: 6px; }
  .segmented button { padding: 8px 12px; }
  input[type="text"] { padding: 9px 12px; }
  .feature-list { gap: 6px; }
  .bank-card { gap: 12px; }
  .btn-lg { padding: 12px 20px; }
}

@media (max-height: 720px) and (min-width: 761px) {
  .game-top { padding: 10px 0 8px; }
  .question-wrap { gap: 16px; padding: 12px 0; }
  .question { font-size: clamp(1.25rem, 2.3vw, 1.95rem); }
  .answer { min-height: 68px; padding: 12px 16px; }
  .answer-key { width: 38px; height: 38px; border-radius: 10px; }
  .explain { padding: 12px 16px; }
  .game-foot { padding: 10px 0 4px; }
}
