/* =========================================================
   TTMC2 — entyscoco
   Direction : la planche de bois taguée. Fond chaleureux,
   taches de peinture, catégories franches et bruyantes.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Caveat:wght@600;700&family=Inter:wght@400;500;600;800&display=swap');

:root {
  --bois: #6B4A2F;
  --bois-clair: #8A6440;
  --bois-fonce: #4A3220;
  --planche: #7A5636;
  --papier: #F6EFE3;
  --encre: #241a12;
  --craie: #FFFFFF;

  --plaisir: #E8A33D;
  --scolaire: #3E8FB0;
  --mature: #7B4FA8;
  --improbable: #5A9E6F;
  --intrepide: #C7453B;
  --challenge: #D93B3B;
  --superbe: #F2C14E;
  --pasdutout: #2B2B2B;
  --arrivee: #4FA3A5;

  --titre: 'Bangers', Impact, sans-serif;
  --main: 'Caveat', cursive;
  --texte: 'Inter', system-ui, sans-serif;

  --r: 10px;
  --ombre: 0 8px 24px rgba(0, 0, 0, .35);
  --ombre-forte: 0 16px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  color: var(--papier);
  font-family: var(--texte);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, .07) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .03) 0 90px, rgba(0, 0, 0, .10) 90px 94px),
    linear-gradient(160deg, #7C5738, #5C3F27 60%, #4A3220);
  background-attachment: fixed;
}

/* éclaboussures de peinture en fond */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(232, 163, 61, .16) 0 12%, transparent 13%),
    radial-gradient(circle at 86% 12%, rgba(123, 79, 168, .14) 0 10%, transparent 11%),
    radial-gradient(circle at 78% 82%, rgba(62, 143, 176, .13) 0 14%, transparent 15%),
    radial-gradient(circle at 20% 88%, rgba(90, 158, 111, .12) 0 11%, transparent 12%);
}
body > * { position: relative; z-index: 1; }

a { color: var(--superbe); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--titre); font-weight: 400; letter-spacing: .02em; margin: 0 0 .4em; line-height: 1.05; }
h1 { font-size: clamp(2.2rem, 6vw, 4rem); text-shadow: 3px 3px 0 rgba(0, 0, 0, .35); }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.2rem; }

.eyebrow {
  font-family: var(--texte); font-size: .68rem; font-weight: 800;
  letter-spacing: .22em; text-transform: uppercase; color: var(--superbe); margin-bottom: .5rem;
}
.hand-note { font-family: var(--main); font-size: 1.3rem; color: var(--superbe); }
.muted { color: rgba(246, 239, 227, .62); }
.small { font-size: .86rem; }
.center { text-align: center; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.stack > * + * { margin-top: .9rem; }
.hidden { display: none !important; }

/* ------------------------------------------------------------ chrome */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem clamp(.8rem, 3vw, 2rem);
  background: linear-gradient(180deg, rgba(36, 26, 18, .96), rgba(36, 26, 18, .78));
  border-bottom: 3px solid rgba(0, 0, 0, .35);
  position: sticky; top: 0; z-index: 40; backdrop-filter: blur(6px);
}

.wordmark { font-family: var(--titre); font-size: 1.7rem; color: var(--papier); display: inline-flex; align-items: baseline; gap: .4rem; }
.wordmark:hover { text-decoration: none; }
.wordmark .two {
  color: var(--intrepide); font-size: 1.15em; transform: rotate(-8deg); display: inline-block;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .3);
}
.wordmark small { font-family: var(--texte); font-size: .55rem; font-weight: 800; letter-spacing: .2em; color: rgba(246, 239, 227, .5); text-transform: uppercase; }

.nav { display: flex; gap: 1rem; align-items: center; font-size: .92rem; font-weight: 600; }
.nav a { color: rgba(246, 239, 227, .72); }
.nav a:hover, .nav a.active { color: var(--superbe); text-decoration: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: clamp(1rem, 3vw, 2.2rem) clamp(.8rem, 3vw, 2rem) 3.5rem; }

/* ------------------------------------------------------- panneaux papier */
.panel {
  background: linear-gradient(180deg, rgba(36, 26, 18, .72), rgba(36, 26, 18, .55));
  border: 2px solid rgba(0, 0, 0, .28); border-radius: var(--r);
  padding: 1.1rem 1.2rem; box-shadow: var(--ombre);
}
.panel + .panel { margin-top: 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .8rem; }

