/* ============================================================
   AI GAMING SYSTEM — retro console / CRT stylesheet
   All styling lives here (contract: no inline styles, no CDN).
   ============================================================ */

:root {
  --green:       #3dff7c;
  --green-soft:  #9af5b8;
  --green-dim:   #2a9d57;
  --green-faint: #15522e;
  --ink:         #d6efdc;   /* readable narration text */
  --amber:       #ffb454;
  --gold:        #ffd76a;
  --red:         #ff4f5e;
  --bg-0:        #020503;
  --bg-1:        #04130a;
  --panel:       #06170d;
  --panel-2:     #081e11;
  --line:        #134d2b;
  --line-bright: #1f7a44;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--mono);
  color: var(--green-soft);
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, #0a2415 0%, var(--bg-1) 45%, var(--bg-0) 100%) fixed;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
}

/* ---------- CRT overlay: scanlines + vignette + faint flicker ---------- */

#crt { position: fixed; inset: 0; pointer-events: none; z-index: 1000; }
#crt::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0)    0px,
    rgba(0,0,0,0)    2px,
    rgba(0,0,0,.20)  2px,
    rgba(0,0,0,.20)  3px);
  animation: crt-flicker 4s steps(60) infinite;
}
#crt::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,.5) 100%),
    linear-gradient(rgba(61,255,124,.025), rgba(61,255,124,.025));
}
@keyframes crt-flicker {
  0%, 100% { opacity: 1; } 50% { opacity: .96; } 73% { opacity: .98; }
}

/* ------------------------------ chrome -------------------------------- */

#chrome { position: fixed; top: .6rem; right: .8rem; z-index: 1100; display: flex; gap: .6rem; align-items: center; }
#mute-btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--green);
  font-size: 1rem; line-height: 1; padding: .45rem .55rem; cursor: pointer; border-radius: 4px;
}
#mute-btn:hover { border-color: var(--line-bright); box-shadow: 0 0 8px rgba(61,255,124,.25); }
#mute-btn.muted { color: var(--green-dim); opacity: .7; }
#mock-badge {
  border: 1px dashed var(--amber); color: var(--amber); padding: .3rem .6rem;
  font-size: .7rem; letter-spacing: .25em; border-radius: 3px; background: rgba(255,180,84,.06);
}

/* ------------------------------ generic ------------------------------- */

.hidden { display: none !important; }

.screen { max-width: 1160px; margin: 0 auto; padding: 2.2rem 1.4rem 3rem; position: relative; }

h1, h2, h3 { font-weight: 700; margin: 0; }

button { font-family: var(--mono); }

.btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--green);
  padding: .7rem 1.5rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .2em;
  cursor: pointer; border-radius: 3px; transition: box-shadow .15s, border-color .15s, transform .05s;
  text-shadow: 0 0 6px rgba(61,255,124,.45);
}
.btn:hover:not(:disabled) { border-color: var(--line-bright); box-shadow: 0 0 14px rgba(61,255,124,.28), inset 0 0 10px rgba(61,255,124,.07); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.primary {
  background: linear-gradient(180deg, #0b2c18, #07200f);
  border-color: var(--line-bright); color: #c8ffd9;
  box-shadow: 0 0 18px rgba(61,255,124,.22);
}
.btn.ghost { background: transparent; border-color: var(--green-faint); color: var(--green-dim); text-shadow: none; }
.btn.ghost:hover:not(:disabled) { color: var(--green); }
.btn.blink { animation: soft-blink 1.4s steps(2) infinite; }
.btn.blink:disabled { animation: none; }
@keyframes soft-blink { 0%,60% { opacity: 1; } 61%,100% { opacity: .55; } }

.corner-back { position: absolute; top: 1.1rem; left: 1.2rem; padding: .45rem .9rem; font-size: .72rem; }

.error-box {
  margin: 1rem auto; max-width: 640px; border: 1px solid var(--red); border-radius: 4px;
  background: rgba(255,79,94,.07); color: #ffb9bf; padding: .9rem 1.1rem;
  display: flex; align-items: center; gap: 1rem; justify-content: space-between; font-size: .85rem;
}
.error-box .btn { border-color: var(--red); color: #ffb9bf; text-shadow: none; flex-shrink: 0; }

.empty-note { color: var(--green-dim); font-size: .8rem; padding: .8rem .4rem; font-style: italic; }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.4); }
::-webkit-scrollbar-thumb { background: var(--green-faint); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-dim); }
* { scrollbar-width: thin; scrollbar-color: var(--green-faint) rgba(0,0,0,.4); }

