.observation { position:absolute; bottom:76px; left:50%; transform:translateX(-50%); width:min(440px,calc(100% - 24px)); padding:10px 12px; background:#17100bf5; border:1px solid #b98f54; border-radius:14px; text-align:center; box-shadow:0 6px 30px #0008; }
.observation[hidden] { display:none; }
.observation p { margin:0 0 7px; font-size:14px; line-height:1.3; }
.observation-actions, #observation-answers { display:flex; gap:6px; justify-content:center; }
#observation-answers { flex:1; }
.observation button { min-width:44px; min-height:44px; flex:1; color:#f8e4bf; background:#35271b; border:1px solid #8c704b; border-radius:8px; font:600 14px system-ui; cursor:pointer; }
.observation button:disabled { opacity:.45; cursor:wait; }
.observation button:focus-visible { outline:3px solid #ffb347; outline-offset:2px; }
#observation-skip { flex:0 0 55px; background:#191311; }
@media(max-height:460px) and (min-width:641px) { .observation { width:250px; left:auto; right:12px; transform:none; bottom:65px; } }
:root {
  --ink: #f4ead8;
  --muted: #b9ab95;
  --panel: rgba(18, 12, 10, .82);
  --line: rgba(244, 234, 216, .16);
  --accent: #ffb347;
  --accent-ink: #2a1606;
  --nav-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #0b0708; color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.game { position: relative; height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h)); min-height: 320px; overflow: hidden; background: #000; }
.game:fullscreen { height: 100vh; }
.stage { position: absolute; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: grab; outline: none; }
#scene.dragging { cursor: grabbing; }
#scene:focus-visible { box-shadow: inset 0 0 0 3px rgba(255, 179, 71, .7); }

.topbar { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.quick-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; width: min(390px,42vw); }
.quick-control { display: grid; grid-template-columns: minmax(0,1fr) 44px; align-items: center; column-gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 16px; background: #100a08d9; backdrop-filter: blur(6px); }
.quick-control label { display: grid; gap: 0; line-height: 1.25; min-width: 0; }
.quick-control label > span { color: var(--muted); font-size: 11px; }
.quick-control output { font-size: 14px; font-weight: 700; }
.quick-control input[type=range] { grid-column: 1/-1; width: 100%; min-width: 0; height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.info-btn { font: 700 18px/1 Georgia,serif; }
.quick-control input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-radius: 5px; }
@media(max-width:640px) { .topbar { flex-wrap: wrap; } .quick-controls { order: 3; width: 100%; } .tools { margin-left: auto; } .counter { font-size: 12px; padding: 6px 10px; } }
@media(max-height:460px) and (min-width:641px) { .quick-control { padding: 0 8px; grid-template-columns: 60px minmax(70px,1fr) 44px; } .quick-controls { width: min(480px,58vw); } .quick-control input[type=range] { grid-column: 2; grid-row: 1; } .quick-control .icon-btn { grid-column: 3; grid-row: 1; } }
.counter { margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .38); border: 1px solid var(--line); font-size: 14px; color: var(--muted); letter-spacing: .02em; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.counter strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.tools { display: flex; gap: 8px; }
.icon-btn, .chip { appearance: none; border: 1px solid var(--line); background: rgba(0, 0, 0, .38); color: var(--ink); min-width: 44px; height: 44px; border-radius: 999px; display: inline-grid; place-items: center; cursor: pointer; touch-action: manipulation; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: background .2s, border-color .2s; }
.chip { padding: 0 14px; font: 600 14px/1 inherit; font-family: inherit; letter-spacing: .02em; }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn:hover, .chip:hover { background: rgba(255, 255, 255, .1); }
.icon-btn:focus-visible, .chip:focus-visible, .hold-btn:focus-visible, .next-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#sound-btn .mute { display: none; }
#sound-btn[aria-pressed="false"] .mute { display: inline; }
#sound-btn[aria-pressed="false"] .wave { display: none; }
#fullscreen-btn[hidden] { display: none; }

.hint { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%); width: min(320px, calc(100% - 40px)); margin: 0; padding: 20px; display: grid; justify-items: center; gap: 8px; border-radius: 18px; background: rgba(10, 6, 4, .94); border: 1px solid rgba(255,179,71,.4); box-shadow: 0 12px 48px #0009; font-size: 15px; line-height: 1.45; text-align: center; pointer-events: none; transition: opacity .25s; }
.hint strong { font-size: 22px; color: var(--accent); }
.scare-recovery { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; padding: 12px 18px; border-radius: 12px; background: #0b0708e8; color: var(--ink); text-align: center; pointer-events: none; }
.game.scare-ended .hold-btn { visibility: hidden; pointer-events: none; }
.game.scare-ended .bottombar:has(.next-btn:not([hidden])) { bottom: calc(50% - 28px); }
.game.scare-ended .next-btn { bottom: 0; }
.hint.hide { opacity: 0; visibility: hidden; }
.hint-hand { width: 22px; height: 22px; position: relative; }
.hint-hand::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(255, 179, 71, .7); animation: swipe 1.8s ease-in-out infinite; }
@keyframes swipe { 0%, 15% { transform: translateX(6px); opacity: 0; } 30% { opacity: 1; } 75% { transform: translateX(-10px); opacity: 1; } 100% { transform: translateX(-10px); opacity: 0; } }

.bottombar { position: absolute; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
.bottombar > * { pointer-events: auto; }
.hold-btn { appearance: none; font: 600 14px/1 inherit; font-family: inherit; color: var(--ink); background: rgba(0, 0, 0, .42); border: 1px solid var(--line); height: 48px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: background .15s, transform .15s; }
.hold-btn svg { width: 20px; height: 20px; }
.hold-btn.active { background: rgba(255, 179, 71, .26); border-color: rgba(255, 179, 71, .6); transform: scale(.97); }
.next-btn { appearance: none; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); font: 700 18px/1 inherit; font-family: inherit; color: var(--accent-ink); background: linear-gradient(180deg, #ffd27a, #ffa53a); border: 0; height: 56px; padding: 0 28px; border-radius: 999px; box-shadow: 0 8px 28px rgba(255, 150, 40, .35), inset 0 1px 0 rgba(255, 255, 255, .6); cursor: pointer; touch-action: manipulation; animation: rise .45s cubic-bezier(.2, .9, .3, 1.2) both; white-space: nowrap; }
.next-btn:hover { filter: brightness(1.06); }
.next-btn[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 0) scale(.94); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

.fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .32s ease; }
.fade.on { opacity: 1; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 15px; letter-spacing: .04em; background: #050304; transition: opacity .4s; }
.game:not([data-phase="loading"]) .loading { opacity: 0; pointer-events: none; }

.settings { border: 1px solid var(--line); border-radius: 18px; padding: 0; background: #17100d; color: var(--ink); width: min(420px, calc(100vw - 24px)); box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
.settings::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
.settings-card { padding: 20px; display: grid; gap: 14px; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-heading .icon-btn { flex-shrink: 0; font: 24px/1 system-ui,sans-serif; }
.settings h2 { margin: 0; font-size: 20px; }
.modes { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.modes legend { font-weight: 600; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.mode { display: block; cursor: pointer; }
.mode input { position: absolute; opacity: 0; }
.mode span { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); transition: border-color .15s, background .15s; }
.mode em { font-style: normal; color: var(--muted); font-size: 14px; }
.mode input:checked + span { border-color: var(--accent); background: rgba(255, 179, 71, .1); }
.mode input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.slider, .toggle { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.slider input { flex: 1; accent-color: var(--accent); height: 32px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.settings { max-height: calc(100dvh - 24px); overflow-y: auto; }
.slider { flex-direction: column; align-items: stretch; gap: 2px; }
.slider > span { display: flex; justify-content: space-between; }
.slider output { color: var(--accent); }
.slider input { flex: auto; height: 44px; width: 100%; margin: 0; }
.scare-guide { border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; font-size: 14px; }
.scare-guide summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.scare-guide dl { margin: 4px 0 12px; } .scare-guide dt { color: var(--accent); font-weight: 700; margin-top: 10px; }
.scare-guide dd { margin: 2px 0 0; color: var(--muted); } .scare-guide p { color: var(--muted); }
.settings-note { margin: 0; color: var(--muted); font-size: 13px; }
.done { min-height: 44px; justify-self: end; font: 700 16px/1 inherit; font-family: inherit; padding: 12px 22px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; }

.about { max-width: 760px; margin: 0 auto; padding: 40px 20px 60px; color: #d9cdb9; }
.about h2 { color: var(--ink); font-size: 26px; margin: 0 0 12px; }
.about h3 { color: var(--ink); font-size: 19px; margin: 26px 0 8px; }
.about a { color: var(--accent); }

@media (max-width: 560px) {
  .counter span { display: none; }
  .counter { padding: 6px 10px; }
  .tools { gap: 5px; }
  .hold-btn span { display: inline; }
  .hold-btn { min-width: 116px; height: 52px; padding: 0 10px; justify-content: center; }
  .hold-btn svg { width: 24px; height: 24px; }
  .chip { padding: 0 12px; }
  .next-btn { height: 54px; font-size: 17px; padding: 0 24px; }
}
@media (max-height: 460px) {
  .topbar { top: 6px; }
  .bottombar { bottom: 6px; }
  .hint { font-size: 14px; padding: 12px; gap: 4px; }
  .hold-btn { height: 44px; }
  .next-btn { height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .hint-hand::before { animation: none; opacity: 1; }
  .next-btn { animation: none; }
}

/* the lights are out: on-screen controls fade with the room */
.game .topbar, .game .bottombar, .game .hint { transition: opacity .25s; }
.game.lights-out .hint { opacity: .08; }

/* Keep repeat/close controls separate from the next-door action. */
.bottombar:has(.next-btn:not([hidden])) { bottom: 76px; }
.bottombar:has(.next-btn:not([hidden])) .next-btn { bottom: -64px; }
@media (max-width: 340px) {
 .topbar { flex-wrap: wrap; }
 .counter { display: none; }
 .tools { flex-wrap: wrap; }
 .hint { max-width: calc(100% - 20px); white-space: normal; text-align: center; }
 .hold-btn { min-width: 100px; padding: 0 6px; }
}

/* Related Halloween activities stay below the game and use responsive existing posters. */
.halloween-games { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.halloween-grid { list-style: none; padding: 0; margin: 20px 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.halloween-card { display: block; height: 100%; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #18110f; text-decoration: none; }
.halloween-card img { display: block; width: 100%; height: auto; aspect-ratio: 4/3; object-fit: cover; }
.halloween-card > div { padding: 16px; }
.about .halloween-card h3 { margin: 0 0 8px; font-size: 19px; line-height: 1.3; color: var(--ink); }
.halloween-card p { margin: 0 0 14px; font-size: 15px; line-height: 1.6; color: #d9cdb9; }
.halloween-card span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; font-weight: 600; }
.halloween-card:hover { border-color: var(--accent); }
.halloween-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.halloween-guide-link a { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width:560px) { .halloween-grid { grid-template-columns: 1fr; } }

/* A native dialog's top layer covers the site nav as well as the game. */
.scare-screen { position:fixed; inset:0; margin:0; padding:0; border:0; width:100vw; height:100vh; height:100dvh; max-width:none; max-height:none; overflow:hidden; background:#030205; color:#fff; overscroll-behavior:contain; }
.scare-screen::backdrop { background:#030205; }
.scare-screen canvas { position:absolute; inset:0; width:100%; height:100%; display:block; }
.skip-scare { position:absolute; right:max(12px,env(safe-area-inset-right)); top:max(12px,env(safe-area-inset-top)); min-height:44px; padding:8px 16px; border:1px solid #ffffff70; border-radius:999px; background:#070409d9; color:#fff; font:600 14px/1.3 system-ui,sans-serif; cursor:pointer; }
.skip-scare span { font-size:20px; margin-left:8px; }
.skip-scare:focus-visible { outline:3px solid #ffb347; outline-offset:3px; }
