/* Parmigiano Bomber — identité visuelle.
   Une affiche de trattoria : papier crème, encre espresso, rouge pomodoro, vert basilico,
   or parmigiano. Bodoni (né à Parme) pour les titres, Titillium (Urbino) pour l'interface,
   Oleo Script pour l'enseigne. */

@font-face { font-family: 'Bodoni Moda'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/bodoni-moda-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bodoni Moda'; font-weight: 900; font-style: normal; font-display: swap; src: url('../fonts/bodoni-moda-latin-900-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bodoni Moda'; font-weight: 900; font-style: italic; font-display: swap; src: url('../fonts/bodoni-moda-latin-900-italic.woff2') format('woff2'); }
@font-face { font-family: 'Titillium Web'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/titillium-web-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Titillium Web'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/titillium-web-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Titillium Web'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/titillium-web-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Oleo Script'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/oleo-script-latin-700-normal.woff2') format('woff2'); }

:root {
  --carta: #fbf5e6;
  --crema: #f3e7cd;
  --pomodoro: #c8281e;
  --pomodoro-scuro: #93170f;
  --basilico: #1f6b3a;
  --basilico-chiaro: #2f9a4c;
  --parmigiano: #f2c14e;
  --crosta: #d99a1e;
  --espresso: #2a1710;
  --noce: #4a2c1c;
  --terra: #76503a;
  --notte: #1d100b;

  --font-display: 'Bodoni Moda', 'Bodoni 72', Didot, 'Times New Roman', serif;
  --font-ui: 'Titillium Web', 'Trebuchet MS', system-ui, sans-serif;
  --font-script: 'Oleo Script', 'Brush Script MT', cursive;

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow-paper: 0 30px 60px -28px rgba(29, 16, 11, 0.75), 0 6px 14px -4px rgba(29, 16, 11, 0.35);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .18 0 0 0 0 .1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.45;
  color: var(--espresso);
  background: var(--notte);
  -webkit-font-smoothing: antialiased;
  accent-color: var(--pomodoro);
  caret-color: var(--pomodoro);
  overscroll-behavior: none;
}
::selection { background: var(--parmigiano); color: var(--espresso); }
* { scrollbar-color: var(--terra) transparent; scrollbar-width: thin; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--basilico); outline-offset: 3px; border-radius: var(--r-s); }
h1, h2, h3, p { margin: 0; }
h2 { font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.01em; text-wrap: balance; }
kbd {
  font-family: var(--font-ui); font-weight: 700; font-size: 0.82em; padding: 0.05em 0.5em; border-radius: 6px;
  background: var(--carta); border: 1.5px solid var(--espresso); box-shadow: 0 2px 0 var(--espresso); white-space: nowrap;
}

#app { height: 100%; }
.screen { height: 100%; overflow: auto; }

/* ------------------------------------------------------------- nappe vichy */
.tovaglia, #screen-title, #screen-lobby {
  background-color: var(--carta);
  background-image:
    radial-gradient(ellipse at 50% 40%, transparent 30%, rgba(29, 16, 11, 0.5) 100%),
    linear-gradient(90deg, rgba(200, 40, 30, 0.62) 50%, transparent 50%),
    linear-gradient(rgba(200, 40, 30, 0.62) 50%, transparent 50%);
  background-size: 100% 100%, 72px 72px, 72px 72px;
}
#screen-title, #screen-lobby { display: grid; place-items: center; padding: clamp(12px, 3vw, 40px); }

/* ---------------------------------------------------------------- affiche */
.poster {
  position: relative;
  background: var(--carta) var(--grain);
  border-radius: 6px;
  box-shadow: inset 0 0 0 7px var(--carta), inset 0 0 0 9px var(--pomodoro), inset 0 0 0 12px var(--carta), inset 0 0 0 13px var(--espresso), var(--shadow-paper);
  padding: clamp(26px, 4vw, 46px);
}
.title-card { width: min(680px, 100%); text-align: center; animation: paper-in 0.7s var(--ease-out) both; }
@keyframes paper-in { from { opacity: 0; transform: translateY(18px) rotate(-1.2deg) scale(0.97); } }