/* ============================== BOOT =================================== */

.boot-head { text-align: center; margin-bottom: 2.4rem; }

.logo {
  font-size: clamp(2rem, 6vw, 4.2rem);
  letter-spacing: .3em; color: #b9ffd2; padding-left: .3em; /* offset tracking */
  text-shadow:
    0 0 6px  rgba(61,255,124,.9),
    0 0 18px rgba(61,255,124,.45),
    0 0 48px rgba(61,255,124,.28),
    0 0 90px rgba(61,255,124,.18);
  animation: logo-pulse 3.6s ease-in-out infinite;
}
@keyframes logo-pulse {
  0%, 100% { text-shadow: 0 0 6px rgba(61,255,124,.9), 0 0 18px rgba(61,255,124,.45), 0 0 48px rgba(61,255,124,.28); }
  50%      { text-shadow: 0 0 8px rgba(61,255,124,1),  0 0 26px rgba(61,255,124,.6),  0 0 70px rgba(61,255,124,.4); }
}

.tagline { margin-top: .8rem; color: var(--green-dim); letter-spacing: .35em; font-size: .8rem; }

.health { margin-top: 1rem; font-size: .72rem; letter-spacing: .2em; color: var(--green-dim); }
.led {
  display: inline-block; width: .6em; height: .6em; border-radius: 50%; margin-right: .6em;
  background: #555; vertical-align: baseline;
}
.led.ok   { background: var(--green); box-shadow: 0 0 8px var(--green); animation: led-breathe 2.4s ease-in-out infinite; }
.led.down { background: var(--red);   box-shadow: 0 0 8px var(--red); }
@keyframes led-breathe { 50% { opacity: .55; } }

/* ----- cartridge slot ----- */

.slot {
  position: relative; max-width: 620px; margin: 0 auto 2.6rem; padding: 2.2rem 1.5rem 1.8rem;
  border: 2px dashed rgba(61,255,124,.35); border-radius: 10px; text-align: center;
  cursor: pointer; transition: border-color .2s, box-shadow .2s, background .2s;
  background: rgba(61,255,124,.025);
}
.slot:hover, .slot:focus-visible, .slot.dragover {
  border-color: var(--green); outline: none;
  box-shadow: 0 0 30px rgba(61,255,124,.18), inset 0 0 40px rgba(61,255,124,.05);
  background: rgba(61,255,124,.05);
}
.slot.dragover .cart-gfx { transform: translateY(10px); }
.slot.inserting .cart-gfx { animation: cart-insert .6s ease-in forwards; }
@keyframes cart-insert { to { transform: translateY(34px); opacity: 0; } }
.slot.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-7px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }

