:root {
  --bg: #2b2622;
  --paper: #f7f2ea;
  --ink: #2d2a26;
  --muted: #7a7067;
  --accent: #c0612b;
  --accent-dark: #9a4a1e;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { color: #c62828; min-height: 1.2em; }
kbd { background: #eee; border: 1px solid #bbb; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 0.85em; color: #333; }
button { font: inherit; cursor: pointer; border: 1px solid #c9bfb3; background: #fff; border-radius: 8px; padding: 8px 14px; }
button.primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent-dark); }
button.link { border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; }
button:disabled { opacity: 0.6; cursor: wait; }
input { font: inherit; padding: 8px 10px; border: 1px solid #c9bfb3; border-radius: 8px; }
.card { background: var(--paper); border-radius: 16px; padding: 22px 26px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); }

/* Accueil */
body.home { min-height: 100vh; background: repeating-linear-gradient(0deg, #5d6b78 0 50px, #56636f 50px 100px); padding: 40px 20px; }
body.home header, body.home footer { max-width: 900px; margin: 0 auto 24px; background: var(--paper); border-radius: 16px; padding: 18px 26px; }
body.home footer { margin-top: 24px; }
body.home h1 { margin: 0 0 6px; }
.cards { max-width: 900px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.game-card h2 { margin: 0 0 8px; }
.game-card .create { width: 100%; margin: 8px 0 12px; }
.game-card .join { display: flex; gap: 8px; }
.game-card .join input { flex: 1; text-transform: uppercase; letter-spacing: 0.3em; min-width: 0; }
.game-card.upcoming { opacity: 0.75; }
.soon { display: inline-block; background: #455a64; color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 0.8em; margin: 0 0 8px; }
#home-error:empty { display: none; }
#home-error { max-width: 900px; margin: 12px auto; background: var(--paper); border-radius: 8px; padding: 0 12px; }

/* Jeu */
body.game { overflow: hidden; background: var(--bg); user-select: none; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: crosshair; }
.panel { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(440px, 92vw); max-height: 92vh; overflow: auto; background: var(--paper); border-radius: 18px; padding: 24px 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); user-select: text; }
.panel h1 { margin: 0 0 4px; }
.panel form { display: grid; gap: 8px; margin-top: 10px; }
.panel .label, .panel label { font-weight: 600; margin: 6px 0 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #f4efe6; box-shadow: 0 0 0 1px #c9bfb3; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.rules { margin-top: 10px; font-size: 0.92em; }
.back { display: inline-block; margin-top: 12px; color: var(--accent); }

.hud-round, .hud-board, .hud-feed, .hud-mass, .hud-help { position: fixed; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); pointer-events: none; }
.hud-round { top: 12px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.45); padding: 6px 16px; border-radius: 999px; font-weight: 700; font-size: 1.1em; }
.hud-round.hurry { background: rgba(198,40,40,0.75); }
.hud-board { top: 12px; right: 12px; width: 230px; background: rgba(0,0,0,0.45); border-radius: 12px; padding: 10px 14px; }
.hud-board h2 { font-size: 0.95em; margin: 0 0 6px; }
.hud-board ol { margin: 0; padding-left: 22px; }
.hud-board li { display: list-item; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-board li b { float: right; }
.hud-board li.me { color: #ffd54f; }
.hud-board p { margin: 6px 0 0; font-size: 0.85em; }
.hud-feed { top: 12px; left: 12px; list-style: none; margin: 0; padding: 0; font-size: 0.95em; }
.hud-feed li { background: rgba(0,0,0,0.4); border-radius: 8px; padding: 4px 10px; margin-bottom: 4px; }
.hud-mass { bottom: 44px; left: 12px; font-weight: 700; font-size: 1.2em; }
.hud-help { bottom: 12px; left: 12px; margin: 0; font-size: 0.85em; opacity: 0.85; }
.hud-minimap { position: fixed; bottom: 12px; right: 12px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.4); pointer-events: none; }
.cup-badge { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #f4efe6; vertical-align: -1px; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(20,16,12,0.45); pointer-events: none; }
.overlay .card { text-align: center; min-width: 300px; }
.overlay .card.wide { min-width: min(560px, 92vw); }
.overlay .big { font-size: 1.8em; font-weight: 800; margin: 0 0 6px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 16px 0; }
.step { width: 150px; }
.step-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-mass { color: var(--muted); margin: 2px 0 6px; }
.step-block { background: var(--accent); color: #fff; font-weight: 800; font-size: 1.6em; border-radius: 8px 8px 0 0; display: flex; align-items: center; justify-content: center; }
.step-1 .step-block { height: 110px; background: #c9a227; }
.step-2 .step-block { height: 80px; background: #9e9e9e; }
.step-3 .step-block { height: 56px; background: #a1673a; }
.podium-rest { text-align: left; display: inline-block; margin: 0 0 8px; }
