/* Project Yellow Maze - interface: industrial, minimal, utilitarian.
   Steel/dark panel framing, chunky amber/yellow readouts, green for good. */

:root {
  --amber: #f0c030;
  --amber-dim: #a8862a;
  --green: #5ce06a;
  --green-dim: #2f7a38;
  --red: #e05040;
  --steel-hi: #6e6d64;
  --steel: #3c3b35;
  --steel-lo: #1d1c18;
  --screen: #0f100c;
  --text: #e4e0cc;
  --dim: #8a8774;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #050504;
  overflow: hidden;
  color: var(--text);
  font-family: 'VT323', ui-monospace, monospace;
  -webkit-font-smoothing: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#screen {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 960px;
  height: 720px;
  transform-origin: 50% 50%;
  background: #000;
  overflow: hidden;
  cursor: crosshair;
}
body[data-screen='play'] #screen { cursor: none; }

/* ---------------------------------------------------------------- view */
#view {
  position: absolute;
  left: 0;
  top: 0;
  width: 960px;
  height: 560px;
  overflow: hidden;
  background: #000;
}
#view3d {
  width: 960px;
  height: 560px;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transform-origin: 50% 50%;
}
#fx-vignette, #fx-hurt {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#fx-vignette {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.85) 100%);
  opacity: 0.35;
}
#fx-hurt {
  background: radial-gradient(ellipse at center, rgba(120, 0, 0, 0) 45%, rgba(150, 10, 0, 0.75) 100%);
  opacity: 0;
}
#automap {
  position: absolute;
  inset: 0;
  width: 960px;
  height: 560px;
  display: none;
}
#automap.show { display: block; }

