/* ============================================================
   Hedgeworth Games — player
   Full-screen, tablet-first, dark. Everything lives in one page.
   ============================================================ */
:root {
  --bg: #0f1014; --bg-2: #171920; --panel: #1f222b; --line: #2f3340;
  --text: #ecedf1; --muted: #9aa1b3; --accent: #d9a441; --accent-2: #b8862f;
  --ok: #4fbf7a; --bad: #d9534f; --info: #4f9bd9;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
/* ?debug=1 panel — what the server sent for each hotspot */
.debug-panel {
  position: fixed; right: 8px; top: 64px; z-index: 80; max-width: 46vw; max-height: 60vh; overflow: auto;
  background: rgba(15, 16, 20, .94); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace; color: var(--text);
}
.debug-panel .dh { color: var(--accent); margin-bottom: 6px; }
.debug-panel table { border-collapse: collapse; }
.debug-panel th { text-align: left; color: var(--muted); font-weight: 400; padding: 1px 8px 3px 0; }
.debug-panel td { padding: 1px 8px 1px 0; white-space: nowrap; }
.debug-panel tr.on td { color: var(--ok); }

/* Build stamp — bottom-right, out of the way of the play area */
.build-stamp {
  position: fixed; right: 10px; bottom: 6px; z-index: 60;
  font-size: 10px; color: var(--muted); opacity: .45; pointer-events: none;
}
@media (max-width: 700px) { .build-stamp { font-size: 9px; opacity: .3; } }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); overflow: hidden; }
body { overscroll-behavior: none; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .4em; font-family: var(--serif); font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 30px; } h2 { font-size: 24px; } h3 { font-size: 17px; font-family: var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.muted { color: var(--muted); } .error { color: var(--bad); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { background: #262a35; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1408; font-weight: 700; }
.btn.primary:hover { background: var(--accent-2); }
.btn.big { padding: 14px 28px; font-size: 18px; border-radius: 12px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Simple pages (join / dev / index) ---------- */
.centre { height: 100%; display: grid; place-items: center; padding: 20px; overflow: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: min(520px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.panel .blurb { color: var(--muted); font-size: 17px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], select { width: 100%; padding: 12px 14px; font: inherit; font-size: 18px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
input:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; font-family: Consolas, monospace; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); margin-bottom: 16px; }
.tag { font-size: 11px; background: var(--bad); color: #fff; padding: 2px 8px; border-radius: 999px; vertical-align: middle; font-family: var(--font); }
ul.plain { list-style: none; padding: 0; margin: 0; color: var(--muted); font-size: 14px; }
ul.plain li { padding: 4px 0; }

/* ---------- App frame ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.hud { height: 56px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.quick-actions { position: fixed; z-index: 15; top: 66px; right: 14px; display: grid; gap: 9px; }
.quick-action { position: relative; width: 62px; height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--line); border-radius: 12px; background: #20222a; color: var(--text); font-weight: 800; cursor: pointer; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.quick-action span { font-size: 9px; letter-spacing: .08em; }
.clue-request { border-color: rgba(217,164,65,.7); background: #302613; color: #ffe2a0; }
.clue-request:hover { background: #413318; }
.journal-request:hover { background: #2b2e38; }
.journal-request.new-entry { animation: journal-glow 1.35s ease-in-out 3; border-color: var(--accent); }
.quick-action .badge { position: absolute; top: -6px; right: -6px; background: var(--accent); color: #1a1408; font-size: 11px; padding: 1px 6px; border-radius: 999px; }
@keyframes journal-glow { 50% { box-shadow: 0 0 10px rgba(255,225,139,.9), 0 0 27px rgba(217,164,65,.65); } }
.hud-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.hud-title .story-title { font-family: var(--serif); font-size: 15px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title .stage-name { font-size: 13px; color: var(--muted); }
.hud-timer { font-family: Consolas, monospace; font-size: 22px; font-weight: 700; padding: 2px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.hud-timer.low { color: var(--bad); border-color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.hud-party { flex: 1; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pp { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pp .av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 11px; color: #111; }
.pp.me { border-color: var(--accent); color: var(--text); }
.pp.off { opacity: .45; }
.pp .where { color: var(--muted); }
.hud-actions { display: flex; gap: 6px; }
.hbtn { position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 18px; cursor: pointer; }
.hbtn .badge { position: absolute; top: -6px; right: -6px; background: var(--accent); color: #1a1408; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }

.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }

/* ---------- Lobby ---------- */
.lobby { display: grid; place-items: center; padding: 20px; overflow: auto; }
.join-code { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center; background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 14px 18px; margin: 18px 0; }
.join-code .label { color: var(--muted); font-size: 13px; }
.join-code .code { font-family: Consolas, monospace; font-size: 34px; font-weight: 700; letter-spacing: .25em; color: var(--accent); }
.join-code .url { grid-column: 1 / -1; color: var(--muted); font-size: 13px; word-break: break-all; }
.lobby-players { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.lobby-players li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.lobby-players .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #111; }
.lobby-players .host { font-size: 11px; color: var(--accent); }
.lobby-actions { text-align: center; }

/* ---------- Stage ---------- */
.stage { position: relative; background: #000; }
.room-clues { position: absolute; z-index: 6; top: 12px; left: 12px; width: min(255px, 32vw); max-height: calc(100% - 24px); overflow: auto; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(18,20,26,.86); box-shadow: 0 10px 28px rgba(0,0,0,.42); backdrop-filter: blur(5px); }
.room-clues[hidden] { display: none; }
.room-clues-head { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.room-clues-list { display: grid; gap: 8px; padding: 9px; }
.room-clue-card { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: rgba(27,30,37,.95); }
.room-clue-card img { display: block; width: 100%; max-height: 155px; object-fit: contain; background: #090a0d; }
.room-clue-card strong { display: block; padding: 8px 9px 1px; color: var(--accent); font-family: var(--serif); font-size: 15px; }
.room-clue-card p { margin: 0; padding: 4px 9px 9px; color: var(--text); font-size: 12px; line-height: 1.4; }
.scene-wrap { flex: 1; min-height: 0; position: relative; overflow: hidden; }
/* Fills whatever the scene itself cannot reach, so there is never a black band against the UI
   bars. A blurred, darkened enlargement of the same background reads as depth rather than a gap. */
.scene-backdrop {
  position: absolute; inset: 0; background-position: center; background-size: cover;
  filter: blur(28px) brightness(.5) saturate(1.1); transform: scale(1.15); pointer-events: none;
}
.scene-backdrop.none { background: radial-gradient(ellipse at 50% 30%, #2a2418 0%, #15140f 70%); filter: none; transform: none; }
.scene { position: absolute; background: #14110c 0 0 / 100% 100% no-repeat; overflow: hidden; box-shadow: 0 0 60px rgba(0,0,0,.55); }
.scene.background-transition::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; background: #07080b; animation: scene-background-transition .68s ease-out forwards; }
@keyframes scene-background-transition { 0% { opacity: 0; } 18% { opacity: .85; } 100% { opacity: 0; } }
.scene.no-bg { background: radial-gradient(ellipse at 50% 30%, #3a3324 0%, #1c1a16 60%, #101010 100%); }
.scene .no-bg-label { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.hotspots { position: absolute; inset: 0; z-index: 2; }
.sequence-progress { position: absolute; z-index: 5; min-width: 48px; padding: 5px 10px; border: 1px solid rgba(217,164,65,.65); border-radius: 999px; background: rgba(18,16,11,.9); box-shadow: 0 6px 18px rgba(0,0,0,.48); color: #ffe4a7; font-size: 13px; font-weight: 800; line-height: 1; text-align: center; pointer-events: none; animation: sequence-progress-in .14s ease-out; }
.sequence-progress.mode-anchor { transform: translate(-50%, 8px); }
.sequence-progress.pos-top-left { top: 12px; left: 12px; }.sequence-progress.pos-top-center { top: 12px; left: 50%; transform: translateX(-50%); }.sequence-progress.pos-top-right { top: 12px; right: 12px; }
.sequence-progress.pos-middle-left { top: 50%; left: 12px; transform: translateY(-50%); }.sequence-progress.pos-middle-center { top: 50%; left: 50%; transform: translate(-50%,-50%); }.sequence-progress.pos-middle-right { top: 50%; right: 12px; transform: translateY(-50%); }
.sequence-progress.pos-bottom-left { bottom: 12px; left: 12px; }.sequence-progress.pos-bottom-center { bottom: 12px; left: 50%; transform: translateX(-50%); }.sequence-progress.pos-bottom-right { bottom: 12px; right: 12px; }
@keyframes sequence-progress-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.hs { position: absolute; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: border-color .15s, background .15s; display: grid; place-items: end start; }
.hs:hover, .hs:focus-visible { border-color: rgba(217,164,65,.7); background: rgba(217,164,65,.08); outline: none; }
.hs .lbl { position: absolute; z-index: 2; margin: 4px; font-size: 12px; background: rgba(0,0,0,.65); color: var(--text); padding: 2px 8px; border-radius: 999px; opacity: 0; transition: opacity .15s; white-space: nowrap; }
.clue.guidance { border-color: rgba(217,164,65,.45); }
.hs .lbl.label-top-left { top: calc(-1 * var(--label-offset, 0px)); left: calc(-1 * var(--label-offset, 0px)); }
.hs .lbl.label-top-center { top: calc(-1 * var(--label-offset, 0px)); left: 50%; transform: translateX(-50%); }
.hs .lbl.label-top-right { top: calc(-1 * var(--label-offset, 0px)); right: calc(-1 * var(--label-offset, 0px)); }
.hs .lbl.label-middle-left { top: 50%; left: calc(-1 * var(--label-offset, 0px)); transform: translateY(-50%); }
.hs .lbl.label-middle-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.hs .lbl.label-middle-right { top: 50%; right: calc(-1 * var(--label-offset, 0px)); transform: translateY(-50%); }
.hs .lbl.label-bottom-left { bottom: calc(-1 * var(--label-offset, 0px)); left: calc(-1 * var(--label-offset, 0px)); }
.hs .lbl.label-bottom-center { bottom: calc(-1 * var(--label-offset, 0px)); left: 50%; transform: translateX(-50%); }
.hs .lbl.label-bottom-right { right: calc(-1 * var(--label-offset, 0px)); bottom: calc(-1 * var(--label-offset, 0px)); }
.hs:hover .lbl, .hs:focus-visible .lbl { opacity: 1; background: rgba(62,48,20,.96); box-shadow: 0 0 8px rgba(255,223,137,.9), 0 0 18px rgba(217,164,65,.5); filter: brightness(1.15); }
/* Label visibility is a per-story setting: hidden (default), hover, always. Doors always show. */
.app.labels-hover .hs:hover .lbl, .app.labels-hover .hs:focus-visible .lbl { opacity: 1; }
.app.labels-always .hs .lbl { opacity: 1; }
.hs.label-display-hover .lbl { opacity: 0 !important; }
.hs.label-display-hover:hover .lbl, .hs.label-display-hover:focus-visible .lbl, .hs.label-display-always .lbl { opacity: 1 !important; }
.hs.label-display-hidden .lbl { display: none; }
.app.labels-hidden .hs:hover { background: rgba(217,164,65,.06); border-color: rgba(217,164,65,.35); }
.hs.navigate { border-style: dashed; }
.hs.navigate .lbl { background: rgba(79,155,217,.85); opacity: .85; }
.hs.press.pressed { animation: pressed .35s ease-out; }
/* Cut-out objects: the image fills the rect; hover grows it and glows along its silhouette */
.hs.has-sprite { border-color: transparent !important; background: transparent !important; overflow: visible; }
.hs .sprite { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; transition: transform .18s ease, filter .18s ease; transform-origin: center; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.hs.has-sprite.hover-glow-grow:hover .sprite, .hs.has-sprite.hover-glow-grow:focus-visible .sprite { transform: scale(1.07); filter: drop-shadow(0 0 6px rgba(255,220,140,.95)) drop-shadow(0 0 18px rgba(217,164,65,.7)) brightness(1.12); }
.hs.has-sprite.hover-glow:hover .sprite, .hs.has-sprite.hover-glow:focus-visible .sprite { filter: drop-shadow(0 0 6px rgba(255,220,140,.95)) drop-shadow(0 0 18px rgba(217,164,65,.7)) brightness(1.12); }
.hs.has-sprite.hover-grow:hover .sprite, .hs.has-sprite.hover-grow:focus-visible .sprite { transform: scale(1.07); }
.hs.has-sprite.pressed .sprite { animation: sprite-press .3s ease-out; }
@keyframes sprite-press { 0% { transform: scale(.9); filter: brightness(1.3); } 100% { transform: none; } }
.hs.has-sprite.solved .sprite { filter: drop-shadow(0 0 8px rgba(79,191,122,.6)); }
@keyframes pressed { 0% { transform: scale(.94); background: rgba(217,164,65,.35); } 100% { transform: none; } }
.hs.solved .lbl { background: rgba(79,191,122,.85); color: #062; opacity: 1; }
.hs.glow { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { border-color: rgba(217,164,65,.9); box-shadow: 0 0 22px rgba(217,164,65,.45); } }
.exits { position: absolute; z-index: 3; left: 50%; bottom: 14px; display: flex; gap: 8px; justify-content: center; width: min(calc(100% - 28px), 720px); transform: translateX(-50%); flex-wrap: wrap; }
.exits:empty { display: none; }
.exits .btn { padding: 8px 14px; font-size: 14px; background: rgba(24,26,32,.9); box-shadow: 0 5px 16px rgba(0,0,0,.36); backdrop-filter: blur(4px); }
.inventory-overlay { position: absolute; z-index: 5; left: 14px; bottom: 14px; display: flex; align-items: end; gap: 7px; max-width: min(72vw, 560px); padding: 7px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(18,20,26,.84); box-shadow: 0 8px 24px rgba(0,0,0,.38); backdrop-filter: blur(5px); }
.inventory-overlay[hidden] { display: none; }
.inventory-label { align-self: center; padding: 0 3px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.inventory { display: flex; gap: 6px; align-items: center; overflow-x: auto; min-width: 0; }
.item { flex: none; width: 52px; height: 52px; padding: 3px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); display: grid; grid-template-rows: 1fr auto; place-items: center; cursor: pointer; position: relative; }
.item .it-icon, .item .it-letter { width: 28px; height: 28px; border-radius: 6px; }
.item .it-icon { display: block; object-fit: contain; }
.item .it-letter { display: grid; place-items: center; background: linear-gradient(135deg, #4d3d1c, #252014); color: #ffe19a; font-size: 16px; font-weight: 800; line-height: 1; }
.item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(217,164,65,.4); }
.item .nm { max-width: 46px; overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.1; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.armed-item-msg { position: absolute; bottom: calc(100% + 8px); left: 0; max-width: 260px; padding: 6px 9px; border: 1px solid rgba(217,164,65,.45); border-radius: 7px; background: rgba(30,25,15,.94); color: #ffe2a0; font-size: 12px; }
.armed-item-msg:empty { display: none; }
.room-clue .clue-kicker { display: block; margin-bottom: 6px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 700px) { .room-clues { top: 8px; left: 8px; width: min(230px, 64vw); max-height: 43%; } .inventory-overlay { left: 8px; bottom: 8px; max-width: calc(100vw - 16px); } .inventory-label { display: none; } .exits { bottom: 8px; width: calc(100% - 16px); } }
.app.item-armed .hs { cursor: crosshair; border-color: rgba(217,164,65,.35); }

/* ---------- Results ---------- */
.results { display: grid; place-items: center; padding: 20px; overflow: auto; }
.result-badge { font-size: 54px; text-align: center; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 18px 0; }
.stats dt { color: var(--muted); } .stats dd { margin: 0; font-weight: 600; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 40; padding: 16px; }
.overlay[hidden] { display: none; }
.dialog { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: pop .18s ease-out; }
.overlay.positioned { top: 56px; bottom: 72px; display: block; background: transparent; padding: 18px; }
.overlay.positioned .dialog { position: absolute; width: min(440px, calc(100vw - 36px)); max-height: min(72vh, 560px); }
.overlay.positioned .dialog .msg-img { max-height: min(48vh, 420px); }
.overlay.positioned .dialog-top-left { top: 18px; left: 18px; }
.overlay.positioned .dialog-top-center { top: 18px; left: 50%; transform: translateX(-50%); }
.overlay.positioned .dialog-top-right { top: 18px; right: 18px; }
.overlay.positioned .dialog-middle-left { top: 50%; left: 18px; transform: translateY(-50%); }
.overlay.positioned .dialog-middle-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.overlay.positioned .dialog-middle-right { top: 50%; right: 18px; transform: translateY(-50%); }
.overlay.positioned .dialog-bottom-left { bottom: 18px; left: 18px; }
.overlay.positioned .dialog-bottom-center { bottom: 18px; left: 50%; transform: translateX(-50%); }
.overlay.positioned .dialog-bottom-right { right: 18px; bottom: 18px; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.dialog .close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 16px; cursor: pointer; }
.dialog h2 { padding-right: 40px; }
.dialog .text { font-size: 18px; line-height: 1.5; font-family: var(--serif); }
.dialog .speaker { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dialog .speaker .em { font-size: 34px; }
.dialog .speaker .portrait { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); }
.dialog .msg-img { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: 10px; margin: 6px 0 12px; background: #000; }
.dialog .speaker .who { color: var(--accent); font-family: var(--serif); font-size: 20px; }
.dialog .hint-row { margin-top: 18px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.dialog .hint-text { margin-top: 10px; padding: 10px 14px; background: var(--bg); border-left: 3px solid var(--accent); border-radius: 6px; color: var(--muted); font-style: italic; }
.dialog .verdict { margin-top: 12px; font-weight: 700; }
.dialog .verdict.ok { color: var(--ok); } .dialog .verdict.bad { color: var(--bad); }
.dialog.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* Widgets */
.widget { margin-top: 14px; }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 8px; justify-content: center; }
.keypad button, .seq-opts button, .dial button { font: inherit; font-size: 22px; padding: 12px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.keypad button:active, .seq-opts button:active { background: var(--accent); color: #1a1408; }
.entry { text-align: center; font-family: Consolas, monospace; font-size: 30px; letter-spacing: .3em; padding: 10px; margin-bottom: 12px; background: var(--bg); border-radius: 10px; min-height: 58px; border: 1px solid var(--line); }
.seq-opts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.seq-opts button { padding: 12px 18px; font-size: 18px; text-transform: capitalize; }
.dial { display: flex; gap: 14px; justify-content: center; }
.dial .d { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dial .d .v { font-family: Consolas, monospace; font-size: 34px; width: 70px; text-align: center; background: var(--bg); border-radius: 10px; padding: 6px 0; border: 1px solid var(--line); }
.dial button { width: 70px; padding: 6px 0; }
.wires { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 30px; }
.wires button { font: inherit; padding: 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--text); text-transform: capitalize; cursor: pointer; }
.wires button.picked { border-color: var(--accent); }
.wires button.paired { border-color: var(--ok); opacity: .8; }
.arrange { display: flex; flex-direction: column; gap: 8px; }
.arrange .row { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.arrange .row span { flex: 1; text-transform: capitalize; }
.arrange .row button { font: inherit; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.textwidget input { font-size: 22px; }
.widget-actions { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }
.assembly-board { position: relative; overflow: hidden; min-height: 190px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }.assembly-board > img { display: block; width: 100%; min-height: 190px; object-fit: contain; }.assembly-empty { display: grid; min-height: 190px; place-items: center; color: var(--muted); }.assembly-slot { position: absolute; display: grid; place-items: center; overflow: hidden; border: 2px dashed rgba(217,164,65,.8); border-radius: 6px; background: rgba(20,17,10,.35); color: var(--text); font-size: 11px; cursor: pointer; }.assembly-slot img { max-width: 100%; max-height: 100%; object-fit: contain; }.assembly-slot.target { background: rgba(217,164,65,.18); }.assembly-slot.filled { border-style: solid; border-color: var(--ok); background: rgba(79,191,122,.18); }.assembly-tray-title { margin-top: 12px; color: var(--muted); font-size: 12px; }.assembly-tray { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }.assembly-tray button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; }.assembly-tray button.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(217,164,65,.25); }.assembly-tray img { width: 22px; height: 22px; object-fit: contain; }

/* Drawers */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg-2); border-left: 1px solid var(--line); z-index: 45; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.5); animation: slide .2s ease-out; }
.drawer[hidden] { display: none; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; }
.drawer-head .close { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); cursor: pointer; }
.drawer-body { overflow: auto; padding: 12px 16px; }
.clue { padding: 12px 0; border-bottom: 1px solid var(--line); }
.clue .ct { font-family: var(--serif); font-size: 18px; color: var(--accent); }
.clue .cb { color: var(--text); margin-top: 4px; }
.logrow { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.logrow .t { flex: none; font-family: Consolas, monospace; font-size: 12px; opacity: .7; padding-top: 2px; }
.empty { color: var(--muted); padding: 20px 0; text-align: center; }

/* Interstitial (stage change / outro) */
.interstitial { position: fixed; inset: 0; z-index: 50; background: rgba(6,6,9,.94); display: grid; place-items: center; padding: 24px; animation: fade .3s; }
.interstitial[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.inter-body { max-width: 640px; text-align: center; }
.inter-kicker { color: var(--muted); text-transform: uppercase; letter-spacing: .15em; font-size: 12px; }
.inter-body h2 { font-size: 34px; color: var(--accent); }
.inter-body p { font-family: var(--serif); font-size: 20px; line-height: 1.6; }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 16px; box-shadow: 0 8px 30px rgba(0,0,0,.5); animation: pop .18s ease-out; max-width: 80vw; }
.toast.ok { border-left-color: var(--ok); } .toast.bad { border-left-color: var(--bad); } .toast.info { border-left-color: var(--info); }
.toast.movement { display: flex; align-items: center; gap: 10px; min-width: 245px; padding: 10px 12px; border-color: rgba(93,157,220,.48); border-left: 3px solid var(--info); background: linear-gradient(135deg, rgba(35,57,79,.98), rgba(26,29,36,.98)); }
.movement-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 8px; background: rgba(93,157,220,.2); color: #b8dcff; font-size: 19px; }
.movement-copy { display: grid; gap: 2px; color: #dceafd; font-size: 12px; }
.movement-copy strong { color: #fff; font-size: 12px; }
@media (max-width: 700px) { .toasts { right: 8px; bottom: 8px; } .toast.movement { min-width: min(245px, calc(100vw - 16px)); } }

@media (max-width: 700px) {
  .hud-title .story-title { display: none; }
  .hud-party .where { display: none; }
  .tray { height: 64px; }
  .overlay.positioned { bottom: 64px; }
  .keypad { grid-template-columns: repeat(3, 60px); }
}

/* ---------- Site pages (landing / account) ---------- */
body.site, .page { overflow: auto; }
.sitenav { display: flex; align-items: center; gap: 18px; padding: 12px 24px; background: var(--bg-2); border-bottom: 1px solid var(--line); font-size: 15px; }
.sitenav .brand { display: inline-flex; align-items: center; line-height: 0; text-decoration: none; }
.sitenav .brand img { display: block; width: auto; height: 36px; }
.sitenav a { color: var(--muted); text-decoration: none; } .sitenav a:hover { color: var(--text); }
.sitenav .spacer { flex: 1; }
.sitenav .btn { padding: 7px 14px; }
.page { padding: 28px 24px 60px; max-width: 1100px; margin: 0 auto; height: auto; }
html:has(.page), body:has(.page) { overflow: auto; height: auto; min-height: 100%; }
.hero { padding: 40px 0 30px; max-width: 760px; }
.hero h1 { font-size: 40px; }
.hero .blurb { font-size: 19px; color: var(--muted); }
.hero .btn { margin: 6px 8px 0 0; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-bottom: 30px; }
.story-card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: inherit; text-decoration: none; }
a.story-card:hover { border-color: var(--accent); }
.story-card .cover, .story-front .cover { height: 160px; background: linear-gradient(135deg, #2b2f3b, #1a1d25) center / cover; display: grid; place-items: center; font-size: 48px; }
.story-front .cover { border-radius: 12px; margin: -8px 0 16px; }
.story-card .body { padding: 16px 18px; }
.story-card h3 { font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 20px; color: var(--text); }
.ents { list-style: none; padding: 0; margin: 8px 0 14px; font-size: 14px; }
.ents li { padding: 4px 0 4px 18px; position: relative; color: var(--muted); }
.ents li::before { content: ""; position: absolute; left: 0; top: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.ents li.ok { color: var(--text); } .ents li.ok::before { background: var(--ok); }
.notice { background: #1f3f2c; border: 1px solid #2c5a3f; border-radius: 12px; padding: 14px 18px; margin-bottom: 24px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.notice .btn { margin-left: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col .panel { width: auto; }
.story-front { width: min(600px, 100%); }
.host-box { text-align: center; padding: 8px 0 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
input[type=email], input[type=password] { width: 100%; padding: 12px 14px; font: inherit; font-size: 18px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } .hero h1 { font-size: 30px; } .sitenav { flex-wrap: wrap; gap: 10px 14px; } }
