/* VOICE: a night adventure, warm and mysterious, readable for an 8-year-old.
   IDEA: torchlight on Jerusalem stone; gold vessels in the dark.
   COLOUR: night indigo ground, limestone cards, temple gold accent.
   TYPE: Secular One for titles, Assistant for text.
   LAYOUT: game first; menus are centred stone tablets over the 3D temple. */
:root {
  --night: #0b1028; --night2: #151d44; --gold: #f2c14e; --gold2: #ffdb7a; --goldd: #b8852a;
  --stone: #f3ead4; --stone2: #e4d6b4; --ink: #241a0e; --muted: #6b5a3e; --red: #e5483e;
  --font: 'Assistant', 'Rubik', 'Arial Hebrew', Arial, sans-serif;
  --title: 'Secular One', 'Assistant', Arial, sans-serif;
}
* { box-sizing: border-box; min-width: 0; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--stone); font: 17px/1.5 var(--font); }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
#stage, #stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) 16px 16px; overflow-y: auto; z-index: 20;
  background: radial-gradient(ellipse at 50% 40%, rgba(11,16,40,0.15), rgba(5,7,20,0.75) 75%); touch-action: pan-y; }
.screen.on { display: flex; }
.screen.dim { background: rgba(5,7,20,0.72); }
.card { background: linear-gradient(180deg, var(--stone), var(--stone2)); color: var(--ink); border-radius: 22px; padding: clamp(20px, 4vw, 34px); width: min(560px, 100%);
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), inset 0 0 0 3px rgba(184,133,42,0.35); text-align: center; max-height: calc(100vh - 32px); overflow-y: auto; }
.card.wide { width: min(860px, 100%); }
.card h2 { font-family: var(--title); font-weight: 400; font-size: clamp(26px, 5vw, 36px); line-height: 1.1; margin: 4px 0 14px; color: #2b1c08; }
.card h3 { font-size: 17px; margin: 18px 0 8px; color: var(--muted); }
.kicker { font-weight: 800; color: var(--goldd); margin: 0; font-size: 15px; }
.lead { font-size: 18px; margin: 8px 0 16px; }
.small { font-size: 14px; color: var(--muted); margin: 8px 0; }
.btnCol { display: grid; gap: 12px; margin-top: 18px; }
.btnRow { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.btn { min-height: 52px; padding: 10px 26px; border-radius: 14px; font-weight: 800; font-size: 19px; background: rgba(255,255,255,0.12); color: var(--stone); border: 2px solid rgba(242,193,78,0.6); }
.card .btn { background: #fffaf0; color: var(--ink); border-color: #cdb78a; }
.btn.gold, .card .btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #2b1c08; border-color: var(--goldd); box-shadow: 0 6px 0 var(--goldd); }
.btn.gold:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--goldd); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible, .choice:focus-visible, .linkBtn:focus-visible { outline: 3px solid #4f8fe8; outline-offset: 2px; }
.linkBtn { padding: 10px 14px; font-weight: 700; text-decoration: underline; color: inherit; opacity: 0.85; min-height: 44px; }

/* title */
#sc-title { background: linear-gradient(270deg, rgba(5,7,20,0.85), rgba(5,7,20,0.25) 65%, rgba(5,7,20,0)); justify-content: flex-start; }
.titleBox { width: min(520px, 100%); padding: 0 clamp(8px, 5vw, 64px); }
.titleBox h1 { font-family: var(--title); font-weight: 400; font-size: clamp(48px, 10vw, 88px); line-height: 0.98; margin: 8px 0 14px; color: var(--gold2);
  text-shadow: 0 0 28px rgba(255,190,80,0.55), 0 4px 0 #6b4410; }
.titleBox .kicker { color: var(--gold); font-size: 18px; }
.titleBox .lead { color: var(--stone); max-width: 30ch; }
.titleBox .btn { width: min(320px, 100%); }

/* mode choice */
.choiceRow { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.choice { background: #fffaf0; border: 2px solid #cdb78a; border-radius: 16px; padding: 22px 16px; display: grid; gap: 4px; color: var(--ink); }
.choice b { font-family: var(--title); font-weight: 400; font-size: 28px; }
.choice span { color: var(--muted); font-size: 15px; }
.choice:hover { border-color: var(--goldd); }

/* nights */
#nightGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.nightBtn { background: #fffaf0; border: 2px solid #cdb78a; border-radius: 14px; padding: 10px 4px; display: grid; justify-items: center; gap: 2px; color: var(--ink); min-height: 92px; }
.nightBtn .flames { display: flex; gap: 2px; height: 26px; align-items: flex-end; direction: ltr; }
.nightBtn .flames i { width: 5px; height: 16px; background: #c9b58c; border-radius: 2px; position: relative; }
.nightBtn .flames i.lit::after { content: ''; position: absolute; left: -2px; top: -9px; width: 9px; height: 10px; background: radial-gradient(circle at 50% 60%, #fff3b0, #ffad33 60%, transparent 70%); border-radius: 50% 50% 45% 45%; }
.nightBtn b { font-size: 15px; }
.nightBtn small { font-size: 12px; color: var(--muted); line-height: 1.2; }
.nightBtn.on { border-color: var(--goldd); background: #fff1c9; box-shadow: inset 0 0 0 2px var(--gold); }
.nightBtn:disabled { opacity: 0.4; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button { background: #fffaf0; border: 2px solid #cdb78a; border-radius: 12px; padding: 10px; font-weight: 800; display: grid; color: var(--ink); min-height: 56px; }
.seg button small { font-weight: 400; color: var(--muted); font-size: 13px; }
.seg button.on { border-color: var(--goldd); background: #fff1c9; box-shadow: inset 0 0 0 2px var(--gold); }

/* characters */
#charGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 10px; text-align: start; }
.charCard { background: #fffaf0; border: 2px solid #cdb78a; border-radius: 16px; padding: 12px; display: grid; grid-template-columns: 44px 1fr; gap: 4px 10px; align-items: start; color: var(--ink); text-align: start; min-height: 120px; }
.charCard .av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; box-shadow: inset 0 0 0 2px rgba(0,0,0,0.15); grid-row: span 2; background: #2a3260 !important; }
.charCard .av svg { display: block; }
.charCard b { font-family: var(--title); font-weight: 400; font-size: 21px; line-height: 1.1; }
.charCard .who { font-size: 13px; color: var(--muted); line-height: 1.25; }
.charCard .ab { grid-column: 1 / -1; font-size: 13.5px; line-height: 1.3; }
.charCard .ab strong { color: #7a4f10; }
.charCard.on { border-color: var(--goldd); background: #fff1c9; box-shadow: inset 0 0 0 2px var(--gold); }
.charCard.taken { opacity: 0.45; filter: grayscale(0.8); }
.charCard .tag { grid-column: 1 / -1; font-size: 12px; font-weight: 800; color: #8b2a20; }
.lobby { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.codeBox, .playersBox { background: #fffaf0; border: 2px dashed #cdb78a; border-radius: 16px; padding: 12px; display: grid; justify-items: center; gap: 4px; }
.codeBox .lbl, .playersBox .lbl { font-weight: 800; color: var(--muted); font-size: 14px; }
#gameCode { font-family: var(--title); font-size: 54px; letter-spacing: 6px; direction: ltr; color: #2b1c08; line-height: 1; }
#qr { width: 132px; height: 132px; }
#qr svg { width: 100%; height: 100%; }
#lobbyPlayers { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; width: 100%; }
#lobbyPlayers li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #f6edd6; border-radius: 10px; font-weight: 700; }
#lobbyPlayers i { width: 14px; height: 14px; border-radius: 50%; flex: none; }
#sc-chars .btnRow { position: sticky; bottom: calc(-1 * clamp(20px, 4vw, 34px)); margin-bottom: calc(-1 * clamp(20px, 4vw, 34px)); padding: 14px 0 clamp(16px, 3vw, 26px); background: linear-gradient(rgba(228,214,180,0), var(--stone2) 35%); }
@media (max-width: 700px) { .kc { font-size: 11.5px; padding: 2px 5px; } .kc kbd { font-size: 10.5px; padding: 0 4px; } #hudHead { left: 60px; } #objectives { max-width: 62vw; } }
@media (max-width: 600px) {
  #charGrid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .charCard { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 10px 8px; }
  .charCard .av { grid-row: auto; } .charCard .who { display: none; } .charCard .ab { font-size: 12.5px; text-align: center; }
  .lobby { grid-template-columns: 1fr; } #nightGrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; } .nightBtn small { display: none; } }

/* join */
#joinCode { font-family: var(--title); font-size: 52px; width: 220px; text-align: center; letter-spacing: 10px; border-radius: 14px; border: 3px solid #cdb78a; padding: 6px; background: #fffaf0; color: var(--ink); }
#joinCode:focus { outline: none; border-color: var(--goldd); }

/* intro / end */
.ctlHelp { display: grid; gap: 6px; text-align: start; background: #fffaf0; border-radius: 14px; padding: 12px 16px; font-size: 15px; }
.ctlHelp div { display: flex; gap: 10px; justify-content: space-between; }
.ctlHelp kbd { font: 700 13px var(--font); background: #2b1c08; color: var(--gold2); border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
#endCandles { display: flex; justify-content: center; gap: 18px; margin: 6px 0 10px; direction: ltr; }
#endCandles svg { width: 46px; height: 80px; }
#endStats, #finalStats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.statBox { background: #fffaf0; border-radius: 12px; padding: 8px; }
.statBox span { display: block; font-size: 13px; color: var(--muted); }
.statBox b { font-size: 22px; font-variant-numeric: tabular-nums; }
#quiz { text-align: start; }
.q { background: #fffaf0; border-radius: 14px; padding: 12px; margin-top: 10px; }
.q p { font-weight: 800; margin: 0 0 8px; }
.q .opts { display: grid; gap: 8px; }
.q .opts button { background: #fff; border: 2px solid #cdb78a; border-radius: 12px; padding: 10px 12px; text-align: start; font-weight: 600; min-height: 46px; color: var(--ink); }
.q .opts button.right { border-color: #2f9a4c; background: #e3f6e6; }
.q .opts button.wrong { border-color: var(--red); background: #fbe4e1; }
.q .fb { font-weight: 800; margin-top: 8px; min-height: 1.5em; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.panel { background: rgba(10,14,34,0.72); border: 1px solid rgba(242,193,78,0.35); border-radius: 14px; padding: 8px 12px; backdrop-filter: blur(4px); }
#hudHead { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; left: 64px; display: flex; flex-direction: column; gap: 8px; }
#hudTop { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
#keybar { pointer-events: auto; touch-action: none; align-self: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 5px 6px; background: rgba(10,14,34,0.8); border: 1px solid rgba(242,193,78,0.35); border-radius: 12px; backdrop-filter: blur(4px); max-width: 100%; }
.kc { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 9px; font-size: 13px; font-weight: 700; color: #e9e2cf; white-space: nowrap; transition: background 0.2s, box-shadow 0.2s, opacity 0.2s; }
.kc kbd { font: 800 12px var(--font); background: #f3ead4; color: #2b1c08; border-radius: 5px; padding: 1px 6px; box-shadow: 0 2px 0 #a08a5c; direction: ltr; }
.kc .kx { color: var(--gold2); font-size: 13px; min-width: 0; }
.kc .kx:empty { display: none; }
.kc.hot { background: rgba(242,193,78,0.28); box-shadow: 0 0 0 1px var(--gold), 0 0 16px rgba(242,193,78,0.65); color: #fff; animation: hot 0.8s infinite alternate; }
.kc.hot kbd { background: var(--gold2); }
.kc.ready { box-shadow: 0 0 0 1px rgba(143,184,255,0.7); }
.kc.warn { background: rgba(229,72,62,0.35); box-shadow: 0 0 0 1px var(--red); color: #fff; }
.kc.off { opacity: 0.42; }
.kc { cursor: pointer; user-select: none; -webkit-user-select: none; min-height: 30px; }
.kc:hover { background: rgba(255,255,255,0.08); }
.kc.press { transform: scale(0.94); background: rgba(242,193,78,0.4); }
.kc.lock { background: rgba(143,184,255,0.3); box-shadow: 0 0 0 1px #8fb8ff; color: #fff; }
@media (pointer: coarse) { .kc { min-height: 36px; padding: 4px 9px; } }
@keyframes hot { to { box-shadow: 0 0 0 1px var(--gold), 0 0 4px rgba(242,193,78,0.3); } }
#nightCandles { display: flex; gap: 10px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(242,193,78,0.25); direction: ltr; justify-content: flex-end; }
.nc { display: grid; justify-items: center; gap: 1px; width: 52px; }
.nc i { width: 8px; height: 18px; background: #8f876f; border-radius: 2px; position: relative; margin-top: 10px; }
.nc.lit i { background: #f3e8c8; }
.nc.lit i::after { content: ''; position: absolute; left: -3px; top: -12px; width: 14px; height: 13px; background: radial-gradient(circle at 50% 62%, #fff3b0, #ffad33 55%, transparent 70%); border-radius: 50% 50% 45% 45%; animation: flick 0.18s infinite alternate; }
.nc small { font-size: 10px; color: #c9c2ad; line-height: 1.1; text-align: center; direction: rtl; }
.nc:not(.lit) small { opacity: 0.6; }
@keyframes flick { to { transform: scale(1.08, 0.92); } }
#score.bump { animation: bump 0.35s; }
@keyframes bump { 40% { transform: scale(1.45); color: #fff; } }
#spits i.pop { animation: spitpop 0.8s; }
@keyframes spitpop { 0% { transform: scale(1); } 40% { transform: scale(1.8, 1.4); box-shadow: 0 0 14px #fff; } }
#objectives { max-width: min(300px, 52vw); font-size: 14px; }
#nightTitle { font-family: var(--title); color: var(--gold2); font-size: 17px; line-height: 1.2; margin-bottom: 4px; }
#objList { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#objList li { display: flex; justify-content: space-between; gap: 10px; }
#objList li b { font-variant-numeric: tabular-nums; direction: ltr; }
#objList li.done { color: #9fe0a8; text-decoration: line-through; text-decoration-thickness: 1px; }
#objList li.opt { color: #c9c2ad; }
#objList li.exit { color: var(--gold2); font-weight: 800; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: 0.55; } }
#stats { display: flex; gap: 14px; font-size: 14px; }
.stat { display: grid; justify-items: center; }
.stat .lbl { font-size: 12px; color: #c9c2ad; }
#score { font-size: 20px; color: var(--gold2); font-variant-numeric: tabular-nums; }
#spits { display: flex; gap: 3px; direction: ltr; height: 22px; align-items: center; }
#spits i { width: 4px; height: 18px; border-radius: 2px; background: rgba(255,255,255,0.18); }
#spits i.got { background: linear-gradient(#e8e8ef, #8a8a96); box-shadow: 0 0 6px rgba(255,230,150,0.8); }
#btnPause { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; pointer-events: auto; }
.roundBtn { width: 46px; height: 46px; border-radius: 50%; background: rgba(10,14,34,0.72); border: 1px solid rgba(242,193,78,0.45); display: grid; place-items: center; }
.roundBtn svg { width: 22px; fill: var(--gold2); }
#toast { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(560px, 88vw); background: rgba(10,14,34,0.88); color: #fff; border: 1px solid rgba(242,193,78,0.6);
  border-radius: 14px; padding: 10px 16px; font-weight: 700; font-size: 17px; text-align: center; opacity: 0; transition: opacity 0.25s; }
#toast.on { opacity: 1; }
#info { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); width: min(520px, 90vw); background: linear-gradient(180deg, var(--stone), var(--stone2)); color: var(--ink);
  border-radius: 14px; padding: 10px 16px; font-weight: 600; font-size: 16px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.3s; }
#info.on { opacity: 1; }
#charBadge { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 14px; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; text-shadow: 0 1px 3px #000; }
#charBadge i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; }
#controls { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 10px; pointer-events: auto; direction: ltr; }
.ctlBtn { width: 74px; height: 74px; border-radius: 50%; background: rgba(10,14,34,0.75); border: 2px solid rgba(242,193,78,0.55); display: grid; place-items: center; align-content: center; gap: 0; position: relative; font-weight: 800; font-size: 12px; color: var(--stone); touch-action: none; }
.ctlBtn.big { width: 104px; height: 104px; font-size: 15px; background: rgba(60,40,8,0.85); border-color: var(--gold); }
.ctlBtn.down { transform: scale(0.94); background: rgba(242,193,78,0.35); }
.ctlBtn.idle { opacity: 0.55; }
.ctlBtn.ready { box-shadow: 0 0 18px rgba(255,200,80,0.8); }
.ctlBtn .ctlName { padding: 0 6px; line-height: 1.1; text-align: center; }
#actionLabel { padding: 0 10px; line-height: 1.15; text-align: center; direction: rtl; }
.dreidelIcon { width: 26px; height: 26px; fill: #8fb8ff; }
#dreidelCount { position: absolute; top: -4px; right: -4px; background: var(--gold); color: #2b1c08; border-radius: 12px; min-width: 24px; height: 24px; display: grid; place-items: center; font-size: 14px; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring circle:first-child { stroke: rgba(255,255,255,0.08); }
#holdRing { stroke: var(--gold2); stroke-dasharray: 283; stroke-dashoffset: 283; stroke-linecap: round; }
.cd { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,0.6); display: grid; place-items: center; font-size: 22px; color: #fff; }
.cd:empty { display: none; }
#callout { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); font-family: var(--title); font-size: clamp(30px, 6vw, 56px); color: var(--gold2); white-space: nowrap; pointer-events: none;
  text-shadow: 0 4px 0 #5a3608, 0 0 26px rgba(255,190,80,0.75); opacity: 0; }
#callout.on { animation: callout 1.9s ease-out both; }
#callout.silver { color: #eef2ff; text-shadow: 0 4px 0 #3a3f5a, 0 0 26px rgba(200,220,255,0.8); }
#callout.bonus { color: #9ff0ff; text-shadow: 0 4px 0 #0b3a52, 0 0 26px rgba(120,220,255,0.85); }
#callout.red { color: #ffb0a6; text-shadow: 0 4px 0 #5a1208, 0 0 26px rgba(255,90,70,0.8); }
@keyframes callout { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 22% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%) scale(1); } }
#prompt { position: absolute; left: 0; top: 0; display: none; align-items: center; gap: 7px; padding: 6px 10px 6px 12px; background: rgba(10,14,34,0.88); border: 2px solid var(--gold); border-radius: 12px; color: #fff; font-weight: 800; font-size: 15px; white-space: nowrap; --p: 0; box-shadow: 0 6px 18px rgba(0,0,0,0.5); }
#prompt::after { content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: var(--gold); }
#prompt.on { display: flex; }
#prompt.dim { border-color: #8a8070; opacity: 0.8; }
#prompt.dim::after { border-top-color: #8a8070; }
#prompt .pk { background: var(--gold2); color: #2b1c08; border-radius: 6px; padding: 1px 7px; font-size: 13px; direction: ltr; }
#prompt .pk:empty, #prompt .ph:empty { display: none; }
#prompt .ph { font-size: 12px; color: var(--gold2); }
#prompt .pr { width: 22px; height: 22px; border-radius: 50%; display: none; background: conic-gradient(var(--gold2) calc(var(--p) * 360deg), rgba(255,255,255,0.15) 0); -webkit-mask: radial-gradient(circle, transparent 6px, #000 7px); mask: radial-gradient(circle, transparent 6px, #000 7px); }
#prompt.hold .pr { display: block; }
#waypoint { position: absolute; left: 0; top: 0; display: none; flex-direction: column; align-items: center; gap: 1px; color: var(--gold2); font-weight: 800; text-shadow: 0 1px 3px #000; pointer-events: none; }
#waypoint.on { display: flex; }
#waypoint .wa { width: 18px; height: 18px; background: var(--gold); transform: rotate(45deg); border: 2px solid #fff6d8; box-shadow: 0 0 14px rgba(255,200,80,0.9); animation: wp 1s infinite alternate; }
#waypoint.edge .wa { transform: rotate(var(--ang)); width: 0; height: 0; background: none; border: 12px solid transparent; border-left: 18px solid var(--gold); border-right: 0; box-shadow: none; filter: drop-shadow(0 0 6px rgba(255,200,80,0.9)); animation: none; }
#waypoint .wd { font-size: 14px; direction: rtl; }
#waypoint .wt { font-size: 12px; color: #f3ead4; }
@keyframes wp { to { transform: rotate(45deg) translate(-3px, -3px); } }
#popups { position: absolute; inset: 0; overflow: hidden; }
.pop { position: absolute; left: 0; top: 0; direction: ltr; font-family: var(--title); font-size: 30px; color: var(--gold2); text-shadow: 0 3px 0 #4a2c06, 0 0 14px rgba(255,190,80,0.8); white-space: nowrap; will-change: transform; }
.pop.bonus { color: #9ff0ff; text-shadow: 0 3px 0 #0b3a52, 0 0 14px rgba(120,220,255,0.85); font-size: 34px; }
.pop.red { color: #ff8a7a; text-shadow: 0 3px 0 #4a0e06, 0 0 12px rgba(255,80,60,0.8); }
.pop.blue { color: #b9d2ff; text-shadow: 0 3px 0 #10224a; font-size: 24px; }
#safeChip { position: absolute; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 34px); left: 14px; padding: 5px 12px; border-radius: 10px; background: rgba(255,200,90,0.9); color: #2b1c08; font-weight: 800; font-size: 14px; opacity: 0; transform: translateY(8px); transition: opacity 0.3s, transform 0.3s; }
#safeChip.on { opacity: 1; transform: none; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 9; opacity: 0; transition: opacity 0.5s; }
#vignette.chase { opacity: 1; background: radial-gradient(ellipse at center, rgba(229,40,30,0) 45%, rgba(229,40,30,0.55)); animation: beat 0.62s infinite; }
#vignette.sus { opacity: 1; background: radial-gradient(ellipse at center, rgba(255,170,40,0) 55%, rgba(255,170,40,0.32)); }
#vignette.safe { opacity: 1; background: radial-gradient(ellipse at center, rgba(255,210,110,0) 60%, rgba(255,210,110,0.22)); }
@keyframes beat { 0%, 100% { opacity: 0.75; } 15% { opacity: 1; } 30% { opacity: 0.8; } 45% { opacity: 0.95; } }
#countdown { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 16; font-family: var(--title); font-size: clamp(90px, 22vw, 200px); color: var(--gold2); text-shadow: 0 8px 0 #5a3608, 0 0 50px rgba(255,190,80,0.8); opacity: 0; }
#countdown.on { animation: count 0.62s ease-out both; }
#countdown.go { font-size: clamp(60px, 14vw, 130px); }
@keyframes count { 0% { opacity: 0; transform: scale(2.2); } 25% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(0.85); } }
#endBadges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0 10px; }
.badge { background: linear-gradient(180deg, #2b3366, #161c44); color: #fff; border: 2px solid var(--gold); border-radius: 14px; padding: 6px 12px; display: grid; text-align: center; animation: badge 0.5s both; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.badge b { font-family: var(--title); font-weight: 400; font-size: 18px; color: var(--gold2); }
.badge span { font-size: 12px; color: #e8e0c8; }
@keyframes badge { from { opacity: 0; transform: scale(0.3) rotate(-8deg); } 70% { transform: scale(1.1); } to { opacity: 1; transform: none; } }
#endCandles svg { animation: badge 0.45s both; }
#endCandles svg.lit path { animation: flick 0.2s infinite alternate; transform-origin: 50% 80%; }
#minimap { position: absolute; top: 120px; left: 10px; border: 2px solid var(--gold); border-radius: 10px; background: rgba(10,14,34,0.85); width: min(240px, 40vw); }
#indicators .ind { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 20px; color: #1a1206; border: 3px solid rgba(0,0,0,0.5); }
#indicators .ind.guard { background: var(--red); color: #fff; }
#indicators .ind.guard.q { background: #ffd54a; color: #1a1206; }
#indicators .ind .tip { position: absolute; width: 0; height: 0; border: 8px solid transparent; }
#joyBase { position: fixed; width: 140px; height: 140px; margin: -70px 0 0 -70px; border-radius: 50%; background: rgba(255,255,255,0.1); border: 2px solid rgba(255,255,255,0.35); display: none; z-index: 11; pointer-events: none; transition: opacity 0.2s; }
#joyBase.idle { opacity: 0.45; }
#joyBase.idle::after { content: 'הליכה'; position: absolute; left: 50%; top: -24px; transform: translateX(-50%); font-weight: 800; font-size: 13px; color: #fff; text-shadow: 0 1px 3px #000; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; border-radius: 50%; background: rgba(242,193,78,0.75); border: 2px solid rgba(255,255,255,0.6); transform: translate(-50%,-50%); }
#flash { position: fixed; inset: 0; background: radial-gradient(circle, rgba(229,72,62,0) 30%, rgba(229,72,62,0.65)); opacity: 0; pointer-events: none; z-index: 12; transition: opacity 0.6s; }
#flash.on { opacity: 1; transition: none; }
#finaleText { position: fixed; left: 50%; bottom: 10%; transform: translateX(-50%); text-align: center; z-index: 15; animation: rise 2s ease-out both; background: radial-gradient(ellipse at center, rgba(8,10,28,0.78), rgba(8,10,28,0) 72%); padding: 26px 70px; }
#finaleText b { display: block; font-family: var(--title); font-weight: 400; font-size: clamp(40px, 8vw, 72px); color: var(--gold2); text-shadow: 0 3px 0 #5a3608, 0 0 30px rgba(255,190,80,0.8); }
#finaleText span { font-size: clamp(18px, 3vw, 26px); color: var(--stone); text-shadow: 0 2px 6px #000; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 30px); } }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--night); color: var(--gold2); font-family: var(--title); font-size: 28px; z-index: 50; }

@media (pointer: fine) { #controls .ctlBtn { width: 64px; height: 64px; } #controls .ctlBtn.big { width: 86px; height: 86px; } }
@media (max-height: 500px) {
  #objectives { font-size: 12.5px; padding: 6px 10px; } #nightTitle { font-size: 15px; }
  .kc { font-size: 11.5px; padding: 2px 6px; } #keybar { padding: 3px 5px; } #hudHead { gap: 5px; }
  #callout { font-size: 34px; top: 46%; } .pop { font-size: 22px; } .pop.bonus { font-size: 26px; } #safeChip { font-size: 12px; padding: 3px 9px; }
  .nc small { display: none; } #nightCandles { margin-top: 3px; padding-top: 3px; } .nc i { height: 13px; margin-top: 8px; }
  .ctlBtn { width: 62px; height: 62px; } .ctlBtn.big { width: 88px; height: 88px; }
  #info { bottom: 110px; font-size: 14px; } #toast { top: 18%; font-size: 15px; }
}

/* ---------- compact HUD (phones, small windows) ---------- */
.kc.gone { display: none; }
#objSum { display: none; }
body.compact #hudHead { left: 58px; right: 8px; gap: 6px; }
body.compact #keybar { padding: 3px 4px; gap: 3px; }
body.compact #objectives { pointer-events: auto; cursor: pointer; max-width: min(46vw, 320px); padding: 5px 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; }
body.compact #nightTitle { font-size: 14px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.compact #objSum { display: block; font-weight: 800; font-size: 13px; color: var(--gold2); white-space: nowrap; }
body.compact #objSum::after { content: ' ▾'; font-size: 10px; opacity: 0.8; }
body.compact #objectives.open #objSum::after { content: ' ▴'; }
body.compact #objList { display: none; grid-column: 1 / -1; font-size: 12.5px; margin-top: 4px; }
body.compact #objectives.open #objList { display: grid; }
body.compact #nightCandles { grid-column: 1 / -1; margin-top: 3px; padding-top: 3px; gap: 6px; }
body.compact .nc { width: auto; }
body.compact .nc small { display: none; }
body.compact .nc i { height: 12px; width: 6px; margin-top: 8px; }
body.compact .nc.lit i::after { width: 11px; height: 10px; top: -10px; left: -2.5px; }
body.compact #objectives:not(.open) #nightCandles { display: none; }
body.compact #stats { padding: 4px 10px; gap: 10px; }
body.compact .stat .lbl { display: none; }
body.compact #score { font-size: 17px; }
body.compact #spits i { height: 13px; width: 3px; }
body.compact #toast { top: 104px; font-size: 14px; padding: 6px 12px; max-width: min(56vw, 440px); }
body.compact #info { bottom: 8px; font-size: 13px; width: min(44vw, 420px); padding: 6px 10px; line-height: 1.35; }
body.compact #charBadge { display: none; }
body.compact #safeChip { top: 62px; bottom: auto; left: 10px; font-size: 12px; padding: 3px 8px; }
body.compact #callout { font-size: 30px; top: 44%; }
body.compact #prompt { font-size: 13px; padding: 4px 8px; }
body.compact #waypoint .wd { font-size: 12px; } body.compact #waypoint .wt { display: none; }
body.compact .pop { font-size: 20px; } body.compact .pop.bonus { font-size: 24px; }
body.compact #minimap { top: 62px; width: min(200px, 32vw); }
body.compact .card { padding: 14px 18px; }
body.compact .card h2 { font-size: 26px; margin: 2px 0 8px; }
body.compact .lead { font-size: 16px; margin: 4px 0 10px; }
body.compact .btnRow { margin-top: 10px; }
body.compact #endCandles svg { width: 34px; height: 58px; }
body.compact .statBox b { font-size: 18px; }
body.compact .badge b { font-size: 15px; }
#introHelp { margin-top: 12px; text-align: start; }
#introHelp summary { cursor: pointer; font-weight: 800; color: var(--muted); padding: 6px 0; text-align: center; }
#introHelp .ctlHelp { margin-top: 6px; }
.btnRow.sticky { position: sticky; bottom: calc(-1 * clamp(14px, 4vw, 34px)); margin-bottom: calc(-1 * clamp(14px, 4vw, 34px)); padding: 10px 0 clamp(12px, 3vw, 26px); background: linear-gradient(rgba(228,214,180,0), var(--stone2) 35%); }
body.compact .ctlBtn { width: 62px; height: 62px; font-size: 11px; } body.compact .ctlBtn.big { width: 90px; height: 90px; font-size: 13px; }
@media (orientation: portrait) { body.compact #objectives { max-width: 58vw; } body.compact #info { width: 64vw; bottom: 12px; right: auto; left: 50%; } body.compact #toast { max-width: 86vw; }
  body.compact #controls { flex-direction: column; align-items: flex-end; } }

/* desktop: the top bar is clickable and the keys work, so the round touch buttons are not needed */
body:not(.touch) #controls { display: none; }
body:not(.touch) #info { bottom: 28px; }
@media (max-width: 980px) and (pointer: fine) { .kc[data-k="cam"], .kc[data-k="pause"] { display: none; } }

#hanukkiah { margin-top: 14px; width: min(340px, 100%); }
#hanukkiah svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 0 14px rgba(255,180,70,0.35)); }
#hanukkiah p { margin: 4px 0 0; font-weight: 700; color: var(--gold2); font-size: 15px; }
#hanukkiah .fl { transform-box: fill-box; transform-origin: 50% 100%; animation: flick 0.22s infinite alternate; }
#hanukkiah .fresh { animation: freshCandle 1.6s ease-out 0.4s both; }
@keyframes freshCandle { 0% { opacity: 0; transform: translateY(-14px); } 60% { opacity: 1; } 100% { transform: none; } }
@media (max-height: 500px) { #hanukkiah { width: 230px; margin-top: 6px; } #hanukkiah p { font-size: 13px; } .titleBox h1 { font-size: 46px; margin: 2px 0 6px; } .titleBox .lead { font-size: 15px; margin: 4px 0 8px; } .titleBox .btnCol { margin-top: 8px; gap: 8px; } }