/* ------------------------------------------------------------------- logo */
.logo { display: inline-grid; justify-items: center; line-height: 0.82; position: relative; user-select: none; }
.logo-top {
  font-family: var(--font-display); font-weight: 900; font-size: clamp(2.1rem, 8.6vw, 5.2rem); letter-spacing: -0.035em;
  text-transform: uppercase; color: var(--pomodoro);
  text-shadow: 0.035em 0.045em 0 var(--parmigiano), 0.07em 0.09em 0 var(--espresso);
}
.logo-bottom {
  font-family: var(--font-script); font-weight: 700; font-size: clamp(2.4rem, 9.6vw, 5.8rem); color: var(--basilico);
  transform: rotate(-5deg) translateY(-0.14em); -webkit-text-stroke: 0.09em var(--carta); paint-order: stroke fill;
  filter: drop-shadow(0.03em 0.05em 0 var(--espresso)); padding: 0 0.2em; margin-bottom: -0.1em;
}
.logo-wheel { position: absolute; right: 1%; bottom: -9%; width: clamp(40px, 10.5vw, 86px); transform: rotate(10deg); }
.logo-wheel canvas { width: 100% !important; height: auto !important; display: block; }
.logo-small .logo-top { font-size: 1.5rem; }
.logo-small .logo-bottom { font-size: 1.7rem; }
.logo-small .logo-wheel { display: none; }

.tricolore { height: 7px; width: min(240px, 60%); margin: 14px auto 0; border-radius: 99px; background: linear-gradient(90deg, var(--basilico) 33.3%, var(--carta) 33.3% 66.6%, var(--pomodoro) 66.6%); box-shadow: 0 0 0 1.5px var(--espresso); }
.tagline { margin-top: 16px; font-size: 1.08rem; color: var(--terra); text-wrap: balance; }
.tagline em { font-family: var(--font-script); font-style: normal; font-size: 1.25em; color: var(--pomodoro); white-space: nowrap; }

/* ------------------------------------------------------------- formulaires */
.title-form { margin-top: 26px; display: grid; gap: 20px; text-align: left; }
.field { display: grid; gap: 7px; }
.field > span, .setting > span, .label {
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--terra);
}
input[type='text'] {
  width: 100%; padding: 0.7em 0.9em; border-radius: var(--r-m); border: 2px solid var(--espresso); background: #fffdf6;
  font-weight: 600; font-size: 1.1rem; box-shadow: inset 0 2px 0 rgba(42, 23, 16, 0.08);
  transition: box-shadow 0.2s var(--ease-out), border-color 0.2s;
}
input[type='text']::placeholder { color: #8a6a55; font-weight: 400; }
input[type='text']:focus-visible { outline: none; border-color: var(--basilico); box-shadow: 0 0 0 4px rgba(31, 107, 58, 0.22); }
#in-code { width: 5.6em; text-align: center; font-family: var(--font-display); font-weight: 900; font-size: 1.35rem; letter-spacing: 0.16em; padding: 0.42em 0.3em 0.42em 0.46em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.78em 1.4em; border-radius: var(--r-m); border: 2px solid var(--espresso); background: var(--carta);
  font-weight: 700; font-size: 1rem; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 4px 0 var(--espresso), 0 12px 18px -10px rgba(29, 16, 11, 0.6);
  transition: transform 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out), background-color 0.16s;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 var(--espresso), 0 16px 22px -10px rgba(29, 16, 11, 0.6); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--espresso), 0 4px 8px -4px rgba(29, 16, 11, 0.6); }
