* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1026; font-family: "Segoe UI", system-ui, sans-serif; color: #fff; user-select: none; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

/* ---------- Title / lobby ---------- */
#title { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center; text-align: center; padding: 16px; overflow-y: auto; }
#title h1 { font-size: clamp(36px, 7vw, 84px); margin: 0; letter-spacing: 1px; text-shadow: 0 4px 0 #7a1420, 0 0 30px rgba(255,80,80,0.4); color: #ff4d5e; }
#title h1 span { color: #fff; text-shadow: 0 4px 0 #1d6b3a, 0 0 30px rgba(120,255,160,0.35); }
#title .sub { font-size: 20px; opacity: 0.85; margin: 8px 0 24px; }
#slots { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-bottom: 20px; }
.slot { width: 150px; height: 120px; border-radius: 16px; border: 3px dashed rgba(255,255,255,0.3); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 15px; opacity: 0.6; }
.slot.on { border-style: solid; opacity: 1; background: rgba(255,255,255,0.08); }
.slot .hat { font-size: 40px; }
.slot .nm { font-weight: 700; font-size: 20px; }
.howto { font-size: 18px; line-height: 1.6; }
.tip { opacity: 0.6; font-size: 14px; }
.controls { display: flex; gap: 40px; margin-top: 10px; text-align: left; font-size: 14px; opacity: 0.85; flex-wrap: wrap; justify-content: center; }
.controls h3 { margin: 0 0 4px; font-size: 16px; }
.controls p { margin: 0; line-height: 1.6; }

#pause { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; flex-direction: column; align-items: center; justify-content: center; }
#pause h2 { font-size: 56px; margin: 0; }

/* ---------- Global HUD ---------- */
#objectives { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(10,14,30,0.75); border: 2px solid rgba(255,255,255,0.15);
  border-radius: 14px; padding: 8px 16px; font-size: 16px; line-height: 1.5; z-index: 5; white-space: nowrap; }
#objectives .done { color: #7dffa0; text-decoration: line-through; opacity: 0.8; }
#objectives .active { color: #ffd43b; font-weight: 700; }
#toasts { position: fixed; top: 110px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: rgba(10,14,30,0.85); border-radius: 10px; padding: 6px 14px; font-size: 16px; font-weight: 600; animation: toastIn 0.25s ease-out; }
.toast.warn { color: #ffd43b; } .toast.bad { color: #ff6b6b; } .toast.good { color: #7dffa0; }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
#banner { position: fixed; top: 32%; left: 50%; transform: translate(-50%, -50%); text-align: center; background: rgba(10,14,30,0.85); border: 3px solid rgba(255,255,255,0.2);
  border-radius: 20px; padding: 22px 40px; z-index: 7; max-width: 90vw; }
#banner h2 { margin: 0 0 6px; font-size: clamp(26px, 4vw, 44px); }
#banner p { margin: 4px 0; font-size: 18px; }
#banner .stars { font-size: 56px; color: #ffd43b; letter-spacing: 6px; }

/* ---------- Santa's briefing dialog ---------- */
#dialog { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); width: min(820px, calc(100vw - 32px)); background: rgba(250,246,236,0.96); color: #2b1d14;
  border: 4px solid #c62828; border-radius: 18px; padding: 14px 20px 10px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); z-index: 8; }
#dialog .who { position: absolute; top: -20px; left: 18px; background: #c62828; color: #fff; font-weight: 800; padding: 3px 14px 3px 8px; border-radius: 12px; font-size: 17px; display: flex; align-items: center; gap: 6px; }
#dialog .face { font-size: 22px; }
#dialog .text { font-size: clamp(17px, 2.2vw, 22px); line-height: 1.45; min-height: 3em; font-weight: 600; }
#dialog .hint { text-align: right; font-size: 13px; opacity: 0.6; margin-top: 4px; }