.cart-gfx { display: flex; justify-content: center; transition: transform .25s ease; }
.cart-body {
  width: 170px; padding: 14px 12px 10px; background: linear-gradient(180deg, #0d2818, #081c10);
  border: 1px solid var(--line-bright); border-bottom: none;
  border-radius: 8px 8px 0 0; box-shadow: 0 0 18px rgba(61,255,124,.12);
}
.cart-label {
  border: 1px solid var(--green-faint); border-radius: 4px; padding: .55rem .4rem;
  font-size: .68rem; letter-spacing: .3em; color: var(--green); line-height: 1.7;
  background: rgba(0,0,0,.35); text-shadow: 0 0 6px rgba(61,255,124,.5);
}
.cart-grooves { display: flex; justify-content: center; gap: 7px; margin-top: 9px; }
.cart-grooves i { width: 26px; height: 4px; background: var(--green-faint); border-radius: 2px; }

.slot-mouth {
  height: 12px; max-width: 260px; margin: 0 auto; border: 1px solid var(--line-bright);
  border-radius: 3px; background: linear-gradient(180deg, #000, #06170d);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.9), 0 0 10px rgba(61,255,124,.15);
}

.slot-label { margin-top: 1.2rem; letter-spacing: .35em; font-size: 1rem; color: var(--green); text-shadow: 0 0 8px rgba(61,255,124,.6); }
.slot-sub { margin-top: .5rem; font-size: .72rem; color: var(--green-dim); letter-spacing: .08em; }
.slot-error { margin-top: .8rem; color: #ffb9bf; font-size: .78rem; }

/* ----- memory card shelf & saves ----- */

.boot-section { max-width: 860px; margin: 0 auto 1.8rem; }
.section-title {
  font-size: .85rem; letter-spacing: .3em; color: var(--green); margin-bottom: .7rem;
  border-bottom: 1px solid var(--green-faint); padding-bottom: .45rem;
  text-shadow: 0 0 8px rgba(61,255,124,.4);
}
.section-sub { float: right; color: var(--green-dim); font-size: .65rem; letter-spacing: .12em; text-shadow: none; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.mem-card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: .8rem .9rem .7rem; cursor: pointer; text-align: left;
  transition: transform .12s, box-shadow .15s, border-color .15s; overflow: hidden;
  color: var(--green-soft); font-family: var(--mono);
}
.mem-card::before { /* memory-card notch */
  content: ""; position: absolute; top: 0; right: 14px; width: 26px; height: 7px;
  background: var(--green-faint); border-radius: 0 0 4px 4px;
}
.mem-card:hover { transform: translateY(-3px); border-color: var(--line-bright); box-shadow: 0 6px 18px rgba(0,0,0,.5), 0 0 14px rgba(61,255,124,.18); }
.mem-card .mc-title { font-size: .82rem; color: #c8ffd9; margin: .15rem 0 .4rem; line-height: 1.35; max-height: 3.4em; overflow: hidden; }
.mem-card .mc-meta { font-size: .66rem; color: var(--green-dim); letter-spacing: .08em; }
.mem-card .mc-rom { color: var(--amber); }
.mem-card .mc-thumb { width: 100%; height: 64px; object-fit: cover; border-radius: 3px; border: 1px solid var(--green-faint); margin-bottom: .45rem; display: block; }

.saves { display: flex; flex-direction: column; gap: .45rem; }
.save-row {
  display: flex; align-items: center; gap: .9rem; background: var(--panel);
  border: 1px solid var(--line); border-radius: 5px; padding: .6rem .9rem;
}
.save-load {
  flex: 1; display: flex; align-items: baseline; gap: .9rem; flex-wrap: wrap;
  background: none; border: none; color: var(--green-soft); cursor: pointer; text-align: left;
  font-family: var(--mono); font-size: .8rem; padding: 0;
}
.save-load:hover:not(:disabled) .sv-title { color: #c8ffd9; text-shadow: 0 0 8px rgba(61,255,124,.5); }
.save-load:disabled { opacity: .35; cursor: default; }
.sv-slot { color: var(--amber); font-size: .68rem; letter-spacing: .15em; }
.sv-title { color: var(--green); }
.sv-meta { color: var(--green-dim); font-size: .68rem; }
.sv-ended { color: var(--gold); font-size: .68rem; letter-spacing: .12em; }
.save-del {
  background: none; border: 1px solid transparent; color: var(--green-dim); cursor: pointer;
  font-size: .85rem; padding: .15rem .45rem; border-radius: 3px;
}
.save-del:hover { color: var(--red); border-color: var(--red); }

.boot-foot { text-align: center; margin-top: 2.6rem; color: var(--green-faint); font-size: .65rem; letter-spacing: .25em; }

/* ============================= COMPILE ================================= */

.compile-head { text-align: center; margin-bottom: 1.2rem; }
#compile-title {
  font-size: clamp(1.3rem, 3.4vw, 2.1rem); letter-spacing: .35em; color: #c8ffd9;
  text-shadow: 0 0 10px rgba(61,255,124,.7), 0 0 30px rgba(61,255,124,.3);
}
#compile-title .dots i { animation: dot-blink 1.2s steps(1) infinite; }
#compile-title .dots i:nth-child(2) { animation-delay: .4s; }
#compile-title .dots i:nth-child(3) { animation-delay: .8s; }
@keyframes dot-blink { 0%,40% { opacity: 1; } 41%,100% { opacity: .15; } }
#compile-title.compiled { color: var(--gold); text-shadow: 0 0 10px rgba(255,215,106,.6), 0 0 30px rgba(255,215,106,.25); }
.compile-book { margin-top: .55rem; color: var(--green-dim); font-size: .78rem; letter-spacing: .12em; }

.stages {
  display: flex; justify-content: center; gap: 2.2vw; list-style: none; margin: 0 0 1.1rem; padding: 0;
  font-size: .7rem; letter-spacing: .22em;
}
.stages li { color: var(--green-faint); display: flex; align-items: center; gap: .5em; transition: color .3s; }
.st-dot { width: .65em; height: .65em; border: 1px solid currentColor; border-radius: 50%; display: inline-block; }
.stages li.active { color: var(--green); text-shadow: 0 0 8px rgba(61,255,124,.6); }
.stages li.active .st-dot { background: var(--green); box-shadow: 0 0 8px var(--green); animation: led-breathe 1s ease-in-out infinite; }
.stages li.done { color: var(--green-dim); }
.stages li.done .st-dot { background: var(--green-dim); }

/* the phosphor terminal — the demo magic */
.terminal {
  height: 52vh; min-height: 260px; overflow-y: auto;
  background: linear-gradient(180deg, rgba(0,8,3,.97), rgba(0,12,5,.97));
  border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.2rem;
  font-size: .8rem; line-height: 1.55; color: var(--green);
  white-space: pre-wrap; word-break: break-word;
  text-shadow: 0 0 5px rgba(61,255,124,.55);
  box-shadow: inset 0 0 60px rgba(0,0,0,.75), 0 0 22px rgba(61,255,124,.08);
  transition: height .5s ease, min-height .5s ease, opacity .5s ease;
}
.terminal.collapsed { height: 90px; min-height: 90px; opacity: .55; font-size: .68rem; }
.terminal .tline { color: var(--amber); text-shadow: 0 0 6px rgba(255,180,84,.5); }
.terminal .tline.ok { color: var(--green-soft); }
.terminal .tw.cur::after { content: "\2588"; animation: cursor-blink 1s steps(1) infinite; color: var(--green); }
@keyframes cursor-blink { 0%,49% { opacity: 1; } 50%,100% { opacity: 0; } }

/* ----- title card ----- */

.title-card { text-align: center; margin-top: 1.6rem; animation: card-in .7s ease both; }
@keyframes card-in { from { opacity: 0; transform: translateY(18px); } }

.art-wrap { position: relative; max-width: 560px; margin: 0 auto 1.2rem; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line-bright); box-shadow: 0 0 30px rgba(61,255,124,.15); background: #000; }
.art-wrap img { display: block; width: 100%; height: 280px; object-fit: cover; }
.art-wrap img.hidden { display: none; }

.art-fallback {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem;
  height: 280px; padding: 1rem;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(61,255,124,.18), transparent 60%),
    linear-gradient(160deg, #06170d 0%, #02090486 60%, #041309 100%);
}
.ft-title {
  font-size: clamp(1.3rem, 4vw, 2.2rem); letter-spacing: .25em; color: #d9ffe6; text-transform: uppercase;
  text-shadow: 0 0 12px rgba(61,255,124,.8), 0 0 40px rgba(61,255,124,.35); line-height: 1.5;
}
.ft-sub { color: var(--green-dim); font-size: .75rem; letter-spacing: .3em; text-transform: uppercase; }
.ft-ornament { color: var(--green-dim); letter-spacing: 1.2em; padding-left: 1.2em; font-size: .8rem; }

#card-title { font-size: clamp(1.5rem, 4vw, 2.4rem); letter-spacing: .2em; color: var(--gold);
  text-shadow: 0 0 14px rgba(255,215,106,.5); text-transform: uppercase; }
#card-subtitle { margin-top: .5rem; font-size: .9rem; color: var(--green); letter-spacing: .15em; font-weight: 400; }
#card-premise { max-width: 640px; margin: 1.1rem auto 0; color: var(--ink); font-size: .88rem; line-height: 1.75; }
.card-role { margin-top: .8rem; color: var(--amber); font-size: .8rem; letter-spacing: .1em; }

.card-actions { margin-top: 1.6rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
#press-start { font-size: 1rem; padding: .9rem 2.6rem; }
.art-job { margin-top: .8rem; color: var(--amber); font-size: .72rem; letter-spacing: .12em; }

/* =============================== PLAY ================================== */

#screen-play { max-width: 1280px; padding-top: 1.2rem; }

.play-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1.1rem; align-items: start; }

.play-main { display: flex; flex-direction: column; gap: .9rem; min-width: 0; }

/* scene art panel */
.scene-panel {
  position: relative; height: 230px; border: 1px solid var(--line-bright); border-radius: 7px;
  overflow: hidden; background: #000; box-shadow: 0 0 26px rgba(61,255,124,.1);
}
.scene-panel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scene-fb { height: 100%; }
.scene-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: .45rem .9rem;
  background: linear-gradient(transparent, rgba(0,0,0,.85)); color: var(--green-soft);
  font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; text-shadow: 0 1px 3px #000;
}
.scene-caption:empty { display: none; }

/* narration log */
.log {
  height: 42vh; min-height: 260px; overflow-y: auto;
  background: rgba(0, 10, 4, .82); border: 1px solid var(--line); border-radius: 7px;
  padding: 1.1rem 1.3rem; font-size: .92rem; line-height: 1.8; color: var(--ink);
  box-shadow: inset 0 0 50px rgba(0,0,0,.6);
}
.turn-block { margin-bottom: 1.3rem; }
.action-echo { color: var(--green-dim); font-size: .78rem; letter-spacing: .1em; margin-bottom: .45rem; }
.action-echo::before { content: "\25B6 "; color: var(--green); }
.narr { white-space: pre-wrap; word-break: break-word; }
.narr .ntext.cur::after { content: "\258C"; color: var(--green); animation: cursor-blink 1s steps(1) infinite; }
.crawl {
  color: var(--gold); font-style: italic; border-left: 2px solid var(--amber);
  padding: .2rem 0 .2rem 1rem; margin-bottom: 1.3rem; white-space: pre-wrap;
  text-shadow: 0 0 8px rgba(255,215,106,.25); line-height: 1.85;
}
.sys-note { color: var(--green-dim); font-size: .72rem; font-style: italic; margin: .4rem 0 1rem; letter-spacing: .08em; }

/* choices */
.choices { display: flex; flex-direction: column; gap: .5rem; }
.choice {
  display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px;
  color: var(--green-soft); padding: .65rem .9rem; font-size: .85rem; cursor: pointer;
  font-family: var(--mono); transition: border-color .12s, box-shadow .12s, background .12s;
}
.choice:hover:not(:disabled) {
  border-color: var(--line-bright); background: var(--panel-2);
  box-shadow: 0 0 12px rgba(61,255,124,.2); color: #d9ffe6;
}
.choice:disabled { opacity: .4; cursor: default; }
.choice .key {
  flex-shrink: 0; width: 1.7em; height: 1.7em; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--green-dim); border-radius: 3px; color: var(--green); font-size: .78rem;
  text-shadow: 0 0 6px rgba(61,255,124,.6);
}
.choice .choice-text { line-height: 1.45; }

/* free action input */
.action-form {
  display: flex; align-items: center; gap: .7rem; background: var(--panel);
  border: 1px solid var(--line); border-radius: 5px; padding: .35rem .5rem .35rem .9rem;
}
.prompt-char { color: var(--green); font-size: 1.1rem; text-shadow: 0 0 8px rgba(61,255,124,.7); }
#action-input {
  flex: 1; background: transparent; border: none; outline: none; color: var(--ink);
  font-family: var(--mono); font-size: .88rem; padding: .45rem 0; caret-color: var(--green);
}
#action-input::placeholder { color: var(--green-faint); }
#action-input:disabled { opacity: .5; }
.action-form:focus-within { border-color: var(--line-bright); box-shadow: 0 0 12px rgba(61,255,124,.18); }
#action-go { padding: .5rem 1.1rem; font-size: .75rem; }

