/* Holly Haunt shared look: tokens, top bar, buttons, sheets. No framework. */
:root {
  --bg: #0c0710;
  --bg-2: #160c18;
  --surface: #1d121c;
  --surface-2: #2a1a22;
  --line: rgba(232, 195, 106, .22);
  --line-strong: rgba(232, 195, 106, .45);
  --gold: #e8c36a;
  --gold-2: #c8913a;
  --ember: #ff8a2a;
  --cream: #fff3dc;
  --muted: rgba(255, 243, 220, .72);
  --violet: #8b6cff;
  --danger: #ff7a7a;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45);
  --glass: rgba(20, 11, 24, .72);
  --glass-line: rgba(255, 236, 190, .14);
  --ok: #2fbf7d;
  --glow-ember: 0 0 28px rgba(255, 160, 60, .35);
  --display: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Trebuchet MS", sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { background: var(--bg); color: var(--cream); font-family: var(--sans); }
body { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 12px;
}

.kicker {
  color: var(--gold);
  font: 700 11px/1.2 var(--sans);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.display {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.02;
}

/* ---------- top bar shared by every game ---------- */
.topbar {
  position: relative; z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: calc(8px + var(--sat)) calc(12px + var(--sar)) 8px calc(12px + var(--sal));
  background: linear-gradient(180deg, rgba(12, 7, 16, .96), rgba(12, 7, 16, .82));
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.topbar .left { display: flex; justify-content: flex-start; min-width: 0; }
.topbar .right { display: flex; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.topbar .mid { text-align: center; min-width: 0; }
.topbar .mid .kicker { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .mid .sub {
  font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.chip-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; min-width: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 243, 220, .06);
  color: var(--cream);
  font: 700 13px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.chip-btn:hover { background: rgba(255, 243, 220, .12); border-color: var(--line-strong); }
.chip-btn:active { transform: scale(.96); }
.chip-btn svg { width: 16px; height: 16px; flex: none; }
.chip-btn.icon { padding: 0; width: 38px; }
.chip-btn[aria-pressed="false"] { opacity: .65; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  font: 800 16px/1 var(--sans);
  letter-spacing: .01em;
  text-decoration: none;
  user-select: none; -webkit-user-select: none;
  transition: transform .1s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn-primary {
  background: linear-gradient(180deg, #f3d488, var(--gold) 45%, var(--gold-2));
  color: #24140a;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 8px 22px rgba(232, 160, 60, .28);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 10px 28px rgba(232, 160, 60, .42); }
.btn-ghost {
  background: rgba(255, 243, 220, .07);
  border-color: var(--line);
  color: var(--cream);
}
.btn-ghost:hover { background: rgba(255, 243, 220, .12); }
.btn-quiet { background: transparent; color: var(--gold); min-height: 44px; }
.btn-quiet:hover { text-decoration: underline; }
.btn-block { width: 100%; }

/* ---------- overlay sheets (start, pause, game over, pay, contact) ---------- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 20;
  display: none;
  align-items: flex-end; justify-content: center;
  padding: calc(16px + var(--sat)) calc(12px + var(--sar)) calc(12px + var(--sab)) calc(12px + var(--sal));
  background: radial-gradient(120% 80% at 50% 100%, rgba(40, 14, 30, .75), rgba(8, 4, 10, .86));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overflow-y: auto;
}
.sheet-wrap.on { display: flex; animation: fadeIn .2s ease-out; }
.sheet {
  width: min(480px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 170, 70, .12), transparent 60%),
    radial-gradient(80% 50% at 100% 100%, rgba(139, 108, 255, .10), transparent 70%),
    linear-gradient(180deg, #2b1a22, #170d14 70%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 22px 18px 18px;
  box-shadow: var(--shadow), 0 1px 0 rgba(255, 255, 255, .08) inset;
  animation: rise .25s ease-out;
}
.sheet.wide { width: min(720px, 100%); }
.sheet h1, .sheet h2 { font-family: var(--display); font-size: clamp(26px, 7vw, 34px); line-height: 1.05; margin: 6px 0 8px; }
.sheet p { color: var(--muted); line-height: 1.45; }
.sheet .lead { margin-bottom: 14px; }
.sheet .actions { display: grid; gap: 8px; margin-top: 14px; }
.sheet .actions.two { grid-template-columns: 1fr 1fr; }
.sheet .fine { font-size: 12px; color: rgba(255, 243, 220, .55); margin-top: 10px; text-align: center; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
}

.stat-row { display: flex; gap: 8px; margin: 6px 0 4px; }
.stat-row > div {
  flex: 1; text-align: center;
  padding: 10px 6px; border-radius: 12px;
  background: rgba(255, 243, 220, .05); border: 1px solid var(--line);
}
.stat-row b { display: block; font: 800 22px/1.1 var(--sans); font-variant-numeric: tabular-nums; color: var(--cream); }
.stat-row span { font-size: 10px; letter-spacing: .16em; color: var(--gold); font-weight: 700; }

/* picture tiles (rooms, nights) */
.pic-tile {
  position: relative; overflow: hidden;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #120a10 center / cover no-repeat;
  color: var(--cream);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 10px 6px 12px;
  text-align: center;
  text-shadow: 0 2px 8px #000;
  font: 800 15px/1.1 var(--sans);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.pic-tile::after {
  content: ""; position: absolute; inset: 45% 0 0;
  background: linear-gradient(transparent, rgba(12, 7, 16, .94));
}
.pic-tile > * { position: relative; z-index: 1; }
.pic-tile:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .4); }
.pic-tile .tag {
  display: inline-block; margin-top: 6px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10px; letter-spacing: .1em; font-weight: 800; white-space: nowrap;
  background: rgba(62, 207, 142, .18); color: #9ff0c6; border: 1px solid rgba(62, 207, 142, .45);
  text-shadow: none;
}
.pic-tile.lock { filter: saturate(.55) brightness(.75); }
.pic-tile.lock .tag { background: rgba(232, 195, 106, .16); color: var(--gold); border-color: var(--line-strong); }
.pic-tile.lock::before {
  content: ""; position: absolute; z-index: 1; top: 10px; right: 10px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(12, 7, 16, .7) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8c36a' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / 14px no-repeat;
  border: 1px solid var(--line-strong);
}

.toast {
  position: absolute; left: 50%; bottom: 12px; z-index: 5;
  transform: translate(-50%, 8px);
  background: rgba(12, 7, 16, .88); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
  white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(14px); opacity: .4; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

img.emma-mark { border-radius: 50%; object-fit: cover; }

/* Festive themes. One choice, stored on this phone, used by every game. */
.theme-hold { position: relative; display: inline-flex; pointer-events: auto; }
.theme-btn { max-width: 46vw; }
.theme-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  display: grid; gap: 4px; min-width: 168px;
  padding: 8px; border-radius: 16px;
  background: rgba(12, 8, 14, .96);
  border: 1px solid var(--line-strong, rgba(232,195,106,.45));
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.theme-pop[hidden] { display: none; }
.theme-pop button {
  text-align: left; border: 0; border-radius: 10px;
  background: transparent; color: var(--cream, #fff3dc);
  font: 700 14px/1.2 var(--sans, system-ui, sans-serif);
  padding: 8px 10px;
}
.theme-pop button:hover, .theme-pop button[aria-current="true"] {
  background: rgba(255,243,220,.1);
}
.theme-props {
  pointer-events: none; position: fixed; z-index: 4;
  top: 8px; left: 0; right: 0; text-align: center;
  font-size: 22px; letter-spacing: .4em; opacity: .8;
}
html[data-theme="halloween"] .theme-props { display: none; }

html[data-theme="christmas"] {
  --bg:#07140e; --bg-2:#102418; --surface:#163024; --surface-2:#1e3d2c;
  --gold:#f2d48a; --gold-2:#b4232c; --ember:#e23b3b; --cream:#f6fff8;
  --muted:rgba(246,255,248,.78); --line:rgba(242,212,138,.32); --line-strong:rgba(242,212,138,.62);
  --violet:#2f8f5b; --danger:#ff8a8a;
}
html[data-theme="diwali"] {
  --bg:#1a0c04; --bg-2:#2a1406; --surface:#3a1c08; --surface-2:#4a280c;
  --gold:#ffd56a; --gold-2:#e07a12; --ember:#ffb020; --cream:#fff6e4;
  --muted:rgba(255,246,228,.78); --line:rgba(255,213,106,.34); --line-strong:rgba(255,213,106,.62);
  --violet:#c45a12;
}
html[data-theme="holi"] {
  --bg:#160816; --bg-2:#241028; --surface:#32143a; --surface-2:#441e4e;
  --gold:#ffd1ea; --gold-2:#7c5cff; --ember:#ff4fa3; --cream:#fff5fb;
  --muted:rgba(255,245,251,.78); --line:rgba(255,209,234,.32); --line-strong:rgba(255,209,234,.6);
  --violet:#7c5cff;
}
html[data-theme="eid"] {
  --bg:#071410; --bg-2:#0e241c; --surface:#143228; --surface-2:#1c4034;
  --gold:#e7d39a; --gold-2:#1f8a5b; --ember:#d4af37; --cream:#f4fff8;
  --muted:rgba(244,255,248,.78); --line:rgba(231,211,154,.32); --line-strong:rgba(231,211,154,.6);
  --violet:#1f8a5b;
}
html[data-theme="thanksgiving"] {
  --bg:#140c08; --bg-2:#24140c; --surface:#321c10; --surface-2:#422414;
  --gold:#f0c07a; --gold-2:#c45c26; --ember:#e07a2a; --cream:#fff4e6;
  --muted:rgba(255,244,230,.78); --line:rgba(240,192,122,.32); --line-strong:rgba(240,192,122,.6);
  --violet:#a34a1c;
}
html[data-theme="newyear"] {
  --bg:#070814; --bg-2:#101428; --surface:#161c38; --surface-2:#222850;
  --gold:#f4e4a8; --gold-2:#8eb6ff; --ember:#d4af37; --cream:#f7f8ff;
  --muted:rgba(247,248,255,.78); --line:rgba(244,228,168,.32); --line-strong:rgba(244,228,168,.62);
  --violet:#7aa2ff;
}
html[data-theme="christmas"] body,
html[data-theme="diwali"] body,
html[data-theme="holi"] body,
html[data-theme="eid"] body,
html[data-theme="thanksgiving"] body,
html[data-theme="newyear"] body { background: var(--bg) !important; color: var(--cream); }
html[data-theme="christmas"] #gate .scene { filter: hue-rotate(88deg) saturate(.9); }
html[data-theme="diwali"] #gate .scene { filter: sepia(.45) saturate(1.45) hue-rotate(-18deg) brightness(1.05); }
html[data-theme="holi"] #gate .scene { filter: hue-rotate(250deg) saturate(1.3); }
html[data-theme="eid"] #gate .scene { filter: hue-rotate(70deg) saturate(.8) brightness(1.05); }
html[data-theme="thanksgiving"] #gate .scene { filter: sepia(.55) saturate(1.2) hue-rotate(-8deg); }
html[data-theme="newyear"] #gate .scene { filter: hue-rotate(190deg) saturate(.7) brightness(1.08); }
html[data-theme]:not([data-theme="halloween"]) #stage { box-shadow: inset 0 0 80px var(--glow-ember, rgba(0,0,0,.2)); }
html[data-theme]:not([data-theme="halloween"]) .dock button,
html[data-theme]:not([data-theme="halloween"]) .sheet,
html[data-theme]:not([data-theme="halloween"]) .hud b,
html[data-theme]:not([data-theme="halloween"]) .hud span {
  background: var(--surface) !important;
  color: var(--cream) !important;
  border-color: var(--line) !important;
}
html[data-theme]:not([data-theme="halloween"]) .primary { background: var(--gold) !important; color: #24140a !important; }

.gate-nav { display: grid !important; grid-template-columns: 1fr auto 1fr; align-items: center; }
.gate-nav .brand { justify-self: start; }
.gate-nav .theme-hold { justify-self: center; }
.gate-nav > .chip-btn { justify-self: end; }
.brand .emma-mark { width: 72px !important; height: 72px !important; }
.topbar .emma-mark { width: 44px !important; height: 44px !important; }

@media (max-width: 480px) {
  .topbar { gap: 4px; padding-left: 8px; padding-right: 8px; }
  .topbar .emma-mark { width: 32px !important; height: 32px !important; }
  #gamesBtn { padding: 0; width: 38px; }
  #gamesBtn .btn-word { display: none; }
  .theme-btn { padding: 0 8px; font-size: 12px; }
  .theme-btn .feel-word { display: none; }
  #score { padding: 0 8px; min-height: 32px; font-size: 12px; }
  .chip-btn.icon { width: 34px; min-width: 34px; }
}
