/* IRONFALL — SNES-terminal aesthetic: dark steel, amber/green CRT phosphor */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  background: #0b0d11; color: #e8e4d8;
  font-family: "Courier New", monospace;
  height: 100%; overflow: hidden;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
#cabinet {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 8px; padding: 8px;
}
#screen-wrap {
  position: relative;
  width: min(96vw, 106vh * 1.3333);
  aspect-ratio: 4 / 3;
  background: #05060a;
  border: 6px solid #232a33;
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(255,176,0,0.08), inset 0 0 60px rgba(0,0,0,0.6);
  overflow: hidden;
}
#game { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
#scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.18) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; font-size: 11px; }
#hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between;
  padding: 4px 8px;
  background: rgba(8,10,14,0.75); border-bottom: 1px solid #c9a227;
  color: #ffb000; text-shadow: 0 0 6px rgba(255,176,0,0.6);
}
#hud-party { position: absolute; top: 24px; left: 6px; display: flex; gap: 6px; }
#hud-party .p { display: flex; flex-direction: column; background: rgba(8,10,14,0.7); padding: 2px 4px; border: 1px solid #39404a; }
#hud-party .p i { font-style: normal; font-size: 8px; color: #7df0ff; }
#hud-party .p b { display: block; height: 4px; background: #33ff66; }
#hud-party .p b.a { background: #ffb000; }
#hud-party .p b.r { background: #ff3b30; }
#hud-prompt {
  position: absolute; bottom: 4px; left: 8px; right: 8px;
  color: #33ff66; text-shadow: 0 0 6px rgba(51,255,102,0.5); font-size: 10px;
}

/* ---------- overlays / panels ---------- */
#overlay {
  position: absolute; inset: 0; pointer-events: auto;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 10px; background: rgba(0,0,0,0.25);
}
#overlay:empty { background: transparent; pointer-events: none; }
.panel {
  background: rgba(8,10,14,0.96); border: 2px solid #c9a227;
  padding: 10px 12px; min-width: 240px; max-width: 92%;
  max-height: 92%; overflow-y: auto;
  box-shadow: 0 0 24px rgba(201,162,39,0.25);
}
.panel.wide { width: 92%; }
.ptitle { color: #ffb000; font-weight: bold; font-size: 14px; margin-bottom: 6px;
  text-shadow: 0 0 8px rgba(255,176,0,0.6); letter-spacing: 1px; }
.ptitle.red { color: #ff3b30; text-shadow: 0 0 8px rgba(255,59,48,0.6); }
.ptitle.gold { color: #ffd75a; }
.psub { color: #9aa4b0; font-size: 10px; margin-bottom: 8px; line-height: 1.5; }
.mlist { display: flex; flex-direction: column; gap: 2px; }
.mi { padding: 4px 6px; font-size: 12px; color: #e8e4d8; cursor: pointer; }
.mi.sel { background: #1d2942; color: #ffd75a; }
.mi.dis { color: #4a5058; }
.pfoot { margin-top: 8px; font-size: 9px; color: #5a6470; }
.dim { color: #5a6470; } .ok { color: #33ff66; }
.risk { color: #ff8a7a; font-size: 9px; border: 1px solid #ff8a7a; padding: 0 3px; }
.bankrow { border-bottom: 1px solid #232a33; padding: 6px 2px; font-size: 11px; line-height: 1.6; }
.logline { font-size: 10px; color: #9fd8a8; padding: 4px 2px; border-bottom: 1px dashed #232a33; line-height: 1.5; }
.statrow { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 2px; }
.statrow b { color: #ffd75a; }

/* dialogue */
.dlg {
  background: rgba(8,10,14,0.96); border: 2px solid #33ff66;
  padding: 10px 12px; width: 94%;
  box-shadow: 0 0 24px rgba(51,255,102,0.2);
}
.dsp { color: #7df0ff; font-size: 11px; font-weight: bold; margin-bottom: 4px; }
.dtxt { font-size: 12px; line-height: 1.6; color: #e8e4d8; min-height: 40px; white-space: pre-wrap; }

/* cinematic */
.cine { display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  width: 100%; height: 100%; padding-bottom: 26px; }
.ctext {
  background: rgba(8,10,14,0.88); border: 1px solid #c9a227;
  padding: 12px 16px; width: 88%; font-size: 12px; line-height: 1.7; color: #e8e4d8;
}

/* battle menu */
.bmenu {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(8,10,14,0.96); border: 2px solid #c9a227;
  padding: 8px 10px; min-width: 190px;
}

/* toast */
#toast {
  position: absolute; top: 34px; left: 50%; transform: translateX(-50%);
  background: rgba(8,10,14,0.94); border: 1px solid #33ff66; color: #9fd8a8;
  padding: 6px 12px; font-size: 11px; max-width: 90%; text-align: center;
  text-shadow: 0 0 6px rgba(51,255,102,0.5); z-index: 30;
}

/* ---------- title ---------- */
#title-screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; padding-bottom: 8%;
  background: linear-gradient(transparent 30%, rgba(5,6,10,0.85) 75%);
}
#title-logo {
  font-size: 44px; font-weight: bold; letter-spacing: 8px; color: #ffb000;
  text-shadow: 0 0 18px rgba(255,176,0,0.8), 0 3px 0 #5a3a00;
}
#title-sub { font-size: 10px; color: #9aa4b0; letter-spacing: 3px; margin: 4px 0 14px; }
#title-menu .topt { display: flex; gap: 18px; }
#title-menu .topt span {
  border: 2px solid #c9a227; padding: 8px 18px; font-size: 13px; color: #ffd75a;
  cursor: pointer; background: rgba(8,10,14,0.8);
}
#title-menu .topt span:hover { background: #1d2942; }
#title-menu .tsub { text-align: center; font-size: 9px; color: #5a6470; margin-top: 8px; }
#title-help {
  position: absolute; bottom: 6px; left: 0; right: 0; text-align: center;
  font-size: 8px; color: #3d444d;
}

/* ---------- death ---------- */
#death-screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10,2,2,0.88); cursor: pointer;
}

/* ---------- touch controls ---------- */
#touch { width: min(96vw, 60vh); }
.tzone { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.tdpad { position: relative; width: 120px; height: 120px; }
.tdpad .tbtn { position: absolute; width: 38px; height: 38px; }
.tdpad .up { left: 41px; top: 0; } .tdpad .down { left: 41px; bottom: 0; }
.tdpad .left { left: 0; top: 41px; } .tdpad .right { right: 0; top: 41px; }
.tbtn {
  background: #1a212b; border: 2px solid #39404a; border-radius: 8px;
  color: #9aa4b0; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: bold; touch-action: none;
}
.tbtn.on { background: #33456b; border-color: #c9a227; color: #ffd75a; }
.tbtns { display: grid; grid-template-columns: repeat(2, 52px); gap: 8px; }
.tbtn.sm { width: 52px; height: 52px; border-radius: 50%; }
.tbtn.big { width: 64px; height: 64px; border-radius: 50%; grid-row: span 2; align-self: center;
  border-color: #c9a227; color: #ffd75a; }
.tsys { display: flex; flex-direction: column; gap: 8px; }
.tbtn.tiny { font-size: 9px; padding: 8px 10px; }
