:root {
  --bg: #1a1230;
  --bg2: #241a40;
  --panel: rgba(36, 26, 62, 0.86);
  --panel2: rgba(52, 38, 86, 0.7);
  --line: rgba(214, 186, 255, 0.16);
  --text: #f1eaff;
  --muted: #b3a6cf;
  --gold: #f2c46d;
  --gold2: #d39a35;
  --red: #e2475b;
  --ev: #a98bff;
  --it: #f2c46d;
  --om: #ff6b7d;
  --green: #6fe3a5;
  --tile: 132px;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }

/* ---------- nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07); font-weight: 700; white-space: nowrap; transition: background .15s, transform .1s; }
.btn:hover { background: rgba(255, 255, 255, 0.13); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.gold { border: 0; background: linear-gradient(180deg, #ffd889, var(--gold2)); color: #3a2200; box-shadow: 0 4px 0 #8a5a12, 0 10px 26px rgba(242, 180, 80, .25); }
.btn.gold:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #8a5a12; }
.btn.red { border: 0; background: linear-gradient(180deg, #ff7a8a, #c22a40); color: #fff; box-shadow: 0 4px 0 #6e1020; }
.btn.big { padding: 15px; font-size: 17px; }
.btn.wide { width: 100%; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.link { border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; padding: 4px; }
.link.center { display: block; margin: 10px auto 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.err { min-height: 18px; color: #ffa3b1; font-size: 13px; margin: 6px 0; }

/* ---------- sảnh ---------- */
.screen { position: fixed; inset: 0; }
#lobby-screen { overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 20px 16px 40px;
  background: radial-gradient(900px 600px at 70% -10%, rgba(169, 139, 255, .22), transparent 60%), radial-gradient(700px 500px at 0% 100%, rgba(226, 71, 91, .14), transparent 60%), var(--bg); }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px 8px 8px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px; }
