/* Boitajeux — styles communs. Chaque jeu redéfinit les jetons de couleur et de police
   sous body[data-theme="<jeu>"] dans son propre theme.css. */

/* Thème de l'accueil : une table en bois sombre, lumière chaude */
:root, body[data-theme="hub"] {
  --bg: #1c1714;
  --bg-glow: #3d2c1f;
  --surface: #2a221d;
  --fg: #f3ebe2;
  --muted: #b5a597;
  --line: rgba(243, 235, 226, .15);
  --glass: rgba(243, 235, 226, .05);
  --accent: #f2c46d;
  --accent-ink: #2a1d06;
  --hot: #e8634a;
  --hot-ink: #ffffff;
  --paper: #fbf6ee;
  --ink: #221b16;
  --ink-soft: #6d6156;
  --ok: #6fd39a;
  --f-display: "Bagel Fat One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; }
html { background: var(--bg); min-height: 100%; }
body {
  margin: 0; min-height: 100vh;
  color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.45;
  background: radial-gradient(120% 55% at 50% -5%, var(--bg-glow) 0%, transparent 62%), var(--bg);
  background-attachment: fixed;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 14px 48px;
  transition: background-color .3s;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h2 { font: 400 22px/1.15 var(--f-display); letter-spacing: .01em; }
p { margin: 0; }

.wrap { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.muted { color: var(--muted); }
.lbl { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.panel { background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.note { background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); border-radius: 12px; padding: 10px 14px; font-weight: 600; }

input { font: 600 16px var(--f-body); color: var(--fg); background: var(--glass); border: 1.5px solid var(--line); border-radius: 999px; padding: 10px 16px; min-width: 0; flex: 1 1 160px; }
input::placeholder { color: var(--muted); }

.btn { font: 700 15px var(--f-body); border-radius: 999px; padding: 10px 18px; border: 1.5px solid var(--line); background: var(--glass); color: var(--fg); cursor: pointer; transition: transform .12s, background .12s, filter .12s; }
.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--fg) 12%, transparent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.hot { background: var(--hot); color: var(--hot-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled), .btn.hot:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn.hot:hover:not(:disabled) { background: var(--hot); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .38; cursor: default; }

/* En-tête de l'accueil */
.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 6px 12px; padding-top: 8px; }
.hero h1 { font: 400 clamp(48px, 13vw, 76px)/.9 var(--f-display); color: var(--paper); letter-spacing: .01em; }
.hero h1 span { color: var(--accent); }
.hero p { grid-column: 1 / -1; color: var(--muted); font-weight: 600; }

/* Tuiles de jeux sur l'accueil */
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.game-tile { border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); min-width: 0; }
.game-tile h2 { font-size: 30px; }
.game-tile .meta { font-size: 13px; font-weight: 700; opacity: .85; }
.game-tile p { opacity: .9; }
.game-tile .actions { margin-top: auto; }

/* Barre du haut en partie */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.topbar .title { font: 400 26px/1 var(--f-display); color: var(--paper); margin-right: auto; }
.chip { font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.warn { background: color-mix(in srgb, var(--hot) 22%, transparent); border-color: transparent; color: var(--fg); }

.prompt { border-radius: 14px; padding: 12px 14px; background: var(--glass); border: 1px solid var(--line); font-weight: 600; }
.prompt.mine { background: var(--hot); color: var(--hot-ink); border-color: transparent; }
.prompt b { font-weight: 800; }
.flag { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); padding: 2px 6px; border-radius: 6px; align-self: flex-start; }

/* Salon d'attente */
.code { font: 400 clamp(34px, 10vw, 48px)/1 var(--f-display); letter-spacing: .12em; color: var(--accent); }
.share { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share input { font-size: 14px; }
.seats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seat { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.free { border-style: dashed; color: var(--muted); font-weight: 600; background: transparent; }
.seat small { color: var(--accent); font-weight: 800; margin-left: 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: middle; flex: none; }
.dot.off { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 700; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Tableaux de score */
.tbl { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
td.num, th.num { text-align: right; }
.win { color: var(--accent); font-weight: 800; }
.result { border: 1.5px solid var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent) 3%, transparent)); }
.result h2 { color: var(--accent); }

.log { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.log b { color: var(--fg); font-weight: 700; }

/* Fenêtre des règles */
#overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .66); z-index: 20; overflow-y: auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet { max-width: 640px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { color: var(--accent); }
.sheet h3 { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.sheet p, .sheet li { max-width: 65ch; }
.sheet ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.ref { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.ref > div { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 6px 8px; border-radius: 10px; background: var(--glass); }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--paper); color: var(--ink); font-weight: 700; padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); z-index: 30; max-width: calc(100% - 32px); }
.conn { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); background: var(--hot); color: var(--hot-ink); font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 999px; z-index: 25; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Jeux en plein écran : la table occupe tout l'écran, sans défilement de page */
body.in-table { padding: 0; height: 100dvh; overflow: hidden; }
.tb-screen { height: 100dvh; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tb-bar { display: flex; align-items: center; gap: 8px; flex: none; min-height: 46px;
  padding: 6px max(12px, env(safe-area-inset-right, 0px)) 6px max(12px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg) 70%, black); border-bottom: 1px solid var(--line); }
.tb-title { font: 400 22px/1 var(--f-display); color: var(--paper); }
.tb-sp { flex: 1; }
.tb-bar .btn.small { padding: 5px 10px; }
.tb-snd { display: inline-flex; align-items: center; justify-content: center; width: 34px; padding: 5px 0 !important; }
.tb-snd svg { width: 18px; height: 18px; }
.tb-snd.off { opacity: .6; }
@media (max-width: 420px) { .tb-bar .chip { display: none; } }

/* Tuile Vinchykulture : plateau télé rétro (police fournie par le jeu) */
@font-face { font-family: "Bungee"; src: url("/vinchykulture/fonts/bungee-latin-400-normal.woff2") format("woff2"); font-display: swap; }
.tile-vinchykulture { background: radial-gradient(120% 90% at 20% 0%, #4b2196 0%, #1b0b40 70%); color: #f5efff; }
.tile-vinchykulture h2 { font: 400 26px/1.05 "Bungee", "Arial Black", system-ui, sans-serif; color: #ffd23f; text-shadow: 0 0 16px rgba(255, 210, 63, .45); }
.tile-vinchykulture .btn.primary { background: #ffd23f; color: #2a1560; text-decoration: none; display: inline-block; }

/* Réglages de partie dans le salon */
.opt-row { display: flex; flex-direction: column; gap: 6px; }
.opt-row + .opt-row { margin-top: 4px; }
.opt-row .chip.on { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); color: var(--fg); }
.muted.small, .small { font-size: 13px; }

/* Pied de page de l'accueil */
.site-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; padding: 8px 0 4px; font-size: 13px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--fg); text-decoration: underline; }
