/* =========================================================================
   Party Games — thème "plateau télé"
   Fond indigo profond, marquee doré, CTA rose.
   ========================================================================= */

:root {
  --bg:        #150E2B;
  --bg-2:      #1E1440;
  --surface:   #241858;
  --surface-2: #2E1F6E;
  --line:      #3B2C7A;
  --ink:       #FBF3E4;
  --muted:     #A594C9;
  --gold:      #FFC93C;
  --gold-2:    #FFE08A;
  --pink:      #FF4D9D;
  --pink-2:    #FF7DBA;
  --green:     #52D273;
  --red:       #FF5C77;
  --blue:      #4CB8F0;
  --violet:    #B388FF;

  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 50% -10%, rgba(255, 201, 60, .10), transparent 60%),
    radial-gradient(900px 700px at 100% 0%, rgba(255, 77, 157, .10), transparent 55%),
    radial-gradient(900px 700px at 0% 100%, rgba(76, 184, 240, .08), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.05; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 3.5vw, 2.2rem); }
p { margin: 0 0 1rem; }
a { color: var(--gold-2); }

.wrap { width: 100%; margin: 0 auto; padding: 24px 32px; }
.wrap.narrow { max-width: 720px; }
.wrap.wide { max-width: none !important; }
.center-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row.tight { gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.text-center { text-align: center; }

/* ---- Marque / logo ---- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 4px rgba(255, 77, 157, .2), 0 0 22px var(--pink); }

/* ---- Cartes ---- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card.pad-lg { padding: 30px; }

.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; font-weight: 700; color: var(--gold); margin-bottom: 6px; }

/* ---- Boutons ---- */
.btn {
  appearance: none; border: 0; cursor: pointer; font-family: var(--font-body);
  font-weight: 700; font-size: 1rem; color: #1a1030;
  padding: 13px 20px; border-radius: 999px; background: var(--gold);
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
  box-shadow: 0 8px 0 -2px rgba(0,0,0,.25);
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(2px); box-shadow: 0 5px 0 -2px rgba(0,0,0,.25); }
.btn:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 3px; }
.btn.block { width: 100%; }
.btn.lg { padding: 17px 26px; font-size: 1.1rem; }
.btn.pink { background: var(--pink); color: #fff; }
.btn.green { background: var(--green); color: #06210f; }
.btn.red { background: var(--red); color: #2a060e; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--muted); background: rgba(255,255,255,.03); }
.btn.sm { padding: 8px 14px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---- Champs ---- */
label.field { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,201,60,.18); }
input::placeholder { color: #6b5b95; }
.input-code { text-transform: uppercase; letter-spacing: .35em; font-family: var(--font-display); font-weight: 800; text-align: center; font-size: 1.6rem; }

/* ---- Avatars ---- */
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-opt { font-size: 1.6rem; padding: 8px 0; text-align: center; border-radius: 12px; cursor: pointer; background: var(--bg); border: 2px solid transparent; }
.avatar-opt:hover { background: var(--surface-2); }
.avatar-opt.selected { border-color: var(--gold); background: var(--surface-2); }

/* ---- Code marquee (signature) ---- */
.marquee { display: inline-flex; gap: 10px; padding: 16px; border-radius: 18px;
  background: radial-gradient(circle at 50% 0, rgba(255,201,60,.16), transparent 70%);
}
.marquee .tile {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(2.4rem, 9vw, 4.6rem);
  width: clamp(3rem, 12vw, 5.4rem); height: clamp(3.6rem, 14vw, 6.4rem);
  display: grid; place-items: center; color: var(--gold-2);
  background: linear-gradient(180deg, #241858, #170f36);
  border: 2px solid var(--gold); border-radius: 14px;
  box-shadow: inset 0 0 22px rgba(255,201,60,.25), 0 0 26px rgba(255,201,60,.22);
}

/* ---- Liste joueurs / puce ---- */
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.chip .ava { font-size: 1.2rem; }
.chip .sc { margin-left: 6px; font-family: var(--font-display); font-weight: 800; color: var(--gold-2); }
.chip.off { opacity: .5; }
.chip .tdot { width: 9px; height: 9px; border-radius: 50%; }

.player-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.player-line .ava { font-size: 1.4rem; }
.player-line .nm { font-weight: 600; }
.player-line .sc { margin-left: auto; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--gold-2); }

/* ---- Scoreboard ---- */
.score-list { display: flex; flex-direction: column; gap: 8px; }
.score-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: linear-gradient(90deg, var(--surface), var(--bg-2)); border: 1px solid var(--line); }
.score-row .rank { font-family: var(--font-display); font-weight: 800; color: var(--muted); width: 1.6em; text-align: center; }
.score-row.first { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold), 0 0 24px rgba(255,201,60,.15); }
.score-row.first .rank { color: var(--gold); }
.score-row .big { margin-left: auto; font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; color: var(--gold-2); }
.score-row .name { font-weight: 700; font-size: 1.1rem; }

/* ---- Bandeau equipe ---- */
.team-head { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.team-head .tdot { width: 16px; height: 16px; border-radius: 50%; }

/* ---- Blocs d'equipe (lobby) : un bloc colore par equipe, tres visuel ---- */
.teams-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.team-block {
  border-radius: var(--radius-lg); padding: 18px; border: 2px solid var(--tc, var(--line));
  background: var(--bg-2);
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc, var(--line)) 16%, var(--bg-2)), var(--bg-2));
}
.team-block .team-block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.team-block .team-block-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--tc); box-shadow: 0 0 14px var(--tc); }
.team-block .team-block-name { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.team-block .team-block-count { margin-left: auto; font-size: .8rem; color: var(--muted); }
.team-block .team-player { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,.18); margin-bottom: 6px; }
.team-block .team-player:last-child { margin-bottom: 0; }
.team-block .team-player .ava { font-size: 1.2rem; }
.team-block .team-player .nm { font-weight: 600; flex: 1; }
.team-block .team-player select { width: auto; padding: 4px 8px; font-size: .78rem; }
.team-block-empty { color: var(--muted); font-size: .85rem; font-style: italic; padding: 8px 10px; }
.unassigned-block { border: 2px dashed var(--line); border-radius: var(--radius-lg); padding: 18px; }

