/* style.css — the cozy disguise, in CSS.
   Everything here reads warm/rounded/adorable. A few custom properties
   (--mood, palette vars) are driven from JS so the SAME UI can later drain and
   crack as the horror sets in, instead of swapping to a separate "horror skin". */

:root {
  --mood: 0;                       /* 0 cozy -> 1 horror, set by atmosphere.js */
  --cream: #fff6e8;
  --honey: #f4c66a;
  --amber: #e8a13a;
  --rose:  #e7a6a0;
  --moss:  #8aa06a;
  --ink:   #5a4632;                /* warm brown text, never harsh black */
  --panel: #fffaf1;
  --shadow: rgba(120, 86, 50, 0.22);
  --font-cute: 'Quicksand', 'Baloo 2', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
  --font-read: 'Quicksand', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: var(--font-read);
  color: var(--ink);
  background: radial-gradient(circle at 50% 30%, #ffe9c4 0%, #f7d9a8 45%, #e9c089 100%);
  -webkit-font-smoothing: antialiased;
}

.screen { position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; }
.hidden { display: none !important; }

/* ---- Menu card ---- */
.menu-card {
  background: var(--panel);
  border-radius: 28px;
  padding: 34px 38px;
  width: min(440px, 92vw);
  max-height: 94vh; overflow-y: auto;   /* scroll rather than clip on short windows */
  box-shadow: 0 18px 50px var(--shadow), inset 0 0 0 3px #ffffff;
  text-align: center;
  animation: floatIn 0.6s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes floatIn { from { transform: translateY(18px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

.lantern { font-size: 64px; animation: wobble 3.2s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

.title {
  font-family: var(--font-cute);
  font-weight: 700;
  font-size: 40px;
  margin: 4px 0 2px;
  color: var(--amber);
  letter-spacing: 0.5px;
  text-shadow: 0 2px 0 #fff, 0 3px 6px var(--shadow);
}
.subtitle { font-family: var(--font-cute); color: var(--amber); margin: 0 0 8px; }
.tagline { color: #9a8160; margin: 0 0 22px; font-size: 15px; }

.field { display: block; text-align: left; margin: 0 0 16px; font-size: 13px; color: #9a8160; }
.field span { display: block; margin-bottom: 5px; padding-left: 6px; }

input[type=text] {
  width: 100%;
  font-family: var(--font-read);
  font-size: 16px;
  padding: 12px 16px;
  border: 2px solid #f0dcb8;
  border-radius: 16px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus { border-color: var(--honey); box-shadow: 0 0 0 4px #f7e2b8; }

.menu-actions { display: flex; flex-direction: column; gap: 12px; }
.join-row { display: flex; gap: 10px; }
.join-row input { text-transform: uppercase; letter-spacing: 4px; text-align: center; font-weight: 700; }
.join-row .btn { flex: 0 0 auto; }
/* a soft "or join a friend" divider between Create and the join row */
.or-divider { display: flex; align-items: center; gap: 10px; color: #b79a6e; font-size: 12.5px; margin: 2px 0; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 2px; border-radius: 2px; background: #f0dcb8; }

.btn {
  font-family: var(--font-cute);
  font-weight: 700;
  font-size: 16px;
  padding: 13px 20px;
  border: none;
  border-radius: 18px;
  background: #ffe7bd;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 0 #e8c98c;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: #ffeec9; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #e8c98c; }
.btn-primary { background: linear-gradient(180deg, #ffce6e, var(--amber)); color: #fff; box-shadow: 0 5px 0 #c9842a; }
.btn-primary:hover { filter: brightness(0.96); box-shadow: 0 5px 0 #c9842a, 0 0 16px rgba(255, 200, 110, 0.6); }
.btn-primary:active { box-shadow: 0 1px 0 #c9842a; }

.menu-error { color: #c0564e; min-height: 18px; font-size: 13px; margin: 12px 0 0; }

.advisory {
  margin-top: 22px; text-align: left; font-size: 12.5px; line-height: 1.5;
  background: #fff3e0; border: 1px dashed #e6c690; border-radius: 14px; padding: 8px 14px;
  color: #8a7150;
}
.advisory summary { cursor: pointer; font-weight: 700; color: #b5894a; }
.advisory p { margin: 8px 2px 4px; }

.menu-foot { margin-top: 20px; color: #b79a6e; font-size: 13px; }

/* ---- Lobby ---- */
.lobby-card { position: relative; width: min(860px, 96vw); max-height: 96vh; overflow: visible;
  padding: 16px 28px 18px; text-align: center; }
.lobby-card .subtitle { margin: 2px 0 8px; font-size: 20px; }

/* Name + chat on one row; wardrobe groups side by side — uses the horizontal space. */
.lobby-tools { display: flex; gap: 14px; align-items: flex-end; text-align: left; margin: 0 0 10px; }
.lobby-tools .lobby-name { flex: 0 0 210px; margin: 0; }
.lobby-tools .lobby-chat { flex: 1 1 0; margin: 0; }
.lobby-chat span { margin-bottom: 3px; }
.lobby-chat .chat-line { margin: 0; padding: 8px 14px; }
/* Tabbed wardrobe: a soft framed panel with one row of category tabs; only the
   active category's controls show, so every option stays without the clutter. */
.wardrobe { position: relative; text-align: left; margin: 2px 0 4px; padding: 9px 12px 11px;
  background: rgba(255,244,224,.55); border-radius: 14px; box-shadow: inset 0 0 0 1px #f0dcb8; }
.wardrobe-tabs { display: flex; gap: 5px; margin-bottom: 9px; }
.wtab { flex: 1 1 0; font-family: var(--font-cute); font-weight: 700; font-size: 13px; cursor: pointer;
  padding: 7px 6px; border: none; border-radius: 10px; background: transparent; color: #9a8160;
  white-space: nowrap; transition: background .12s, color .12s, box-shadow .12s; }
.wtab:hover { background: #fff0d6; color: var(--amber); }
.wtab.selected { background: #fff; color: var(--amber); box-shadow: 0 2px 6px rgba(120,90,60,.18); }
.wardrobe-panels { min-height: 84px; }
.wpanel { display: flex; flex-direction: column; justify-content: center; gap: 9px; min-height: 84px; }
.wpanel .types { margin: 0; }
.wpanel .swatches { margin: 0; gap: 6px; }   /* tighter so all 24 wools fit one row */

/* Back-to-menu link, top-left of the card */
.btn-link { position: absolute; top: 16px; left: 18px; background: none; border: none; cursor: pointer;
  font-family: var(--font-cute); font-weight: 700; font-size: 14px; color: #b5894a; padding: 4px 6px; border-radius: 10px; }
.btn-link:hover { background: #fff0d6; color: var(--amber); }

/* Game code lives in the title; the invite-link button sits top-right. */
.room-share { position: absolute; top: 14px; right: 16px; display: flex; align-items: center; margin: 0; }
.roomcode { font-family: var(--font-cute); font-weight: 800; font-size: 23px; letter-spacing: 3px; color: var(--amber);
  cursor: copy; padding: 0 4px; border-radius: 8px; transition: background .12s; }
.roomcode:hover { background: #fff0d6; text-decoration: underline; }
.btn-sm { font-size: 12px; padding: 6px 12px; box-shadow: 0 3px 0 #e8c98c; }
.btn-sm:active { box-shadow: 0 1px 0 #e8c98c; }

.lobby-name { display: block; margin: 0 0 12px; }
.lobby-name span { margin-bottom: 3px; }
.lobby-name input { padding: 8px 14px; }
.section-label { color: #9a8160; font-weight: 700; font-size: 12px; letter-spacing: .5px;
  text-transform: uppercase; margin: 0 0 7px; }

/* Wardrobe groups: a label, a row of style chips (beanie/scarf), then colour swatches. */
.pick-group { margin: 0 0 12px; }
.pick-group .pick-label { display: block; width: auto; text-align: left; margin-bottom: 5px;
  font-weight: 700; font-size: 13px; color: #8a6f4a; }
.types { display: flex; gap: 6px; margin-bottom: 7px; }
.type-chip { font-family: var(--font-cute); font-weight: 700; font-size: 12px; cursor: pointer;
  padding: 5px 11px; border: none; border-radius: 999px; background: #fff0d6; color: #8a6f4a;
  box-shadow: inset 0 0 0 1px #f0dcb8; transition: transform .1s, background .12s; }
.type-chip:hover { transform: translateY(-1px); }
.type-chip.selected { background: linear-gradient(180deg, #ffce6e, var(--amber)); color: #fff; box-shadow: 0 2px 0 #c9842a; }

/* Lobby chat input — messages appear as bubbles over the characters (see .char-bubble) */
.chat-line { width: 100%; margin: 6px 0 4px; }
.hint { color: #b79a6e; font-size: 13px; margin-top: 8px; }

/* Ready + Start launch row */
.lobby-launch { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 10px; }
/* Ready button: a bright GREEN call-to-action until you're readied up... */
.ready-btn { background: linear-gradient(180deg, #8fe07a, #4ea043); color: #fff; box-shadow: 0 4px 0 #3a7a32; }
.ready-btn:hover { background: linear-gradient(180deg, #98e684, #54a949); }
.ready-btn:active { box-shadow: 0 1px 0 #3a7a32; }
/* ...then a calmer "confirmed" green once ready, so your status reads at a glance. */
.ready-btn.is-ready { background: #eafae6; color: #357a2e; box-shadow: inset 0 0 0 2px #8fe07a, 0 4px 0 #cfe9c4; }
.ready-btn.is-ready:hover { background: #e0f6da; }
.ready-btn.is-ready:active { box-shadow: inset 0 0 0 2px #8fe07a, 0 1px 0 #cfe9c4; }

/* While readied up, the wardrobe is locked — dimmed + uninteractive, with a hint. */
.wardrobe.locked { pointer-events: none; }
.wardrobe.locked .wardrobe-tabs, .wardrobe.locked .wardrobe-panels { opacity: 0.4; }
.wardrobe.locked::after { content: '🔒 Unready to change your look'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 14px;
  font-family: var(--font-cute); font-weight: 700; font-size: 14px; color: #5f7a4f;
  background: rgba(255, 250, 241, 0.35); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.25); }
.btn:disabled:active { transform: none; }

/* ---- Lobby character select: four big slot boxes in a row + colour pickers ---- */
/* The top margin reserves headroom so the speech bubbles can pop ABOVE the avatars
   without overlapping the room-code row above. */
.char-boxes { display: flex; gap: 8px; margin: 54px 0 14px; }
/* No box chrome — just the avatar, a name tag over its head, and a bubble above. */
.char-box { position: relative; overflow: visible; flex: 1 1 0; display: flex; flex-direction: column;
  align-items: center; padding: 2px 4px; min-width: 0; }
.char-box.empty { opacity: .5; }
/* State cues without a box: tint the name tag — you = warm amber, ready = green (the
   rebuild appends a "✓" to a ready player's name). */
.char-box.you   .char-name { color: #f6c468; }
.char-box.ready .char-name { color: #92e58c; }
/* Name sits BELOW the avatar (a nameplate), styled like the in-game tag (warm-white +
   dark outline). `order` puts it after the canvas in the flex column. */
.char-name { order: 2; margin-top: 3px; z-index: 3;
  font-family: var(--font-cute); font-weight: 700; font-size: 17px; color: #fdf3e0;
  -webkit-text-stroke: 3px rgba(40,28,18,0.85); paint-order: stroke fill;
  /* horizontal padding so the text STROKE (which spills ~1.5px past the glyph) isn't
     clipped by overflow:hidden — otherwise the first/last letters look shaved. */
  padding: 0 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-box canvas { order: 1; width: 100%; height: 122px; display: block; }
/* Chat speech bubble — pops ABOVE the avatar (into the row's top margin) with a tail
   pointing down at it. The cream OUTER carries the tail; the inner <span> wraps + clamps
   to 3 lines (clamp needs overflow:hidden, which would otherwise eat the tail). */
.char-bubble { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 3px) scale(.96);
  width: max-content; max-width: calc(100% - 8px); box-sizing: border-box;
  background: #fffaf1; color: #3a2c1c; font-size: 11px; font-weight: 600; line-height: 1.28;
  padding: 4px 9px; border-radius: 11px; box-shadow: 0 4px 10px rgba(60,40,20,.45);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 8; text-align: center; }
.char-bubble span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  overflow: hidden; white-space: normal; overflow-wrap: break-word; }
.char-bubble.show { opacity: 1; transform: translate(-50%, -5px) scale(1); }
.char-bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid #fffaf1;
  filter: drop-shadow(0 2px 1px rgba(60,40,20,.3)); }
.customize { margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatches .swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: none; padding: 0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.6), 0 1px 3px rgba(0,0,0,.3); transition: transform .12s; }
.swatches .swatch:hover { transform: scale(1.14); }
.swatches .swatch.selected { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px #fff8, 0 0 0 4px currentColor; transform: scale(1.16); }

/* ============================================================= */
/* GAME overlay UI                                                */
/* ============================================================= */
#game { background: #000; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.subtitle-bar {
  position: fixed; left: 50%; bottom: 250px; transform: translateX(-50%);
  max-width: 70ch; padding: 12px 22px; border-radius: 16px;
  background: rgba(40, 28, 18, 0.74); color: #fff5e6;
  font-size: 18px; text-align: center; line-height: 1.4;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); backdrop-filter: blur(3px);
}

.banner {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  padding: 10px 26px; border-radius: 999px; font-family: var(--font-cute);
  font-weight: 700; font-size: 17px; color: var(--ink);
  background: rgba(255, 250, 241, 0.92); box-shadow: 0 4px 18px var(--shadow);
  transition: background .8s, color .8s;
}

/* Chat — just the input (bottom-RIGHT); messages appear as bubbles above players' heads. */
.chat { position: fixed; right: 18px; bottom: 18px; width: 280px; max-width: 42vw; z-index: 5; }
.chat-input {
  width: 100%; border-radius: 12px; opacity: 0.55; transition: opacity .15s;
  background: rgba(255,253,248,.9); border: 2px solid transparent;
}
.chat-input:focus { opacity: 1; border-color: var(--honey); }

/* HUD — health + inventory (bottom-LEFT). */
.hud { position: fixed; left: 18px; bottom: 18px; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.hp { width: 180px; height: 16px; border-radius: 999px; background: rgba(0,0,0,.4);
  overflow: hidden; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.hp span { display: block; height: 100%; width: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #f0a86a, #e5675c); transition: width .25s; }

/* Contextual interaction prompt */
.prompt {
  position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; z-index: 7;
  padding: 7px 16px 7px 8px; border-radius: 999px;
  background: rgba(20,14,8,.7); color: #fff3e0; font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
/* Keyless info prompts (no E glyph) — symmetric padding so the label isn't left-tight. */
.prompt.info { padding: 7px 16px; }
.prompt-key {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  border-radius: 7px; background: #ffe7bd; color: #4a3a22; font-weight: 800; font-size: 14px;
  box-shadow: 0 2px 0 #c9a767;
}

/* Current location name (top-left, above the checklist) */
.location-name {
  position: fixed; top: 16px; left: 16px; z-index: 7;
  font-family: var(--font-cute); font-weight: 700; font-size: 23px;
  color: var(--amber); background: rgba(20,14,9,.5); border-radius: 12px;
  padding: 6px 14px; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  letter-spacing: .3px; text-shadow: 0 1px 3px #000;
}

/* Cozy chore checklist */
.checklist {
  position: fixed; top: 80px; left: 16px; z-index: 6;
  background: rgba(255,250,241,.9); border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 6px 20px var(--shadow); min-width: 230px; font-size: 15px; color: var(--ink);
}
.checklist .cl-title { font-family: var(--font-cute); font-weight: 700; color: var(--amber);
  margin-bottom: 6px; font-size: 16px; }
.checklist .cl-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.checklist .cl-ic { flex: none; width: 1.5em; text-align: center; }   /* fixed icon column so labels always line up */
.checklist .cl-lbl { flex: 1; }
.checklist .cl-val { flex: none; font-weight: 700; color: #b5894a; }
.checklist .cl-row.done { opacity: .5; text-decoration: line-through; }
.checklist .cl-row.done .cl-val { color: var(--moss); }
/* Sub-steps (e.g. the stew's vegetables) — indented, a touch smaller and dimmer. */
.checklist .cl-row.cl-sub { padding: 1px 0 1px 14px; font-size: 13.5px; color: #6b5a44; }
.checklist .cl-row.cl-sub .cl-val { color: #b09060; min-width: 2.4em; text-align: right; }
.checklist .cl-row.cl-sub.done { opacity: .55; }

/* Persistent objective */
.objective {
  position: fixed; top: 58px; left: 50%; transform: translateX(-50%);
  padding: 7px 18px; border-radius: 12px; font-size: 14px; color: #ffeccb;
  background: rgba(20,14,8,.55); box-shadow: 0 2px 10px rgba(0,0,0,.4);
  max-width: 70ch; text-align: center; transition: color .8s;
}

/* Escape task */
.escape { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  width: min(420px, 80vw); text-align: center; z-index: 9; }
.escape-hint { color: #aef0c0; font-weight: 700; margin-bottom: 6px; text-shadow: 0 1px 3px #000; }
.escape-bar { height: 14px; border-radius: 999px; background: rgba(0,0,0,.5); overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }
.escape-bar span { display: block; height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #6fd6a0, #9fe6c0); transition: width .2s; }

/* Stew stir progress */
.stew { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  width: min(360px, 70vw); text-align: center; z-index: 9; }
.stew-hint { color: #ffe6b0; font-weight: 700; margin-bottom: 6px; text-shadow: 0 1px 3px #000; }
.stew-bar { height: 14px; border-radius: 999px; background: rgba(0,0,0,.5); overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }
.stew-bar span { display: block; height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #e8a13a, #ffce6e); transition: width .15s; }
.stew-bar.chop-bar span { background: linear-gradient(90deg, #8a5a32, #c98b4a); }

/* Wood-chopping finesse mini-game: a marker sweeps the track; hit E in the green zone. */
.chop-track { position: relative; height: 18px; border-radius: 999px; background: rgba(0,0,0,.55);
  margin-bottom: 7px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); overflow: hidden; }
.chop-zone { position: absolute; top: 2px; bottom: 2px; left: 40%; width: 22%;
  background: linear-gradient(180deg, #8fe07a, #4ea043); border-radius: 5px;
  box-shadow: 0 0 8px rgba(130,225,115,.7); }
.chop-marker { position: absolute; top: -2px; bottom: -2px; left: 0; width: 4px;
  background: #fff; border-radius: 2px; box-shadow: 0 0 7px #fff, 0 0 2px #fff; transform: translateX(-50%); }
.chop-track.hit { box-shadow: inset 0 0 0 2px rgba(150,240,130,.95); }
.chop-track.miss { box-shadow: inset 0 0 0 2px rgba(240,120,90,.95); }

/* Ending */
.ending { background: #000; z-index: 25; }
.ending .menu-card { width: min(540px, 92vw); }
.endtext { color: #b79a6e; line-height: 1.55; margin: 10px 0 16px; font-size: 15px; }

/* Fade-to-black helper used by phase transitions / death / finale. */
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none;
  transition: opacity 1.2s; z-index: 20; }

/* ---- Inventory ---- */
.inventory { display: flex; gap: 8px; }
.inv-slot { background: rgba(0,0,0,.42); border-radius: 12px; padding: 6px 12px;
  color: #fff3e0; font-family: var(--font-cute); font-weight: 700; font-size: 13px;
  min-width: 92px; text-align: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.inv-slot.empty { opacity: .5; }
.inv-slot .inv-name { display: block; }
.durability { height: 5px; border-radius: 3px; background: rgba(255,255,255,.15); margin-top: 4px; overflow: hidden; }
.durability span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg,#f0c46a,#e58a4a); transition: width .15s; }
.inv-slot.meds { min-width: 0; color: #ffd2d2; }

/* ---- Atmosphere overlays ---- */
.overlay-fx { position: fixed; inset: 0; pointer-events: none; z-index: 8; }
#vignette {
  /* opacity driven from JS via --dread/--mood blend */
  box-shadow: inset 0 0 18vw 6vw rgba(0,0,0,0.0);
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 38%, rgba(0,0,0,0.85) 100%);
  opacity: 0; transition: opacity .4s;
}
#hurtflash {
  /* red damage tint — opacity driven from JS (pulses on a hit) */
  background: radial-gradient(ellipse at center, rgba(150,0,0,0) 30%, rgba(170,10,10,0.9) 100%);
  opacity: 0; transition: opacity .12s ease-out; z-index: 9;
}
#hurtflash.fire {
  /* burning in the hearth: hot orange flames lick up from the bottom + a red sear */
  background:
    radial-gradient(ellipse at center, rgba(190,40,0,0) 22%, rgba(150,20,0,0.55) 100%),
    linear-gradient(to top, rgba(255,140,0,0.75) 0%, rgba(255,90,0,0.35) 18%, rgba(255,70,0,0) 42%);
  transition: opacity .05s linear;
}
#grain {
  opacity: 0; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ---- Downed / dead overlays ---- */
.state-overlay {
  position: fixed; inset: 0; z-index: 15; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 8px;
  color: #f5e6d6; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(60,0,0,0.15), rgba(0,0,0,0.55));
}
#downed { background: radial-gradient(ellipse at center, rgba(90,10,10,0.25), rgba(0,0,0,0.6)); }
.state-overlay h2 { font-family: var(--font-cute); font-size: 34px; margin: 0; }
.state-overlay p { margin: 2px; opacity: .85; }
.bleed { width: 260px; height: 10px; border-radius: 999px; background: rgba(255,255,255,.15); overflow: hidden; margin-top: 10px; }
.bleed span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg,#d65a5a,#7a1010); transition: width .2s; }
.revive-label { color: #aef0c0; font-weight: 700; }

/* ---- Options overlay (sound mix + rebindable controls) ---- */
.icon-btn { font-size: 20px; line-height: 1; background: #fff0d6; border: none; cursor: pointer;
  color: #b5894a; width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 3px 0 #e8c98c;
  transition: transform .1s, background .12s, color .12s; }
.icon-btn:hover { background: #ffe3b0; color: var(--amber); transform: rotate(25deg); }
.icon-btn:active { box-shadow: 0 1px 0 #e8c98c; }
.icon-btn-corner { position: absolute; top: 14px; right: 16px; }
.game-gear { position: fixed; top: 14px; right: 14px; z-index: 12; }

.options-screen { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; }
.opt-backdrop { position: absolute; inset: 0; background: rgba(28,18,10,.55); backdrop-filter: blur(3px); }
.opt-card { position: relative; z-index: 1; width: min(440px, 92vw); padding: 26px 30px 22px; text-align: left; }
.opt-card .subtitle { text-align: center; margin: 0 0 14px; }
.opt-section { margin: 0 0 16px; }
.opt-h { font-family: var(--font-cute); font-size: 15px; color: #8a6f4a; margin: 0 0 10px;
  border-bottom: 2px solid #f0dcb8; padding-bottom: 5px; }
.opt-h small { font-weight: 600; color: #b79a6e; font-size: 12px; }
.opt-row { display: flex; align-items: center; gap: 12px; margin: 0 0 9px; font-size: 14px; color: var(--ink); font-weight: 600; }
.opt-row > span { flex: 0 0 64px; }
.opt-row input[type=range] { flex: 1 1 0; accent-color: var(--amber); cursor: pointer; }
.opt-mute { gap: 8px; margin-top: 4px; }
.opt-mute > span { flex: 1 1 auto; }
.opt-mute input { accent-color: var(--amber); width: 16px; height: 16px; cursor: pointer; }

.opt-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.opt-ctl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.opt-ctl-label { font-size: 13px; color: var(--ink); font-weight: 600; }
.opt-key { font-family: var(--font-cute); font-weight: 700; font-size: 12px; min-width: 56px; cursor: pointer;
  padding: 5px 9px; border: none; border-radius: 9px; background: #fff0d6; color: #8a6f4a;
  box-shadow: inset 0 0 0 1px #f0dcb8; transition: background .12s, color .12s; }
.opt-key:hover { background: #ffe3b0; color: var(--amber); }
.opt-key.listening { background: linear-gradient(180deg, #ffce6e, var(--amber)); color: #fff; box-shadow: 0 2px 0 #c9842a; }

.opt-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