.btn-primary { background: var(--pomodoro); color: #fffdf6; border-color: var(--pomodoro-scuro); box-shadow: 0 4px 0 var(--pomodoro-scuro), 0 12px 18px -10px rgba(29, 16, 11, 0.7); }
.btn-primary:hover:not(:disabled) { background: #d6352a; box-shadow: 0 6px 0 var(--pomodoro-scuro), 0 16px 22px -10px rgba(29, 16, 11, 0.7); }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--pomodoro-scuro), 0 4px 8px -4px rgba(29, 16, 11, 0.6); }
.btn-primary.is-ready { background: var(--basilico); border-color: #134726; box-shadow: 0 4px 0 #134726, 0 12px 18px -10px rgba(29, 16, 11, 0.7); }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.btn-ghost:hover:not(:disabled) { box-shadow: none; transform: none; color: var(--pomodoro); }
.btn-small { font-size: 0.85rem; padding: 0.6em 1.1em; }
.btn:disabled { opacity: 0.55; filter: saturate(0.4); }

.title-actions { display: grid; grid-template-columns: 1fr auto; gap: 14px 20px; align-items: center; }
.title-actions .btn-primary { font-size: 1.1rem; padding: 0.9em 1.4em; }
.join-row { display: flex; gap: 10px; align-items: center; }
.form-error { min-height: 1.4em; font-weight: 600; color: var(--pomodoro-scuro); }
.howto { margin-top: 18px; text-align: left; border-top: 2px dotted rgba(42, 23, 16, 0.4); padding-top: 14px; }
.howto summary { font-weight: 700; cursor: pointer; color: var(--basilico); width: fit-content; }
.howto ul { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.howto li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.howto .bonus-row { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; }
.howto .bonus-row b { font-weight: 700; }

/* ---------------------------------------------------- choix du personnage */
.char-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.char {
  --c: var(--espresso);
  display: grid; justify-items: center; gap: 4px; padding: 8px 4px 7px; border-radius: var(--r-m);
  border: 2px solid transparent; background: transparent; position: relative;
  transition: transform 0.18s var(--ease-out), background-color 0.18s, border-color 0.18s;
}
.char canvas { border-radius: 50%; background: color-mix(in srgb, var(--c) 18%, #fffdf6); box-shadow: 0 0 0 2px var(--espresso), 0 0 0 5px color-mix(in srgb, var(--c) 0%, transparent); transition: box-shadow 0.2s var(--ease-out); }
.char-name { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.02em; line-height: 1.1; text-align: center; }
.char:hover:not(:disabled) { transform: translateY(-3px); }
.char:hover:not(:disabled) canvas { box-shadow: 0 0 0 2px var(--espresso), 0 0 0 5px color-mix(in srgb, var(--c) 55%, transparent); }
.char.is-selected { background: color-mix(in srgb, var(--c) 14%, transparent); border-color: var(--espresso); }
.char.is-selected canvas { box-shadow: 0 0 0 2px var(--espresso), 0 0 0 6px var(--c); }
.char.is-selected .char-name { color: var(--espresso); }
.char:disabled { opacity: 0.38; filter: grayscale(0.9); }

/* ------------------------------------------------------------------ lobby */
.lobby { width: min(1040px, 100%); animation: paper-in 0.6s var(--ease-out) both; }
.lobby-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding-bottom: 20px; border-bottom: 3px double var(--espresso); }
.lobby-head .btn-ghost { justify-self: end; }
.lobby-head .logo { justify-self: start; }
.room-code { display: grid; justify-items: center; gap: 2px; }
.room-code-label { font-weight: 700; font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--terra); }
.code {
  font-family: var(--font-display); font-weight: 900; font-size: clamp(2rem, 6vw, 2.9rem); line-height: 1; letter-spacing: 0.14em;
  padding: 0.14em 0.3em 0.16em 0.44em; background: #fffdf6; border: 2px solid var(--espresso); border-radius: var(--r-s);
  box-shadow: 0 4px 0 var(--espresso), 0 12px 18px -10px rgba(29, 16, 11, 0.6); color: var(--pomodoro);
  transition: transform 0.16s var(--ease-out);
}
.code:hover { transform: translateY(-2px) rotate(-1.5deg); }
.room-code-hint { font-size: 0.82rem; color: var(--terra); min-height: 1.3em; }
.lobby-body { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 44px); padding-top: 22px; }
.panel h2 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; }
.panel h2:not(:first-child) { margin-top: 26px; }
.panel h2 span { font-family: var(--font-ui); font-weight: 600; font-size: 0.85rem; color: var(--terra); letter-spacing: 0.02em; }
.players { list-style: none; margin: 0 0 16px; padding: 0; }
.player {
  --c: var(--terra);
  display: grid; grid-template-columns: 48px 1fr auto auto; align-items: center; gap: 12px; min-height: 60px; padding: 6px 2px;
  border-bottom: 2px dotted rgba(42, 23, 16, 0.32);
}
.player canvas { border-radius: 50%; background: color-mix(in srgb, var(--c) 20%, #fffdf6); box-shadow: 0 0 0 2px var(--espresso), 0 0 0 5px var(--c); margin-left: 5px; }
.player-id { display: grid; min-width: 0; }
.player-name { font-family: var(--font-display); font-weight: 700; font-size: 1.18rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player.is-me .player-name { color: var(--pomodoro-scuro); }
.player-role { font-size: 0.82rem; color: var(--terra); }
.player-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.player.is-empty { grid-template-columns: 48px 1fr; color: var(--terra); }
.player.is-empty::before { content: ''; width: 40px; height: 40px; margin-left: 5px; border-radius: 50%; border: 2px dashed rgba(118, 80, 58, 0.6); }
.player-empty { font-style: italic; font-size: 0.92rem; }
/* Tampons encreurs */
.tag {
  font-weight: 700; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.12em 0.55em; white-space: nowrap;
  border: 2px solid currentColor; border-radius: 6px; transform: rotate(-3deg); color: var(--terra);
}
.tag-ready { color: var(--basilico); animation: stamp 0.35s var(--ease-pop) both; }
.tag-host { color: #8a5a06; transform: rotate(2deg); }
.tag-wait { border-style: dashed; }
.tag-off { color: var(--pomodoro-scuro); }
.tag-bot { transform: rotate(1.5deg); }
@keyframes stamp { from { transform: rotate(-3deg) scale(1.9); opacity: 0; } }

.settings { display: grid; gap: 14px; }
.setting { display: grid; gap: 7px; }
.seg { display: flex; flex-wrap: wrap; gap: 7px; }
.seg-btn {
  padding: 0.36em 0.95em; border-radius: 99px; border: 2px solid var(--espresso); background: transparent; font-weight: 700; font-size: 0.92rem;
  transition: background-color 0.16s, color 0.16s, transform 0.16s var(--ease-out);
}
.seg-btn:hover:not(:disabled):not(.is-on) { background: rgba(42, 23, 16, 0.09); transform: translateY(-1px); }
.seg-btn.is-on { background: var(--espresso); color: var(--carta); }
.seg-btn:disabled:not(.is-on) { opacity: 0.45; border-style: dashed; }
.lobby-actions { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.lobby-actions .btn-primary { font-size: 1.12rem; padding: 0.9em 1.7em; }
.lobby-status { font-weight: 600; color: var(--terra); flex: 1 1 200px; text-wrap: balance; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 2px solid transparent; background: transparent;
  transition: background-color 0.16s, transform 0.16s var(--ease-out);
}
.icon-btn svg { width: 22px; height: 22px; display: block; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: rgba(127, 90, 60, 0.25); transform: scale(1.08); }
.icon-btn.is-off { opacity: 0.45; }
.icon-btn.is-off svg .wave { display: none; }
.icon-btn .slash { display: none; }
.icon-btn.is-off .slash { display: block; }

/* -------------------------------------------------------------------- jeu */
#screen-game { display: flex; flex-direction: column; overflow: hidden; position: relative; background: var(--notte); color: var(--carta); }
.hud {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 8px 18px; padding: 6px 14px;
  background: linear-gradient(#3a2116, #2a1710); border-bottom: 3px solid var(--notte); box-shadow: inset 0 -1px 0 rgba(242, 193, 78, 0.35);
}
.hud-left { display: grid; line-height: 1.15; min-width: 0; }
.hud-round { font-family: var(--font-display); font-weight: 900; font-size: 1.12rem; }
.hud-arena { font-size: 0.82rem; color: #d9bf9b; max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-arena.is-feed { color: var(--parmigiano); font-weight: 600; }
.hud-timer {
  font-family: var(--font-display); font-weight: 900; font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums lining-nums;
  color: var(--parmigiano); min-width: 3.1em; text-align: center; padding: 0.12em 0.4em 0.16em; border-radius: var(--r-s);
  background: rgba(29, 16, 11, 0.6); box-shadow: inset 0 0 0 1.5px rgba(242, 193, 78, 0.4);
}
.hud-timer.is-soon { color: #ffb38a; }
.hud-timer.is-sudden { font-family: var(--font-script); font-size: 1.25rem; padding: 0.3em 0.6em; background: var(--pomodoro); color: #fffdf6; box-shadow: none; animation: throb 0.7s ease-in-out infinite alternate; }
@keyframes throb { to { background: #e04a35; transform: scale(1.04); } }
.hud-scores { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.score {
  --c: var(--terra);
  display: flex; align-items: center; gap: 6px; padding: 2px 10px 2px 2px; border-radius: 99px; background: rgba(251, 245, 230, 0.1);
  font-weight: 700; font-size: 0.86rem; transition: opacity 0.4s, filter 0.4s;
}
.score canvas { border-radius: 50%; background: color-mix(in srgb, var(--c) 35%, #fffdf6); box-shadow: 0 0 0 2px var(--c); }
.score.is-me { background: rgba(251, 245, 230, 0.22); box-shadow: inset 0 0 0 1.5px rgba(251, 245, 230, 0.6); }
.score-name { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score.is-dead { opacity: 0.42; filter: grayscale(1); }
.score.is-dead .score-name { text-decoration: line-through; }
.pips { display: inline-flex; gap: 3px; align-items: center; }
/* une manche gagnée = une part de parmesan */
.pip { width: 11px; height: 11px; clip-path: polygon(0 100%, 100% 100%, 100% 0); background: rgba(242, 193, 78, 0.25); }
.pip.is-on { background: var(--parmigiano); }
.hud-right { display: flex; gap: 2px; color: var(--carta); }
.stage { flex: 1; min-height: 0; position: relative; }
.stage canvas { display: block; }
.hud-me {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 46px; padding: 5px 14px;
  background: linear-gradient(#2a1710, #23130d); border-top: 3px solid var(--notte); box-shadow: inset 0 1px 0 rgba(242, 193, 78, 0.25);
}
.stat { display: inline-flex; align-items: center; gap: 5px; transition: opacity 0.3s, filter 0.3s; }
.stat b { font-family: var(--font-display); font-weight: 900; font-size: 1.1rem; font-variant-numeric: lining-nums; }
.stat.is-off { opacity: 0.28; filter: grayscale(1); }
.stat-curse b { font-family: var(--font-ui); font-size: 0.9rem; color: var(--parmigiano); }
.stat-curse { animation: wobble 0.5s ease-in-out infinite alternate; }
@keyframes wobble { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
.hud-note { font-size: 0.86rem; color: #d9bf9b; margin-left: auto; }

.banner {
  position: absolute; left: 50%; top: 42%; translate: -50% -50%; pointer-events: none; text-align: center; white-space: nowrap; z-index: 5;
  font-family: var(--font-script); font-weight: 700; font-size: clamp(3rem, 11vw, 6rem); line-height: 1; color: var(--parmigiano);
  -webkit-text-stroke: 0.14em var(--espresso); paint-order: stroke fill; filter: drop-shadow(0 0.08em 0 rgba(29, 16, 11, 0.55));
  animation: banner-pop 0.5s var(--ease-pop) both;
}
.banner-small { font-size: clamp(1.5rem, 5vw, 2.6rem); color: var(--carta); white-space: normal; width: min(90%, 26ch); }
.banner-count { font-family: var(--font-display); font-weight: 900; font-size: clamp(6rem, 22vw, 11rem); color: var(--carta); }
.banner-danger { color: #ff6a52; }
@keyframes banner-pop { from { opacity: 0; scale: 0.5; rotate: -6deg; } }

.overlay { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 14px; overflow: auto; background: rgba(29, 16, 11, 0.72); animation: fade-in 0.3s ease-out both; }
@keyframes fade-in { from { opacity: 0; } }
.card { width: min(560px, 100%); color: var(--espresso); text-align: center; animation: paper-in 0.55s var(--ease-out) both; }
.card h2 { font-size: clamp(1.5rem, 4.6vw, 2.2rem); }
.result-hero { margin: 14px auto 2px; width: fit-content; position: relative; }
.result-hero canvas { border-radius: 50%; background: color-mix(in srgb, var(--c) 22%, #fffdf6); box-shadow: 0 0 0 3px var(--espresso), 0 0 0 8px var(--c); }
.result-list { list-style: none; margin: 18px 0 0; padding: 0; text-align: left; }
.result { --c: var(--terra); display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 5px 4px; border-bottom: 2px dotted rgba(42, 23, 16, 0.3); }
.result canvas { border-radius: 50%; background: color-mix(in srgb, var(--c) 22%, #fffdf6); box-shadow: 0 0 0 2px var(--c); }
.result-name { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result.is-winner .result-name { color: var(--pomodoro-scuro); }
.result.is-me { background: rgba(242, 193, 78, 0.22); }
.card .pip { width: 15px; height: 15px; background: rgba(42, 23, 16, 0.14); }
.card .pip.is-on { background: var(--crosta); }
.result-next { margin-top: 16px; font-weight: 600; color: var(--terra); }

.match-card { width: min(640px, 100%); overflow: hidden; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: clamp(6px, 2vw, 16px); margin-top: 26px; position: relative; isolation: isolate; }
.podium::before {
  content: ''; pointer-events: none; position: absolute; z-index: -1; left: 50%; bottom: 40%; width: 130%; aspect-ratio: 1; translate: -50% 50%; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(242, 193, 78, 0.5) 0 9deg, transparent 9deg 18deg);
  mask-image: radial-gradient(circle, #000 12%, transparent 62%); animation: spin 40s linear infinite;
}
@keyframes spin { to { rotate: 1turn; } }
.podium-step { --c: var(--terra); display: grid; justify-items: center; gap: 6px; flex: 0 1 150px; min-width: 0; animation: rise 0.8s var(--ease-out) both; }
.podium-1 { animation-delay: 0.35s; } .podium-2 { animation-delay: 0.15s; }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } }
.podium-step canvas { margin-bottom: 8px; border-radius: 50%; background: color-mix(in srgb, var(--c) 22%, #fffdf6); box-shadow: 0 0 0 3px var(--espresso), 0 0 0 7px var(--c); }
.podium-name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-block { width: 100%; display: grid; align-content: start; justify-items: center; gap: 2px; padding: 8px 4px; border: 2px solid var(--espresso); border-bottom: 0; border-radius: var(--r-s) var(--r-s) 0 0; background: var(--parmigiano); }
.podium-block b { font-family: var(--font-display); font-weight: 900; font-size: 2.2rem; line-height: 1; }
.podium-block span { font-size: 0.8rem; font-weight: 700; }
.podium-1 .podium-block { height: 124px; } .podium-2 .podium-block { height: 92px; background: #e9dcc0; } .podium-3 .podium-block { height: 68px; background: #dba36b; }
.podium-rest { position: relative; z-index: 1; margin-top: 0; padding-top: 12px; border-top: 3px double var(--espresso); font-size: 0.9rem; color: var(--terra); }
.match-actions { position: relative; z-index: 1; margin-top: 20px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.net, .toast {
  position: fixed; left: 50%; translate: -50% 0; z-index: 50; max-width: min(92vw, 520px); padding: 0.6em 1.2em; border-radius: 99px;
  font-weight: 700; text-align: center; box-shadow: 0 14px 30px -12px rgba(29, 16, 11, 0.8); animation: toast-in 0.4s var(--ease-out) both;
}
.net { top: 12px; background: var(--pomodoro); color: #fffdf6; }
.toast { bottom: 18px; background: var(--espresso); color: var(--carta); border: 2px solid var(--parmigiano); }
@keyframes toast-in { from { opacity: 0; translate: -50% 12px; } }

/* ------------------------------------------------------- contrôles tactiles */
.touch { position: absolute; inset: auto 0 0 0; height: 0; z-index: 6; }
.stick { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: 64px; width: 128px; height: 128px; border-radius: 50%; background: rgba(251, 245, 230, 0.14); border: 2px solid rgba(251, 245, 230, 0.4); touch-action: none; }
.knob { position: absolute; left: 37px; top: 37px; width: 50px; height: 50px; border-radius: 50%; background: rgba(251, 245, 230, 0.75); box-shadow: 0 4px 10px rgba(29, 16, 11, 0.5); }
.touch-buttons { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: 64px; display: flex; gap: 14px; align-items: flex-end; }
.touch-buttons button { display: grid; place-items: center; width: 84px; height: 84px; padding: 0; border-radius: 50%; border: 2px solid rgba(251, 245, 230, 0.5); background: rgba(251, 245, 230, 0.2); touch-action: none; }
.touch-buttons button:active { background: rgba(242, 193, 78, 0.5); }
.touch-buttons .btn-det { width: 60px; height: 60px; }

/* -------------------------------------------------------------- adaptations */
@media (max-width: 800px) {
  .lobby-body { grid-template-columns: 1fr; }
  .lobby-head { grid-template-columns: 1fr auto; }
  .lobby-head .logo { display: none; }
  .room-code { justify-items: start; }
  .title-actions { grid-template-columns: 1fr; }
  .join-row { justify-content: space-between; }
  .hud { grid-template-columns: auto 1fr auto; padding: 4px 8px; gap: 4px 10px; }
  .hud-scores { grid-column: 1 / -1; grid-row: 2; }
  .score-name { display: none; }
  .score { padding-right: 7px; }
  .hud-timer { font-size: 1.3rem; justify-self: center; }
  .hud-note { display: none; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .poster { padding: 26px 18px; }
  .char-grid { gap: 4px; }
  .char canvas { width: 44px !important; height: 44px !important; }
  .char-name { font-size: 0.68rem; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .hud-me { min-height: 36px; padding: 2px 10px; }
  .hud-scores { grid-column: auto; grid-row: auto; }
  .hud { grid-template-columns: auto auto 1fr auto; }
  .stick, .touch-buttons { bottom: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
