/* DÉBATONS V4 — components (needs tokens.css). Light BEM; states via :disabled,
   [aria-pressed|checked|current|invalid|busy]. Reference: docs/DESIGN.md */

/* == 1. Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html { text-size-adjust: 100%; -webkit-text-size-adjust: 100%; scroll-padding: 72px 0 120px; }
body {
  margin: 0;
  min-height: 100dvh;
  font: var(--weight-regular) var(--text-md)/var(--leading-body) var(--font-text);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    radial-gradient(120% 60% at 0% 0%, var(--bg-glow-1), transparent 60%),
    radial-gradient(90% 50% at 100% 100%, var(--bg-glow-2), transparent 65%);
  background-attachment: fixed;

  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; box-shadow: 0 0 0 6px var(--night-950); }

[tabindex="-1"]:focus-visible { outline-offset: 6px; }

h1, h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: var(--tracking-display); line-height: var(--leading-tight); }
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); font-weight: 700; }

/* == 2. Layout */
.app { max-width: var(--content-max); margin-inline: auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; }
.screen__body { flex: 1; padding: var(--space-4) var(--gutter) var(--space-8); display: flex; flex-direction: column; gap: var(--space-6); }
.screen--enter { animation: screen-in var(--dur-slow) var(--ease-out); }
.screen__body--game { gap: var(--space-4); padding-top: var(--space-2); }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack--tight { gap: var(--space-2); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.section__head--flush { margin-bottom: 0; }
.section__title { font: var(--weight-bold) var(--text-lg)/1.2 var(--font-text); }
.section__meta { font-size: var(--text-sm); color: var(--color-text-muted); }

/* == 3. Topbar (header §3.1, E6 bar) */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--space-2);
  min-height: 64px; padding: var(--space-2); background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
}
.topbar__title { flex: 1; min-width: 0; font-size: var(--text-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__title:first-child { padding-left: var(--space-2); }
.topbar--home { padding-inline: var(--gutter); border-bottom: 0; background: transparent; backdrop-filter: none; position: static; }
.topbar__logo { height: 28px; width: auto; }
.topbar__mode {
  flex: 1; min-width: 0; font: var(--weight-bold) var(--text-sm)/1.2 var(--font-text);
  color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* == 4. Buttons §3.2 */
.btn {
  --btn-bg: var(--color-surface-2); --btn-fg: var(--color-text); --btn-bd: var(--color-border-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--target-min); min-width: var(--target-min); padding: var(--space-3) var(--space-5);
  border: 1.5px solid var(--btn-bd); border-radius: var(--radius-md); background: var(--btn-bg);
  color: var(--btn-fg); font: var(--weight-bold) var(--text-md)/1.2 var(--font-text); text-align: center;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-base), border-color var(--dur-base), box-shadow var(--dur-base);
  touch-action: manipulation; user-select: none;
}
.btn:hover { --btn-bg: var(--color-surface-3); }
.btn:active { transform: scale(0.97); }
.btn--primary {
  --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-bd: transparent;
  min-height: var(--target-primary); background-image: var(--accent-gradient);
  box-shadow: var(--shadow-primary); font-size: var(--text-md);
}
.btn--primary:hover { --btn-bg: var(--accent); filter: brightness(1.06); }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--accent-text); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.btn--ghost:hover { --btn-bg: var(--accent-soft); }
.btn--danger { --btn-bg: var(--color-error); --btn-fg: var(--color-error-ink); --btn-bd: transparent; }
.btn--danger:hover { --btn-bg: #ffa3a3; }
.btn--danger-quiet { --btn-bg: transparent; --btn-fg: var(--color-error); --btn-bd: color-mix(in srgb, var(--color-error) 60%, transparent); }
.btn--whatsapp { --btn-bg: #25d366; --btn-fg: #06261a; --btn-bd: transparent; }
.btn--whatsapp:hover { --btn-bg: #3ee07a; }
.btn--icon { padding: 0; width: var(--target-min); border-color: transparent; --btn-bg: transparent; border-radius: var(--radius-pill); }
.btn--icon:hover { --btn-bg: var(--color-surface-2); }
.btn--sm { min-height: var(--target-min); padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.btn--block { display: flex; width: 100%; }
.btn--stacked { flex-direction: column; gap: 2px; padding-block: var(--space-3); }
.btn__sub { font-weight: 400; font-size: var(--text-sm); opacity: 0.85; }
.btn__icon { width: 22px; height: 22px; flex: none; }

.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::before {
  content: ""; width: 18px; height: 18px; flex: none;
  border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
.btn-row { display: flex; gap: var(--space-2); }
.btn-row > .btn { flex: 1 1 0; }
.btn-row--end { justify-content: flex-end; }
.btn-row--end > .btn { flex: 0 1 auto; }

.btn-note { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); }
.actionbar .btn-note { margin: 0; }
.btn-row--game > .btn:first-child { flex: 0 0 40%; min-height: var(--target-primary); }
.btn-note--warn { color: var(--color-warning); }

.actionbar {
  position: sticky; bottom: 0; z-index: var(--z-sticky);
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--color-bg) 70%, transparent);
}
.actionbar:has(> .game-status) { background: var(--color-bg); } /* app: opaque when it holds text (guest wait) */
.actionbar::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: color-mix(in srgb, var(--color-border) 45%, transparent); }

.btn:disabled, .btn:disabled:hover, .btn[aria-disabled="true"], .btn[aria-disabled="true"]:hover {
  --btn-bg: var(--color-surface); --btn-fg: var(--color-text-muted); --btn-bd: var(--color-border);
  cursor: not-allowed; box-shadow: none; transform: none; background-image: none; filter: none;
}

/* == 5. Mode cards (E2) */
.mode-list { display: flex; flex-direction: column; gap: var(--space-3); }
.mode-card {
  --mode: var(--accent); position: relative; display: grid; grid-template-columns: 52px 1fr;
  grid-template-areas: "emoji head" "emoji desc"; column-gap: var(--space-3); row-gap: var(--space-1);
  width: 100%; min-height: 96px; padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-lg);
  background: linear-gradient(100deg, color-mix(in srgb, var(--mode) 14%, var(--color-surface)) 0%, var(--color-surface) 55%);
  color: var(--color-text); text-align: left; overflow: hidden;
  transition: border-color var(--dur-base), transform var(--dur-fast) var(--ease-out);
}
.mode-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--mode); }
.mode-card:hover { border-color: var(--mode); }
.mode-card:active { transform: scale(0.985); }
.mode-card--couple { --mode: var(--mode-couple); }
.mode-card--hot { --mode: var(--mode-hot); }
.mode-card--amis { --mode: var(--mode-amis); }
.mode-card--double { --mode: var(--mode-double); }
.mode-card__emoji {
  grid-area: emoji; align-self: center; display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--mode) 22%, var(--night-950)); font-size: 1.6rem; line-height: 1;
}
.mode-card__head { grid-area: head; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.mode-card__name { font: var(--weight-bold) var(--text-lg)/1.2 var(--font-display); letter-spacing: var(--tracking-display); }
.mode-card__meta { margin-left: auto; font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; }
.mode-card__desc { grid-area: desc; font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.4; }

/* == 6. Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-sm);
  font: var(--weight-bold) var(--text-xs)/1.4 var(--font-text);
  background: var(--color-surface-3); color: var(--color-text);
}
.badge--adult { background: var(--mode-hot); color: #2a0a04; }
.badge--host { background: var(--accent-soft); color: var(--accent-text); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); }

/* == 7. Fields */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label { font-weight: 700; font-size: var(--text-md); }
.field__row { display: flex; gap: var(--space-2); align-items: center; }
.field__row > .field__input { flex: 1; }
.field__input, .field__textarea {
  width: 100%; min-height: var(--target-min); padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--night-950); color: var(--color-text); font-size: var(--text-md);
  transition: border-color var(--dur-base), box-shadow var(--dur-base);
}
.field__input::placeholder, .field__textarea::placeholder { color: #a693b5; opacity: 1; }
.field__input:hover, .field__textarea:hover { border-color: var(--color-text-muted); }
.field__input:focus-visible, .field__textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.field__input:disabled { opacity: 0.6; }
.field__input--code { font: var(--weight-bold) var(--text-xl)/1 var(--font-display); letter-spacing: var(--tracking-code); text-transform: uppercase; }
.field__textarea { min-height: 112px; resize: vertical; line-height: var(--leading-body); }
.field__foot { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); }
.field__help { font-size: var(--text-sm); color: var(--color-text-muted); }
.field__counter { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.field__counter--limit { color: var(--color-warning); font-weight: 700; }
.field__error { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); font-weight: 700; color: var(--color-error); }
.field__error::before { content: "!"; flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--color-error); color: var(--color-error-ink); font-size: 13px; line-height: 1; margin-top: 1px; }
.field__input[aria-invalid="true"], .field__textarea[aria-invalid="true"] { border-color: var(--color-error); }

