/* Werewolf companion — Hub look (dark slate, blue + gold), phone first. */
:root {
  --bg: #0f1117;
  --bg-soft: #161923;
  --card: #1a1e2b;
  --card-2: #212636;
  --line: #2a3042;
  --text: #e8eaf0;
  --muted: #969db4;
  --accent: #6ea8fe;
  --warm: #f0b354;
  --wolf: #e0605a;
  --good: #4cc38a;
  --night: #0a0d1a;
  --r: 12px;
  --tap: 44px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  position: fixed; inset: 0;
  background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation; -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- app frame ---------- */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.top { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 2; }
.top h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sub { font-size: 13px; color: var(--muted); white-space: nowrap; }
.top .grow { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: 0 0 auto; }
.icon-btn:hover { background: var(--card); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.icon-btn svg { width: 22px; height: 22px; }
.main { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }
.pane { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pad { padding: 12px 14px; }
.side { display: none; }
.tabbar { flex: 0 0 auto; display: flex; border-top: 1px solid var(--line); background: var(--bg-soft); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { flex: 1; height: 54px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.sel { color: var(--accent); }

@media (min-width: 900px) {
  .side { display: flex; flex-direction: column; flex: 0 0 340px; border-left: 1px solid var(--line); background: var(--bg-soft); min-height: 0; }
  .tabbar.game-tabs { display: none; }
  .wide-only { display: initial; }
  .main.center > .pane { max-width: 1180px; margin: 0 auto; }
}
@media (max-width: 899px) { .wide-only { display: none !important; } }

/* ---------- buttons & controls ---------- */
.btn { min-height: var(--tap); padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; transition: transform .08s, background .15s, border-color .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--card-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b1020; }
.btn.primary:hover { background: #86b7ff; }
.btn.warm { background: var(--warm); border-color: var(--warm); color: #1d1405; }
/* Disabled main actions: a quiet outline in the button's colour, readable text (not a muddy fill). */
.btn.primary:disabled, .btn.warm:disabled { opacity: 1; background: var(--card); color: #6d7591; }
.btn.primary:disabled { border-color: rgba(110,168,254,.35); }
.btn.warm:disabled { border-color: rgba(240,179,84,.35); }
.btn.danger { background: transparent; border-color: #5a2a2a; color: #ff8a80; }
.btn.ghost { background: transparent; }
.btn.big { min-height: 54px; font-size: 17px; border-radius: 14px; }
.btn.block { width: 100%; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .btn { flex: 1 1 0; }
.qmark { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; align-items: center; justify-content: center; background: transparent; padding: 0; vertical-align: middle; flex: 0 0 auto; }
.qmark:hover { color: var(--text); border-color: var(--muted); }
/* 40px tap area around the small ? without making it look bigger. */
.qmark { position: relative; }
.qmark::after { content: ""; position: absolute; inset: -10px; }
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); min-height: 34px; }
.seg button.sel { background: var(--card-2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; inset: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 15px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(20px); }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 20px; line-height: 1; }
.stepper button:active { transform: scale(.94); }
.stepper button:disabled { opacity: .3; }
.stepper .val { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type=text] { width: 100%; min-height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); padding: 8px 12px; font-size: 16px; }
input[type=text]:focus { outline: none; border-color: var(--accent); }
.label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.label .grow { flex: 1; }

/* ---------- home ---------- */
.home { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 16px 40px; gap: 22px; position: relative; overflow: hidden; }
.home .hero { text-align: center; position: relative; }
.home .hero .moon-big { width: 96px; height: 96px; margin: 0 auto 6px; display: block; filter: drop-shadow(0 0 28px rgba(240,179,84,.35)); }
.home h1 { font-size: clamp(36px, 9vw, 54px); margin: 0; letter-spacing: -.02em; line-height: 1.05; }
.home .tag { color: var(--muted); margin-top: 6px; font-size: 15px; }
.menu, .home .hero { position: relative; z-index: 1; }
.menu { display: grid; gap: 10px; width: 100%; max-width: 420px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); text-align: left; transition: transform .08s, background .15s; }
.menu-item:hover { background: var(--card-2); }
.menu-item:active { transform: scale(.98); }
.menu-item .mi-ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--bg-soft); color: var(--warm); flex: 0 0 auto; }
.menu-item .mi-ic svg { width: 24px; height: 24px; }
.menu-item b { display: block; font-size: 17px; }
.menu-item small { color: var(--muted); font-size: 13px; }
.menu-item.main-item { border-color: #3a4a6e; background: linear-gradient(180deg, #1e2740, #1a1e2b); }
.home .stars, .night-bg .stars { position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 72% 12%, #cfe0ff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 40% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 86% 40%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 22% 62%, #cfe0ff 50%, transparent 51%), radial-gradient(1px 1px at 60% 76%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 92% 84%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 6% 90%, #fff 50%, transparent 51%); }
.foot { position: absolute; bottom: calc(10px + env(safe-area-inset-bottom)); font-size: 12px; color: #5d6480; }

/* ---------- setup ---------- */
.setup { flex: 1; display: grid; grid-template-columns: 1fr; min-height: 0; }
.setup .col { min-height: 0; display: flex; flex-direction: column; }
.setup .col-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 14px; }
.setup .col-foot { flex: 0 0 auto; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); display: flex; gap: 8px; align-items: center; }
.setup .col-foot .btn { flex: 1; }
.setup .col.step-hidden { display: none; }
@media (min-width: 900px) {
  .setup { grid-template-columns: minmax(320px, 400px) 1fr; max-width: 1180px; margin: 0 auto; width: 100%; }
  .setup .col.step-hidden { display: flex; }
  .setup .col + .col { border-left: 1px solid var(--line); }
  .setup .col-foot .phone-only, .setup .col-foot.phone-only { display: none; }
}
.count-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 12px; }
.count-row .big-n { font-size: 34px; font-weight: 800; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.count-row .stepper button { width: 44px; height: 44px; font-size: 24px; }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 8px; }
.names .nm { display: flex; align-items: center; gap: 6px; }
.names .nm .seat { width: 24px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.names .nm.bot input { color: var(--muted); }
.names .nm .tagbot { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; flex: 0 0 auto; }
.setup-list { display: grid; gap: 8px; }
.setup-opt { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; transition: border-color .15s, background .15s; }
.setup-opt.sel { border-color: var(--accent); background: #1b2440; box-shadow: inset 0 0 0 1px var(--accent); }
.setup-opt .so-name { font-weight: 700; }
.setup-opt .so-roles { grid-column: 1 / 2; display: flex; flex-wrap: wrap; gap: 4px; }
.setup-opt .so-pct { grid-row: 1 / 3; grid-column: 2; text-align: right; }
.setup-opt .so-pct b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.setup-opt .so-pct small { color: var(--muted); font-size: 11px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 12px; white-space: nowrap; }
.chip .ri { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.chip .ri svg { width: 14px; height: 14px; }
.chip.wolf { border-color: #5a2e2e; }
.custom-roles { display: grid; gap: 6px; margin-top: 10px; }
.custom-roles .cr { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.custom-roles .cr .nm { flex: 1; display: flex; align-items: center; gap: 8px; }
.balance-note { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 8px; }

/* ---------- role icons (tiny emblems) ---------- */
.ri { color: #fff; }
.ri.wolf { background: #6b2525; }
.ri.village { background: #233a66; }

/* ---------- deal (pass the phone) ---------- */
.deal { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px 16px; text-align: center; min-height: 0; overflow-y: auto; }
.deal .who { font-size: 15px; color: var(--muted); }
.deal .who b { display: block; font-size: 30px; color: var(--text); margin-top: 2px; line-height: 1.15; }
/* The card shrinks with the screen height so "Hide · pass on" always fits without scrolling. */
.flip { width: min(60vw, clamp(150px, calc((100dvh - 400px) * .75), 250px)); flex: 0 0 auto; aspect-ratio: 3 / 4; perspective: 900px; border: 0; padding: 0; background: transparent; }
.flip-in { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.flip.open .flip-in { transform: rotateY(180deg); }
.flip:not(.open):active .flip-in { transform: scale(.97); transition-duration: .08s; }
.flip { display: block; }
.flip .face { display: block; position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.flip .face svg { width: 100%; height: 100%; display: block; }
.flip .front { transform: rotateY(180deg); }
.role-title { font-size: 26px; font-weight: 800; margin: 0; }
.role-title.wolf { color: var(--wolf); }
.role-title.village { color: var(--accent); }
.role-help { max-width: 34ch; color: var(--muted); font-size: 15px; margin: 0 auto; min-height: 2.8em; }
.dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; max-width: 300px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.done { background: var(--accent); }
.dots i.now { background: var(--warm); }

/* ---------- night ---------- */
.night-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% -20%, #1b2550 0%, var(--night) 60%); z-index: 0; }
.night { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); gap: 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.say { text-align: center; font-size: clamp(19px, 5vw, 26px); font-weight: 600; line-height: 1.3; min-height: 2.7em; display: flex; align-items: center; justify-content: center; padding: 0 6px; color: #dfe6ff; transition: opacity .25s; }
.say.fade { opacity: .25; }
.step-head { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--muted); font-size: 14px; }
.step-head svg { width: 26px; height: 26px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(104px, 100%), 1fr)); gap: 8px; }
.pbtn { position: relative; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: rgba(26,30,43,.92); padding: 8px 10px; text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px; transition: transform .08s, border-color .15s, background .15s; min-width: 0; }
.pbtn:active { transform: scale(.97); }
.pbtn .pn { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbtn .ps { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbtn.sel { border-color: var(--warm); background: #2c2414; box-shadow: inset 0 0 0 1px var(--warm); }
.pbtn.dead { opacity: .45; }
.pbtn.dead .pn { text-decoration: line-through; text-decoration-color: rgba(255,255,255,.35); }
.pbtn:disabled { opacity: .35; }
.pbtn.me { border-color: #3a4a6e; }
.pbtn .odds { position: absolute; right: 8px; top: 7px; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.pbtn .bar { position: absolute; left: 8px; right: 8px; bottom: 5px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.07); overflow: hidden; }
.pbtn .bar i { display: block; height: 100%; border-radius: 2px; transition: width .4s ease; }
.pbtn.has-odds { padding-bottom: 12px; }
/* Odds sit under the name so full names fit three to a row on a phone. */
.pbtn.has-odds .odds { position: static; font-size: 14px; line-height: 1.1; }
/* With many players the list scrolls and the action buttons stay on screen. */
.night .actions { margin-top: auto; display: flex; gap: 8px; position: sticky; bottom: calc(-12px - env(safe-area-inset-bottom)); padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); margin-bottom: calc(-12px - env(safe-area-inset-bottom)); background: linear-gradient(to bottom, rgba(10,13,26,0), var(--night) 35%); z-index: 2; }
.night .actions .btn { flex: 1; }
.result-card { margin: 0 auto; text-align: center; padding: 14px 18px; border-radius: 16px; border: 1px solid var(--line); background: rgba(26,30,43,.9); animation: pop .35s ease; }
.result-card b { display: block; font-size: 26px; }
.result-card.bad b { color: var(--wolf); }
.result-card.good b { color: var(--good); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.wait-moon { width: 120px; height: 120px; margin: 10px auto; display: block; animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.05); opacity: 1; } }
.progress { height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.witch-box { display: grid; gap: 10px; }
.witch-box .victim { text-align: center; font-size: 17px; }
.witch-box .victim b { color: var(--wolf); font-size: 22px; }

/* ---------- day ---------- */
.day { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.day .day-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 12px; }
.day .day-foot { flex: 0 0 auto; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 8px; background: var(--bg); }
.day .day-foot .btn { flex: 1; min-width: 0; padding: 10px 8px; }
.news { border-radius: 14px; background: linear-gradient(180deg, #23283a, #1a1e2b); border: 1px solid var(--line); padding: 12px 14px; display: flex; gap: 12px; align-items: center; animation: pop .35s ease; }
.news svg.sun { width: 36px; height: 36px; flex: 0 0 auto; }
.news .nt { font-size: 17px; font-weight: 600; }
.news .nt small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.stat-line b { color: var(--text); }
.claims { display: grid; gap: 6px; }
.claim { display: flex; align-items: center; gap: 8px; font-size: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 10px; }
.claim .ct { flex: 1; min-width: 0; }
.claim .x { width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; font-size: 18px; }
.tagw { color: var(--wolf); font-weight: 700; }
.tagg { color: var(--good); font-weight: 700; }
.feed { display: grid; gap: 6px; }
.bubble { background: var(--card); border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; padding: 8px 11px; font-size: 14px; animation: pop .3s ease; }
.bubble b { color: var(--warm); }

/* ---------- log ---------- */
.log { display: grid; gap: 4px; font-size: 14px; }
.log .lh { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 10px 0 2px; display: flex; align-items: center; gap: 6px; }
.log .lh:first-child { margin-top: 0; }
.log .le { padding: 4px 0 4px 10px; border-left: 2px solid var(--line); }
.log .le.secret { border-left-color: #6b2525; color: #f0c4c0; }
.log .le.vote { border-left-color: var(--warm); }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 24px 8px; }

/* ---------- game over ---------- */
.over-head { text-align: center; padding: 16px 8px 6px; }
.over-head h2 { margin: 6px 0 0; font-size: 30px; }
.over-head.wolves h2 { color: var(--wolf); }
.over-head.village h2 { color: var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(92px, 100%), 1fr)); gap: 10px; }
.mini-card { text-align: center; font-size: 13px; min-width: 0; }
.mini-card .mc-art { border-radius: 10px; overflow: hidden; aspect-ratio: 3/4; box-shadow: var(--shadow); position: relative; }
.mini-card .mc-art svg { width: 100%; height: 100%; display: block; }
.mini-card.dead .mc-art { filter: grayscale(.85) brightness(.55); }
.mini-card.dead .mc-r { color: #b97a76; }
.mini-card .mc-n { font-weight: 700; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card .mc-r { color: var(--muted); font-size: 12px; }

/* ---------- sheet (bottom sheet on phone, card on laptop) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(5,7,12,.6); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
.sheet { width: 100%; max-height: 88dvh; background: var(--bg-soft); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .25s cubic-bezier(.2,.7,.2,1); padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; }
.sheet-body { overflow-y: auto; padding: 4px 14px 14px; display: grid; gap: 14px; }
.sheet-foot { padding: 10px 14px 14px; display: flex; gap: 8px; border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { width: 460px; border-radius: 18px; border-bottom: 1px solid var(--line); max-height: 84dvh; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.set-row { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.set-row .sl { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.set-group { display: grid; gap: 6px; }
/* Sound & effects rows (from js/fx.js) drawn like the other Settings rows */
.fx-set { display: grid; gap: 6px; }
.fx-set .fx-row { border-top: 0; padding: 0; min-height: 40px; }
.fx-set .fx-lab { gap: 6px; }
.fx-set .seg button[aria-pressed="true"] { background: var(--card-2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.fx-set .q { position: relative; display: inline-flex; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; align-items: center; justify-content: center; background: transparent; padding: 0; }
.fx-set .q::after { content: ""; position: absolute; inset: -10px; }
.fx-set .fx-test { min-height: 34px; background: var(--card-2); }
.fx-set .fx-vol { accent-color: var(--accent); }
.fx-set .switch { width: 50px; height: 30px; }
.fx-set .switch span { border-radius: 15px; }
.fx-set .switch span::after { width: 24px; height: 24px; }
.fx-set .switch input:checked + span::after { transform: translateX(20px); }
.fx-set .seg { gap: 2px; padding: 3px; border-radius: 10px; }
.fx-set .seg button { padding: 7px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; min-height: 34px; }
.help-text { font-size: 14px; color: var(--muted); line-height: 1.5; }
.help-text b { color: var(--text); }

/* ---------- lab / rules pages ---------- */
.page { max-width: 860px; margin: 0 auto; width: 100%; }
.page h2 { font-size: 20px; margin: 18px 0 8px; }
.page h2:first-child { margin-top: 4px; }
.page p, .page li { color: #c9cee0; font-size: 15px; line-height: 1.55; }
.page ul { padding-left: 20px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; font-variant-numeric: tabular-nums; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; }
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(148px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--card-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); z-index: 80; font-size: 14px; max-width: 90vw; text-align: center; animation: up .2s ease; }

/* ---------- online: join + lobby */
.join-row { display: flex; gap: 8px; }
.join-row .code-in { flex: 1; text-transform: uppercase; letter-spacing: .3em; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.lobby { display: flex; flex-direction: column; gap: 6px; }
.code-big { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); width: 100%; }
.code-big b { font-size: 34px; letter-spacing: .22em; color: var(--warm); font-variant-numeric: tabular-nums; line-height: 1.15; padding-left: .22em; }
.code-big small { color: var(--muted); font-size: 12px; }
.lobby .names { grid-template-columns: 1fr; }
.lobby .nm { min-height: 42px; padding: 2px 8px 2px 0; border-bottom: 1px solid var(--line); }
.lobby .seat-name { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby .nm.bot .seat-name { color: var(--muted); }
.lobby .seat-btn { min-height: 34px; padding: 4px 12px; font-size: 14px; flex: 0 0 auto; }
.lobby .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.lobby .dot.on { background: var(--good); }
@media (min-width: 900px) { .lobby .names { grid-template-columns: 1fr 1fr; column-gap: 18px; } }
.online-pick .names { grid-template-columns: 1fr; }
.online-pick .menu-item { width: 100%; }

/* ---------- the real table (css/table.css kit + Werewolf seats) ----------
   Everyone sits round a wooden table, their role card (poker size, 63 x 88) in front of them. */
.ww-pc { --card-w: 60px; width: var(--card-w); --ratio: 63 / 88; background: #0d0f17; padding: 5%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ww-pc svg, .ww-card .tbl-face svg { width: 100%; height: 100%; display: block; }
.ww-play { position: relative; }
.ww-play .stat-line { flex: 0 0 auto; padding: 4px 14px; gap: 2px 12px; font-size: 12px; min-height: 30px; border-bottom: 1px solid var(--line); background: var(--bg); }
.ww-table { --muted: #cdbf9f; --cw: 40px; --sw: 80px; flex: 1 1 auto; min-height: 0; overflow: hidden; box-shadow: inset 0 0 0 1px #2b1a0c, inset 0 0 26px rgba(0,0,0,.55); }
.ww-table.s-m { --cw: 36px; --sw: 72px; }
.ww-table.s-s { --cw: 22px; --sw: 62px; }
.pbtn.ww-seat { position: absolute; left: 0; top: 0; z-index: 2; width: var(--sw); min-height: 44px; padding: 3px 2px 4px; border: 0; border-radius: 10px; background: transparent; box-shadow: none; align-items: center; justify-content: flex-start; gap: 3px; text-align: center; color: #f3efe4; }
.pbtn.ww-seat:not(:disabled):hover { background: rgba(255,240,200,.07); }
.pbtn.ww-seat.dead, .pbtn.ww-seat:disabled { opacity: 1; }
.ww-table.picking .pbtn.ww-seat:disabled:not(.dead):not(.me) { opacity: .6; }
.ww-card { --card-w: var(--cw); width: var(--cw); rotate: var(--r, 0deg); transition: translate .2s ease, box-shadow .2s ease; display: block; background: #0d0f17; border-color: rgba(0,0,0,.6); }
.ww-card .tbl-face { background: #0d0f17; padding: 5%; border: 0; box-shadow: none; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ww-card .tbl-face::after { display: none; }
.ww-card .ww-hide { display: none; }
.ww-seat .pn.tbl-plate { max-width: 100%; font-size: 12px; line-height: 17px; padding: 1px 6px; }
.ww-seat .ps { max-width: 100%; font-size: 11px; line-height: 1.2; color: #e6dcc6; text-shadow: 0 1px 2px #000; }
.ww-seat .ps .tagw { color: #ff8f86; }
.ww-seat .ps .tagg { color: #7fe0ae; }
.pbtn.ww-seat.has-odds { padding-bottom: 4px; }
.pbtn.ww-seat .odds, .pbtn.ww-seat.has-odds .odds { position: static; font-size: 13px; line-height: 1; padding: 2px 6px 1px; border-radius: 7px; background: rgba(12,8,4,.62); }
.pbtn.ww-seat .bar { position: static; display: block; width: 70%; height: 3px; margin-top: -1px; background: rgba(0,0,0,.4); }
.ww-seat.sel .ww-card { translate: 0 -6px; }
.ww-seat.sel .ww-card { box-shadow: 0 0 0 2px var(--warm), 0 10px 18px rgba(0,0,0,.55); }
.ww-seat.sel .tbl-plate { border-color: #f0c35a; box-shadow: 0 0 0 2px rgba(240,195,90,.5), 0 2px 4px rgba(0,0,0,.4); }
.ww-seat.dead .ww-card { filter: grayscale(.55) brightness(.72); }
.ww-seat.dead .tbl-plate { color: #a99c84; text-decoration: line-through; text-decoration-color: rgba(255,255,255,.4); }
.ww-seat.me { width: calc(var(--sw) * 1.15); }
.ww-seat.me .ww-card { --card-w: calc(var(--cw) * 1.4); width: calc(var(--cw) * 1.4); }
.ww-seat.me .tbl-plate { border-color: #c79a4a; }
/* 13-20 players on a phone: smaller cards, the odds colour alone (no bar), one line under each name */
.ww-table.s-s .ww-seat .pn.tbl-plate { font-size: 10px; line-height: 13px; padding: 0 4px; }
.ww-table.s-s .pbtn.ww-seat .odds { font-size: 11px; line-height: 12px; padding: 0 4px; }
.ww-table.s-s .pbtn.ww-seat .bar { display: none; }
.ww-table.s-s .ww-seat .ps { font-size: 10px; line-height: 12px; }
.ww-table.s-s .pbtn.ww-seat { gap: 1px; padding: 1px; }
/* ...and the odds / role sit on the lower edge of the card, like a marker laid on it */
.ww-table.s-s .pbtn.ww-seat .odds, .ww-table.s-s .ww-seat .ps { position: absolute; z-index: 1; left: 50%; top: calc(1px + var(--cw) * 88 / 63 - 11px); transform: translateX(-50%); white-space: nowrap; }
.ww-table.s-s .ww-seat .ps { background: rgba(12,8,4,.72); border-radius: 6px; padding: 0 4px; max-width: none; }
/* the middle of the table: the narrator's news, claims and the night line */
.ww-center { position: absolute; z-index: 1; left: 90px; right: 90px; top: 90px; bottom: 90px; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.ww-cin { margin: auto 0; display: flex; flex-direction: column; gap: 8px; align-items: stretch; text-align: center; }
.ww-center .news { background: linear-gradient(180deg, #f3ead3, #e6d9b8); color: #2b1d10; border: 1px solid #b9a77f; border-radius: 4px; padding: 8px 10px; gap: 8px; text-align: left; rotate: -1deg; box-shadow: 0 2px 3px rgba(0,0,0,.35), 0 8px 16px rgba(0,0,0,.3); }
.ww-center .news .nt { font-size: 15px; }
.ww-center .news .nt small { color: #5e4c30; }
.ww-center .news svg.sun { width: 28px; height: 28px; }
.ww-center .claim { background: #f1e8d0; color: #2b1d10; border: 1px solid #b9a77f; border-radius: 4px; text-align: left; font-size: 13px; box-shadow: 0 2px 4px rgba(0,0,0,.35); }
.ww-center .claim:nth-child(even) { rotate: .8deg; }
.ww-center .claim:nth-child(odd) { rotate: -.6deg; }
.ww-center .claim .tagw { color: #b3261e; }
.ww-center .claim .tagg { color: #1d7a48; }
.ww-center .claim .x { color: #6d5a3a; }
.ww-center .result-card { background: linear-gradient(180deg, #f3ead3, #e6d9b8); color: #2b1d10; border-color: #b9a77f; border-radius: 4px; box-shadow: 0 2px 3px rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.35); }
.ww-center .result-card .muted { color: #5e4c30; }
.ww-center .result-card.bad b { color: #b3261e; }
.ww-center .result-card.good b { color: #1d7a48; }
.ww-center .say { font-size: clamp(16px, 4.4vw, 26px); min-height: 0; padding: 0; color: #f6f0e0; text-shadow: 0 1px 3px #000; }
.ww-center .wait-moon { width: 72px; height: 72px; margin: 4px auto; }
.ww-center .step-head { color: var(--muted); text-shadow: 0 1px 2px #000; }
.ww-center .label { color: var(--muted); text-shadow: 0 1px 2px #000; }
.ww-center .witch-box .victim { text-shadow: 0 1px 3px #000; }
.ww-center .witch-box .victim b { color: #ff8f86; }
.ww-center .role-title { font-size: 21px; text-shadow: 0 1px 3px #000; }
.ww-center .role-help { color: #e6dcc6; font-size: 14px; min-height: 0; text-shadow: 0 1px 2px #000; }
.ww-center .over-head { padding: 0; text-shadow: 0 1px 3px #000; }
.ww-center .over-head h2 { font-size: 26px; }
.ww-center .over-head svg { width: 48px; height: 48px; }
.ww-center .tbl { font-size: 13px; background: rgba(12,8,4,.5); border-radius: 6px; }
.ww-center .log { text-align: left; background: rgba(12,8,4,.5); border-radius: 6px; padding: 6px 8px; }
.ww-center .empty { color: #e6dcc6; padding: 8px; }
.ww-center .progress { background: rgba(0,0,0,.4); }
/* night: the same table in the dark, a little moonlight from above */
.ww-table.is-night::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse 90% 70% at 50% 30%, rgba(60,80,150,.28), rgba(6,9,22,.86) 75%); }
.ww-table.is-night .ww-seat .ww-card { filter: brightness(.82) saturate(.85); }
.ww-table.is-night .ww-seat.dead .ww-card { filter: grayscale(.6) brightness(.6); }
.night .day-foot { background: var(--night); }
/* the deal: the role deck on the table, one card at a time */
.deal.tbl-surface { --muted: #d7c8a6; position: relative; }
.ww-deck { position: absolute; top: 14px; left: 14px; z-index: 1; }
.ww-dcard { --card-w: 40px; width: 40px; display: block; }
.ww-deck .tbl-badge { right: -8px; bottom: -4px; }
.ww-ghost { padding: 5%; background: #0d0f17; }
.flip { width: min(60vw, clamp(150px, calc((100dvh - 400px) * .716), 250px)); aspect-ratio: 63 / 88; }
.flip .face { background: #0d0f17; padding: 4.5%; border: 1px solid rgba(0,0,0,.6); border-radius: 12px; box-shadow: 0 2px 3px rgba(0,0,0,.4), 0 14px 28px rgba(0,0,0,.45); }
.deal.tbl-surface .who b, .deal.tbl-surface .role-title, .deal.tbl-surface .role-help { text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.deal.tbl-surface .role-help { color: #e6dcc6; }
.deal.tbl-surface .dots i { background: rgba(0,0,0,.45); }
/* your own (bigger) card: the laid-on markers sit on its lower edge too */
.ww-table.s-s .ww-seat.me .odds, .ww-table.s-s .ww-seat.me .ps { top: calc(1px + var(--cw) * 1.4 * 88 / 63 - 11px); }
.ww-table.s-s .ww-seat.has-odds .ps { margin-top: -13px; }
/* the narrowest phones: 13-20 seats need a little less room each */
@media (max-width: 360px) {
  .ww-table.s-s { --cw: 20px; --sw: 48px; }
  .ww-table.s-s .ww-seat .pn.tbl-plate { font-size: 9px; padding: 0 3px; }
  .ww-table.s-m { --cw: 32px; --sw: 64px; }
}
/* phone on its side: a short, wide table, so small cards with the markers laid on them */
@media (max-height: 500px) {
  .ww-table, .ww-table.s-m { --cw: 26px; --sw: 74px; }
  .ww-table.s-s { --cw: 20px; --sw: 58px; }
  .ww-table .pbtn.ww-seat { gap: 1px; padding: 1px; min-height: 0; }
  .ww-table .pbtn.ww-seat .bar { display: none; }
  .ww-table .ww-seat .pn.tbl-plate { font-size: 11px; line-height: 14px; padding: 0 4px; }
  .ww-table .pbtn.ww-seat .odds, .ww-table .ww-seat .ps { position: absolute; z-index: 1; left: 50%; top: calc(1px + var(--cw) * 88 / 63 - 11px); transform: translateX(-50%); white-space: nowrap; font-size: 10px; line-height: 12px; padding: 0 4px; }
  .ww-table .ww-seat .ps { background: rgba(12,8,4,.72); border-radius: 6px; max-width: none; }
  .ww-table .ww-seat.me .odds, .ww-table .ww-seat.me .ps { top: calc(1px + var(--cw) * 1.4 * 88 / 63 - 11px); }
  .ww-table .ww-seat.has-odds .ps { margin-top: -13px; }
  .ww-table .ww-seat .ps { max-width: calc(var(--sw) + 8px); overflow: hidden; text-overflow: ellipsis; }
  .ww-center .say { font-size: 15px; }
  .ww-center .wait-moon { width: 40px; height: 40px; }
  .ww-center .news .nt, .ww-center .claim { font-size: 12px; }
  .ww-center .news, .ww-center .claim { padding: 4px 8px; }
  .ww-cin { gap: 4px; }
}
@media (min-width: 900px) {
  .ww-table { --cw: 64px; --sw: 132px; }
  .ww-table.s-m { --cw: 54px; --sw: 118px; }
  .ww-table.s-s { --cw: 40px; --sw: 92px; }
  .pbtn.ww-seat { min-height: 44px; padding: 4px; }
  .ww-seat .pn.tbl-plate { font-size: 14px; line-height: 20px; padding: 1px 8px; }
  .ww-table.s-s .ww-seat .pn.tbl-plate { font-size: 12px; line-height: 17px; }
  .ww-seat .ps { font-size: 12px; }
  .pbtn.ww-seat .odds, .pbtn.ww-seat.has-odds .odds { font-size: 16px; margin: 0; }
  .ww-center .news .nt { font-size: 18px; }
  .ww-center .claim { font-size: 15px; }
  .ww-cin { max-width: 560px; width: 100%; margin: auto; }
  .ww-center .say { font-size: 26px; }
  .ww-center .wait-moon { width: 96px; height: 96px; }
  .ww-play .stat-line { padding: 6px 20px; font-size: 14px; }
}

/* ---------- laptop: use the width (bigger player tiles, centred night) ---------- */
@media (min-width: 900px) {
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
  .pbtn { min-height: 84px; padding: 12px 16px; border-radius: 14px; }
  .chip { font-size: 13px; padding: 3px 10px 3px 3px; }
  .chip .ri { width: 22px; height: 22px; }
  .chip .ri svg { width: 16px; height: 16px; }
  .setup-opt { padding: 12px 16px; }
  .setup-opt .so-name { font-size: 17px; }
  .setup-opt .so-pct b { font-size: 26px; }
  .setup-opt .so-pct small { font-size: 12px; }
  .menu { max-width: 460px; }
  .menu-item { padding: 16px 18px; }
  .menu-item b { font-size: 18px; }
  .menu-item small { font-size: 14px; }
  .tbl { font-size: 15px; }
  .legend { font-size: 14px; }
  .pbtn .pn { font-size: 18px; }
  .pbtn .ps { font-size: 13px; }
  .pbtn.has-odds { padding-bottom: 18px; }
  .pbtn.has-odds .odds { font-size: 20px; margin-top: 2px; }
  .pbtn .bar { left: 16px; right: 16px; bottom: 9px; height: 4px; }
  .pbtn:not(:disabled):hover { border-color: #3a4a6e; background: var(--card-2); }
  .night-main > .side { display: none; } /* it sat hidden under the night sky and pushed the night off centre */
  .night { width: 100%; max-width: 900px; margin: 0 auto; padding-top: 24px; gap: 18px; }
  .say { font-size: 28px; }
  .day .day-body { padding: 16px 20px; gap: 14px; }
  .day .day-foot { padding: 12px 20px; }
  .news { padding: 16px 18px; }
  .news .nt { font-size: 20px; }
  .news svg.sun { width: 42px; height: 42px; }
  .stat-line { font-size: 15px; }
  .claim, .bubble { font-size: 15px; }
  .deal .who b { font-size: 36px; }
  .role-title { font-size: 30px; }
}
/* The table screens use .night only as a hook for the night sounds: no padding or scrolling of their own. */
.ww-play.night { padding: 0; gap: 0; overflow: hidden; max-width: none; margin: 0; }

/* ---------- the table fills its space (layoutTables in app.js sets --cw/--sw and the text sizes) ---------- */
.ww-table.fit .ww-seat .pn.tbl-plate { font-size: var(--pf); line-height: calc(var(--pf) * 1.3); }
.ww-table.fit .pbtn.ww-seat .odds { font-size: var(--of); line-height: 1.05; }
.ww-table.fit .ww-seat .ps { font-size: var(--sf); line-height: 1.2; }
.ww-table.fit.s-s .ww-seat.has-odds .ps { margin-top: calc(-1 * var(--of) - 3px); }
@media (max-height: 500px) {
  .ww-table.fit .ww-seat.has-odds .ps { margin-top: calc(-1 * var(--of) - 3px); }
}
/* Landscape phone: the table takes the full height; the stat line and the buttons sit in a column on the right. */
@media (max-height: 500px) and (orientation: landscape) {
  .ww-play { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); }
  .ww-play > .ww-table { grid-column: 1; grid-row: 1 / 3; height: auto; }
  .ww-play > .stat-line { grid-column: 2; grid-row: 1; width: 176px; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 12px; border-bottom: 0; border-left: 1px solid var(--line); }
  .ww-play > .stat-line > span[style*="margin-left"] { margin-left: 0 !important; }
  .ww-play > .day-foot { grid-column: 2; grid-row: 2; width: 176px; flex-direction: column; justify-content: flex-end; border-top: 0; border-left: 1px solid var(--line); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  .ww-play > .day-foot .btn { flex: 0 0 auto; }
  .ww-play > .day-foot > .muted { flex: 0 0 auto !important; }
  /* Four short buttons (Hint, Claim, Skip, Vote) sit two by two so they clear the stat lines above. */
  .ww-play > .day-foot:has(> .btn:nth-child(4)) { display: grid; grid-template-columns: 1fr 1fr; align-content: end; }
}