#floorname {
  position: absolute;
  left: 24px;
  top: 20px;
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: 26px;
  color: var(--amber);
  text-shadow: 3px 3px 0 #000;
  opacity: 0;
  pointer-events: none;
}
#floorname small {
  display: block;
  font-family: 'VT323', monospace;
  font-weight: 400;
  font-size: 24px;
  color: var(--text);
}
#floorname.show { animation: floorname 6s ease forwards; }
@keyframes floorname {
  0% { opacity: 0; transform: translateY(-6px); }
  10%, 75% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

#subtitles {
  position: absolute;
  left: 60px;
  right: 60px;
  bottom: 18px;
  text-align: center;
  pointer-events: none;
}
.sub {
  display: inline-block;
  margin: 4px auto 0;
  padding: 2px 12px;
  font-size: 25px;
  line-height: 1.15;
  background: rgba(0, 0, 0, 0.62);
  color: var(--text);
  text-shadow: 2px 2px 0 #000;
  animation: subin 0.3s ease;
  max-width: 100%;
}
.sub + .sub { display: table; }
.sub.out { opacity: 0; transition: opacity 0.6s; }
.sub-thought { color: #d8d2b8; font-style: italic; }
.sub-intercom { color: var(--amber); }
.sub-tape { color: #a8f0a8; }
.sub-tape b { color: var(--green); font-weight: normal; }
.sub-phone { color: #9ad8e8; }
.sub-hint { color: #fff; font-size: 22px; background: rgba(40, 40, 20, 0.75); }
@keyframes subin { from { opacity: 0; transform: translateY(4px); } }

/* ---------------------------------------------------------------- HUD */
#hud {
  position: absolute;
  left: 0;
  top: 560px;
  width: 960px;
  height: 122px;
  display: flex;
  gap: 4px;
  padding: 6px 6px 4px;
  background: linear-gradient(#45443c, #2a2924 8%, #1f1e1a 92%, #121210);
  border-top: 2px solid #6e6d64;
}
.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 4px 6px 6px;
  background: linear-gradient(#34332d, #23221e);
  border: 2px solid;
  border-color: var(--steel-hi) var(--steel-lo) var(--steel-lo) var(--steel-hi);
  box-shadow: inset 0 0 0 1px #000;
}
.panel::before, .panel::after {
  /* rivets */
  content: '';
  position: absolute;
  top: 3px;
  width: 3px;
  height: 3px;
  background: #8a897e;
  box-shadow: 0 0 0 1px #111;
}
.panel::before { left: 3px; }
.panel::after { right: 3px; }
.lbl {
  text-align: center;
  font-size: 21px;
  color: #d6d2bf;
  letter-spacing: 1px;
  line-height: 20px;
  height: 22px;
}
.scr {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--screen);
  border: 2px solid;
  border-color: #070705 #4a4940 #4a4940 #070705;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}
.num {
  font-size: 46px;
  line-height: 40px;
  text-shadow: 0 0 6px currentColor;
}
.num.sm { font-size: 34px; }
.green { color: var(--green); }
.amber { color: var(--amber); }
#p-health { width: 132px; }
#p-focus { width: 158px; }
#p-battery { width: 146px; }
#p-key { width: 100px; }
#p-obj { flex: 1; }
#p-inv { width: 196px; }
#p-health.low .num { color: var(--red); animation: blink 0.8s steps(2) infinite; }
#hud-ecg { width: 52px; height: 26px; image-rendering: pixelated; }

.fbar {
  width: 82px;
  height: 22px;
  border: 2px solid #4a3a10;
  padding: 2px;
  background: #0a0a06;
}
#b-focus {
  height: 100%;
  width: 70%;
  background: repeating-linear-gradient(90deg, var(--amber) 0 3px, transparent 3px 5px);
  box-shadow: 0 0 6px rgba(240, 192, 48, 0.5);
  transition: width 0.3s;
}
#p-focus.low #b-focus { background: repeating-linear-gradient(90deg, var(--red) 0 3px, transparent 3px 5px); }
#p-focus.low .num { color: var(--red); }

.batt {
  position: relative;
  width: 50px;
  height: 22px;
  border: 2px solid var(--green-dim);
  padding: 2px;
  background: #050a05;
}
.batt::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 5px;
  width: 4px;
  height: 8px;
  background: var(--green-dim);
}
#b-batt {
  height: 100%;
  width: 100%;
  background: repeating-linear-gradient(90deg, var(--green) 0 4px, transparent 4px 6px);
  transition: width 0.3s;
}
#p-battery.low #b-batt { background: repeating-linear-gradient(90deg, var(--red) 0 4px, transparent 4px 6px); }
#p-battery.low .num { color: var(--red); }
#p-battery.on .batt { box-shadow: 0 0 8px rgba(92, 224, 106, 0.6); }
#p-battery.on .lbl::after { content: ' \2022'; color: var(--green); }

#i-key { width: 52px; height: 52px; object-fit: contain; image-rendering: pixelated; visibility: hidden; }
#v-keyn { position: absolute; right: 12px; bottom: 8px; font-size: 22px; color: var(--amber); }

#v-obj {
  padding: 2px 8px;
  text-align: center;
  font-size: 23px;
  line-height: 21px;
  color: var(--amber);
  text-shadow: 0 0 5px rgba(240, 192, 48, 0.45);
}
#v-obj.new { animation: objnew 1.6s steps(2) 3; }
@keyframes objnew { 50% { color: #fff6c8; } }

.slots { flex: 1; display: flex; gap: 6px; justify-content: center; }
.slot { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.slot span { font-size: 18px; color: #b8b4a0; line-height: 16px; }
.slot .box {
  position: relative;
  width: 54px;
  height: 54px;
  background: var(--screen);
  border: 2px solid;
  border-color: #070705 #5a594f #5a594f #070705;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot img { max-width: 44px; max-height: 44px; image-rendering: pixelated; visibility: hidden; }
.slot b { position: absolute; right: 3px; bottom: 0; font-weight: normal; font-size: 20px; color: var(--amber); }

body:not(.inrun) #hud, body:not(.inrun) #prompt { visibility: hidden; }

/* ---------------------------------------------------------------- prompt strip */
#prompt {
  position: absolute;
  left: 0;
  top: 682px;
  width: 960px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(#141410, #0b0b09);
  border-top: 1px solid #2c2b25;
  font-size: 27px;
  letter-spacing: 1px;
  color: var(--text);
}
#prompt-icon img { height: 26px; image-rendering: pixelated; display: block; }
#prompt.flash { color: #fff8d8; }
#prompt.p-locked, #prompt.p-power { color: #f0d8a0; }
#prompt.p-check { color: #b8f0b8; }

/* ---------------------------------------------------------------- overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 10;
}
.overlay.show { display: block; }
.overlay.dimmed { background: rgba(4, 4, 2, 0.72); }

.steel {
  background: linear-gradient(#4a4942, #2a2925);
  border: 3px solid;
  border-color: #7a796e #151410 #151410 #7a796e;
  padding: 8px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.8), inset 0 0 0 1px #000;
}
.steel { display: flex; flex-direction: column; }
.steel > .inner {
  flex: 1;
  background: #12130e;
  border: 2px solid;
  border-color: #060604 #4a4940 #4a4940 #060604;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.9);
  height: 100%;
  padding: 18px 22px;
}
h2 {
  margin: 0 0 12px;
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: 26px;
  color: var(--amber);
  letter-spacing: 2px;
}
h3 { margin: 10px 0 6px; font-size: 24px; font-weight: normal; color: var(--amber); }
.dim { color: var(--dim); }
p { margin: 6px 0; font-size: 22px; line-height: 1.1; }

/* menus */
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  font-family: 'Silkscreen', monospace;
  font-size: 22px;
  color: var(--amber);
  cursor: pointer;
  white-space: pre;
  padding: 2px 0;
}
.menu-item .cur { visibility: hidden; display: inline-block; width: 28px; color: var(--amber); }
.menu-item.sel .cur { visibility: visible; }
.menu-item.sel .txt { color: #fff3b8; text-shadow: 0 0 8px rgba(240, 192, 48, 0.7); }
.menu-item.disabled { color: #5a4c22; cursor: default; }
.menu-sep { font-family: 'Silkscreen', monospace; color: #6a5420; font-size: 18px; padding-left: 28px; }
.menu-hint { font-size: 22px; color: #cfc9b0; min-height: 26px; }
.menu-hint.bottom { position: absolute; left: 0; right: 0; bottom: 30px; text-align: center; text-shadow: 2px 2px 0 #000; }

/* title */
#title .logo {
  position: absolute;
  right: 40px;
  top: 34px;
  text-align: right;
}
#title h1 {
  margin: 0;
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: 58px;
  line-height: 54px;
  color: var(--amber);
  text-shadow: 4px 4px 0 #1a1404, 0 0 18px rgba(240, 192, 48, 0.35);
  letter-spacing: 2px;
}
#title .logo p { font-size: 24px; color: #e8e2c8; margin-top: 8px; text-shadow: 2px 2px 0 #000; letter-spacing: 2px; }
.menu-panel { position: absolute; left: 36px; top: 36px; width: 330px; height: 470px; }
#title .menu-panel .inner { padding-top: 30px; }
.title-foot {
  position: absolute;
  left: 0;
  right: 0;
  top: 560px;
  height: 160px;
  padding: 18px 30px;
  background: linear-gradient(#2a2924, #121210);
  border-top: 2px solid #6e6d64;
}
.foot-row { display: flex; justify-content: space-between; font-size: 22px; color: #bdb8a0; margin-top: 10px; }
.title-foot .menu-hint { color: var(--amber); font-size: 26px; }

.menu-panel.center { left: 50%; top: 60px; transform: translateX(-50%); height: auto; min-height: 380px; width: 380px; }
.menu-panel.center.wide { width: 620px; }
.side-panel { position: absolute; right: 40px; top: 60px; width: 230px; }
#pause-stats { font-size: 22px; line-height: 1.25; color: #cfc9b0; }

/* journal */
.journal-panel { position: absolute; left: 60px; right: 60px; top: 40px; bottom: 40px; }
.journal-panel .inner { display: flex; flex-direction: column; }
#journal-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
#journal-tabs span {
  font-family: 'Silkscreen', monospace;
  font-size: 18px;
  padding: 4px 12px;
  border: 2px solid #3a3a30;
  color: var(--dim);
  cursor: pointer;
}
#journal-tabs span.on { color: #12130e; background: var(--amber); border-color: var(--amber); }
#journal-body { flex: 1; overflow: auto; font-size: 22px; }
.jgrid { display: flex; flex-wrap: wrap; gap: 10px; }
.jitem { display: flex; align-items: center; gap: 10px; min-width: 250px; padding: 6px 10px; background: #1a1b15; border: 1px solid #33332a; }
.jitem img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.jlist { display: flex; flex-direction: column; gap: 4px; }
.jrow { font-size: 26px; color: var(--amber); cursor: pointer; }
.jrow .cur { visibility: hidden; display: inline-block; width: 24px; }
.jrow.sel .cur { visibility: visible; }
.jrow.dim { color: #5a4c22; }
.jfoot { margin-top: 10px; font-size: 20px; color: var(--dim); }
.controls p { font-size: 24px; }
.controls b { color: var(--amber); font-weight: normal; }

/* reader */
.reader-panel { position: absolute; left: 70px; right: 70px; top: 60px; bottom: 60px; }
.reader-panel .inner { display: flex; gap: 26px; align-items: flex-start; }
#reader-img { width: 250px; image-rendering: pixelated; filter: drop-shadow(4px 6px 0 rgba(0, 0, 0, 0.6)); transform: rotate(-3deg); margin-top: 20px; }
.reader-body { flex: 1; }
#reader-text { white-space: pre-wrap; font-family: 'VT323', monospace; font-size: 28px; line-height: 1.15; color: #e8e2c8; margin: 0; min-height: 300px; }

/* boot */
#boot { background: #000; padding: 26px 34px; cursor: pointer; }
#boot-text { margin: 0; font-family: 'VT323', monospace; font-size: 24px; line-height: 22px; color: #bdbdbd; white-space: pre; }
#boot-press { position: absolute; bottom: 40px; left: 0; right: 0; text-align: center; font-size: 30px; color: #fff; visibility: hidden; }
#boot-press.show { visibility: visible; animation: blink 1s steps(2) infinite; }

/* cards */
#card { background: #000; display: none; }
#card.show { display: flex; align-items: center; justify-content: center; }
#card-text { text-align: center; font-family: 'Silkscreen', monospace; font-size: 26px; line-height: 40px; color: var(--amber); }
#card-text div:nth-child(n + 3) { color: #e8e2c8; }
#card-text.in { animation: cardin 1.2s ease; }
@keyframes cardin { from { opacity: 0; letter-spacing: 6px; } }

#ending { background: #000; padding: 50px 80px; }
#ending-text { font-size: 30px; line-height: 1.2; color: #e8e2c8; }
#ending-text > div { animation: subin 1s ease; }
.end-stats { margin-top: 26px; }
.end-stats h2 { font-size: 24px; }
.end-stats .unlock { color: var(--green); }
.end-stats .credits { color: var(--dim); font-size: 20px; margin-top: 16px; }
.blink { animation: blink 1s steps(2) infinite; color: #fff; }
@keyframes blink { 50% { opacity: 0; } }

#fatal { display: none; position: absolute; inset: 0; z-index: 50; margin: 0; padding: 30px; background: #0000aa; color: #fff; font-family: 'VT323', monospace; font-size: 22px; white-space: pre-wrap; }

/* ---------------------------------------------------------------- CRT */
body.crt #screen::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.025) 0%, rgba(0, 0, 0, 0.32) 100%);
  mix-blend-mode: multiply;
  animation: crt 0.12s steps(2) infinite;
}
@keyframes crt { 50% { opacity: 0.94; } }

/* ---------------------------------------------------------------- touch */
#touch-ui { display: none; }
body.touch #touch-ui { display: block; }
body:not([data-screen='play']) #touch-ui { display: none; }
#touch-look { position: absolute; left: 40%; right: 0; top: 0; bottom: 0; }
#touch-stick {
  position: absolute;
  left: 40px;
  bottom: 40px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px solid rgba(240, 192, 48, 0.45);
  background: rgba(0, 0, 0, 0.25);
}
#touch-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  background: rgba(240, 192, 48, 0.55);
}
#touch-btns { position: absolute; right: 24px; bottom: 30px; display: flex; flex-direction: column; gap: 10px; }
#touch-btns button {
  width: 96px;
  height: 52px;
  font-family: 'Silkscreen', monospace;
  font-size: 18px;
  color: var(--amber);
  background: rgba(20, 20, 14, 0.75);
  border: 2px solid var(--amber-dim);
}