/* == 8. Chips & segmented */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--target-min);
  padding: var(--space-2) var(--space-4); border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-pill); background: transparent; color: var(--color-text);
  font-size: var(--text-sm); font-weight: 700;
  transition: background-color var(--dur-base), border-color var(--dur-base);
}
.chip:hover { background: var(--color-surface-2); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--color-text); }
.chip[aria-pressed="true"]::before, .chip[aria-checked="true"]::before { content: ""; width: 14px; height: 8px; margin-top: -4px; border: solid var(--accent-text); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg); }
.chip:disabled { opacity: 0.5; cursor: not-allowed; }
.chip__emoji { font-size: 1.05em; }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
  border: 1.5px solid var(--color-border); border-radius: var(--radius-md); background: var(--night-950);
}
.segmented__opt {
  min-height: 48px; padding: var(--space-2) var(--space-1);
  border: 0; border-radius: 10px; background: transparent;
  color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 700;
}
.segmented__opt:hover { color: var(--color-text); background: var(--color-surface); }
.segmented__opt[aria-checked="true"], .segmented__opt[aria-pressed="true"] { background: var(--color-text); color: var(--ink); }

.swatch { width: 18px; height: 18px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.25); }
.swatch--rose { background: linear-gradient(135deg, #ff4d8d, #ffa94d); }
.swatch--bleu { background: linear-gradient(135deg, #3fc6ff, #8f7dff); }
.swatch--or { background: linear-gradient(135deg, #ffbf3c, #ffe08a); }

/* == 9. Panels, banners, notices */
.panel { padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }
.banner {
  display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4);
  border-radius: var(--radius-lg); border: 1.5px solid var(--color-border); background: var(--color-surface);
}
.banner__title { font-weight: 700; }
.banner__text { font-size: var(--text-sm); color: var(--color-text-muted); }
.banner__text--strong { color: var(--color-text); }
.banner--resume { border-color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--color-surface) 70%); }
.banner--resume .banner__title::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: var(--space-2); border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.banner--pwa { border-style: dashed; }
.banner--update { flex-direction: row; align-items: center; justify-content: space-between; }
.banner--muted { border-color: var(--color-border); color: var(--color-text-muted); }

.notice {
  display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); border-left: 4px solid currentColor;
  font-size: var(--text-sm); line-height: 1.45;
}
.notice__text { color: var(--color-text); }
.notice--info { color: var(--color-text-muted); background: var(--color-surface); }
.notice--warning { color: var(--color-warning); background: var(--color-warning-bg); }
.notice--error { color: var(--color-error); background: var(--color-error-bg); }
.notice--success { color: var(--color-success); background: var(--color-success-bg); }
.notice--timeup { color: var(--color-warning); background: var(--color-warning-bg); font-weight: 700; font-size: var(--text-md); }

.netbar {
  position: sticky; top: 64px; z-index: var(--z-banner);
  display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--gutter);
  font-size: var(--text-sm); font-weight: 700;
}
.netbar::before, .presence::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; }
.netbar--lost { background: var(--color-warning-bg); color: var(--color-warning); }
.netbar--lost::before { animation: pulse 1.4s ease-in-out infinite; }
.netbar--host-away { background: var(--color-surface-2); color: var(--color-text); }
.netbar--host-away::before { background: transparent; box-shadow: inset 0 0 0 2px var(--color-text-muted); }
.netbar--back { background: var(--color-success-bg); color: var(--color-success); }
.netslot { display: contents; } /* app: wrapper of the connection banner, keeps .netbar sticky under the topbar */
.netbar--inline { position: static; border-radius: var(--radius-md); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* == 10. Home hero (E1) */
.hero { padding: var(--space-4) 0 var(--space-2); }
.hero__title { overflow-wrap: anywhere; font: 800 clamp(2rem, 1.4rem + 3vw, 2.6rem)/1.05 var(--font-display); letter-spacing: -0.02em; text-wrap: balance; }
.hero__intro { margin-top: var(--space-3); color: var(--color-text-muted); font-size: var(--text-md); max-width: 30ch; }
.online { display: flex; flex-direction: column; gap: var(--space-3); }
.online__head { display: flex; flex-direction: column; }
.online__title { font: var(--weight-bold) var(--text-lg)/1.2 var(--font-text); }
.online__sub { font-size: var(--text-sm); color: var(--color-text-muted); }
.legal { font-size: var(--text-sm); color: var(--color-text-muted); }

/* == 11. Game: turn, scorebar, timer, card */
.timer {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px;
  border-radius: var(--radius-pill); background: var(--color-surface-2);
  font: var(--weight-bold) var(--text-md)/1 var(--font-text); font-variant-numeric: tabular-nums;
}
.timer__icon { width: 18px; height: 18px; }
.timer--low { background: var(--color-warning-bg); color: var(--color-warning); }
.timer--up { background: var(--color-error-bg); color: var(--color-error); }

.scorebar {
  position: relative; display: flex; gap: var(--space-2); margin-inline: calc(var(--gutter) * -1);
  padding: var(--space-1) var(--gutter) var(--space-2); overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.scorebar::-webkit-scrollbar { display: none; }
.score {
  flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 40px; padding: 6px 12px; border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill); background: var(--color-surface); font-size: var(--text-sm);
  color: var(--color-text-muted); white-space: nowrap;
}
.score__pts { font-weight: 700; color: var(--color-text); font-variant-numeric: tabular-nums; }
.score[aria-current="true"] { border-color: var(--color-text); background: var(--color-text); color: var(--ink); font-weight: 700; }
.score[aria-current="true"] .score__pts { color: var(--ink); }
.score[aria-current="true"]::before { content: ""; border: 5px solid transparent; border-left: 7px solid var(--accent); border-right: 0; filter: brightness(0.75); }

.turn { font: 800 var(--text-turn)/1.15 var(--font-display); letter-spacing: -0.01em; text-align: center; text-wrap: balance; }
.turn__name { color: var(--accent-text); }
.turn--me { color: var(--accent-ink); background: var(--accent-gradient); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); align-self: center; }
.turn--me .turn__name { color: inherit; }