/* ---- Imposteur ---- */
.imp-word-card {
  text-align: center; padding: 28px; border-radius: var(--radius-lg);
  background: radial-gradient(circle at 50% 0%, rgba(255,201,60,.14), transparent 70%), linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 2px solid var(--gold);
}
.imp-word-card .imp-word { font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 7vw, 3.2rem); color: var(--gold-2); margin-top: 6px; }
.imp-clue-line { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.imp-clue-line .ava { font-size: 1.2rem; }
.imp-clue-line .word { margin-left: auto; font-weight: 700; color: var(--gold-2); }
.imp-round-label { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; color: var(--muted); margin: 4px 0; }

/* Grille de vote : une carte cliquable par joueur cible */
.imp-vote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.imp-vote-card {
  cursor: pointer; text-align: center; padding: 16px 10px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--bg); transition: border-color .15s, transform .1s;
}
.imp-vote-card:hover { border-color: var(--muted); transform: translateY(-2px); }
.imp-vote-card.selected { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 12%, var(--bg)); }
.imp-vote-card .ava { font-size: 2rem; display: block; margin-bottom: 6px; }
.imp-vote-card .nm { font-weight: 700; }

/* Resultats : avatar/pseudo de l'imposteur mis en evidence visuellement */
.imp-reveal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.imp-reveal-card {
  text-align: center; padding: 16px 10px; border-radius: var(--radius-lg); border: 2px solid var(--line); background: var(--bg);
  position: relative;
}
.imp-reveal-card.is-impostor { border-color: var(--red); background: radial-gradient(circle at 50% 0%, rgba(255,92,119,.18), transparent 70%), var(--bg); box-shadow: 0 0 24px rgba(255,92,119,.25); }
.imp-reveal-card .ava { font-size: 2.4rem; display: block; }
.imp-reveal-card .nm { font-weight: 700; margin-top: 4px; }
.imp-reveal-card .imp-tag { display: inline-block; margin-top: 6px; font-size: .72rem; font-weight: 800; letter-spacing: .05em; padding: 3px 10px; border-radius: 999px; background: var(--red); color: #2a060e; }
.imp-reveal-card .imp-votes { margin-top: 6px; font-size: .8rem; color: var(--muted); }
.imp-outcome-banner { text-align: center; padding: 18px; border-radius: var(--radius-lg); font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.imp-outcome-banner.caught { background: rgba(82,210,115,.15); border: 2px solid var(--green); color: var(--green); }
.imp-outcome-banner.escaped { background: rgba(255,92,119,.15); border: 2px solid var(--red); color: var(--red); }

/* ---- Image Guess ---- */
.ig-image {
  display: block; width: 100%; max-height: 420px; object-fit: contain;
  border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line);
}

/* ---- Petit bac : grille reponses ---- */
.pb-grid { display: grid; gap: 10px; }
.pb-cat { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; gap: 10px; align-items: center; }
.pb-cat > .lab { font-weight: 700; color: var(--muted); }

/* ---- Petit bac : tableau de correction (lignes = joueurs, colonnes = categories) ---- */
.pb-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.pb-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.pb-table th, .pb-table td { padding: 10px 12px; text-align: left; white-space: nowrap; }
.pb-table thead th {
  background: var(--surface-2); font-family: var(--font-display); font-weight: 800;
  position: sticky; top: 0; border-bottom: 2px solid var(--line);
}
.pb-table thead th.letter-col { color: var(--gold); text-align: center; }
.pb-table tbody tr { border-top: 1px solid var(--line); }
.pb-table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
.pb-table td.who { display: flex; align-items: center; gap: 8px; font-weight: 700; position: sticky; left: 0; background: var(--bg-2); }
.pb-table tbody tr:nth-child(even) td.who { background: #1c1440; }
.pb-table td.who .ava { font-size: 1.15rem; }
.pb-cell { display: flex; align-items: center; gap: 6px; }
.pb-cell .val { font-weight: 600; }
.pb-cell .val.invalid { text-decoration: line-through; color: var(--muted); }
.pb-cell .val.empty { color: var(--muted); font-weight: 400; font-style: italic; }
.pb-cell .pts { font-family: var(--font-display); font-weight: 800; font-size: .82rem; }
.pb-cell .pts.p2 { color: var(--gold); }
.pb-cell .pts.p1 { color: var(--green); }
.pb-cell .pts.p0 { color: var(--muted); }
.pb-table td.total { font-family: var(--font-display); font-weight: 800; color: var(--gold-2); text-align: center; }
.pb-table .tgl { border: 0; background: transparent; cursor: pointer; font-size: 1rem; padding: 2px 4px; border-radius: 6px; line-height: 1; }
.pb-table button.tgl:hover { background: var(--surface-2); }
.pb-table span.tgl { cursor: default; }

/* ---- Gros affichage TV ---- */
.tv-letter { font-family: var(--font-display); font-weight: 800; font-size: clamp(6rem, 30vw, 20rem); line-height: 1; color: var(--gold-2); text-shadow: 0 0 60px rgba(255,201,60,.4); }
.tv-question { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.8rem, 5vw, 4rem); text-align: center; max-width: 20ch; }

/* ---- Chrono ---- */
.timer { font-family: var(--font-display); font-weight: 800; font-size: 2rem; color: var(--gold-2); }
.timer.warn { color: var(--red); }

/* ---- Divers ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--gold-2); border: 1px solid var(--line); }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--red); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); z-index: 50; }

.game-tile { flex: 1; min-width: 220px; text-align: left; background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: border-color .15s, transform .1s; }
.game-tile:hover { border-color: var(--gold); transform: translateY(-2px); }
.game-tile .ico { font-size: 2.4rem; }
.game-tile h3 { margin: 8px 0 4px; }

/* ---- Welcome (page d'accueil) : 3 grandes tuiles cliquables ---- */
.welcome-tiles { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; max-width: 980px; }
.welcome-tile {
  display: flex; flex-direction: column; width: 280px; text-decoration: none; color: var(--ink);
  background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1.5px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .12s ease;
}
.welcome-tile:hover { border-color: var(--gold); transform: translateY(-4px); }
.welcome-tile-media { position: relative; aspect-ratio: 16 / 9; background: var(--bg); }
.welcome-tile-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.welcome-tile-play {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; color: #fff;
  background: rgba(21,14,43,.28); text-shadow: 0 4px 14px rgba(0,0,0,.5); transition: background .15s ease;
}
.welcome-tile:hover .welcome-tile-play { background: rgba(21,14,43,.12); }
.welcome-tile-media-icon { display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, rgba(255,201,60,.16), transparent 70%), var(--bg); }
.welcome-tile-icon { font-size: 4.4rem; }
.welcome-tile-label { padding: 16px; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }

@media (max-width: 640px) {
  .welcome-tile { width: 100%; max-width: 340px; }
}

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

@media (max-width: 520px) {
  .avatar-grid { grid-template-columns: repeat(5, 1fr); }
  .pb-cat { grid-template-columns: 1fr; gap: 4px; }
}
