/* The Last Bloodbender — shared look for splash, TV and phones. A full-moon
   night over the Jasmine Dragon: deep indigo, moonlight cream, the four
   nations' colours for the character kinds, and a blood-moon red for Hama. */
:root {
  --night: #120d24; --night2: #1b1436; --night3: #2a2050; --deep: #0a0716;
  --moon: #f3ead6; --dim: #a59cc0; --line: #3b3168;
  --water: #5fb3ea; --earth: #9fd36a; --fire: #ef7a4a; --blood: #e0414f; --air: #f2c14e;
  --good: #5fb3ea; --evil: #e0414f; --ok: #6fdc8c;
  --display: "Bree Serif", Georgia, serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { min-height: 100%; }
body {
  color: var(--moon); font: 600 16px/1.4 var(--body);
  background: var(--night) radial-gradient(ellipse at 70% -10%, #3a2d6e 0%, var(--night) 60%) fixed;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .3px; }
h1 { color: var(--moon); font-size: 44px; line-height: 1.05; }
h2 { color: var(--air); font-size: 22px; }
h3 { color: var(--moon); font-size: 18px; }
button { background: var(--night3); border: 2px solid var(--line); color: var(--moon); padding: 10px 14px;
  border-radius: 12px; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; }
button.primary { background: var(--air); border-color: var(--air); color: #2a1c00; }
button.danger { background: var(--blood); border-color: var(--blood); color: #fff; }
button.on { background: var(--water); border-color: var(--water); color: #04121d; }
button:disabled { opacity: .35; cursor: default; }
select, input, textarea { font: inherit; padding: 8px; border-radius: 8px; background: var(--night2); color: var(--moon); border: 2px solid var(--line); }
.muted { color: var(--dim); } .small { font-size: 13px; }
.tagg { color: var(--dim); font-size: 13px; margin-left: 6px; }
.good { color: var(--good); } .evil { color: var(--evil); } .okc { color: var(--ok); }
.av { border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.rtag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 800; font-size: .9em; white-space: nowrap;
  background: #ffffff12; border: 1px solid #ffffff22; }
.rtag.k-villager { color: var(--water); } .rtag.k-outsider { color: var(--earth); }
.rtag.k-agent { color: var(--fire); } .rtag.k-bloodbender { color: var(--blood); }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(160px); background: var(--moon);
  color: var(--deep); padding: 10px 18px; border-radius: 10px; transition: transform .25s; z-index: 50; max-width: 92vw; font-weight: 800; }
#toast.show { transform: translateX(-50%) translateY(0); }
#conn { position: fixed; top: 8px; right: 8px; background: var(--blood); color: #fff; padding: 4px 10px; border-radius: 8px;
  font-size: 13px; display: none; z-index: 60; }
#conn.show { display: block; }

/* ---- kit phone shell: join + lobby ---------------------------------------- */
.join, .lobbyv { max-width: 480px; margin: 0 auto; padding: 28px 18px; display: grid; gap: 14px; }
.join input { font-size: 20px; padding: 12px; }
.join button, .lobbyv button { font-size: 17px; padding: 13px; }
.hint { color: var(--dim); }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }
.seat-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px;
  background: #00000030; border-radius: 10px; margin: 4px 0; }
.bb-lobby { display: grid; gap: 10px; background: #00000030; border-radius: 12px; padding: 12px; }
.bb-lobby label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---- phone ---------------------------------------------------------------- */
.screen { max-width: 520px; margin: 0 auto; padding: 0 12px 90px; display: grid; gap: 12px; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 4px; background: linear-gradient(var(--night) 70%, transparent); }
.bar .brand { font-family: var(--display); font-size: 18px; color: var(--moon); }
.bar .ph { font-weight: 900; color: var(--air); }
.bar .code { color: var(--dim); letter-spacing: 2px; font-weight: 900; }
.card { background: #ffffff0d; border: 1px solid #ffffff1a; border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.card.hot { border-color: var(--air); box-shadow: 0 0 0 2px #f2c14e55; }
.card.red { border-color: var(--blood); }
.role { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; }
.role .emb { grid-row: span 3; font-size: 52px; width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff22, #00000040); border: 3px solid currentColor; }
.role .rn { font-family: var(--display); font-size: 24px; line-height: 1.1; }
.role .rk { font-weight: 900; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.role .ab { grid-column: 1 / -1; font-size: 15px; }
.role .fl { grid-column: 1 / -1; font-size: 13px; color: var(--dim); font-style: italic; }
.k-villager { color: var(--water); } .k-outsider { color: var(--earth); } .k-agent { color: var(--fire); } .k-bloodbender { color: var(--blood); }
.hidecard { display: flex; justify-content: space-between; align-items: center; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick button { padding: 12px 6px; font-size: 15px; text-align: center; }
.pick button.sel { background: var(--air); border-color: var(--air); color: #2a1c00; }
.pick button.dead { opacity: .55; }
.info { display: grid; gap: 6px; }
.info .it { padding: 8px 10px; border-left: 3px solid var(--water); background: #00000030; border-radius: 6px; }
.info .it .when { font-size: 12px; color: var(--dim); font-weight: 800; }
.town { display: grid; gap: 4px; }
.town .tr { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 10px; background: #00000028; border-radius: 8px; }
.town .tr.dead { opacity: .6; }
.town .tr .cl { font-size: 12px; color: var(--dim); text-align: right; }
.bigvote { display: grid; gap: 10px; text-align: center; }
.bigvote .hand { font-size: 22px; padding: 18px; }
.banner { text-align: center; padding: 14px; border-radius: 14px; background: #00000040; font-family: var(--display); font-size: 20px; }
.dead-note { text-align: center; padding: 10px; border-radius: 12px; background: #ffffff10; color: var(--dim); }
.reveal { display: grid; gap: 4px; }
.reveal .rr { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: #00000030; }
.reveal .rr.evil { box-shadow: inset 4px 0 0 var(--evil); } .reveal .rr.good { box-shadow: inset 4px 0 0 var(--good); }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--night2); border-top: 2px solid var(--line);
  border-radius: 18px 18px 0 0; padding: 16px 14px 24px; max-height: 80vh; overflow: auto; display: grid; gap: 10px; }
.sheet .x { justify-self: end; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 8px; justify-content: center; padding: 10px;
  background: linear-gradient(transparent, var(--night) 35%); flex-wrap: wrap; }
.dock button { flex: 1 1 0; max-width: 170px; padding: 12px 6px; }

/* ---- the Scroll (Storyteller's phone) ------------------------------------- */
.scroll .row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 10px; border-radius: 10px; background: #00000030; }
.scroll .row.dead { opacity: .55; }
.scroll .row .marks { font-size: 13px; color: var(--dim); grid-column: 1 / -1; }
.scroll .row .marks b { color: var(--air); }
.prop { display: grid; gap: 8px; }
.prop .val { font-size: 18px; font-weight: 800; }
.prop .why { font-size: 13px; color: var(--dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 7px 10px; font-size: 14px; }
.chips button.sel { background: var(--air); border-color: var(--air); color: #2a1c00; }

/* ---- TV ------------------------------------------------------------------- */
.tv { height: 100vh; display: grid; grid-template-rows: auto 1fr; padding: 1.6vh 1.6vw; gap: 1.2vh; overflow: hidden; }
.tv header { display: flex; align-items: center; gap: 2vw; }
.tv .brand { font-family: var(--display); font-size: 3.6vh; color: var(--moon); }
.tv .brand .moon { color: var(--blood); }
.tv .ph { font-weight: 900; font-size: 3vh; color: var(--air); }
.tv .clock { font-weight: 900; font-size: 3vh; color: var(--moon); font-variant-numeric: tabular-nums; }
.tv .sub { flex: 1; font-weight: 800; font-size: 2.1vh; color: var(--dim); text-align: right; }
.tv .code { font-family: var(--display); font-size: 3.4vh; letter-spacing: .5vh; color: var(--air); }
.tv .stage { display: grid; grid-template-columns: 1fr 26vw; gap: 1.6vw; min-height: 0; }
.square { position: relative; min-height: 0; border-radius: 3vh; border: .4vh solid var(--line);
  background: radial-gradient(ellipse at 50% 50%, #2c2160 0%, #171030 70%); overflow: hidden; }
.square.night { background: radial-gradient(ellipse at 50% 45%, #241a4d 0%, #0b0818 70%); }
.tok { position: absolute; transform: translate(-50%, -50%); width: 11vh; display: grid; justify-items: center; gap: .3vh; text-align: center; transition: transform .3s; }
.tok .disc { width: 9vh; height: 9vh; border-radius: 50%; display: grid; place-items: center; font-size: 4.2vh;
  background: radial-gradient(circle at 40% 35%, #f6efdf, #cfc3a5); color: #2a1c00; border: .45vh solid #e9dcbc; box-shadow: 0 .6vh 1.4vh #0008; position: relative; }
.tok .disc .ini { font-family: var(--display); font-size: 3.8vh; }
.tok.dead .disc { background: radial-gradient(circle at 40% 35%, #6b6585, #3a3552); border-color: #57507a; color: #cfc8e6; }
.tok.dead .disc::after { content: ''; position: absolute; inset: -.3vh; border-radius: 50%; background: repeating-linear-gradient(135deg, #0000 0 .8vh, #0005 .8vh 1.4vh); }
.tok .nm { font-weight: 900; font-size: 1.9vh; white-space: nowrap; max-width: 14vh; overflow: hidden; text-overflow: ellipsis;
  background: #000a; padding: .1vh .8vh; border-radius: .8vh; }
.tok .cl { font-size: 1.5vh; color: var(--dim); white-space: nowrap; max-width: 15vh; overflow: hidden; text-overflow: ellipsis; }
.tok .lv { position: absolute; top: -.6vh; right: -.6vh; width: 2.8vh; height: 2.8vh; border-radius: 50%; background: var(--moon); border: .3vh solid #2a2050;
  font-size: 1.5vh; display: grid; place-items: center; color: #2a1c00; font-weight: 900; }
.tok .hand { position: absolute; left: -1.4vh; top: -1.2vh; font-size: 3.6vh; filter: drop-shadow(0 .3vh .3vh #000a); }
.tok .hand.down { opacity: .25; }
.tok.clockhand .disc { box-shadow: 0 0 0 .6vh var(--air), 0 0 3vh var(--air); }
.tok.nominee .disc { border-color: var(--blood); box-shadow: 0 0 0 .5vh var(--blood), 0 0 3vh #e0414f99; }
.tok.nominator .nm { color: var(--air); }
.tok.block::before { content: '⚖️'; position: absolute; top: -3.2vh; font-size: 3vh; }
.tok.yes .disc { border-color: var(--ok); }
.tok.off .nm::after { content: ' 📴'; }
.tok.reveal-evil .disc { border-color: var(--evil); box-shadow: 0 0 0 .5vh var(--evil); }
.tok.reveal-good .disc { border-color: var(--good); }
.centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 50%; display: grid; gap: 1.4vh; justify-items: center; text-align: center; }
.centre .big { font-family: var(--display); font-size: 5vh; line-height: 1.1; }
.centre .mid { font-size: 2.6vh; font-weight: 800; }
.centre .tally { font-family: var(--display); font-size: 8vh; color: var(--air); line-height: 1; }
.centre .tally small { font-size: 3vh; color: var(--dim); }
.moonart { font-size: 14vh; line-height: 1; filter: drop-shadow(0 0 4vh #f3ead655); }
.moonart.red { filter: drop-shadow(0 0 5vh #e0414faa) hue-rotate(-30deg) saturate(2); }
.crier { display: flex; flex-direction: column; gap: .8vh; min-height: 0; overflow: hidden; }
.crier h3 { font-size: 2.4vh; color: var(--air); }
.crier .ln { font-size: 1.9vh; font-weight: 700; padding: .6vh 1vh; background: #00000035; border-radius: 1vh; }
.crier .ln.night { color: #b9b2e6; }
.crier .ln.k-banish, .crier .ln.k-yue, .crier .ln.k-slay { border-left: .4vh solid var(--blood); }
.crier .ln.k-dawn { border-left: .4vh solid var(--air); }
.crier .ln.k-claim { color: var(--water); }
.crier .lines { display: flex; flex-direction: column; gap: .7vh; justify-content: flex-end; flex: 1; min-height: 0; overflow: hidden; }
.counts { font-size: 1.7vh; color: var(--dim); font-weight: 800; }
.flash { position: fixed; inset: 0; display: grid; place-items: center; background: #0a0716cc; z-index: 40; animation: fadein .4s; }
.flash .word { font-family: var(--display); font-size: 9vh; text-align: center; max-width: 80vw; line-height: 1.1; }
.flash .word small { display: block; font-family: var(--body); font-size: 3vh; color: var(--dim); margin-top: 2vh; }
@keyframes fadein { from { opacity: 0 } }
.endbtns { display: flex; justify-content: center; gap: 2vw; }
.endbtns button { font-size: 2.6vh; padding: 1.2vh 3vw; }
.verdict { font-family: var(--display); font-size: 6vh; }
.verdict.good { color: var(--good); } .verdict.evil { color: var(--evil); }
.atr .atr-title { font-family: var(--display); font-weight: 400; }
.atr .bb-note { display: flex; flex-direction: column; align-items: center; gap: .8vh; }
.atr .bb-note .opts { display: flex; flex-wrap: nowrap; justify-content: center; gap: 1vw; font-size: .9vw; color: var(--moon); white-space: nowrap; }
.atr .bb-note label { display: inline-flex; align-items: center; gap: .35vw; }
.atr .bb-note select { font-size: .85vw; padding: .15em .3em; border-width: 2px; }
.atr .bb-note .buttons { display: flex; gap: .7vw; }
.atr .bb-note .buttons button { font-size: .95vw; padding: .3em 1em; }