.game-card {
  --mode: var(--accent); position: relative; display: flex; flex-direction: column; gap: var(--space-4);
  min-height: 260px; padding: var(--space-5); border-radius: var(--radius-card);
  background: radial-gradient(140% 70% at 100% 0%, color-mix(in srgb, var(--mode) 16%, transparent), transparent 60%), var(--paper);
  color: var(--color-text-on-paper); box-shadow: var(--shadow-card); isolation: isolate;
}
.game-card::after {
  content: ""; position: absolute; inset: 8px; z-index: -1;
  border: 1.5px solid color-mix(in srgb, var(--mode) 45%, transparent);
  border-radius: calc(var(--radius-card) - 8px); pointer-events: none;
}
.game-card--couple { --mode: var(--mode-couple); }
.game-card--hot { --mode: var(--mode-hot); }
.game-card--amis { --mode: var(--mode-amis); }
.game-card--double { --mode: var(--mode-double); }
.game-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.game-card__cat { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 700; color: var(--color-text-on-paper-muted); }
.game-card__type {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px; border-radius: var(--radius-sm); background: var(--ink); color: var(--paper);
  font: var(--weight-bold) var(--text-xs)/1.3 var(--font-display); letter-spacing: 0.04em;
}
.game-card__type::before { content: ""; width: 10px; height: 10px; background: var(--mode); }
.game-card__type--question::before { border-radius: 50%; }
.game-card__type--defi::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.game-card__type--devine::before { transform: rotate(45deg) scale(0.85); }
.game-card__text {
  flex: 1; min-width: 0; display: flex; align-items: center; font: 700 var(--text-card)/var(--leading-snug) var(--font-text);
  letter-spacing: -0.005em; text-wrap: pretty; overflow-wrap: break-word; hyphens: manual;
}
.game-card__text--long { font-size: var(--text-card-long); }
.game-card__tip { padding-top: var(--space-3); border-top: 1.5px dashed color-mix(in srgb, var(--ink) 25%, transparent); font-size: var(--text-sm); color: var(--color-text-on-paper-muted); }

