/* ════════════════════════════════════════════════════════════════
   CRYPT CRAWLERS — game-style site. Boot → title → hunt → reveal.
   Full pixel typography (Press Start 2P + VT323).
   Palette: warm charcoal + torch amber. NO purple anywhere.
   ════════════════════════════════════════════════════════════════ */

:root {
  --bg:      #0c0a08;   /* scorched earth */
  --bg2:     #110e0b;
  --panel:   #171310;
  --panel2:  #1d1814;
  --line:    #2b241c;
  --text:    #e6dcc8;
  --dim:     #978b76;
  --dimmer:  #5e5648;
  --amber:   #ffb570;
  --amber2:  #ffd9a0;
  --gold:    #d4a93c;
  --ember:   #c2563a;
  --ghost:   #7be87b;
  --px:    "Press Start 2P", monospace;
  --mono:  "VT323", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: clip; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1.45;
}
img { display: block; max-width: 100%; }
.mono { font-family: var(--mono); }
.gold { color: var(--gold); }
.ember { color: var(--ember); }
.ghost { color: var(--ghost); }
.t-dim { color: var(--dim); }
.hidden { display: none !important; }

/* ── pixel buttons ─────────────────────────────────────────── */
.pxbtn {
  font-family: var(--px);
  font-size: 13px;
  color: var(--amber2);
  background: var(--panel2);
  border: 0;
  padding: 16px 26px;
  cursor: pointer;
  position: relative;
  box-shadow:
    0 -4px 0 0 var(--line), 0 4px 0 0 var(--line),
    -4px 0 0 0 var(--line), 4px 0 0 0 var(--line),
    inset 0 -4px 0 0 rgba(0,0,0,0.45);
  transition: transform .05s;
}
.pxbtn:hover { color: var(--amber); background: #241d17; }
.pxbtn:active { transform: translateY(2px); box-shadow:
    0 -4px 0 0 var(--line), 0 2px 0 0 var(--line),
    -4px 0 0 0 var(--line), 4px 0 0 0 var(--line),
    inset 0 -2px 0 0 rgba(0,0,0,0.45); }
.pxbtn:disabled { color: var(--dimmer); cursor: not-allowed; }
.pxbtn.big { font-size: 17px; padding: 22px 38px; animation: btnpulse 1.6s steps(2) infinite; }
.pxbtn.small { font-size: 10px; padding: 11px 16px; }
.pxbtn.ghostly { color: var(--dim); }
@keyframes btnpulse { 50% { color: var(--amber); } }

/* ── screens ───────────────────────────────────────────────── */
.screen { min-height: 100vh; min-height: 100dvh; }
#screen-boot, #screen-game, #screen-reveal {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}

/* ── boot ──────────────────────────────────────────────────── */
.boot-inner { text-align: center; padding: 24px; width: min(480px, 90vw); }
.boot-logo {
  font-family: var(--px);
  font-size: clamp(16px, 4vw, 26px);
  color: var(--amber);
  text-shadow: 0 0 22px rgba(255,181,112,0.5);
  margin-bottom: 34px;
  animation: bootflick 2s steps(3) infinite;
}
@keyframes bootflick { 60% { opacity: 1; } 70% { opacity: 0.75; } 80% { opacity: 1; } }
.boot-bar {
  height: 22px; border: 4px solid var(--line);
  background: var(--bg2); padding: 3px;
}
.boot-fill {
  height: 100%; width: 0%;
  background: repeating-linear-gradient(90deg, var(--amber) 0 8px, var(--ember) 8px 16px);
  transition: width .18s steps(4);
}
.boot-line { margin-top: 14px; color: var(--dim); font-size: 19px; }

/* ── title screen ──────────────────────────────────────────── */
#screen-title { position: relative; z-index: 10; }
.title-head {
  position: sticky; top: 0; z-index: 12;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  background: rgba(12,10,8,0.93);
  border-bottom: 2px solid var(--line);
}
.pill {
  font-size: 18px; color: var(--dim);
  border: 2px solid var(--line);
  padding: 4px 12px;
}
.pill.is-live { color: var(--ghost); border-color: var(--ghost); text-shadow: 0 0 10px rgba(123,232,123,0.5); }

.title-core {
  min-height: calc(100vh - 60px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; text-align: center; padding: 40px 20px 30px;
  position: relative;
  background:
    radial-gradient(ellipse 70% 45% at 50% 38%, rgba(255,181,112,0.07), transparent 70%),
    var(--bg);
}
.game-logo {
  font-family: var(--px);
  font-size: clamp(30px, 8vw, 64px);
  line-height: 1.25;
  color: var(--amber);
  text-shadow:
    4px 4px 0 #3a2417,
    0 0 36px rgba(255,181,112,0.45);
}
.tagline { color: var(--dim); font-size: clamp(18px, 2.6vw, 22px); }

.title-specimen { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.title-specimen img {
  width: clamp(160px, 26vw, 230px);
  image-rendering: pixelated;
  border: 4px solid var(--line);
  box-shadow: 0 0 44px rgba(255,181,112,0.18);
}
.specimen-tag { font-size: 17px; color: var(--dimmer); max-width: 270px; }

.start-sub { color: var(--dim); font-size: 19px; }

.lore-door {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel);
  border: 2px dashed var(--gold);
  color: var(--gold);
  padding: 12px 18px;
  cursor: pointer;
  font-size: 18px;
}
.door-art { font-size: 26px; }

.title-nav { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.nav-btn { color: var(--dim); }
.nav-btn:hover { color: var(--amber); }

/* ── game-menu panels (no page scroll — screens, like a game) ── */
.panel {
  position: fixed; inset: 0; z-index: 16;
  background: var(--bg);
  overflow-y: auto;
  padding: 70px 20px 60px;
}
.panel > * { max-width: 1080px; margin-left: auto; margin-right: auto; }
.panel-back {
  position: fixed; top: 12px; left: 14px; z-index: 17;
}
.panel .px-h2 { margin-bottom: 26px; }
.px-h2 {
  font-family: var(--px);
  font-size: clamp(13px, 3vw, 19px);
  color: var(--amber);
  text-align: center;
  margin-bottom: 26px;
}
.sec-sub { text-align: center; color: var(--dim); margin: -14px 0 24px; }

.how-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.how-card {
  background: var(--panel);
  border: 2px solid var(--line);
  padding: 18px 16px;
}
.how-card .hnum { font-family: var(--px); font-size: 12px; color: var(--ember); margin-bottom: 10px; }
.how-card b { color: var(--amber2); font-weight: normal; }
.how-note { text-align: center; margin-top: 18px; color: var(--dim); }

.gallery {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.dweller-card { background: var(--panel); border: 2px solid var(--line); padding: 8px; }
.dweller-card img { width: 100%; height: auto; image-rendering: pixelated; }
.dweller-card.is-cursed { border-color: #2c4a2c; }
.dweller-name { font-size: 18px; color: var(--amber2); margin-top: 8px; }
.dweller-sub { font-size: 16px; color: var(--dimmer); }

.ladder {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.tier { background: var(--panel); border: 2px solid var(--line); padding: 10px; text-align: center; }
.tier img { width: 100%; image-rendering: pixelated; }
.tier figcaption { margin-top: 8px; font-size: 17px; color: var(--dim); line-height: 1.3; }

.road { display: grid; gap: 12px; max-width: 640px; margin: 0 auto; }
.road-step { border: 2px solid var(--line); background: var(--panel); padding: 16px 18px; color: var(--dim); }
.road-step b { color: var(--text); }
.road-step.is-now { border-color: var(--amber); }
.road-step.is-now b { color: var(--amber); }

.foot { text-align: center; border-top: 2px solid var(--line); padding-top: 22px; color: var(--dim); display: grid; gap: 6px; font-size: 18px; }
.foot-stats { color: var(--amber2); }

/* ── game screen ───────────────────────────────────────────── */
#screen-game { padding: 0; }
.stage {
  position: relative;
  width: 100vw; height: 100vh; height: 100dvh;
  background: #070604;
  touch-action: none;
  overflow: hidden;
  cursor: none;
}
canvas { display: block; width: 100%; height: 100%; }
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  font-size: clamp(20px, 3.6vw, 26px);
  color: var(--amber2);
  text-shadow: 0 0 10px rgba(255,181,112,0.5);
  pointer-events: none; z-index: 3;
}
.hud .haul { color: var(--gold); }
#hud-stolen { color: var(--ember); }

.overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center;
  background: rgba(7,6,4,0.88);
  padding: 24px;
  cursor: auto;
}
.ov-body { font-size: clamp(19px, 3vw, 23px); max-width: 520px; line-height: 1.4; }
.ov-body .gold { color: var(--gold); }
.ov-btns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.ov-status { min-height: 26px; color: var(--dim); max-width: 480px; }
.ov-status.is-err { color: var(--ember); }
.ov-status.is-ok { color: var(--ghost); }

/* ── reveal ────────────────────────────────────────────────── */
.reveal-inner {
  text-align: center; padding: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  max-width: 720px;
}
.reveal-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.r-chest {
  width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
  background: var(--panel);
  border: 3px solid var(--line);
  transition: border-color .3s, box-shadow .3s;
}
.r-chest.is-free { border-color: var(--gold); box-shadow: 0 0 22px rgba(212,169,60,0.5); }
.r-chest.is-paid { border-color: var(--dim); }

@media (max-width: 560px) {
  .pxbtn.big { font-size: 14px; padding: 18px 26px; }
  body { font-size: 19px; }
}

/* ── MY DWELLERS + THE PITS ─────────────────────────────────── */
#screen-pits { position: fixed; inset: 0; z-index: 20; overflow-y: auto; background: var(--bg); }
.pits-inner { max-width: 760px; margin: 0 auto; padding: 56px 18px 40px; text-align: center; }
.pits-sub { color: var(--dim); font-size: 19px; margin: 10px 0 22px; }
.pits-arena { display: flex; align-items: center; justify-content: center; gap: 18px; }
.fighter { width: 230px; }
.fighter img { width: 100%; image-rendering: pixelated; border: 3px solid var(--line); background: #060503; transition: transform .08s; }
.fighter.hit img { transform: translateX(6px); border-color: var(--ember); }
.fighter.guard img { border-color: var(--gold); }
.fighter.down img { filter: grayscale(1) brightness(.5); transform: rotate(90deg) scale(.8); }
.f-name { font-size: 17px; color: var(--text); margin-bottom: 6px; min-height: 38px; }
.hpbar { height: 14px; border: 2px solid var(--line); background: #060503; margin-bottom: 8px; }
.hpfill { height: 100%; width: 100%; background: var(--ghost); transition: width .25s steps(8); }
.hpfill.foe { background: var(--ember); }
.vs { font-family: 'Press Start 2P', monospace; color: var(--gold); font-size: 22px; }
.pits-log { margin: 18px auto 14px; max-width: 540px; min-height: 86px; max-height: 86px; overflow: hidden;
  border: 2px solid var(--line); background: var(--panel); padding: 8px 12px; text-align: left;
  font-size: 17px; line-height: 1.45; color: var(--dim); display: flex; flex-direction: column; justify-content: flex-end; }
.pits-log .hitline { color: var(--amber); }
.pits-controls { display: flex; gap: 12px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.pits-controls .pxbtn[disabled] { opacity: .35; }
.pits-foot { display: flex; gap: 16px; justify-content: center; align-items: center; }
#pitsStreak { color: var(--gold); font-size: 18px; }
.mine-card .pxbtn { margin-top: 8px; width: 100%; }
@media (max-width: 620px) {
  .pits-arena { gap: 8px; }
  .fighter { width: 40vw; }
}

/* ── nav rows + pits powers ─────────────────────────────────── */
.title-nav { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.nav-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.holder-row .pxbtn { border-color: #5a4a2c; color: var(--gold); }
.small-h { font-size: 16px; margin: 26px 0 10px; }
.pits-mode { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.pits-mode .pxbtn.is-on { color: var(--gold); border-color: var(--gold); }
.pits-controls .pxbtn.locked { opacity: .28; filter: grayscale(.7); }
.pits-blood { color: var(--dim); font-size: 17px; margin: 2px 0 12px; }
.pits-law { max-width: 560px; margin: 26px auto 0; text-align: left; font-size: 18px; line-height: 1.5;
  border-top: 2px solid var(--line); padding-top: 6px; color: var(--text); }
.pits-law p { margin: 8px 0; }
.fighter.phasing img { opacity: .45; border-color: var(--ghost); }

/* ── pit records + vault ────────────────────────────────────── */
.pits-records { max-width: 560px; margin: 26px auto 0; text-align: left; font-size: 18px;
  border-top: 2px solid var(--line); padding-top: 6px; }
.rec-row { display: flex; gap: 10px; padding: 5px 8px; border-bottom: 1px solid var(--line); align-items: baseline; }
.rec-row .r-rank { width: 36px; color: var(--gold); }
.rec-row .r-wallet { flex: 1; color: var(--text); }
.rec-row .r-wl { width: 86px; color: var(--dim); }
.rec-row .r-pts { width: 90px; text-align: right; color: var(--amber); }
.rec-row.is-you { background: rgba(212,169,60,0.08); border-left: 3px solid var(--gold); }
.vault-card .pxbtn { width: 100%; margin-top: 8px; }

.gifting-line { color: var(--gold); font-size: 19px; margin-top: -8px; text-shadow: 0 0 12px rgba(212,169,60,0.35); }

.pits-gate { max-width: 480px; margin: 0 auto 22px; padding: 14px; border: 2px solid var(--gold);
  background: var(--panel); font-size: 19px; color: var(--text); }
.pits-gate .ov-btns { margin-top: 12px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

#osBtn { text-decoration: none; display: inline-block; }
.foot-link { color: var(--gold); text-decoration: none; }
.foot-link:hover { text-shadow: 0 0 8px rgba(212,169,60,0.5); }

.ledger-strip { max-width: 520px; margin: 0 auto 14px; padding: 8px 12px; font-size: 18px;
  display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap;
  border: 2px solid var(--gold); color: var(--gold); background: rgba(212,169,60,0.07); }
.ledger-strip.is-signed { border-color: var(--ghost); color: var(--ghost); background: rgba(123,232,123,0.05); }

.altar-banner { color: var(--ember); font-size: 18px; margin: -6px 0 14px; text-shadow: 0 0 10px rgba(194,86,58,0.4); }
#oathBtn { border-color: var(--ember); color: var(--ember); }
.mine-card .sac-btn { border-color: var(--ember); color: var(--ember); margin-top: 6px; width: 100%; }

/* ── the pixel modal — in-game dialogs, no browser popups ──── */
.pxmodal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.78); padding: 18px;
}
.pxmodal-box {
  width: min(560px, 94vw); max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 3px solid var(--gold);
  box-shadow: 0 0 0 3px #000, 0 0 38px rgba(212,169,60,0.22);
  padding: 22px 24px 26px; text-align: center;
}
.pxmodal-box.is-grave { border-color: var(--ember); box-shadow: 0 0 0 3px #000, 0 0 38px rgba(194,86,58,0.3); }
.pxm-body { font-size: 19px; line-height: 1.5; color: var(--text); margin: 14px 0 20px; white-space: pre-line; }
.pxm-body .gold { color: var(--gold); }
.pxm-body .ember { color: var(--ember); }
.pxm-body .ghost { color: var(--ghost); }
.pxm-btns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pxm-btns .pxbtn.grave { border-color: var(--ember); color: var(--ember); }
.pxm-btns .pxbtn.grave:hover { color: var(--amber); }

/* ── the oath button, always seen — locked until worthy ────── */
#oathBtn.is-locked { opacity: .42; filter: grayscale(.6); }
.oath-hint { font-size: 15px; color: var(--dim); width: 100%; text-align: center; }

/* the prize stock gallery */
#vaultGrid .dweller-card { opacity: .92; }
#vaultMore { margin-top: 10px; font-size: 17px; }
#vaultAuto { color: var(--gold); font-size: 18px; padding: 8px 12px;
  border: 2px solid var(--gold); background: rgba(212,169,60,0.07);
  text-shadow: 0 0 10px rgba(212,169,60,0.3); }
