:root {
  color-scheme: dark;
  font-family: "Courier New", monospace;
  background: #15100c;
  color: #f2e8d0;
  --yellow: #ffcc17;
  --near-black: #11140e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #fff5bb; outline-offset: 3px; }
.workstation {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
  overflow: hidden;
  background: #24160d;
}
.desk {
  position: relative;
  container-type: inline-size;
  width: max(109vw, min(187svh, 120vw));
  aspect-ratio: 1672 / 941;
  flex: none;
}
@media (pointer: fine) {
  .workstation {
    height: 100svh;
    background:
      linear-gradient(#201310db, #28170fbb),
      url("assets/nec-desk-wide.jpg") center / cover;
  }
}
@media (pointer: fine) and (min-aspect-ratio: 19/10) {
  .desk { width: 190svh; }
}
.room {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
}
.monitor {
  position: absolute;
  left: 22.4%;
  top: 9.77%;
  width: 37.82%;
  height: 51.1%;
  border-radius: 3.1% / 4.2%;
  overflow: hidden;
  background: #0b1009;
  box-shadow: inset 0 0 15px #030503, 0 0 12px #a17e3429;
  container-type: inline-size;
}
.glass {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  outline: none;
}
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse, transparent 69%, #06080264),
    repeating-linear-gradient(0deg, transparent 0 2px, #0809001f 2px 3px);
  box-shadow: inset 0 0 9px 2px #10100585;
}
canvas {
  display: block;
  background: #25291a;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.power {
  position: absolute;
  left: 77.85%;
  top: 50.25%;
  width: 1.9%;
  height: 3%;
  background: transparent;
  border: 0;
  border-radius: 10%;
}
.power:hover { box-shadow: 0 0 12px #ffe8a886; }
.sticky-note {
  position: absolute;
  z-index: 3;
  top: 34.5%;
  left: 68.85%;
  width: 8.9%;
  aspect-ratio: 1.2;
  display: grid;
  align-content: start;
  gap: 0.25em;
  padding: 0.7em 0.52em 0.55em 0.64em;
  border: 0;
  color: #32273d;
  background: linear-gradient(174deg, #fae69e 0%, #ffe69d 75%, #f5d887 100%);
  box-shadow: 1px 3px 4px #3e271ea6, inset 0 1px #fff3b6;
  transform: rotate(-4deg);
  transform-origin: 82% 7%;
  transition: transform 150ms ease-out;
  font: 700 clamp(8px, 0.88cqw, 20px)/0.98 "Bradley Hand", "Segoe Print", "Chalkboard SE", "Comic Sans MS", cursive;
  text-align: left;
  white-space: nowrap;
}
.sticky-note strong {
  font-size: 1.35em;
  text-decoration: underline;
  text-underline-offset: 0.09em;
  text-decoration-thickness: 1px;
}
.sticky-note span:nth-child(3) { transform: rotate(1.3deg); }
.sticky-note span:nth-child(4) { transform: rotate(-1.5deg); }
.sticky-note:hover, .sticky-note:focus-visible { transform: rotate(-2deg) scale(1.3); }
.desk-keys { position: absolute; inset: 0; pointer-events: none; }
.desk-key {
  position: absolute;
  left: calc(var(--key-x) * 1cqw);
  top: calc(var(--key-y) * 1cqw);
  width: calc(var(--key-w) * 1cqw);
  height: calc(var(--key-h) * 1cqw);
  padding: 0;
  border: 0;
  border-radius: 9%;
  background: transparent;
  color: #42270a;
  touch-action: none;
  pointer-events: auto;
}
.desk-key::before {
  content: "";
  position: absolute;
  inset: 4% -2% -7%;
  border-radius: 15% 15% 20% 20%;
  background: #2f1d12cc;
  box-shadow: inset 0 2px 2px #160e08a0, 0 0 4px #84400c8a;
  opacity: 0;
  pointer-events: none;
}
.desk-key > span {
  position: absolute;
  inset: 0;
  display: grid;
  justify-content: center;
  align-content: start;
  padding-top: 0.12cqw;
  border-radius: inherit;
  text-shadow: 0 1px #ffda9180;
  background-image: url("assets/nec-desk-wide.jpg");
  background-size: 100cqw auto;
  background-position: calc(var(--key-x) * -1cqw) calc(var(--key-y) * -1cqw);
  font: 900 max(7px, 0.62cqw)/1 "Courier New", monospace;
  transition: transform 115ms cubic-bezier(.22,.72,.31,1.2), filter 90ms ease, box-shadow 90ms ease;
  pointer-events: none;
}
.desk-key:hover > span { filter: brightness(1.15); box-shadow: inset 0 0 0 1px #ffdd8a9c; }
.desk-key:is(.is-pressed, :active)::before { opacity: 1; }
.desk-key.is-pressed > span, .desk-key:active > span {
  transform: translateY(27%) scaleX(0.95) scaleY(0.9);
  filter: brightness(0.82) saturate(1.22);
  box-shadow: 0 -0.28cqw 0.23cqw #2a190edd, inset 0 -0.12cqw #ffdb6d8c;
  transition: transform 34ms ease-out, filter 32ms linear, box-shadow 32ms linear;
}
.desk-key-up { --key-x: 56.16; --key-y: 49.22; --key-w: 2.15; --key-h: 1.45; }
.desk-key-left { --key-x: 53.89; --key-y: 50.12; --key-w: 2.33; --key-h: 1.79; }
.desk-key-down { --key-x: 56.28; --key-y: 50.12; --key-w: 2.04; --key-h: 1.79; }
.desk-key-right { --key-x: 58.37; --key-y: 50.12; --key-w: 2.27; --key-h: 1.79; }
.desk-key-space { --key-x: 26.67; --key-y: 50.12; --key-w: 15.13; --key-h: 1.73; }
.game-menu, .hud { position: absolute; inset: 0; }
.game-menu {
  display: grid;
  align-items: safe center;
  justify-items: center;
  z-index: 4;
  background: radial-gradient(ellipse at 49% 48%, #121e14e6 4%, #171707c9 52%, #070904f5 90%);
  text-align: center;
  padding: 4cqw 6cqw;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  touch-action: pan-y;
}
.game-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(113deg, #b4ba161a, transparent 35%),
    repeating-linear-gradient(140deg, transparent 0 19px, #e8c5480b 19px 22px, transparent 22px 53px);
  pointer-events: none;
}
.cover, .panel { position: relative; width: min(100%, 520px); }
.cover {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2.3cqw;
}
.wordmark {
  color: #10100a;
  background: #ffcb05;
  padding: 0.75cqw 1.45cqw 0.7cqw;
  line-height: 1;
  filter: drop-shadow(0 2px 0 #925913) drop-shadow(0 0 10px #f7ce2340);
}
.wordmark > span {
  position: relative;
  display: block;
  border-block: max(1px, 0.35cqw) solid #10100a;
  padding: 0.26cqw 0.25cqw 0.29cqw;
  font: 1000 clamp(19px, 6cqw, 46px)/0.93 "Arial Black", Impact, sans-serif;
  letter-spacing: -0.085em;
}
.wordmark .brand-e { font-size: 0.81em; }
.wordmark sup { position: absolute; right: -0.86em; top: 0.6em; font: bold 0.19em/1 sans-serif; }
.cover h1 {
  position: relative;
  margin: 0 0 1.6cqw;
  font: 1000 italic clamp(44px, 16.9cqw, 160px)/0.74 Impact, "Arial Black", "Arial Narrow", sans-serif;
  letter-spacing: -0.065em;
  color: #ffdf35;
  text-shadow: 0.04em 0.04em #a66018, 0.08em 0.08em #1f200c, 0.1em 0.12em #000b;
  transform: skewX(-5deg);
}
.main-button, .secondary-button {
  min-height: max(34px, 7.5cqw);
  padding: 1.2cqw 2.8cqw;
  color: #151304;
  border: 1px solid #fff07e;
  background: var(--yellow);
  font-size: max(13px, 3cqw);
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 #090a04;
}
.main-button:hover { background: #ffe976; }
.main-button kbd {
  margin-left: 0.5ch;
  padding: 0.1em 0.22em;
  border: 1px solid #18140385;
  font-size: 0.72em;
}
.menu-link, .secondary-button {
  color: #f1e5bb;
  background: #1c2112;
  border-color: #706b43;
}
.menu-link {
  min-height: 28px;
  padding: 0.3em 0.65em;
  font-weight: bold;
  font-size: max(12px, 2.45cqw);
  background: transparent;
  border: 0;
  text-transform: uppercase;
}
.menu-link:hover, .secondary-button:hover { color: var(--yellow); }
.cover-links { display: flex; gap: 1cqw; }
.mission-list {
  display: grid;
  gap: 0.7cqw;
  width: min(80%, 390px);
}
.mission-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35em 0.5em;
  min-height: max(25px, 6cqw);
  padding: 0.5cqw 1.7cqw;
  text-align: left;
  font-size: max(11px, 2.45cqw);
  letter-spacing: -0.025em;
}
.mission-list button small {
  color: #ffcf47;
  font-size: 0.78em;
  letter-spacing: normal;
  white-space: nowrap;
}
.mission-list button:disabled { opacity: 0.61; cursor: default; }
.mission-list button:disabled:hover { color: #f1e5bb; }
.mission-list button:disabled small { color: #bfae9f; }
.gear-list { width: min(91%, 420px); }
.gear-detail {
  grid-column: 1 / -1;
  color: #d3cfb6;
  font: normal 0.87em/1.2 "Courier New", monospace;
  text-transform: none;
}
.panel { display: grid; justify-items: center; gap: 2.1cqw; }
.panel h2, .panel p, .panel dl { margin: 0; }
.panel h2 {
  color: var(--yellow);
  text-transform: uppercase;
  font: 1000 clamp(26px, 7.5cqw, 68px)/0.95 Impact, "Arial Black", sans-serif;
  letter-spacing: 0.025em;
  text-shadow: 0 3px #4e2a09;
}
.panel p { font-size: max(12px, 3cqw); line-height: 1.35; max-width: 36ch; }
.panel p.reward { color: #bce791; font-weight: bold; }
.panel .eyebrow {
  font-size: max(11px, 2.45cqw);
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c9c891;
}
.menu-actions { display: flex; flex-wrap: wrap; gap: 1.5cqw; justify-content: center; }
.panel dl {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 1.2em;
  row-gap: 0.32em;
  text-align: left;
  font-size: max(11px, 2.68cqw);
}
.panel dt { color: #faf3d1; }
.panel dd { margin: 0; color: var(--yellow); }
.hud { z-index: 2; pointer-events: none; font-weight: 700; }
.hud-top {
  position: absolute;
  inset: 3% 4% auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: max(10px, 2.7cqw);
  text-shadow: 1px 2px #080a01;
}
.hud-location, .hud-goal {
  padding: 0.24em 0.45em;
  background: #10130cdb;
  border: 1px solid #b4ae653e;
}
.hud-route { display: grid; justify-items: start; gap: 0.42em; max-width: 71%; }
.hud-objective {
  padding: 0.28em 0.42em;
  border-left: max(2px, 0.44cqw) solid #ffd04c;
  background: #10130eeb;
  color: #ffdf73;
  font-size: max(10px, 2.38cqw);
  line-height: 1.04;
}
.hud-objective.ready { color: #ceffa9; border-color: #a2ec74; }
.hud-location b, .hud-goal b { margin-right: 0.46ch; color: var(--yellow); }
.hud-goal.ready { color: #d4ff92; }
.hud-message {
  position: absolute;
  left: 3.8%;
  bottom: 17%;
  width: fit-content;
  max-width: 57%;
  padding: 0.28em 0.52em;
  font-size: max(11px, 2.65cqw);
  line-height: 1.12;
  background: #111806e8;
  color: #ffda51;
  text-align: left;
  border: 1px solid #e6cf697a;
  text-shadow: 0 2px #010100;
}
.hud-message:empty { display: none; }
.hud-interact {
  position: absolute;
  left: 50%;
  bottom: 18%;
  display: flex;
  gap: 0.64em;
  align-items: center;
  width: max-content;
  max-width: 86%;
  padding: 0.42em 0.62em;
  border: 1px solid #f5ca5b;
  background: #101311f5;
  color: #fff2b0;
  font-size: max(10px, 2.5cqw);
  line-height: 1.08;
  transform: translateX(-50%);
  box-shadow: 0 3px #050806c0;
}
.hud-interact kbd {
  padding: 0.16em 0.3em;
  background: #f6c843;
  color: #1d1704;
  font-weight: 900;
}
.hud:has(.hud-interact:not([hidden])) .hud-message {
  bottom: 28%;
}
.hud-chain {
  position: absolute;
  right: 4%;
  top: 12%;
  color: #ffdb3e;
  text-shadow: 1px 2px #281304, 0 0 8px #000;
  font-size: max(11px, 3cqw);
  font-style: italic;
}
.hud-base {
  position: absolute;
  display: flex;
  justify-content: stretch;
  inset: auto 0 0;
  height: 13.2%;
  padding: 0 3%;
  border-top: 2px solid #b59335;
  background: repeating-linear-gradient(0deg, #20201c 0 2px, #1b1d1c 2px 3px);
  box-shadow: 0 -2px #15180d, inset 0 1px #f7cd63, inset 0 4px #ffe57a12;
}
.hud-stat {
  display: grid;
  flex: 1;
  justify-items: center;
  align-content: center;
  gap: 0.3cqw;
  color: #f4dbc0;
}
.hud-stat + .hud-stat { border-left: 1px solid #b6953c55; }
.hud-stat strong { font-size: max(12px, 4.2cqw); line-height: 0.85; color: #ffcd2c; }
.hud-stat span { font-size: max(8px, 1.76cqw); line-height: 1; }
.hud-tool span { color: #ffcf36; white-space: nowrap; }
.hud-reserve { position: relative; }
.hud-reserve i {
  position: absolute;
  inset: auto 13% 8%;
  height: max(2px, 0.34cqw);
  background: #5c594b;
}
.hud-reserve i::after {
  content: "";
  display: block;
  width: var(--percent, 100%);
  height: 100%;
  background: var(--fill, #f3c33f);
  box-shadow: 0 0 4px color-mix(in srgb, var(--fill, #f3c33f) 55%, transparent);
}
#water-meter { --fill: #77dbe9; }
#dash-meter { --fill: #88d585; }
.hud-dash strong { font-size: max(11px, 3cqw); }
.hud-score .boost { color: #a5ec83; }
.hud-stat .low { color: #ff8a60; }
.desk-tools {
  position: absolute;
  z-index: 6;
  bottom: max(env(safe-area-inset-bottom, 0px), 10px);
  right: max(env(safe-area-inset-right, 0px), 12px);
  display: flex;
  gap: 5px;
}
.desk-tools button {
  padding: 0.55em 0.65em;
  background: #211a14ed;
  color: #f4dec4;
  font-size: max(12px, 0.78rem);
  border: 1px solid #e2c39b65;
  min-height: 38px;
}
.desk-tools button:hover { border-color: #ffce61; color: #ffce61; }
.touch-controls { display: none; }
.screen-only .room, .screen-only .power, .screen-only .sticky-note, .screen-only .desk-keys { visibility: hidden; }
.screen-only .desk { width: min(100vw, 145.45svh); aspect-ratio: 16 / 11; }
.workstation.screen-only { background: #0b0e0c; }
.screen-only .monitor { inset: 0; width: 100%; height: 100%; border-radius: 0; }
.screen-only .game-menu { padding-inline: 16%; }
.screen-only .cover { gap: min(2.3cqw, 22px); }
.screen-only .glass::after { box-shadow: none; }

@media (pointer: fine) and (max-width: 600px) {
  .workstation { background: radial-gradient(ellipse at 48% 40%, #3e261a, #1b120e 80%); }
  .desk { width: min(165vw, 187svh); }
  .desk-tools { position: relative; inset: auto; padding: 8px 0 12px; }
}
@container (max-width: 285px) {
  .game-menu { padding: 3cqw 5cqw; }
  .panel { gap: 1.28cqw; }
  .panel h2 { font-size: clamp(20px, 7.25cqw, 27px); }
  .panel .main-button, .panel .secondary-button { min-height: 27px; font-size: 11px; }
  .mission-list button { min-height: 21px; font-size: 10px; }
  .result-panel .menu-actions { grid-row: 3; }
}
@media (pointer: coarse) {
  .desk-keys, #fullscreen { display: none; }
}