.game-card--blank { justify-content: center; text-align: center; min-height: 240px; }
.game-card--blank .game-card__text { justify-content: center; flex: 0; font-family: var(--font-display); font-size: var(--text-xl); }

.game-card--compact { min-height: 0; padding: var(--space-4); gap: var(--space-2); border-radius: var(--radius-lg); }
.game-card--compact::after { display: none; }
.game-card--compact .game-card__type { align-self: flex-start; }
.game-card--compact .game-card__text { font-size: var(--text-lg); }

.game-card--deal { animation: deal var(--dur-deal) var(--ease-spring) both; }
@keyframes deal { from { opacity: 0; transform: translateY(18px) rotate(-2.5deg) scale(0.96); } }
@media (prefers-reduced-motion: reduce) {
  .game-card--deal { animation: fade-in 1ms both; }
  .netbar--lost::before, .btn[aria-busy="true"]::before, .skeleton { animation: none; }
}
@keyframes fade-in { from { opacity: 0; } }

.game-info { text-align: center; font-size: var(--text-sm); color: var(--color-text-muted); }
.game-status { text-align: center; font-size: var(--text-md); color: var(--color-text-muted); }
.game-status strong { color: var(--color-text); }

.points__title { font-weight: 700; margin-bottom: var(--space-2); }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: var(--space-2); }
.point-btn {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  min-height: var(--target-primary); padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
  font-weight: 700; text-align: left;
}
.point-btn:hover { background: var(--color-surface-2); border-color: var(--accent); }
.point-btn:active { transform: scale(0.97); }
.point-btn__name { min-width: 0; overflow-wrap: anywhere; line-height: 1.25; }
.point-btn__plus { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 1.2rem; line-height: 1; }
.point-btn__score { font-weight: 400; color: var(--color-text-muted); font-size: var(--text-sm); }