/* HUD */
.hud {
  position: sticky; top: 1rem; display: flex; flex-direction: column; gap: .8rem;
  background: rgba(4, 16, 9, .75); border: 1px solid var(--line); border-radius: 7px;
  padding: 1rem .95rem; box-shadow: inset 0 0 30px rgba(0,0,0,.5);
}
.hud-title {
  font-size: .78rem; letter-spacing: .18em; color: var(--gold); text-transform: uppercase;
  text-align: center; line-height: 1.5; text-shadow: 0 0 8px rgba(255,215,106,.4);
  border-bottom: 1px solid var(--green-faint); padding-bottom: .7rem;
}
.hud-block h3 {
  font-size: .62rem; letter-spacing: .3em; color: var(--green-dim); margin-bottom: .45rem; font-weight: 400;
}
.hud-location { color: var(--green-soft); font-size: .82rem; }
.hud-quest { color: #d9ffe6; font-size: .82rem; line-height: 1.4; }
.hud-quest-goal { color: var(--green-dim); font-size: .68rem; line-height: 1.5; margin-top: .25rem; }
.hud-quest-n { color: var(--green-dim); font-size: .65rem; letter-spacing: .15em; margin-top: .3rem; }

.bar { height: 9px; background: rgba(0,0,0,.55); border: 1px solid var(--green-faint); border-radius: 4px; overflow: hidden; margin-top: .5rem; }
.bar-fill { height: 100%; width: 0%; border-radius: 3px; transition: width .6s ease, background .4s; background: linear-gradient(90deg, #1d7a42, var(--green)); box-shadow: 0 0 8px rgba(61,255,124,.5); }
.bar-fill.quest { background: linear-gradient(90deg, #7a5a1d, var(--amber)); box-shadow: 0 0 8px rgba(255,180,84,.4); }
.bar-fill.warn { background: linear-gradient(90deg, #7a5a1d, var(--amber)); box-shadow: 0 0 8px rgba(255,180,84,.5); }
.bar-fill.crit { background: linear-gradient(90deg, #7a1d27, var(--red)); box-shadow: 0 0 8px rgba(255,79,94,.55); }

.stat-row { margin-bottom: .65rem; }
.stat-row .stat-line { display: flex; justify-content: space-between; font-size: .72rem; }
.stat-row .stat-name { color: var(--green-soft); letter-spacing: .08em; text-transform: uppercase; }
.stat-row .stat-val { color: var(--green); }

.hud-inv { list-style: none; margin: 0; padding: 0; font-size: .76rem; color: var(--ink); }
.hud-inv li { padding: .18rem 0; }
.hud-inv li::before { content: "\25C6 "; color: var(--amber); font-size: .65rem; }
.hud-inv li.none { color: var(--green-faint); font-style: italic; }
.hud-inv li.none::before { content: ""; }

.hud-turns { text-align: center; color: var(--green-faint); font-size: .65rem; letter-spacing: .2em; }
#play-quit { font-size: .68rem; padding: .5rem; }

/* ========================= GAME OVER OVERLAY =========================== */

.overlay {
  position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center;
  background: rgba(1, 5, 2, .88); backdrop-filter: blur(3px); animation: overlay-in .5s ease both;
}
@keyframes overlay-in { from { opacity: 0; } }

.go-box { max-width: 620px; padding: 2.5rem 2rem; text-align: center; }
.go-title {
  font-size: clamp(2.4rem, 8vw, 4.6rem); letter-spacing: .28em; padding-left: .28em;
  text-transform: uppercase; animation: go-zoom .6s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes go-zoom { from { transform: scale(.4); opacity: 0; } }
.overlay.victory .go-title {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255,215,106,.9), 0 0 40px rgba(255,215,106,.5), 0 0 90px rgba(255,180,84,.35);
}
.overlay.defeat .go-title {
  color: var(--red);
  text-shadow: 0 0 12px rgba(255,79,94,.9), 0 0 40px rgba(255,79,94,.5), 0 0 90px rgba(255,79,94,.3);
}
.go-text { margin: 1.4rem 0 0; color: var(--ink); font-size: .92rem; line-height: 1.8; white-space: pre-wrap; }
.go-actions { margin-top: 2.2rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.overlay.victory .btn.primary { border-color: var(--amber); color: var(--gold); box-shadow: 0 0 18px rgba(255,215,106,.25); }
.overlay.defeat .btn.primary { border-color: var(--red); color: #ffb9bf; box-shadow: 0 0 18px rgba(255,79,94,.25); }

/* ============================ responsive =============================== */

@media (max-width: 920px) {
  .play-grid { grid-template-columns: 1fr; }
  .hud { position: static; order: 2; }
  .log { height: 38vh; }
  .scene-panel { height: 180px; }
  .stages { flex-wrap: wrap; gap: .8rem 1.4rem; }
}
