@font-face { font-family: "Bungee"; src: url(fonts/bungee.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Rubik"; src: url(fonts/rubik.woff2) format("woff2"); font-weight: 300 900; font-display: swap; }
/* Rocket Prout : interface des menus. Le jeu lui-même est dessiné en 3D sur #gl,
   l'interface en jeu sur #hud. Univers unique (nuit violette, accents orange fusée). */
:root {
  --night: #1a1430; --panel: #2a2050; --panel-2: #342866; --line: #4e3f86; --ink: #fff4dc; --muted: #c9b6ee;
  --rocket: #ff5d3a; --gold: #ffcf2e; --mint: #4dffd2; --red: #ff4b4b; --blue: #3b8cff;
  --display: "Bungee", Impact, "Arial Black", sans-serif;
  --body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--night); color: var(--ink); font-family: var(--body); }
#gl, #hud { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud { pointer-events: none; }

.screen {
  position: fixed; inset: 0; overflow-y: auto; display: flex; justify-content: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--night) 40%, transparent), color-mix(in srgb, var(--night) 94%, transparent) 50%);
  padding-block: max(28px, env(safe-area-inset-top, 0px)) 36px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.screen.dim { background: color-mix(in srgb, var(--night) 80%, transparent); align-items: center; }
.wrap { width: 100%; max-width: 1080px; display: grid; gap: 22px; align-content: start; }
.wrap.narrow { max-width: 620px; }
.wrap.center { text-align: center; justify-items: center; }
.stack { display: grid; gap: 10px; align-content: start; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 22px; }
.cards3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.eyebrow { margin: 0; font: 800 12px/1.2 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 6px 0 0; font: 400 clamp(56px, 12vw, 132px)/.86 var(--display); color: var(--gold); text-shadow: 4px 4px 0 var(--rocket), 8px 8px 0 #0d0a1c; text-wrap: balance; }
h2 { margin: 2px 0 0; font: 400 clamp(30px, 6vw, 56px)/1 var(--display); text-wrap: balance; }
h3 { margin: 0; font: 400 16px/1.2 var(--display); color: var(--ink); }
.tagline { margin: 14px 0 0; max-width: 52ch; font-size: 18px; line-height: 1.45; }
.hint { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.hint strong { color: var(--ink); }
.error { margin: 0; color: #ff8a8a; font-weight: 600; min-height: 1.4em; }
.menu { display: grid; gap: 12px; max-width: 420px; }

.btn {
  font: 400 17px/1 var(--display); background: var(--gold); color: var(--night); border: 0; padding: 15px 22px; cursor: pointer;
  box-shadow: 0 5px 0 #a7810b; transition: transform .05s;
}
.btn.big { font-size: 21px; padding: 18px 26px; }
.btn.alt { background: var(--mint); box-shadow: 0 5px 0 #1e9a7c; }
.btn.small { font-size: 13px; padding: 9px 12px; box-shadow: 0 3px 0 #a7810b; }
.btn.icon { width: 42px; height: 42px; padding: 0; font-size: 22px; background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 3px var(--line); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 3px var(--line); }
.btn:active { transform: translateY(3px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.card { background: color-mix(in srgb, var(--panel) 90%, transparent); border-top: 4px solid var(--c, var(--line)); padding: 16px 18px; min-width: 0; }
.card dl { margin: 10px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; line-height: 1.35; }
.card dt { white-space: nowrap; } .card dd { margin: 0; color: var(--muted); }
kbd { font: 600 12px/1 var(--body); background: var(--night); border: 1px solid var(--line); border-bottom-width: 3px; padding: 3px 6px; color: var(--ink); }
label { font-weight: 600; font-size: 14px; }
input:not([type]), input[type="text"], select {
  font: 600 17px var(--body); color: var(--ink); background: var(--night); border: 3px solid var(--line); padding: 10px 12px; min-width: 0;
}
#join-code { font: 400 28px var(--display); letter-spacing: .3em; width: 9ch; text-transform: uppercase; }
input[type="range"] { width: 100%; accent-color: var(--gold); }
.check { display: flex; gap: 10px; align-items: center; }
.facts { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.45; max-width: 70ch; }

/* Salon */
.lobby-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: end; }
.code-box { display: grid; gap: 6px; justify-items: start; background: var(--panel); padding: 12px 16px; border-left: 6px solid var(--mint); }
.code-box strong { font: 400 40px/1 var(--display); letter-spacing: .2em; color: var(--mint); }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.slot { border: 3px dashed var(--line); background: color-mix(in srgb, var(--panel) 85%, transparent); padding: 12px; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 10px; align-items: center; min-height: 74px; }
.slot.on { border-style: solid; border-color: var(--c); }
.slot .sw { grid-row: span 2; width: 34px; height: 44px; border-radius: 17px 17px 8px 8px; background: var(--sw, var(--line)); }
.slot .who { font: 800 16px/1.15 var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .dev { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot button.team { grid-column: 1 / -1; font: 800 11px var(--body); letter-spacing: .1em; text-transform: uppercase; border: 0; padding: 5px; cursor: pointer; color: #fff; background: var(--tc); }
.slot.empty .who { color: var(--muted); font-weight: 600; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice, .arena {
  display: grid; gap: 6px; align-content: start; text-align: left; padding: 12px 14px; cursor: pointer; font-family: var(--body); color: var(--ink);
  background: color-mix(in srgb, var(--panel) 88%, transparent); border: 3px solid var(--line); min-width: 0;
}
.choice b, .arena b { font: 400 16px/1.1 var(--display); color: var(--c, var(--ink)); }
.choice span, .arena span { font-size: 13px; line-height: 1.35; color: var(--muted); }
.choice[aria-pressed="true"], .arena[aria-pressed="true"] { border-color: var(--c, var(--gold)); box-shadow: inset 0 0 0 2px var(--c, var(--gold)); }
.arenas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; gap: 8px; align-items: center; padding: 8px 12px; cursor: pointer; font: 700 14px var(--body); color: var(--ink); background: var(--panel); border: 3px solid var(--line); }
.chip i { width: 12px; height: 12px; background: var(--c); transform: rotate(45deg); flex: none; }
.chip[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, var(--panel)); }
.chip[aria-pressed="false"] { opacity: .65; }
.bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.sticky-bar { position: sticky; bottom: -36px; background: color-mix(in srgb, var(--night) 92%, transparent); padding: 14px 0; border-top: 2px solid var(--line); }
.bots { display: flex; align-items: center; gap: 10px; font: 400 15px/1 var(--display); }
.bots output { min-width: 2ch; text-align: center; font-size: 22px; }
.rule { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.rule select { font-size: 14px; padding: 6px 8px; }

/* Vestiaire */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { font: 400 14px var(--display); padding: 10px 14px; background: var(--panel); color: var(--muted); border: 3px solid var(--line); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--night); background: var(--gold); border-color: var(--gold); }
.locker { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 22px; align-items: start; }
.preview-box { position: sticky; top: 0; aspect-ratio: 3 / 4; max-width: 100%; background: radial-gradient(circle at 50% 40%, var(--panel-2), var(--night)); border: 3px solid var(--line); }
#preview { width: 100%; height: 100%; display: block; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.preset { display: grid; gap: 6px; justify-items: center; padding: 10px 6px; cursor: pointer; background: var(--panel); border: 3px solid var(--line); color: var(--ink); font: 700 13px var(--body); }
.preset .sw { width: 36px; height: 46px; border-radius: 18px 18px 8px 8px; }
.preset[aria-pressed="true"] { border-color: var(--gold); }
.custom { display: grid; gap: 12px; }
.custom .field { display: grid; gap: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 30px; height: 30px; border: 3px solid var(--night); cursor: pointer; padding: 0; background: var(--c); }
.swatch[aria-pressed="true"] { outline: 3px solid var(--ink); }

table { border-collapse: collapse; width: 100%; font-size: 16px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--line); }
th { font: 800 12px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.n { text-align: right; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--panel); border-left: 6px solid var(--gold); padding: 12px 18px; font-weight: 600; z-index: 10; max-width: calc(100% - 32px); }

@media (max-width: 860px) {
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .cards3, .locker { grid-template-columns: 1fr; }
  .arenas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-box { position: static; max-width: 280px; }
}
@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }

/* Manette : la sélection est bien visible, et un bandeau rappelle les boutons */
.pad-focus { outline: 4px solid var(--gold) !important; outline-offset: 3px; box-shadow: 0 0 0 9px rgba(255, 207, 46, .22) !important; }
.padbar { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(14px, env(safe-area-inset-bottom, 0px)); z-index: 9; display: flex; gap: 14px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--night) 88%, transparent); border: 2px solid var(--line); padding: 8px 14px; font-size: 13px; color: var(--muted); }
.padbar b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-right: 6px; background: var(--panel-2); color: var(--ink); border-radius: 11px; font: 800 12px var(--body); }

/* ---------- Téléphone et tablette ---------- */
body:not(.touch-only) .only-touch { display: none !important; }
body.touch-only .no-touch { display: none !important; }
body.touch-only:not(.has-pad) .no-touch-unless-pad { display: none !important; }
body.touch-only { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
body.touch-only button, body.touch-only select, body.touch-only input { touch-action: manipulation; }
#gl { touch-action: none; }

.touch { position: fixed; inset: 0; z-index: 5; touch-action: none; -webkit-user-select: none; user-select: none; }
.touch .stick { position: fixed; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%; border: 3px solid rgba(255, 244, 220, .45); background: rgba(26, 20, 48, .28); opacity: 0; pointer-events: none; transition: opacity .12s; }
.touch .stick.on { opacity: 1; }
.touch .stick i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(255, 244, 220, .8); box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.tbtn { position: fixed; display: grid; place-items: center; border-radius: 50%; font: 400 15px/1 var(--display); color: var(--night); box-shadow: 0 5px 0 rgba(0, 0, 0, .35); opacity: .88; }
.tbtn.on { transform: translateY(3px) scale(.96); box-shadow: 0 2px 0 rgba(0, 0, 0, .35); opacity: 1; }
.tbtn.fire { width: 104px; height: 104px; right: max(22px, env(safe-area-inset-right, 0px)); bottom: max(26px, env(safe-area-inset-bottom, 0px)); background: var(--rocket); color: var(--ink); font-size: 17px; }
.tbtn.jump { width: 72px; height: 72px; right: calc(max(22px, env(safe-area-inset-right, 0px)) + 118px); bottom: max(22px, env(safe-area-inset-bottom, 0px)); background: var(--gold); }
.tbtn.mini { width: auto; height: 38px; padding: 0 14px; border-radius: 19px; font-size: 13px; background: rgba(26, 20, 48, .78); color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.tbtn.pause { left: max(12px, env(safe-area-inset-left, 0px)); top: 112px; min-width: 46px; }
.tbtn.score { left: calc(max(12px, env(safe-area-inset-left, 0px)) + 58px); top: 112px; }
.tbtn.taunt { left: calc(max(12px, env(safe-area-inset-left, 0px)) + 150px); top: 112px; }
.thint b { color: var(--ink); }
.thint { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); margin: 0; padding: 6px 12px; background: rgba(26, 20, 48, .7); font-size: 13px; color: var(--muted); pointer-events: none; white-space: nowrap; transition: opacity .4s; }
.touch.used .thint { opacity: 0; }

.rotate { display: none; position: fixed; inset: 0; z-index: 30; background: var(--night); place-items: center; text-align: center; padding: 24px; }
.rotate div { display: grid; gap: 10px; }
.rotate b { font: 400 26px/1.1 var(--display); color: var(--gold); }
.rotate span { color: var(--muted); }
@media (orientation: portrait) and (pointer: coarse) { body[data-screen="game"] .rotate { display: grid; } }

/* Petits écrans à l'horizontale (téléphone) : tout plus compact */
@media (max-height: 520px) {
  .screen { padding-block: max(12px, env(safe-area-inset-top, 0px)) 18px; }
  .wrap { gap: 14px; }
  h1 { font-size: 52px; text-shadow: 3px 3px 0 var(--rocket), 6px 6px 0 #0d0a1c; }
  h2 { font-size: 30px; }
  .tagline { font-size: 15px; margin-top: 8px; }
  .btn { font-size: 15px; padding: 12px 16px; }
  .btn.big { font-size: 18px; padding: 14px 20px; }
  #home .wrap.narrow { max-width: 900px; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); align-items: center; }
  .menu { gap: 9px; }
  .slot { min-height: 58px; padding: 8px; }
  .sticky-bar { padding: 8px 0; }
  .preview-box { max-width: 200px; }
}

/* Défis du vestiaire */
.challenges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.challenges li { display: grid; grid-template-columns: 26px 1fr; gap: 2px 10px; align-items: center; padding: 9px 10px; background: var(--panel); border: 3px solid var(--line); }
.challenges li b { font-size: 14px; } .challenges li span { grid-column: 2; font-size: 12.5px; color: var(--muted); }
.challenges li i { grid-row: span 2; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); }
.challenges li.done { border-color: var(--mint); } .challenges li.done i { background: var(--mint); border-color: var(--mint); }
.preset.locked { opacity: .5; cursor: help; }

/* Avis */
textarea { font: 500 16px/1.45 var(--body); color: var(--ink); background: var(--night); border: 3px solid var(--line); padding: 10px 12px; resize: vertical; width: 100%; }
textarea:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.label { font-weight: 600; font-size: 14px; }
.moods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mood { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; font-size: 30px; line-height: 1; background: var(--panel); border: 3px solid var(--line); cursor: pointer; color: var(--ink); }
.mood span { font: 700 13px var(--body); }
.mood[aria-pressed="true"] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--panel)); }