.back svg { width: 18px; height: 18px; }
.hero { text-align: center; max-width: 560px; }
.hero-house { width: min(380px, 86vw); margin: 0 auto; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .5)); }
.hero h1 { position: relative; z-index: 1; margin-top: -26px; padding-top: .18em; font-size: clamp(44px, 11vw, 80px); font-weight: 900; letter-spacing: .04em; line-height: 1.05; color: #fff4e0; text-shadow: 0 0 24px rgba(255, 196, 109, .55), 0 4px 0 #6e1f30, 0 10px 30px rgba(0, 0, 0, .6); }
.hero h1 small { display: block; margin-top: 4px; font-size: .3em; font-weight: 700; letter-spacing: .12em; color: #ffd98a; }
.hero p { color: #d6cbef; line-height: 1.6; margin: 10px 0 0; }
.hero p b { color: var(--om); }
.panel { width: min(440px, 100%); padding: 22px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); box-shadow: 0 30px 70px rgba(0, 0, 0, .45); }
.panel.wide { width: min(620px, 100%); }
.panel.scroll { max-height: 86vh; overflow-y: auto; }
.panel h2 { font-size: 24px; margin-bottom: 14px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, .25); margin-bottom: 16px; }
.tab { border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.tab.on { background: rgba(255, 255, 255, .1); color: var(--text); }
form label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
form input, .join input, .chat-form input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10, 6, 24, .55); outline: none; }
form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 196, 109, .15); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
#google-btn { display: flex; justify-content: center; min-height: 44px; }
.me { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 19px; color: var(--bg); background: linear-gradient(135deg, var(--gold), #a98bff); background-size: cover; background-position: center; }
.me-info { flex: 1; min-width: 0; }
.me-info b { display: block; font-size: 17px; }
.me-info small { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.join { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.join input { margin: 0; text-align: center; text-transform: uppercase; letter-spacing: .2em; font-weight: 800; }
.join input::placeholder { letter-spacing: normal; text-transform: none; font-weight: 500; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 0 8px; font-weight: 800; font-size: 14px; }
.list-head small { color: var(--green); font-weight: 600; font-size: 12px; }
.room-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.room-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; background: rgba(255, 255, 255, .05); text-align: left; width: 100%; }
.room-item:hover:not(:disabled) { border-color: var(--gold); }
.room-item:disabled { opacity: .55; cursor: default; }
.room-item b { display: block; font-size: 14px; }
.room-item small { color: var(--muted); font-size: 12px; }
.cnt { font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 99px; background: rgba(169, 139, 255, .16); color: #d6c8ff; }
.empty { text-align: center; color: var(--muted); padding: 14px; font-size: 13px; }
.room-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.room-top b { display: block; font-size: 18px; }
.room-top small { color: var(--muted); font-size: 13px; }
#room-code { color: var(--gold); font-weight: 800; letter-spacing: .2em; font-size: 16px; }
.members { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.member { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 12px; background: rgba(255, 255, 255, .06); min-width: 0; font-size: 13px; font-weight: 700; }
.member .avatar { width: 28px; height: 28px; font-size: 12px; }
.member span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member em { font-style: normal; font-size: 11px; color: #3a2200; background: var(--gold); padding: 1px 7px; border-radius: 99px; }
.member .kick { border: 0; background: none; color: var(--muted); font-size: 16px; }
.member.slot { border: 1px dashed var(--line); background: none; color: var(--muted); justify-content: center; font-weight: 500; min-height: 42px; }
.member.bot { color: #d6c8ff; }
.bots-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper b { min-width: 18px; text-align: center; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--gold); }
.chat { border-radius: 14px; background: rgba(0, 0, 0, .22); padding: 8px; margin-bottom: 14px; }
.chat-log { height: 100px; overflow-y: auto; font-size: 13px; line-height: 1.45; padding: 2px 4px 6px; }
.chat-log p { margin: 0 0 2px; }
.chat-log b { color: var(--gold); }
.chat-log .sys { color: var(--muted); font-style: italic; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.chat-form input { margin: 0; padding: 9px 12px; }
.wait { text-align: center; color: var(--muted); padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .04); }
.rules { line-height: 1.6; padding-left: 20px; color: #ddd3f2; }
.rules li { margin-bottom: 8px; }
.sym { display: inline-block; padding: 0 8px; border-radius: 99px; font-weight: 700; font-size: 13px; }
.sym.ev { background: rgba(169, 139, 255, .2); color: var(--ev); }
.sym.it { background: rgba(242, 196, 109, .2); color: var(--it); }
.sym.om { background: rgba(255, 107, 125, .2); color: var(--om); }
.board-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; margin-bottom: 14px; }
.brow { display: grid; grid-template-columns: 30px 34px 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.brow .avatar { width: 34px; height: 34px; font-size: 13px; }
.brow small { display: block; color: var(--muted); font-size: 12px; }
.brow .rk { font-weight: 900; text-align: center; color: var(--muted); }
.brow .sc { font-weight: 800; color: var(--gold); }

/* ---------- màn chơi ---------- */
#game-screen { display: grid; grid-template-columns: 1fr 370px; grid-template-rows: 60px 1fr; background: radial-gradient(1200px 800px at 40% 40%, #2a1e48, #150e26 70%); }
.topbar { grid-column: 1 / 2; display: flex; align-items: center; gap: 12px; padding: 0 14px; z-index: 3; }
.floors { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.floors button { border: 0; background: none; padding: 7px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.floors button .short { display: none; }
.floors button.on { background: rgba(242, 196, 109, .18); color: var(--gold); }
.floors button i { font-style: normal; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 11px; background: var(--red); color: #fff; }
.top-info { margin-left: auto; display: flex; gap: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; justify-content: flex-end; }
.top-info span { padding: 5px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); white-space: nowrap; }
.top-info b { color: var(--text); }
.top-info .haunt-tag { background: rgba(226, 71, 91, .25); color: #ffd0d6; border-color: rgba(226, 71, 91, .5); }
.board-wrap { grid-column: 1 / 2; grid-row: 2; position: relative; overflow: hidden; touch-action: none; cursor: grab;
  background: radial-gradient(circle at 50% 45%, rgba(242, 196, 109, .07), transparent 55%), repeating-linear-gradient(45deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 7px); }
.board-wrap.drag { cursor: grabbing; }
.board { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.board-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 8px 16px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: #e6dcff; pointer-events: none; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
.board-hint:empty { display: none; }

.tile { position: absolute; width: var(--tile); height: var(--tile); }
.tile-art { position: absolute; inset: 0; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
.tile-art svg { width: 100%; height: 100%; }
.tile-name { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 2px 8px; border-radius: 6px; background: rgba(20, 12, 34, .8); font-size: 10.5px; font-weight: 700; white-space: nowrap; color: #f3e9d2; letter-spacing: .01em; pointer-events: none; }
.tile-sym { position: absolute; right: 14px; top: 14px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(20, 12, 34, .85); pointer-events: none; }
.tile-sym svg { width: 15px; height: 15px; }
.tile-sym.event { color: var(--ev); box-shadow: 0 0 10px rgba(169, 139, 255, .6); }
.tile-sym.item { color: var(--it); box-shadow: 0 0 10px rgba(242, 196, 109, .6); }
.tile-sym.omen { color: var(--om); box-shadow: 0 0 10px rgba(255, 107, 125, .6); }
.tile.sealed .tile-art::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(111, 227, 165, .35), transparent 70%); }
.tile .stair { position: absolute; left: 14px; top: 14px; padding: 2px 7px; border-radius: 6px; font-size: 10px; font-weight: 800; background: rgba(242, 196, 109, .9); color: #3a2200; pointer-events: none; }
.tile.reach { cursor: pointer; }
.tile.reach .tile-art { outline: 3px solid rgba(242, 196, 109, .85); outline-offset: -3px; box-shadow: 0 0 26px rgba(242, 196, 109, .45), 0 10px 24px rgba(0, 0, 0, .45); }
.tile.reach:hover .tile-art { outline-color: #fff2c8; }
.tile.ghost { border: 2px dashed rgba(242, 196, 109, .6); border-radius: 8px; background: rgba(242, 196, 109, .06); display: grid; place-items: center; cursor: pointer; color: var(--gold); font-weight: 800; font-size: 13px; text-align: center; line-height: 1.3; transition: background .15s; }
.tile.ghost:hover { background: rgba(242, 196, 109, .16); }
.tile.ghost b { display: block; font-size: 30px; line-height: 1; }
.tile.new .tile-art { animation: flip .55s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes flip { from { transform: rotateY(90deg) scale(.8); opacity: 0; } }
.tokens { position: absolute; inset: 22px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 4px; pointer-events: none; }
.tok { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; border: 3px solid var(--c); box-shadow: 0 4px 10px rgba(0, 0, 0, .55), 0 0 0 2px rgba(0, 0, 0, .4); background: #1a1028; position: relative; transition: transform .2s; }
.tok svg { width: 100%; height: 100%; }
.tok.cur { animation: bob 1.2s ease-in-out infinite; box-shadow: 0 0 0 3px #fff4d8, 0 0 18px var(--c); }
.tok.dead { filter: grayscale(1) brightness(.5); }
.tok.traitor { border-color: var(--red); box-shadow: 0 0 14px rgba(226, 71, 91, .9); }
.tok.monster { border-color: #9af2e0; box-shadow: 0 0 16px rgba(154, 242, 224, .8); background: #2a1e3a; }
.tok.monster.stun { opacity: .55; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ---------- cột bên phải ---------- */
.side { grid-column: 2; grid-row: 1 / 3; background: rgba(22, 14, 40, .92); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; padding: 14px; overflow-y: auto; z-index: 4; }
.turn { padding: 14px; border-radius: 16px; background: var(--panel2); border: 1px solid var(--line); }
.turn.mine { border-color: rgba(242, 196, 109, .6); box-shadow: 0 0 0 1px rgba(242, 196, 109, .3), 0 10px 30px rgba(242, 196, 109, .12); }
.turn-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.turn-head .tok { width: 36px; height: 36px; flex: none; }
.turn-head b { font-size: 16px; }
.turn-head small { display: block; color: var(--muted); font-size: 12px; }
.moves { display: flex; gap: 4px; margin: 0 0 10px; }
.moves i { width: 22px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); }
.moves i.on { background: linear-gradient(90deg, var(--gold), #ffe3a8); box-shadow: 0 0 8px rgba(242, 196, 109, .6); }
.acts { display: flex; flex-wrap: wrap; gap: 6px; }
.acts .btn { flex: 1 1 auto; }
.goal { margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; background: rgba(226, 71, 91, .14); border: 1px solid rgba(226, 71, 91, .35); color: #ffe0e4; }
.goal b { color: #fff; }

.me-card { border-radius: 16px; overflow: hidden; background: var(--panel2); border: 1px solid var(--line); }
.me-top { display: flex; gap: 12px; padding: 12px; align-items: center; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 30%, transparent), transparent); }
.me-top .pt { width: 64px; height: 64px; border-radius: 14px; overflow: hidden; border: 2px solid var(--c); flex: none; }
.me-top b { font-size: 17px; display: block; }
.me-top small { color: var(--muted); font-size: 12px; }
.tracks { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.track { display: grid; grid-template-columns: 22px 74px 1fr; align-items: center; gap: 6px; }
.track .ti { width: 20px; height: 20px; }
.track .ti.might { color: #ff8a7a; } .track .ti.speed { color: #ffd36a; } .track .ti.sanity { color: #c8a8ff; } .track .ti.knowledge { color: #7ad8ff; }
.track .tn { font-size: 12px; font-weight: 700; color: var(--muted); }
.track .steps { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; }
.track .steps span { height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; background: rgba(0, 0, 0, .25); color: rgba(241, 234, 255, .45); }
.track .steps span.skull { color: #c9bfe0; }
.track .steps span.skull svg { width: 14px; height: 14px; }
.track .steps span.on { background: linear-gradient(180deg, #ffe3a8, var(--gold2)); color: #3a2200; box-shadow: 0 0 10px rgba(242, 196, 109, .5); transform: scale(1.08); }
.track .steps span.start { box-shadow: inset 0 -2px 0 rgba(111, 227, 165, .7); }
.track .steps span.danger.on { background: linear-gradient(180deg, #ff9aa6, var(--red)); color: #fff; }

.inv { display: flex; flex-wrap: wrap; gap: 6px; }
.inv:empty { display: none; }
.chip { display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); font-size: 12.5px; font-weight: 700; }
.chip .ic { width: 28px; height: 28px; border-radius: 8px; background: rgba(0, 0, 0, .3); }
.chip.omen { border-color: rgba(255, 107, 125, .4); }
.chip.item { border-color: rgba(242, 196, 109, .35); }
.chip:hover { background: rgba(255, 255, 255, .1); }

.players { display: flex; flex-direction: column; gap: 6px; }
.prow { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid transparent; }
.prow.cur { border-color: rgba(242, 196, 109, .5); background: rgba(242, 196, 109, .07); }
.prow .tok { width: 32px; height: 32px; border-width: 2px; }
.prow b { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow small { color: var(--muted); font-size: 11.5px; }
.mini { display: flex; gap: 3px; }
.mini span { font-size: 11px; font-weight: 800; padding: 2px 5px; border-radius: 6px; background: rgba(0, 0, 0, .3); }
.mini .m { color: #ff8a7a; } .mini .s { color: #ffd36a; } .mini .n { color: #c8a8ff; } .mini .k { color: #7ad8ff; }
.badge { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 99px; margin-left: 4px; vertical-align: 1px; }
.badge.t { background: var(--red); color: #fff; }
.badge.d { background: #555; color: #ddd; }
.badge.e { background: var(--green); color: #0a3020; }
.badge.b { background: rgba(169, 139, 255, .3); color: #e6dcff; }

.feed { flex: 1; min-height: 160px; display: flex; flex-direction: column; border-radius: 16px; background: rgba(0, 0, 0, .22); padding: 8px; }
.feed-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.feed-tabs button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.feed-tabs button.on { background: rgba(255, 255, 255, .08); color: var(--text); }
.feed-body { flex: 1; overflow-y: auto; font-size: 12.5px; line-height: 1.5; padding: 0 4px; min-height: 100px; max-height: 260px; }
.feed-body p { margin: 0 0 4px; color: #d8cdee; }
.feed-body p.hot { color: #ffb3bd; font-weight: 700; }
.feed-body b { color: var(--gold); }
.feed .chat-form { margin-top: 6px; }

/* ---------- lớp phủ ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.overlay.dim { background: rgba(10, 4, 22, .84); }
/* có lớp phủ thì dừng mọi chuyển động phía dưới cho máy nhẹ */
body.modal-open .board *, body.modal-open .side * { animation: none !important; transition: none !important; }
.board-wrap { contain: strict; }
#pick { background: radial-gradient(circle at 50% 30%, rgba(42, 30, 72, .96), rgba(14, 8, 28, .98)); }
.pick-box { width: min(1080px, 100%); text-align: center; }
.pick-box h2 { font-size: 34px; font-weight: 900; }
.sub { color: var(--muted); margin: 6px 0 20px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.pc { border-radius: 18px; overflow: hidden; border: 2px solid var(--line); background: var(--panel); text-align: left; padding: 0; transition: transform .15s, border-color .15s; }
.pc:hover:not(:disabled) { transform: translateY(-4px); border-color: var(--c); }
.pc:disabled { opacity: .35; cursor: not-allowed; }
.pc.mine { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 196, 109, .3); opacity: 1; }
.pc .pt svg { width: 100%; height: auto; }
.pc .pb { padding: 10px 12px 12px; }
.pc b { font-size: 16px; display: block; }
.pc small { color: var(--muted); font-size: 12px; }
.pc .who { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--gold); min-height: 16px; }
.pc .mini { margin-top: 8px; }

.card-box { width: min(360px, 92vw); border-radius: 22px; overflow: hidden; background: linear-gradient(180deg, #2e2148, #1c1430); border: 2px solid var(--cc); box-shadow: 0 0 0 6px rgba(0, 0, 0, .25), 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px color-mix(in srgb, var(--cc) 35%, transparent); animation: cardIn .45s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes cardIn { from { transform: rotateY(80deg) translateY(30px) scale(.85); opacity: 0; } }
.card-type { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 8px; background: var(--cc); color: #1a1028; font-weight: 900; letter-spacing: .12em; font-size: 12px; text-transform: uppercase; }
.card-type svg { width: 16px; height: 16px; }
.card-art { height: 170px; display: grid; place-items: center; background: radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--cc) 40%, transparent), transparent 65%); }
.card-art svg { width: 150px; height: 150px; }
.card-body { padding: 4px 20px 20px; text-align: center; }
.card-body h3 { font-size: 22px; font-weight: 900; margin-bottom: 6px; }
.card-body .flavor { font-style: italic; color: #cfc3e8; font-size: 14px; line-height: 1.5; margin: 0 0 12px; }
.card-body .effect { font-size: 13.5px; font-weight: 600; color: #f6efff; background: rgba(0, 0, 0, .25); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.table { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; text-align: left; }
.table div { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 7px 10px; border-radius: 10px; background: rgba(0, 0, 0, .22); font-size: 13px; line-height: 1.4; }
.table div b { color: var(--gold); text-align: center; }
.table div.hit { background: linear-gradient(90deg, rgba(242, 196, 109, .3), rgba(242, 196, 109, .08)); box-shadow: inset 0 0 0 1px rgba(242, 196, 109, .6); }
.result { font-weight: 800; font-size: 15px; margin: 0 0 14px; color: #fff4d8; }
.card-wait { color: var(--muted); font-size: 13px; }

.dice-tray { position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%); z-index: 30; padding: 16px 22px 14px; border-radius: 22px; background: rgba(28, 18, 50, .94); border: 1px solid rgba(242, 196, 109, .4); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); text-align: center; pointer-events: none; animation: trayIn .25s ease-out; max-width: calc(100vw - 24px); }
@keyframes trayIn { from { opacity: 0; transform: translate(-50%, 20px) scale(.9); } }
.dice-tray .lbl { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.dice-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; perspective: 600px; }
.dice-row + .vs { margin: 8px 0; font-weight: 900; color: var(--red); font-size: 13px; }
.die { width: 44px; height: 44px; position: relative; transform-style: preserve-3d; animation: roll 1s cubic-bezier(.2, .7, .3, 1) both; }
.die .f { position: absolute; inset: 0; border-radius: 9px; background: linear-gradient(145deg, #fff7e6, #e2cfa6); border: 1px solid #b89a62; display: grid; place-items: center; box-shadow: inset 0 -3px 6px rgba(120, 80, 20, .3); }
.die .f i { width: 9px; height: 9px; border-radius: 50%; background: #6e1f30; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
.die .f.two { grid-template-columns: 1fr 1fr; padding: 9px; }
.die .f.two i:nth-child(1) { justify-self: start; align-self: start; }
.die .f.two i:nth-child(2) { justify-self: end; align-self: end; }
.die .f.zero::after { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(110, 31, 48, .3); }
.die .f1 { transform: translateZ(22px); } .die .f2 { transform: rotateY(90deg) translateZ(22px); } .die .f3 { transform: rotateY(180deg) translateZ(22px); }
.die .f4 { transform: rotateY(-90deg) translateZ(22px); } .die .f5 { transform: rotateX(90deg) translateZ(22px); } .die .f6 { transform: rotateX(-90deg) translateZ(22px); }
@keyframes roll { 0% { transform: translateY(-40px) rotateX(620deg) rotateY(480deg); } 70% { transform: translateY(4px) rotateX(-10deg) rotateY(8deg); } 100% { transform: none; } }
.dice-tray .tot { margin-top: 12px; font-size: 26px; font-weight: 900; color: var(--gold); animation: pop .3s 1s both; }
@keyframes pop { from { opacity: 0; transform: scale(.5); } }

.haunt-box { width: min(560px, 100%); text-align: center; padding: 30px 24px; border-radius: 24px; background: radial-gradient(circle at 50% 0%, rgba(226, 71, 91, .35), transparent 60%), #1e1232; border: 2px solid rgba(226, 71, 91, .6); box-shadow: 0 0 80px rgba(226, 71, 91, .35); animation: cardIn .5s ease-out; }
.haunt-box .kicker { color: #ffb3bd; font-weight: 800; letter-spacing: .18em; font-size: 12px; text-transform: uppercase; }
.haunt-box h2 { font-size: clamp(34px, 7vw, 52px); font-weight: 900; margin: 6px 0 10px; color: #fff0f2; text-shadow: 0 0 30px rgba(226, 71, 91, .8); }
.haunt-box p { color: #e6dcf5; line-height: 1.6; }
.haunt-box .who { display: flex; justify-content: center; margin: 14px 0; }
.haunt-box .who .tok { width: 72px; height: 72px; border-width: 4px; }
.haunt-box .goal { text-align: left; margin: 12px 0 18px; }
.haunt-box.win { background: radial-gradient(circle at 50% 0%, rgba(242, 196, 109, .35), transparent 60%), #1e1232; border-color: rgba(242, 196, 109, .7); box-shadow: 0 0 80px rgba(242, 196, 109, .3); }

#toasts { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.toast { padding: 9px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; background: rgba(36, 26, 62, .95); border: 1px solid var(--line); animation: toastIn .25s ease-out; max-width: 480px; text-align: center; }
.toast.warn { border-color: rgba(242, 196, 109, .6); }
.toast.danger { border-color: rgba(226, 71, 91, .7); background: rgba(110, 16, 36, .95); }

@media (max-width: 900px) {
  :root { --tile: 112px; }
  #game-screen { grid-template-columns: 1fr; grid-template-rows: 56px 1fr auto; }
  .topbar { grid-column: 1; padding: 0 10px; gap: 8px; }
  .top-info span:not(.haunt-tag):not(.rd) { display: none; }
  .floors button { padding: 6px 9px; font-size: 12.5px; }
  .board-wrap { grid-column: 1; grid-row: 2; }
  .side { grid-column: 1; grid-row: 3; max-height: 46vh; border-left: 0; border-top: 1px solid var(--line); padding: 10px; gap: 10px; }
  .feed { min-height: 140px; }
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 900px) {
  .floors button .full { display: none; }
  .floors button .short { display: inline; }
  .die { width: 30px; height: 30px; }
  .die .f { border-radius: 7px; }
  .die .f i { width: 6px; height: 6px; }
  .die .f.two { padding: 6px; }
  .die .f1 { transform: translateZ(15px); } .die .f2 { transform: rotateY(90deg) translateZ(15px); } .die .f3 { transform: rotateY(180deg) translateZ(15px); }
  .die .f4 { transform: rotateY(-90deg) translateZ(15px); } .die .f5 { transform: rotateX(90deg) translateZ(15px); } .die .f6 { transform: rotateX(-90deg) translateZ(15px); }
  .dice-row { gap: 7px; flex-wrap: nowrap; }
  .dice-tray { padding: 10px 14px; bottom: auto; top: 64px; }
  .dice-tray .tot { font-size: 20px; margin-top: 6px; }
}