.stepper { display: flex; align-items: center; gap: var(--space-2); }
.stepper__val { min-width: 2.5ch; text-align: center; font: var(--weight-bold) var(--text-lg)/1 var(--font-text); font-variant-numeric: tabular-nums; }

/* == 12. Secret answers */
.responders { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.progress + .progress__bar + .responders { margin-top: var(--space-3); }
.responder {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: var(--text-sm); color: var(--color-text-muted); border: 1.5px dashed var(--color-border-strong);
}
.responder--done { border-style: solid; border-color: var(--color-success); color: var(--color-text); }
.responder--done::before { content: "✓"; color: var(--color-success); font-weight: 700; }
.progress { font-weight: 700; }
.progress__bar { height: 6px; margin-top: var(--space-2); border-radius: 3px; background: var(--color-surface-3); overflow: hidden; }
.progress__fill { height: 100%; background: var(--accent-gradient); border-radius: inherit; transition: width var(--dur-slow) var(--ease-out); }

.sent { padding: var(--space-4); border-radius: var(--radius-md); background: var(--color-success-bg); border: 1.5px solid color-mix(in srgb, var(--color-success) 50%, transparent); }
.sent__title { color: var(--color-success); font-weight: 700; }
.sent__text { margin: var(--space-2) 0 var(--space-3); font-size: var(--text-lg); }

.answers { display: flex; flex-direction: column; gap: var(--space-3); }
.answers__team { font-size: var(--text-sm); font-weight: 700; color: var(--color-text-muted); margin-top: var(--space-2); }
.answer {
  display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); background: var(--color-surface); border-left: 4px solid var(--accent);
}
.answer__name { font-size: var(--text-sm); font-weight: 700; color: var(--accent-text); }
.answer__text { font-size: var(--text-lg); line-height: 1.35; overflow-wrap: anywhere; white-space: pre-wrap; }
.answer--empty { border-left-color: var(--color-border); }
.answer--empty .answer__name { color: var(--color-text-muted); }
.answer--empty .answer__text { font-size: var(--text-md); font-style: italic; color: var(--color-text-muted); }
.answers--reveal .answer { animation: fade-in var(--dur-slow) var(--ease-out) both; }

