:root {
  --bg: #1e1f22; --panel: #2b2d31; --panel2: #313338; --line: #3f4147; --text: #e9eaec; --muted: #a3a6ad;
  --accent: #5865f2; --ok: #23a55a; --bad: #da373c; --gold: #f0b232;
  --brown: #9a6b3f; --grey: #8b9099; --blue: #3b82f6; --red: #e5484d; --green: #2fae60; --yellow: #d9a520; --purple: #9d5bd2;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 "gg sans", "Noto Sans", "Segoe UI", system-ui, sans-serif; }
button { font: inherit; color: inherit; border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer;
  background: var(--panel2); transition: transform .08s, filter .15s; }
button:hover:not(:disabled) { filter: brightness(1.15); }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; }
button.ok { background: var(--ok); color: #fff; }
button.ghost { background: transparent; border: 1px solid var(--line); }
#app { max-width: 1200px; margin: 0 auto; padding: 12px; }
.center { display: flex; align-items: center; justify-content: center; min-height: 70vh; text-align: center; }
.status { font-size: 18px; color: var(--muted); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
h1 { font-size: 22px; margin: 4px 0 2px; }
h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 14px 0 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
.topbar .title { font-weight: 700; font-size: 16px; }
.topbar .spacer { flex: 1; }
.pill { background: var(--panel2); border-radius: 999px; padding: 4px 10px; font-size: 13px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.timer.low { background: var(--bad); color: #fff; }

/* ---------- players strip ---------- */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.pl { background: var(--panel); border: 2px solid transparent; border-radius: 10px; padding: 8px 10px; cursor: pointer; position: relative; }
.pl.me { border-color: var(--accent); }
.pl.left, .pl.right { border-color: #4e5058; }
.pl .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .tag { font-size: 11px; color: var(--muted); }
.pl .stats { font-size: 13px; margin-top: 3px; }
.pl .played { position: absolute; top: 6px; right: 8px; }
.pl.offline { opacity: .55; }

/* ---------- log ---------- */
.log { background: var(--panel); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.log .head { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.log.military { border-left: 4px solid var(--red); }

/* ---------- hand ---------- */
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 6px 2px 8px; }
.section-title h2 { margin: 0; }
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.card { background: var(--panel); border-radius: 10px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  border: 2px solid transparent; transition: transform .1s, border-color .1s; min-height: 170px; }
.card:hover { transform: translateY(-3px); }
.card.selected { border-color: #fff; transform: translateY(-5px); box-shadow: 0 6px 18px #0008; }
.card.chosen { border-color: var(--ok); }
.card .band { padding: 6px 9px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #0007; }
.card .kind { font-size: 10px; font-weight: 600; opacity: .9; text-transform: uppercase; letter-spacing: .05em; }
.card .body { padding: 7px 9px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card .cost { font-size: 13px; }
.card .effect { font-size: 12.5px; color: #d6d8dc; flex: 1; }
.card .why { font-size: 12px; padding-top: 5px; border-top: 1px solid var(--line); }
.card .why.ok { color: #7ee2a2; }
.card .why.no { color: #f59b9e; }
.c-brown .band { background: var(--brown); } .c-grey .band { background: var(--grey); } .c-blue .band { background: var(--blue); }
.c-red .band { background: var(--red); } .c-green .band { background: var(--green); } .c-yellow .band { background: var(--yellow); }
.c-purple .band { background: var(--purple); }

.actions { position: sticky; bottom: 0; background: linear-gradient(#1e1f2200, var(--bg) 25%); padding: 16px 0 10px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 5; }
.actions button { flex: 1 1 180px; padding: 12px; }
.actions .sub { display: block; font-size: 11px; opacity: .85; font-weight: 400; }
.choice-banner { background: #23a55a22; border: 1px solid var(--ok); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }

/* ---------- boards ---------- */
.board { background: var(--panel); border-radius: 12px; padding: 12px; margin-top: 14px; }
.wonder { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.stage { flex: 1 1 150px; background: var(--panel2); border-radius: 8px; padding: 7px 9px; font-size: 12.5px; border: 2px dashed var(--line); }
.stage.built { border: 2px solid var(--gold); background: #f0b23218; }
.stage .n { font-weight: 700; }
.kv { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 999px; color: #fff; }
.chip.c-brown { background: var(--brown); } .chip.c-grey { background: var(--grey); } .chip.c-blue { background: var(--blue); }
.chip.c-red { background: var(--red); } .chip.c-green { background: var(--green); } .chip.c-yellow { background: var(--yellow); }
.chip.c-purple { background: var(--purple); }

/* ---------- lobby / end ---------- */
.hero { text-align: center; padding: 24px 12px 8px; }
.hero .big { font-size: 46px; }
.lobby-list { max-width: 420px; margin: 14px auto; display: flex; flex-direction: column; gap: 6px; }
.lobby-list div { background: var(--panel); border-radius: 8px; padding: 9px 12px; display: flex; justify-content: space-between; }
.cta { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
table.scores { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; margin-top: 12px; }
table.scores th, table.scores td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.scores th { color: var(--muted); font-size: 12px; font-weight: 600; }
table.scores td.name { text-align: left; font-weight: 700; }
table.scores td.total { font-weight: 800; color: var(--gold); font-size: 16px; }

/* ---------- misc ---------- */
.modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 20; padding: 12px; }
.modal-box { background: var(--bg); border-radius: 14px; max-width: 720px; width: 100%; max-height: 90vh; overflow: auto; padding: 16px; border: 1px solid var(--line); }
.modal-box p { margin: 4px 0; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--bad); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 30; max-width: 90vw; }
.conn { position: fixed; top: 0; left: 0; right: 0; background: var(--bad); color: #fff; text-align: center; padding: 4px; z-index: 30; font-size: 13px; }
.section-title { flex-wrap: wrap; }
@media (max-width: 520px) {
  .hand { grid-template-columns: repeat(2, 1fr); }
  .players { grid-template-columns: repeat(2, 1fr); }
  .actions { gap: 6px; padding-top: 10px; }
  .actions button { flex: 1 1 30%; padding: 9px 4px; font-size: 12.5px; }
  .actions .sub { display: none; }
  .card { min-height: 150px; }
}

/* ---------- illustrations ---------- */
.mascot { width: 128px; height: 128px; filter: drop-shadow(0 6px 14px #0007); }
.logo { width: 28px; height: 28px; }
.pl { overflow: hidden; padding-top: 0; }
.pl .thumb { display: block; width: calc(100% + 20px); height: 48px; object-fit: cover; margin: 0 -10px 6px; }
.pl .played { top: 4px; background: #000a; border-radius: 999px; padding: 0 4px; }
.card .art { height: 66px; display: flex; align-items: center; justify-content: center; font-size: 30px; letter-spacing: 2px;
  background-image: url(art/paws.svg), linear-gradient(160deg, #ffffff22, #00000033); }
.card .art span { filter: drop-shadow(0 3px 4px #0006); }
.c-brown .art { background-color: #7a5230; } .c-grey .art { background-color: #6b7078; } .c-blue .art { background-color: #2b5fb8; }
.c-red .art { background-color: #b5363a; } .c-green .art { background-color: #23864a; } .c-yellow .art { background-color: #a87f14; }
.c-purple .art { background-color: #7a3fae; }
.banner { position: relative; border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.banner > img:not(.mascot-small) { display: block; width: 100%; height: auto; aspect-ratio: 320 / 140; object-fit: cover; }
.board .banner { max-width: 460px; }
.banner-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 8px; font-weight: 800; font-size: 16px;
  background: linear-gradient(transparent, #000c); text-shadow: 0 1px 3px #000; }
.banner.winner { max-width: 560px; margin: 0 auto 12px; }
.banner.winner > img:first-child { height: auto; }
.banner .mascot-small { position: absolute; right: 12px; top: 10px; width: 70px; height: 70px; filter: drop-shadow(0 4px 8px #0008); }
@media (max-width: 520px) { .card .art { height: 52px; font-size: 24px; } }

/* ---------- transitions ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: #000d; padding: 16px; cursor: pointer; }
.overlay-box { max-width: 560px; width: 100%; text-align: center; }
.overlay-box > img { width: 100%; border-radius: 14px; box-shadow: 0 10px 40px #000a; }
.ov-title { font-size: 30px; font-weight: 800; margin-top: 14px; text-shadow: 0 2px 8px #000; }
.ov-sub { font-size: 18px; color: var(--gold); font-weight: 700; }
.ov-note { color: var(--muted); margin-top: 6px; }
.ov-lines { margin-top: 10px; font-size: 14px; line-height: 1.6; background: var(--panel); border-radius: 10px; padding: 10px; text-align: left; }
.overlay.show .overlay-box { animation: ov-in .45s ease-out; }
.overlay.show .overlay-box > img { animation: ov-zoom 4s ease-out; }
@keyframes ov-in { from { opacity: 0; transform: scale(.92) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ov-zoom { from { transform: scale(1.04); } to { transform: scale(1); } }

/* ---------- lobby settings ---------- */
.settings { max-width: 560px; margin: 14px auto 0; background: var(--panel); border-radius: 12px; padding: 12px 14px; }
.settings h3 { margin: 0 0 8px; }
.setting { margin: 8px 0; }
.setting-name { font-weight: 700; margin-bottom: 5px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { padding: 6px 11px; font-size: 13px; background: var(--panel2); }
.seg button.on { background: var(--accent); color: #fff; }
.seg button.on:disabled { opacity: 1; }

.deck-info { margin-top: 10px; font-size: 13px; }

button.danger { color: #f59b9e; border-color: #da373c88; }
button.danger-fill { background: var(--bad); color: #fff; border: 0; }
.toast.info { background: var(--panel2); border: 1px solid var(--line); }

/* ---------- emojis (images) ---------- */
img.emoji { height: 1.3em; width: 1.3em; margin: 0 .04em; vertical-align: -0.28em; }
.card .art { height: 84px; }
.card .art img.emoji { height: 48px; width: 48px; margin: 0 3px; vertical-align: middle; filter: drop-shadow(0 3px 4px #0006); }
.card .cost, .card .effect { font-size: 14px; }
.card .cost img.emoji, .card .effect img.emoji { height: 1.5em; width: 1.5em; }
.stage img.emoji, .kv img.emoji { height: 1.45em; width: 1.45em; }
.pl .stats img.emoji { height: 1.35em; width: 1.35em; }
@media (max-width: 520px) { .card .art { height: 64px; } .card .art img.emoji { height: 36px; width: 36px; } }

.spectators { text-align: center; margin-top: 6px; }

/* ---------- choix du jeu ---------- */
.modes { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.modes button { padding: 8px 16px; font-weight: 700; }
.modes button.on { background: var(--accent); color: #fff; }
.modes button.on:disabled { opacity: 1; }
.mascot.square { border-radius: 24px; }
.lg-preview { max-width: 560px; margin: 10px auto 0; text-align: center; background: var(--panel); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.lg-preview.bad { border: 1px solid var(--bad); color: #f59b9e; }
.overlay-box > img.square { max-width: 260px; aspect-ratio: 1; }

/* ---------- Loup-Garou ---------- */
.lg-narrator { position: relative; border-radius: 14px; overflow: hidden; background-size: cover; background-position: center;
  min-height: 150px; display: flex; align-items: flex-end; gap: 12px; padding: 14px; margin-bottom: 10px; }
.lg-narrator::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #000a, #0004 60%, #0000); }
.lg-minet { position: relative; width: 92px; height: 92px; flex: none; filter: drop-shadow(0 4px 10px #000a); }
.lg-bubble { position: relative; background: #fffffff2; color: #1e1f22; border-radius: 14px; padding: 10px 14px; max-width: 640px;
  font-size: 15px; line-height: 1.45; box-shadow: 0 6px 18px #0007; }
.lg-bubble::before { content: ""; position: absolute; left: -10px; bottom: 18px; border: 10px solid transparent; border-right-color: #fffffff2; border-left: 0; }
.lg-who { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #7a3fae; }
.lg-card { display: flex; gap: 14px; align-items: center; background: var(--panel); border-radius: 12px; padding: 10px; margin-bottom: 10px; position: relative; }
.lg-card > img { width: 110px; height: 110px; border-radius: 12px; flex: none; }
.lg-card.dead > img { filter: grayscale(1) brightness(.7); }
.lg-card-title { font-size: 17px; margin-bottom: 3px; }
.lg-card-txt > div { margin-top: 3px; }
.lg-card-txt { padding-right: 34px; }
.lg-card .small { position: absolute; top: 8px; right: 8px; padding: 4px 8px; }
.hidden-card { justify-content: center; cursor: pointer; min-height: 60px; color: var(--muted); }
.lg-dead { color: #f59b9e; font-weight: 700; }
.lg-panel { background: var(--panel); border-radius: 12px; padding: 12px; margin-bottom: 10px; border: 2px solid var(--accent); }
.lg-panel.wolf { border-color: var(--bad); }
.lg-panel.muted { border-color: transparent; text-align: center; }
.lg-panel h3 { margin: 0 0 6px; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 16px; }
.lg-targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; }
.lg-target { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; background: var(--panel2); }
.lg-target.on { background: var(--accent); color: #fff; }
.lg-t-emoji { font-size: 22px; }
.lg-t-name { font-weight: 700; font-size: 13px; }
.lg-badge { position: absolute; top: 4px; right: 6px; background: var(--bad); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 800; padding: 0 7px; }
.lg-votes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: 12.5px; }
.lg-votes span { background: var(--panel2); border-radius: 999px; padding: 3px 9px; }
.lg-chat { margin-top: 12px; background: var(--bg); border-radius: 10px; padding: 8px; }
.lg-chat-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.lg-chat-msgs { max-height: 140px; overflow-y: auto; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.lg-chat-in { display: flex; gap: 6px; margin-top: 6px; }
.lg-chat-in input { flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px; font: inherit; }
.lg-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.lg-p { position: relative; background: var(--panel); border-radius: 10px; padding: 8px; text-align: center; }
.lg-p.dead { opacity: .5; }
.lg-p-emoji { font-size: 26px; }
.lg-p-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-p-sub { font-size: 12px; color: var(--muted); min-height: 16px; }
tr.deadrow td { opacity: .6; }
@media (max-width: 520px) {
  .lg-minet { width: 60px; height: 60px; }
  .lg-bubble { font-size: 13.5px; }
  .lg-card > img { width: 76px; height: 76px; }
  .lg-targets, .lg-players { grid-template-columns: repeat(2, 1fr); }
}