/* ---------- Per-player viewport HUD ---------- */
.pv { position: fixed; pointer-events: none; overflow: hidden; border: 2px solid rgba(0,0,0,0.85); }
.pv .tag { position: absolute; top: 8px; left: 10px; font-weight: 700; font-size: 18px; text-shadow: 0 2px 3px #000; display: flex; align-items: center; gap: 6px; }
.pv .dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 2px solid #fff; }
.pv .eye { position: absolute; top: 8px; right: 10px; width: 120px; height: 26px; border-radius: 13px; background: rgba(0,0,0,0.55); overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.pv .eye-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #ffb020; transition: width 0.1s; }
.pv .eye span { position: relative; font-weight: 700; text-shadow: 0 1px 2px #000; }
.pv .bottom { position: absolute; left: 10px; bottom: 10px; }
.pv .inv { font-size: 20px; text-shadow: 0 2px 3px #000; margin-bottom: 4px; display: flex; gap: 10px; align-items: center; }
.pv .inv .state { font-size: 15px; font-weight: 700; color: #b8f5ff; }
.pv .noise { background: rgba(0,0,0,0.6); border-radius: 10px; padding: 6px 10px; width: 220px; }
.pv .noise-label { font-size: 12px; font-weight: 800; letter-spacing: 2px; opacity: 0.8; display: flex; justify-content: space-between; }
.pv .noise-bar { position: relative; height: 16px; border-radius: 8px; background: linear-gradient(90deg, #1f5130 0%, #1f5130 30%, #5e5418 30%, #5e5418 65%, #5e1f1f 65%); overflow: hidden; margin-top: 3px; }
.pv .noise-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 8px; }
.pv .noise-bar::after { content: ""; position: absolute; left: 30%; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.5); }
.pv .noise-word { font-size: 14px; font-weight: 800; margin-top: 2px; height: 18px; }
.pv .noise.loud { animation: shake 0.15s infinite; }
@keyframes shake { 0%,100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
.pv .radar { position: absolute; right: 10px; bottom: 80px; width: 130px; height: 130px; transition: width 0.15s, height 0.15s; }
.pv .radar.big { width: 200px; height: 200px; }
.pv .prompt { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); background: rgba(0,0,0,0.7); border-radius: 12px; padding: 6px 14px; font-size: 18px; font-weight: 700; white-space: nowrap; }
.pv .prompt b { display: inline-block; min-width: 26px; padding: 0 6px; border-radius: 13px; background: #2f80ed; margin-right: 6px; text-align: center; }
.pv .caught { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: rgba(40,80,140,0.85); border: 2px solid #bfe3ff; border-radius: 14px; padding: 10px 18px; text-align: center; font-size: 18px; font-weight: 700; max-width: 90%; }
/* first-person extras */
.pv .crosshair { display: none; }
.pv .radar { display: none; }            /* heartbeat sensor only while the button is held */
.pv .radar.big { display: block; }
.pv.fp .radar { display: none; }          /* first person: it's on the wrist instead */
.pv.fp .crosshair { display: block; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: rgba(255,255,255,0.9); box-shadow: 0 0 0 2px rgba(0,0,0,0.5); }
.pv .tools { display: flex; gap: 6px; position: absolute; right: 10px; bottom: 10px; }
.pv .tool { position: relative; width: 52px; height: 52px; border-radius: 10px; background: rgba(10,14,30,0.7); border: 2px solid rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; }
.pv .tool .ico { font-size: 28px; }
.pv .tool .key { position: absolute; top: -9px; left: -6px; background: #2f80ed; border-radius: 8px; font-size: 11px; font-weight: 800; padding: 1px 5px; }
.pv .tool .cnt { position: absolute; bottom: 1px; right: 4px; font-size: 13px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.pv .tool.on { border-color: #ffd43b; background: rgba(90,70,10,0.75); }
.pv .tool.empty { opacity: 0.4; }
.pv .stance { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font-weight: 800; font-size: 15px; letter-spacing: 1px; background: rgba(0,0,0,0.5); padding: 3px 10px; border-radius: 10px; text-shadow: 0 1px 2px #000; }
.pv .stance:empty { display: none; }
.pv .stance.sneak { color: #7dffa0; } .pv .stance.run { color: #ff8a65; }
.pv.small .tool { width: 44px; height: 44px; } .pv.small .tool .ico { font-size: 20px; }
.pv.small .noise { width: 160px; padding: 4px 8px; }
.pv.small .radar { width: 100px; height: 100px; }
.pv.small .radar.big { width: 150px; height: 150px; }
.pv.small .tag { font-size: 15px; }
.pv.small .prompt { font-size: 15px; }

/* ---------- Gadget bar (RT / left click uses the selected one; LB/RB or mouse wheel switch) ---------- */
.pv .tools { align-items: flex-end; }
.pv .items { display: flex; gap: 4px; }
.pv .item { position: relative; width: 48px; height: 48px; border-radius: 10px; background: rgba(10,14,30,0.65); border: 2px solid rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; opacity: 0.75; transition: transform 0.1s, opacity 0.1s; }
.pv .item .ico { font-size: 22px; }
.pv .item .cnt { position: absolute; bottom: 0; right: 3px; font-size: 12px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.pv .item .num { position: absolute; top: 1px; left: 4px; font-size: 10px; font-weight: 800; opacity: 0.5; }
.pv .item .key { display: none; position: absolute; top: -9px; left: -6px; background: #2f80ed; border-radius: 8px; font-size: 11px; font-weight: 800; padding: 1px 5px; }
.pv .item.sel { opacity: 1; transform: translateY(-6px) scale(1.2); border-color: #ffd43b; background: rgba(90,70,10,0.8); z-index: 2; }
.pv .item.sel .key { display: block; }
.pv .item.empty .ico { filter: grayscale(1); opacity: 0.4; }
.pv .itemhint { position: absolute; right: 0; top: -22px; font-size: 11px; font-weight: 800; opacity: 0.8; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.pv .itemname { position: absolute; right: 10px; bottom: 84px; font-size: 13px; font-weight: 700; background: rgba(0,0,0,0.55); padding: 2px 8px; border-radius: 8px; max-width: 60%; text-align: right; }
.pv.small .item { width: 36px; height: 36px; } .pv.small .item .ico { font-size: 17px; }
.pv.small .itemname { font-size: 11px; bottom: 68px; }
.pv.small .itemhint { display: none; }
#objectives .hint { color: #bfe3ff; }
.houseSel { font-size: 22px; font-weight: 800; margin: 6px 0 14px; display: flex; align-items: center; gap: 14px; justify-content: center; }
.houseSel .arrow { background: rgba(255,255,255,0.12); border-radius: 10px; padding: 2px 12px; font-size: 20px; }
.houseSel small { display: block; font-size: 13px; font-weight: 600; opacity: 0.7; }

/* Language flags on the start page */
.langSel { position: absolute; top: 16px; right: 16px; display: flex; align-items: center; gap: 10px; }
.langSel .flag { padding: 0; border: 3px solid transparent; border-radius: 8px; background: none; cursor: pointer; opacity: 0.55; line-height: 0; transition: opacity .15s, transform .15s, border-color .15s; }
.langSel .flag svg { height: 34px; width: auto; border-radius: 4px; display: block; }
.langSel .flag:hover { opacity: 0.9; transform: scale(1.06); }
.langSel .flag.on { opacity: 1; border-color: #ffd43b; transform: scale(1.1); }
.langSel .langHint { font-size: 12px; opacity: 0.6; max-width: 150px; text-align: left; }
@media (max-width: 600px) { .langSel { position: static; margin-bottom: 10px; } .langSel .langHint { display: none; } }

/* Light meter (under the noise meter) */
.pv .light { background: rgba(0,0,0,0.6); border-radius: 10px; padding: 6px 10px; width: 220px; margin-top: 6px; }
.pv .light-bar { position: relative; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #141a33 0%, #141a33 22%, #3a3418 22%, #3a3418 55%, #4d4626 55%); overflow: hidden; margin-top: 3px; }
.pv .light-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; transition: background .2s; }
.pv .light-word { font-size: 13px; font-weight: 800; margin-top: 2px; height: 16px; color: #dfe6ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv.small .light { width: 160px; padding: 4px 8px; }

/* Network play bar on the start page */
.netBar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: center; margin: -6px 0 14px; font-size: 14px; }
.netBar button { font: inherit; font-weight: 700; color: #fff; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); border-radius: 10px; padding: 6px 12px; cursor: pointer; }
.netBar button:hover { background: rgba(255,255,255,0.22); }
#netStatus { flex-basis: 100%; text-align: center; min-height: 1.2em; color: #ffd43b; }

/* ---------- Cover screen ---------- */
#cover { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer;
  background: radial-gradient(ellipse at 50% 45%, rgba(11,16,38,0.15), rgba(11,16,38,0.75)); }
#cover .coverBox { padding: 16px; animation: coverIn 1.2s ease-out; }
#cover .kicker { font-size: clamp(14px, 2vw, 22px); letter-spacing: 6px; text-transform: uppercase; color: #bfe3ff; opacity: 0.9; text-shadow: 0 2px 6px #000; }
#cover h1 { font-size: clamp(44px, 9vw, 120px); margin: 6px 0 0; line-height: 1.05; color: #ff4d5e;
  text-shadow: 0 6px 0 #7a1420, 0 0 40px rgba(255,80,80,0.5), 0 10px 30px rgba(0,0,0,0.6); }
#cover h1 span { display: block; color: #fff; text-shadow: 0 6px 0 #1d6b3a, 0 0 40px rgba(120,255,160,0.4), 0 10px 30px rgba(0,0,0,0.6); }
#cover .sub { font-size: clamp(16px, 2.2vw, 24px); margin: 14px 0 26px; text-shadow: 0 2px 6px #000; }
#cover .press { margin-top: 34px; font-size: clamp(22px, 3.2vw, 38px); font-weight: 800; color: #ffd43b; text-shadow: 0 3px 0 #6b4f00, 0 0 24px rgba(255,212,59,0.6); animation: pulse 1.4s ease-in-out infinite; }
#cover .tip { margin-top: 18px; opacity: 0.65; font-size: 15px; text-shadow: 0 1px 3px #000; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.96); } }
@keyframes coverIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.langSel.big { position: static; justify-content: center; gap: 22px; }
.langSel.big .flag svg { height: 64px; }
.langSel .flag.on { opacity: 1; border-color: #ffd43b; transform: scale(1.08); box-shadow: 0 0 18px rgba(255,212,59,0.5); }

/* ---------- Elf maker (crew screen) ---------- */
#title h1.small { font-size: clamp(26px, 4vw, 46px); }
#title .crewH { margin: 2px 0 14px; font-size: clamp(20px, 2.6vw, 30px); color: #ffd43b; text-shadow: 0 2px 4px #000; }
#slots { gap: 16px; margin-bottom: 12px; }
.slot { width: 230px; height: auto; min-height: 150px; padding: 10px; justify-content: flex-start; background: rgba(10,14,30,0.45); }
.slot:not(.on) { justify-content: center; }
.slot.on { border-color: var(--c); background: rgba(10,14,30,0.35); box-shadow: 0 0 18px rgba(0,0,0,0.4); }
.slot .pv3d { width: 100%; height: 190px; border-radius: 10px; background: radial-gradient(ellipse at 50% 85%, rgba(255,255,255,0.10), rgba(255,255,255,0) 70%); }
.slot .nm { color: var(--c); margin-top: 2px; }
.slot .who { font-size: 13px; opacity: 0.75; margin-bottom: 6px; }
.slot .opts { width: 100%; display: flex; flex-direction: column; gap: 3px; }
.slot .row { display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; border-radius: 8px; padding: 2px 0; border: 2px solid transparent; }
.slot .row.sel { border-color: var(--c); background: rgba(255,255,255,0.10); }
.slot .row .lab { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; opacity: 0.6; display: block; }
.slot .row .val { font-size: 15px; font-weight: 700; }
.slot .row .val.nameEdit { cursor: text; text-decoration: underline dotted rgba(255,255,255,0.4); }
.slot .row button { background: rgba(255,255,255,0.12); color: #fff; border: 0; border-radius: 6px; height: 26px; font-size: 13px; cursor: pointer; padding: 0; }
.slot .row button:hover { background: rgba(255,255,255,0.25); }
.slot .row .swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; vertical-align: -2px; margin-right: 5px; }
.slot .row input { width: 100%; font: inherit; font-size: 15px; font-weight: 700; text-align: center; border-radius: 6px; border: 2px solid var(--c); background: #0b1026; color: #fff; padding: 1px 4px; }
.slot .remote { font-size: 12px; opacity: 0.55; margin-top: 4px; }
#title .howto { font-size: 15px; line-height: 1.6; margin: 4px 0 10px; text-shadow: 0 1px 3px #000; }
.bigBtn { font: inherit; font-size: 20px; font-weight: 800; color: #2b1d14; background: #ffd43b; border: 0; border-radius: 14px; padding: 10px 24px; cursor: pointer; box-shadow: 0 4px 0 #a07c00; }
.bigBtn:hover { filter: brightness(1.08); }
.bigBtn.ghost { background: rgba(10,14,30,0.75); color: #fff; box-shadow: none; border: 2px solid rgba(255,255,255,0.3); font-size: 16px; padding: 6px 16px; }
.ctlBox { margin-top: 10px; opacity: 0.85; }
.ctlBox summary { cursor: pointer; font-weight: 700; }

/* ---------- Street (house picker) ---------- */
#street { position: fixed; inset: 0; pointer-events: none; }
#street .streetH { position: absolute; top: 14px; left: 20px; margin: 0; font-size: clamp(22px, 3vw, 36px); text-shadow: 0 3px 0 #1d6b3a, 0 2px 10px #000; }
#streetLabels { position: absolute; inset: 0; }
.hl { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer; text-align: center; white-space: nowrap; }
.hl .n { display: inline-block; min-width: 44px; height: 44px; line-height: 40px; border-radius: 22px; font-size: 24px; font-weight: 900; background: rgba(10,14,30,0.8); border: 3px solid #fff; padding: 0 8px; }
.hl.open .n { border-color: #7dffa0; }
.hl.locked .n { border-color: #8fa3c7; color: #8fa3c7; }
.hl.sel .n { border-color: #ffd43b; background: #ffd43b; color: #2b1d14; transform: scale(1.15); }
.hl .st { display: block; font-size: 18px; color: #ffd43b; text-shadow: 0 2px 3px #000; letter-spacing: 1px; }
#houseInfo { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); width: min(380px, 40vw); background: rgba(250,246,236,0.96); color: #2b1d14;
  border: 4px solid #c62828; border-radius: 18px; padding: 16px 20px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); pointer-events: auto; }
#houseInfo.locked { border-color: #5d6b88; }
#houseInfo .num { font-size: 13px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: #c62828; }
#houseInfo.locked .num { color: #5d6b88; }
#houseInfo h3 { margin: 2px 0 2px; font-size: clamp(20px, 2.2vw, 26px); }
#houseInfo .blurb { font-size: 14px; opacity: 0.7; margin-bottom: 8px; }
#houseInfo ul { margin: 6px 0; padding-left: 4px; list-style: none; font-size: 16px; line-height: 1.6; font-weight: 600; }
#houseInfo .who { font-size: 14px; margin-top: 6px; }
#houseInfo .stars { font-size: 26px; color: #e0a800; letter-spacing: 3px; }
#houseInfo .lock { margin-top: 8px; font-weight: 800; color: #5d6b88; font-size: 16px; }
#houseInfo .go { margin-top: 10px; font-weight: 800; color: #1d6b3a; font-size: 16px; }
#houseInfo.shake { animation: shake 0.12s 3; }
.streetBar { position: absolute; left: 20px; bottom: 16px; display: flex; gap: 16px; align-items: center; pointer-events: auto; flex-wrap: wrap; right: 20px; }
.streetHint { font-size: 15px; background: rgba(10,14,30,0.7); padding: 6px 12px; border-radius: 10px; }
@media (max-width: 760px) { #houseInfo { left: 16px; right: 16px; width: auto; top: auto; bottom: 70px; transform: none; } }
#title .netBar { margin: 12px 0 0; }
@media (max-width: 1100px) { #title h1.small { margin-top: 44px; } }
#objectives .bonus { color: #ffd43b; opacity: 0.85; }
