/* The Haunt — candle-lit purple dark, blood red, ectoplasm green. */
:root {
  --bg: #120b18; --panel: #1e1426; --panel2: #2a1d35; --ink: #eee4f4; --dim: #a395b0;
  --red: #c4313b; --green: #7fd18b; --gold: #e3b34a; --violet: #9d6bd1; --bone: #efe6d2;
  --display: "Creepster", "Bebas Neue", Impact, sans-serif;
  --serif: "IM Fell English", Georgia, serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.35 system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: normal; letter-spacing: 1.5px; }
h1 { color: var(--green); font-size: 46px; line-height: 1; text-shadow: 0 0 18px #7fd18b55; }
h2 { color: var(--violet); font-size: 26px; }
button { background: var(--panel2); border: 1px solid #47335a; color: var(--ink); padding: 10px 14px; border-radius: 10px; font: inherit; font-size: 15px; cursor: pointer; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
button:disabled { opacity: .35; cursor: default; }
button.sel { outline: 2px solid var(--gold); outline-offset: 2px; }
button small { display: block; font-size: 11px; color: var(--dim); font-weight: normal; }
button.small { padding: 5px 9px; font-size: 13px; }
button.wide { width: 100%; margin-top: 8px; text-align: left; }
button.big { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; }
.red { color: #ff6b74; } .blk { color: var(--ink); }
.muted { color: var(--dim); } .small { font-size: 13px; }
.tagg { color: var(--dim); font-size: 14px; margin-left: 8px; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(140px); background: var(--bone); color: #1b1020;
  padding: 10px 18px; border-radius: 10px; transition: transform .25s; z-index: 50; max-width: 90vw; }
#toast.show { transform: translateX(-50%) translateY(0); }
#conn { position: fixed; top: 8px; right: 8px; background: var(--red); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 13px; display: none; z-index: 60; }
#conn.show { display: block; }
.sprfb { font-style: normal; font-size: 11px; color: var(--dim); }

/* ---- cards ---- */
.cd { display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0; position: relative;
  width: 3.3em; min-height: 4.5em; padding: .3em .2em; border-radius: .4em; background: var(--bone); color: #24152c;
  border: 1px solid #0006; box-shadow: 0 2px 6px #000a; font-family: var(--serif); line-height: 1; }
.cd.red { color: #b0202c; }
.cd b { font-size: 1.45em; } .cd i { font-style: normal; font-size: 1.45em; }
.cd small { font-size: .62em; line-height: 1.05; margin-top: .2em; color: #4a3550; text-align: center; font-family: system-ui; }
.cd em { position: absolute; bottom: -.9em; left: 50%; transform: translateX(-50%); font-size: .6em; font-style: normal; color: var(--dim); background: var(--bg); padding: 0 3px; border-radius: 3px; }
.cd .ph { position: absolute; top: 2px; right: 2px; }
.cd.sel { outline: 3px solid var(--gold); transform: translateY(-4px); }
.cd.dim { opacity: .4; }
.cd.big { font-size: 2.2vh; width: 5em; min-height: 7em; }
.mc { display: inline-block; background: var(--bone); color: #24152c; border-radius: 4px; padding: 0 4px; margin: 1px; font: 600 13px var(--serif); }
.mc.red { color: #b0202c; }

/* ---- sheet ---- */
.sheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0; }
.col { background: var(--panel); border-radius: 8px; padding: 6px; text-align: center; }
.colhead { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--dim); }
.imm { font-size: 12px; }
.tol b { font-size: 22px; } .tol small { font-size: 13px; color: var(--gold); } .tol span { color: var(--dim); font-size: 13px; }
.tol.hot b { color: var(--gold); } .tol.over b { color: var(--red); }
.bar { height: 5px; background: #000; border-radius: 3px; overflow: hidden; margin-top: 3px; }
.bar i { display: block; height: 100%; background: var(--green); }
.bar.hot i { background: var(--gold); } .bar.over i { background: var(--red); }
.pws, .sqs { display: flex; justify-content: center; gap: 3px; margin-top: 5px; }
.pw, .sq { font-size: 10px; border: 1px solid #554466; border-radius: 4px; padding: 1px 4px; color: var(--dim); }
.pw.on { background: var(--violet); color: #fff; border-color: var(--violet); }
.sq.marked { background: var(--gold); color: #241708; border-color: var(--gold); }
.sq.spent { text-decoration: line-through; opacity: .5; }
.sheet.compact .col { padding: 3px; }
.sheet.compact .tol b { font-size: 16px; }
ul.powers { list-style: none; padding: 0; margin-top: 6px; font-size: 13px; }
ul.powers li { padding: 3px 0; border-bottom: 1px solid #2f2240; }

/* ---- phone ---- */
.phone { max-width: 900px; margin: 0 auto; padding: 0 10px 60px; display: grid; gap: 10px; }
.join, .lobbyv { max-width: 480px; margin: 0 auto; padding: 36px 12px; display: flex; flex-direction: column; gap: 14px; }
.join input { font: inherit; font-size: 20px; padding: 12px; border-radius: 10px; border: 1px solid #47335a; background: var(--panel2); color: var(--ink); }
.hint { color: var(--dim); font-style: italic; }
.seat-row { padding: 8px 10px; background: var(--panel); border-radius: 10px; margin: 4px 0; display: flex; justify-content: space-between; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0 8px; font-size: 13px; color: var(--dim); border-bottom: 1px solid #2f2240; }
.brand { font-family: var(--display); color: var(--green); font-size: 22px; letter-spacing: 2px; }
.role { background: var(--panel2); border-radius: 6px; padding: 2px 8px; color: var(--ink); }
.role.sm { background: var(--red); color: #fff; } .role.out { background: #333; }
.status { background: var(--panel); border-radius: 10px; padding: 10px 12px; font-size: 17px; border-left: 4px solid transparent; }
.status.go { border-left-color: var(--green); }
.block { background: var(--panel); border-radius: 10px; padding: 8px 10px; }
.block summary { cursor: pointer; font-weight: 600; }
.hand { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.trick { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; min-height: 80px; }
.play { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 13px; }
.grid2, .grid3, .grid4 { display: grid; gap: 6px; margin-top: 6px; }
.grid2 { grid-template-columns: repeat(2, 1fr); } .grid3 { grid-template-columns: repeat(3, 1fr); } .grid4 { grid-template-columns: repeat(4, 1fr); }
.tencard { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tenbar b { font-size: 20px; } .tenbar b.ok { color: var(--green); }
.log .loghead { display: flex; justify-content: space-between; align-items: center; color: var(--violet); }
.logline { font-size: 14px; color: var(--dim); padding: 2px 0; border-bottom: 1px solid #2a1f35; }
.buildbar { display: flex; justify-content: space-between; font-size: 14px; color: var(--dim); }
.buildbar b { color: var(--gold); font-size: 18px; }
.errs { color: #ffb0b5; font-size: 14px; }
.seeker.out { opacity: .55; }
.score { color: var(--gold); font-size: 1.3em; }
.roomcard { border-left: 4px solid var(--red); }

/* ---- map ---- */
.mapwrap { overflow: auto; max-width: 100%; touch-action: manipulation; }
.map { position: relative; background: #07040a; border-radius: 6px; margin: 0 auto; }
.cell { position: absolute; overflow: hidden; }
.cell > i { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.cell.empty { outline: 1px solid #ffffff10; outline-offset: -1px; }
.cell.room.wt { border-top: 2px solid #000; } .cell.room.wb { border-bottom: 2px solid #000; }
.cell.room.wl { border-left: 2px solid #000; } .cell.room.wr { border-right: 2px solid #000; }
.cell.darkroom { filter: brightness(.55); }
.cell.darkroom.wt { border-top: 1px solid #6b5580; } .cell.darkroom.wb { border-bottom: 1px solid #6b5580; }
.cell.darkroom.wl { border-left: 1px solid #6b5580; } .cell.darkroom.wr { border-right: 1px solid #6b5580; }
.cell.darkroom.hot { filter: none; animation: glow 1.4s ease-in-out infinite alternate; }
.cell.room.hot { animation: glow 1.4s ease-in-out infinite alternate; }
.cell.pick { box-shadow: inset 0 0 0 2px #7fd18b88; cursor: pointer; }
.cell.sel { box-shadow: inset 0 0 0 3px var(--gold); background: #e3b34a44; }
.cell.here::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 12px #e3b34a99; }
.cell.revealing { animation: flicker 1s steps(1) both; }
.door { position: absolute; width: 8px; height: 8px; background: var(--gold); border-radius: 2px; transform: translate(-50%, -50%); z-index: 3; box-shadow: 0 0 6px var(--gold); }
.door.v { width: 6px; height: 14px; } .door.h { width: 14px; height: 6px; }
.mk { position: absolute; display: flex; align-items: center; justify-content: center; z-index: 2; pointer-events: none; font-size: 10px; color: var(--green); font-weight: 700; }
.rlabel { position: absolute; z-index: 4; font-size: 10px; color: var(--bone); background: #000a; padding: 0 3px; border-radius: 3px; pointer-events: none; white-space: nowrap; }
.feats { position: absolute; z-index: 4; display: flex; gap: 1px; pointer-events: none; }
.actor { position: absolute; z-index: 5; transform: translate(-50%, -55%); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.actor .props { display: flex; gap: 1px; margin-top: -6px; }
.actor.revealing { animation: pop 2.6s cubic-bezier(.2, 1.6, .4, 1) both; }
.props.revealing { animation: drop 2.6s ease-out both; }
.feats.revealing { animation: fadein 2.6s ease-out both; }
@keyframes flicker { 0% { filter: brightness(0); } 10% { filter: brightness(1.4); } 18% { filter: brightness(.1); } 30% { filter: brightness(1); } 38% { filter: brightness(.3); } 50%, 100% { filter: brightness(1); } }
@keyframes pop { 0%, 38% { transform: translate(-50%, -55%) scale(0); opacity: 0; } 46% { transform: translate(-50%, -55%) scale(1.9); opacity: 1; } 56% { transform: translate(-50%, -55%) scale(.9); } 64%, 100% { transform: translate(-50%, -55%) scale(1); opacity: 1; } }
@keyframes drop { 0%, 60% { transform: translateY(-60px); opacity: 0; } 72% { transform: translateY(4px); opacity: 1; } 80%, 100% { transform: translateY(0); opacity: 1; } }
@keyframes fadein { 0%, 20% { opacity: 0; } 40%, 100% { opacity: 1; } }
@keyframes glow { from { box-shadow: inset 0 0 0 1px #7fd18b55; } to { box-shadow: inset 0 0 14px 2px #7fd18bcc; } }

/* ---- TV ---- */
.tv { height: 100vh; display: flex; flex-direction: column; padding: 1.2vh 1.4vw; gap: 1vh; font-size: 1.8vh; overflow: hidden; }
.tv header { display: flex; align-items: baseline; gap: 1.4vw; }
.tv .brand { font-size: 4.6vh; }
.tv .head { font-size: 2.8vh; color: var(--bone); }
.tv .code { margin-left: auto; font-family: var(--display); color: var(--dim); font-size: 3vh; letter-spacing: 5px; }
.tvbody { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 30vw; gap: 1.4vw; }
.tvbody main { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5vh; }
.tvbody aside { display: flex; flex-direction: column; gap: 1vh; min-height: 0; overflow: hidden; }
.seats { display: grid; gap: .8vh; }
.seatcard { background: var(--panel); border-radius: 10px; padding: .7vh .7vw; border-left: 4px solid transparent; }
.seatcard.live { border-left-color: var(--green); background: var(--panel2); }
.seatcard.out { opacity: .5; }
.seatcard .who { font-size: 2.2vh; }
.seatcard .rows { display: flex; flex-direction: column; font-size: 1.5vh; gap: 2px; }
.seatcard .dealt { color: var(--gold); }
.tv .sheet { gap: .3vw; margin: .4vh 0; } .tv .col { padding: .3vh .2vw; }
.tv .tol b { font-size: 2.2vh; } .tv .colhead { font-size: 1.2vh; }
.ticker { flex: 1; min-height: 0; overflow: hidden; color: var(--dim); font-size: 1.8vh; display: flex; flex-direction: column; justify-content: flex-end; }
.felt { background: radial-gradient(ellipse at 50% 40%, #2b1a3a, var(--bg) 70%); border-radius: 16px; }
.trickbig { display: flex; gap: 1.6vw; align-items: flex-end; }
.caption { font-size: 2.8vh; color: var(--bone); text-align: center; }
.caption.big { font-family: var(--display); font-size: 6vh; color: var(--green); }
.building .house { width: min(60vw, 70vh); image-rendering: pixelated; border-radius: 10px; }
.tv.shake { animation: shake .5s linear; }
@keyframes shake { 0%, 100% { transform: translate(0); } 20% { transform: translate(-14px, 6px); } 40% { transform: translate(12px, -8px); } 60% { transform: translate(-8px, 4px); } 80% { transform: translate(6px, -2px); } }
.banner { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); font-family: var(--display); font-size: 9vh; color: var(--red);
  text-shadow: 0 0 30px #000, 0 0 12px var(--red); z-index: 90; animation: fadein .3s both; white-space: nowrap; }
.lobby { height: 100vh; display: flex; align-items: center; justify-content: space-evenly; gap: 40px; padding: 40px;
  background: radial-gradient(ellipse at 70% 25%, #2a1838, var(--bg) 70%); }
.lobby h1 { font-size: 100px; }
.lobby .code { font-family: var(--display); font-size: 100px; letter-spacing: 16px; color: var(--bone); margin: 8px 0; }
.join-hint { color: var(--dim); margin-top: 10px; font-size: 20px; }
.seat-list { margin: 14px 0; } .lobby .seat-row { font-size: 24px; }
.buttons { display: flex; gap: 10px; margin-top: 16px; }
.qr { width: min(30vw, 44vh); } .qr svg { width: 100%; height: auto; border-radius: 14px; }
.opts { display: grid; gap: 10px; margin-top: 14px; font-size: 19px; }
.opts select { font: inherit; padding: 8px; border-radius: 8px; background: var(--panel2); color: var(--ink); border: 1px solid #47335a; }
.av { border-radius: 50%; vertical-align: middle; }

/* colour under the sprites, so the map reads before (or without) the atlas */
.cell.room.r-C { background: #3b2652; } .cell.room.r-D { background: #4f1f26; }
.cell.room.r-H { background: #5a4a48; } .cell.room.r-S { background: #2c2c36; }
.cell.hallc { background: #4a3a26; }
.cell.darkroom { background: #1c1426; }
.rlabel { overflow: hidden; text-overflow: ellipsis; }
.col .tol b { color: var(--ink); }
.col .colhead { color: var(--dim); }
.col.red .colhead span:first-of-type { color: var(--dim); }
html, body { overflow-x: hidden; }
.phone > * { min-width: 0; }
.mapwrap { overflow: hidden; }
.tvmap .map { box-shadow: 0 0 40px #000 inset; }