/* == 13. Lobby: room code, players, presence */
.room-code { text-align: center; padding: var(--space-5) var(--space-4); }
.room-code__actions { margin-top: var(--space-5); }
.room-code__label { font-size: var(--text-sm); color: var(--color-text-muted); }
.room-code__value {
  display: flex; justify-content: center; gap: 0.6em; margin-top: var(--space-2);
  font: 800 var(--text-3xl)/1 var(--font-display); letter-spacing: var(--tracking-code);
  color: var(--color-text); font-variant-numeric: tabular-nums;
}
.room-code__group { padding-left: var(--tracking-code); }
.room-code--sm .room-code__value { font-size: var(--text-xl); }

.player-list { display: flex; flex-direction: column; }
.player-row {
  display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-2) 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 60%, transparent);
}
.player-row:last-child { border-bottom: 0; }
.player-row__main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2); }
.player-row__name { font-weight: 700; overflow-wrap: anywhere; }
.player-row__me { color: var(--color-text-muted); font-weight: 400; }
.player-row--away .player-row__name { color: var(--color-text-muted); }

.presence { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; }
.presence--online::before { background: var(--color-success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success) 25%, transparent); }
.presence--away::before { background: none; border: 2px solid var(--color-text-muted); }

.saving { font-size: var(--text-sm); color: var(--color-text-muted); }

.skeleton { height: 20px; border-radius: 6px; background: linear-gradient(90deg, var(--color-surface) 0%, var(--color-surface-2) 50%, var(--color-surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* == 14. End: winner & ranking */
.end-reason { text-align: center; font-weight: 700; color: var(--color-text-muted); }
.winner { position: relative; text-align: center; padding: var(--space-6) var(--space-4) var(--space-5); }
.winner__crown { width: 56px; height: 40px; margin: var(--space-4) auto var(--space-3); color: var(--accent); }
.winner__name { font: 800 clamp(1.9rem, 1.4rem + 2.5vw, 2.4rem)/1.05 var(--font-display); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.winner__pts { margin-top: var(--space-2); font-size: var(--text-lg); color: var(--color-text-muted); }
.winner__pts strong { color: var(--accent-text); font-size: var(--text-xl); }

.ranking { display: flex; flex-direction: column; gap: var(--space-2); }
.ranking__row {
  display: grid; grid-template-columns: 3.2rem 1fr auto; align-items: center; gap: var(--space-3);
  min-height: 52px; padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md); background: var(--color-surface);
}
.ranking__rank { font: var(--weight-bold) var(--text-md)/1 var(--font-display); color: var(--color-text-muted); }
.ranking__name { font-weight: 700; overflow-wrap: anywhere; }
.ranking__pts { font: var(--weight-bold) var(--text-lg)/1 var(--font-text); font-variant-numeric: tabular-nums; }
.ranking__row--first { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.ranking__row--first .ranking__rank { color: var(--accent-text); }
.end-summary { text-align: center; color: var(--color-text-muted); font-size: var(--text-sm); }
.end-thanks { text-align: center; font: var(--weight-bold) var(--text-lg)/1.3 var(--font-display); }

.blocker { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: var(--space-3); padding: var(--space-8) var(--gutter); }
.blocker__title { font-size: var(--text-2xl); }
.blocker__text { color: var(--color-text-muted); }
.blocker.panel { flex: none; padding: var(--space-5); }
.blocker.panel .blocker__title { font-size: var(--text-lg); }

/* == 15. Sheet (P1, P2) & dialog (D1, D2) */
.sheet { position: fixed; inset: 0; z-index: var(--z-sheet); display: flex; flex-direction: column; justify-content: flex-end; }
.sheet__backdrop, .dialog::backdrop { background: rgb(8 2 14 / 0.72); }
.sheet__backdrop { position: absolute; inset: 0; border: 0; padding: 0; cursor: default; }
.sheet__panel {
  position: relative; width: 100%; max-width: var(--content-max); max-height: 88dvh; margin-inline: auto;
  display: flex; flex-direction: column; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-surface); border: 1px solid var(--color-border); border-bottom: 0;
  box-shadow: var(--shadow-lg); animation: sheet-up var(--dur-slow) var(--ease-out);
}
.sheet__panel::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--color-border-strong); margin: var(--space-2) auto 0; }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet__head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5); }
.sheet__title { flex: 1; font-size: var(--text-lg); }
.sheet__body { overflow-y: auto; padding: 0 var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--space-5); }
.sheet__subtitle { margin-bottom: var(--space-2); }
.menu-list { display: flex; flex-direction: column; }
.menu-list__item {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; min-height: 56px; padding: var(--space-2) var(--space-1);
  border: 0; border-bottom: 1px solid var(--color-border); background: none;
  color: var(--color-text); font-weight: 700; text-align: left;
}
.menu-list__item:last-child { border-bottom: 0; }
.menu-list__item:hover { color: var(--accent-text); }
.menu-list__item--danger { color: var(--color-error); }