.paper {
  background: var(--papier); color: var(--encre); border-radius: 4px;
  box-shadow: var(--ombre); padding: 1rem 1.2rem;
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* -------------------------------------------------------------- boutons */
.btn {
  font-family: var(--texte); font-weight: 800; font-size: .9rem; letter-spacing: .01em;
  color: var(--papier); background: linear-gradient(180deg, #6f4e33, #533a25);
  border: 2px solid rgba(0, 0, 0, .3); border-radius: 8px;
  padding: .55rem 1.05rem; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .3);
  transition: transform .1s, box-shadow .1s, filter .1s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 3px solid var(--superbe); outline-offset: 2px; }

.btn--go { background: linear-gradient(180deg, #F2C14E, #D19A26); color: #2A1F08; border-color: #8f6a15; }
.btn--yes { background: linear-gradient(180deg, #6FBF7A, #3E8F53); color: #0d2412; border-color: #2c6b3c; }
.btn--no { background: linear-gradient(180deg, #E0574C, #B33127); color: #2a0b08; border-color: #8b241c; }
.btn--ghost { background: rgba(0, 0, 0, .25); border-color: rgba(246, 239, 227, .22); color: rgba(246, 239, 227, .8); box-shadow: none; }
.btn--ghost:hover { color: var(--papier); }
.btn--sm { padding: .34rem .7rem; font-size: .78rem; }
.btn--block { display: block; width: 100%; }

/* ------------------------------------------------------------- formulaires */
label.field { display: block; margin-bottom: .8rem; }
label.field > span { display: block; font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: rgba(246, 239, 227, .6); margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; font-family: var(--texte); font-size: .95rem; color: var(--encre);
  background: var(--papier); border: 2px solid rgba(0, 0, 0, .25); border-radius: 6px; padding: .5rem .7rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--superbe); }
textarea { font-family: ui-monospace, monospace; font-size: .82rem; }

.toggle { display: flex; gap: .7rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px dashed rgba(246, 239, 227, .14); cursor: pointer; }
.toggle:last-child { border-bottom: 0; }
.toggle input { appearance: none; width: 40px; height: 22px; flex: 0 0 40px; margin-top: .15rem; border-radius: 99px; background: rgba(0, 0, 0, .45); border: 2px solid rgba(0, 0, 0, .3); position: relative; cursor: pointer; }
.toggle input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: rgba(246, 239, 227, .6); transition: transform .15s, background .15s; }
.toggle input:checked { background: var(--superbe); }
.toggle input:checked::after { transform: translateX(18px); background: #3a2a10; }
.toggle b { font-size: .92rem; display: block; }
.toggle em { font-style: normal; font-size: .8rem; color: rgba(246, 239, 227, .6); }
.toggle.disabled { opacity: .4; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .55rem 0; border-bottom: 1px dashed rgba(246, 239, 227, .14); display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.list li:last-child { border-bottom: 0; }

table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th { text-align: left; font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--superbe); padding: .45rem .5rem; border-bottom: 2px solid rgba(242, 193, 78, .3); }
table.data td { padding: .45rem .5rem; border-bottom: 1px dashed rgba(246, 239, 227, .12); vertical-align: middle; }
table.data tr:hover td { background: rgba(242, 193, 78, .07); }

.tag { display: inline-block; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 99px; border: 2px solid currentColor; }
.tag--live { color: #6FBF7A; }
.tag--lobby { color: var(--superbe); }
.tag--done { color: rgba(246, 239, 227, .5); }
.tag--bot { color: var(--scolaire); }
.tag--admin { color: var(--intrepide); }

/* ------------------------------------------------------------ catégories */
.cat {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  padding: .2rem .6rem; border-radius: 99px; color: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .28);
}
.cat--plaisir { background: var(--plaisir); color: #3a2606; }
.cat--scolaire { background: var(--scolaire); }
.cat--mature { background: var(--mature); }
.cat--improbable { background: var(--improbable); }
.cat--intrepide { background: var(--intrepide); }
.cat--challenge { background: var(--challenge); }
.cat--superbe { background: var(--superbe); color: #3a2606; }
.cat--pasdutout { background: var(--pasdutout); }
.cat--arrivee { background: var(--arrivee); }
.cat--depart { background: #8A7A5C; }

/* ---------------------------------------------------------------- plateau */
.board-wrap {
  background:
    repeating-linear-gradient(179deg, rgba(0, 0, 0, .05) 0 46px, rgba(255, 255, 255, .03) 46px 50px),
    linear-gradient(160deg, #8A6440, #6B4A2F);
  border: 5px solid var(--bois-fonce); border-radius: 14px;
  padding: 1rem; box-shadow: var(--ombre-forte); overflow-x: auto;
}
.board {
  display: grid; gap: 6px; grid-template-columns: repeat(var(--cols, 8), minmax(0, 1fr));
  min-width: 420px;
}
.cell {
  position: relative; aspect-ratio: 1; border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, .3); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .22);
  display: grid; place-items: center; font-size: .6rem; font-weight: 800;
  color: rgba(255, 255, 255, .85); text-transform: uppercase; letter-spacing: .04em;
  transition: transform .15s;
}
.cell span.n { position: absolute; top: 2px; left: 4px; font-size: .52rem; opacity: .55; }
.cell.here { transform: scale(1.08); box-shadow: 0 0 0 3px var(--craie), 0 6px 16px rgba(0, 0, 0, .5); z-index: 2; }
.cell .pawns { position: absolute; bottom: 2px; display: flex; gap: 2px; justify-content: center; width: 100%; }
.pawn {
  width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .55);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .5); font-size: 0;
}
.pawn.t0 { background: #F2C14E; } .pawn.t1 { background: #E0574C; }
.pawn.t2 { background: #63A9CB; } .pawn.t3 { background: #7ECB8E; }

.legend { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; }

/* --------------------------------------------------------------- la carte */
.qcard {
  background: var(--papier); color: var(--encre); border-radius: 10px;
  box-shadow: var(--ombre-forte); overflow: hidden; position: relative;
}
.qcard-head { padding: .8rem 1.1rem; color: #fff; }
.qcard-head .kicker { font-size: .7rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; opacity: .9; }
.qcard-head .theme { font-family: var(--titre); font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.05; text-shadow: 2px 2px 0 rgba(0, 0, 0, .22); }
.qcard-body { padding: 1rem 1.1rem 1.2rem; }

.notes { display: grid; grid-template-columns: repeat(10, 1fr); gap: .4rem; }
.note-btn {
  aspect-ratio: 1; border-radius: 8px; border: 2px solid rgba(0, 0, 0, .25);
  background: linear-gradient(180deg, #fff, #e6dbc7); color: var(--encre);
  font-family: var(--titre); font-size: clamp(1rem, 2.6vw, 1.6rem); cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .2); transition: transform .1s, filter .1s;
}
.note-btn:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-2px); }
.note-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.note-btn:disabled { opacity: .3; cursor: not-allowed; }
.note-btn.hot { background: linear-gradient(180deg, #F5D07B, #E0A33A); }
.note-hint { font-family: var(--main); font-size: 1.15rem; color: #6b5433; margin-top: .5rem; }

.question { font-size: clamp(1.05rem, 2.4vw, 1.35rem); font-weight: 600; line-height: 1.45; }
.question .lvl {
  display: inline-block; font-family: var(--titre); font-size: 1.9rem; color: var(--intrepide);
  margin-right: .5rem; vertical-align: -.15em;
}
.answer-box { display: flex; gap: .5rem; margin-top: .9rem; }
.answer-box input { flex: 1; font-size: 1rem; }
.expected { margin-top: .8rem; padding: .6rem .8rem; border-left: 5px solid var(--improbable); background: rgba(90, 158, 111, .14); border-radius: 4px; }
.expected b { display: block; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #3c6b4b; }
.given { margin-top: .6rem; font-family: var(--main); font-size: 1.35rem; color: #4a3a22; }

.verdict { font-family: var(--titre); font-size: 2rem; text-align: center; padding: .4rem 0; }
.verdict.ok { color: #2f7d45; }
.verdict.ko { color: #b3312a; }

.clock {
  font-family: var(--titre); font-size: 1.5rem; color: var(--encre);
  padding: .1rem .6rem; border-radius: 6px; background: rgba(0, 0, 0, .08);
}
.clock.warn { background: rgba(224, 87, 76, .2); color: #a52a20; animation: tick 1s infinite; }
@keyframes tick { 50% { opacity: .5; } }

/* ---------------------------------------------------------------- équipes */
.teams { display: grid; gap: .6rem; }
.team-row {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem;
  border-radius: 8px; background: rgba(0, 0, 0, .25); border-left: 6px solid transparent;
}
.team-row.t0 { border-left-color: #F2C14E; } .team-row.t1 { border-left-color: #E0574C; }
.team-row.t2 { border-left-color: #63A9CB; } .team-row.t3 { border-left-color: #7ECB8E; }
.team-row.active { background: rgba(242, 193, 78, .18); box-shadow: inset 0 0 0 2px rgba(242, 193, 78, .45); }
.team-row .nm { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row .pos { font-family: var(--titre); font-size: 1.4rem; color: var(--superbe); }
.team-row .acc { font-size: .72rem; color: rgba(246, 239, 227, .6); }

.log { height: 250px; overflow-y: auto; font-size: .86rem; padding-right: .4rem; }
.log p { margin: 0 0 .3rem; padding-left: .6rem; border-left: 3px solid rgba(246, 239, 227, .16); }
.log p.card { border-left-color: var(--plaisir); font-weight: 600; }
.log p.note { border-left-color: var(--scolaire); }
.log p.good { border-left-color: #6FBF7A; font-weight: 600; }
.log p.bad { border-left-color: var(--intrepide); }
.log p.bonus { border-left-color: var(--superbe); }
.log p.malus { border-left-color: #999; }
.log p.move { color: rgba(246, 239, 227, .65); }
.log p.reveal { color: rgba(246, 239, 227, .7); font-style: italic; }
.log p.gameover, .log p.finish { border-left-color: var(--superbe); font-weight: 800; }
.log p.start { font-family: var(--main); font-size: 1.1rem; color: var(--superbe); }

.chat { height: 140px; overflow-y: auto; font-size: .86rem; }
.chat p { margin: 0 0 .25rem; }
.chat b { color: var(--superbe); }
.chat p.sys { color: rgba(246, 239, 227, .55); font-style: italic; }

/* ----------------------------------------------------------------- divers */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 12, 6, .8); display: grid; place-items: center; z-index: 60; padding: 1rem; backdrop-filter: blur(3px); }
.modal { width: min(780px, 100%); max-height: 88vh; overflow-y: auto; background: linear-gradient(180deg, #6f4e33, #533a25); border: 3px solid rgba(0, 0, 0, .35); border-radius: 12px; padding: 1.4rem; box-shadow: var(--ombre-forte); }

.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: #2a1d12; border: 2px solid var(--superbe); color: var(--papier); padding: .6rem 1.1rem; border-radius: 8px; z-index: 90; box-shadow: var(--ombre); max-width: 92vw; font-weight: 600; }
.toast.err { border-color: var(--intrepide); }

.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 2rem; align-items: center; padding: 1rem 0 2rem; }
.hero p.lead { font-size: 1.05rem; color: rgba(246, 239, 227, .78); max-width: 48ch; }
.splat {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #F2C14E, #C7453B 70%);
  box-shadow: var(--ombre-forte); transform: rotate(-6deg); max-width: 300px; margin: 0 auto;
}
.splat span { font-family: var(--titre); font-size: clamp(2.4rem, 7vw, 4.4rem); color: #2A1F08; text-align: center; line-height: .95; }

.pill { display: inline-block; font-size: .7rem; font-weight: 700; padding: .18rem .55rem; border: 2px solid rgba(246, 239, 227, .22); border-radius: 99px; color: rgba(246, 239, 227, .65); margin: 0 .25rem .3rem 0; }
.pill.on { color: var(--superbe); border-color: rgba(242, 193, 78, .5); }

.game-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 1.1rem; align-items: start; }

@media (max-width: 1080px) {
  .game-layout { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------ panel d'administration */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; }
.kpi { background: rgba(0, 0, 0, .3); border: 2px solid rgba(0, 0, 0, .25); border-radius: 8px; padding: .8rem .9rem; }
.kpi b { display: block; font-family: var(--titre); font-size: 2rem; color: var(--superbe); line-height: 1; }
.kpi span { font-size: .62rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: rgba(246, 239, 227, .55); }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 2px solid rgba(246, 239, 227, .14); }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; color: rgba(246, 239, 227, .6); font-family: var(--texte); font-weight: 800; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; padding: .6rem .8rem; cursor: pointer; }
.tabs button.active { color: var(--superbe); border-bottom-color: var(--superbe); }
.sparkline { display: flex; align-items: flex-end; gap: 3px; height: 46px; margin-top: .5rem; }
.sparkline div { flex: 1; background: linear-gradient(180deg, var(--superbe), #c9971f); border-radius: 3px 3px 0 0; min-height: 2px; }