.dialog {
  width: min(calc(100% - 2 * var(--gutter)), 420px); padding: var(--space-6) var(--space-5) var(--space-5);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg);
  background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-lg);
}
.dialog[open] { animation: dialog-in var(--dur-base) var(--ease-out); }
@keyframes dialog-in { from { opacity: 0; transform: scale(0.96); } }
.dialog__title { font-size: var(--text-xl); margin-bottom: var(--space-3); }
.dialog__body { color: var(--color-text-muted); display: flex; flex-direction: column; gap: var(--space-3); }
.dialog__list { display: flex; flex-direction: column; gap: var(--space-2); color: var(--color-text); }
.dialog__list li { display: flex; gap: var(--space-2); }
.dialog__list li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 0.55em; border-radius: 2px; background: var(--accent); }
.dialog__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-6); }
.dialog__actions > .btn { flex: 1 1 140px; }
.dialog--adult { border-top: 4px solid var(--mode-hot); }

/* == 16. Toast §3.5 */
.toast-region {
  position: fixed; z-index: var(--z-toast); left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: min(calc(100% - 2 * var(--gutter)), calc(var(--content-max) - 2 * var(--gutter)));
  display: flex; flex-direction: column; gap: var(--space-2); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 52px; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border-radius: var(--radius-md); background: var(--color-text); color: var(--ink);
  font-weight: 700; box-shadow: var(--shadow-md); pointer-events: auto;
  animation: toast-in var(--dur-base) var(--ease-out);
}
.toast__text { flex: 1; min-width: 0; }
.toast__action { min-height: var(--target-min); padding: 0 var(--space-4); border: 0; border-radius: 10px; background: var(--ink); color: var(--paper); font-weight: 700; }
.toast--error { background: var(--color-error); color: var(--color-error-ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* == 17. Utilities (minimal) */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--color-text-muted); }
.grow { flex: 1; }

@media (min-width: 600px) {
  .app { padding-block: var(--space-4); }
  .actionbar { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
}
@media (forced-colors: active) {
  .btn, .chip, .score, .game-card { border: 2px solid CanvasText; }
  .score[aria-current="true"], .chip[aria-pressed="true"] { outline: 3px solid Highlight; }
}

/* == Narrow viewports (≤ 240 px, i.e. 200 % zoom on a 360 px phone) — QA-BUG-01 / AC-36 */
@media (max-width: 240px) {
  .section__head { flex-wrap: wrap; }
  .segmented { grid-auto-flow: row; }
  .chip { max-width: 100%; white-space: normal; text-align: left; }
  .game-card__text, .game-card__text--long { font-size: var(--text-md); hyphens: auto; overflow-wrap: anywhere; }
}
