/* White, shaded in gray with a hint of aquamarine. */
:root {
  --ink: #262e2c;
  --w: #ffffff;
  --bg: #eef1f0;
  --a1: #e7ebea;
  --a2: #cdd4d2;
  --a3: #929e9b;
  --dim: #646f6c;
  --accent: #4a5552;
  --font: 'Jersey 15', monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  position: relative;
  font-family: var(--font);
  font-size: 15px;
  line-height: 18px;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: none;
  user-select: none;
}
button { font: inherit; color: inherit; }

#stage { position: absolute; inset: 0; touch-action: none; }
.px-canvas { display: block; image-rendering: pixelated; }
/* A full-screen fade between floors and runs. */
#fade { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; }

.box {
  position: absolute;
  background: var(--w);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.tune {
  right: 16px; top: 64px; width: 290px; max-height: calc(100% - 80px); overflow-y: auto;
  padding: 10px 12px 12px;
}
.tune[hidden] { display: none; }
.tune-head { display: flex; justify-content: space-between; align-items: baseline; }
.tune-head h2 { margin: 0; font-size: 24px; font-weight: 400; }
.tune-head span { color: var(--dim); }
.tune h3 { margin: 12px 0 4px; font-size: 15px; font-weight: 400; color: var(--w); background: var(--ink); padding: 1px 6px; }
.tune-row { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; margin: 4px 0 6px; }
.tune-row b { font-weight: 400; color: var(--dim); }
.tune-row.changed b { color: var(--accent); }
.tune-row input { grid-column: 1 / -1; width: 100%; margin: 2px 0 0; accent-color: var(--accent); }
.tune-seg, .tune-btns { display: flex; gap: 6px; margin-top: 6px; }
.tune-seg button, .tune-btns button {
  flex: 1; padding: 3px 6px; cursor: pointer;
  background: var(--a1); border: 2px solid var(--ink);
}
.tune-seg button.on { background: var(--accent); color: var(--w); }
.tune-btns { margin-top: 14px; }
.tune-btns.tune-dev { margin-top: 6px; }
.tune-seg button:hover, .tune-btns button:hover { background: var(--a2); }
.tune-state { flex: 1; align-self: center; color: var(--dim); }

/* ---------- the interface ---------- */
.ui { position: absolute; inset: 0; pointer-events: none; }
.ui b { font-weight: 400; }

/* HUD: health and shards top left, the level top right, items bottom left. */
.hud { position: absolute; inset: 0; transition: opacity 0.3s; }
.hud.hidden { opacity: 0; }
.hud-left { position: absolute; left: 16px; top: 14px; }
.hud-hp { display: flex; gap: 4px; }
.pip { width: 16px; height: 16px; border: 2px solid var(--ink); background: var(--w); box-shadow: 2px 2px 0 var(--ink); }
.pip.on { background: var(--ink); }
.hud-row { display: flex; gap: 12px; align-items: center; margin-top: 8px; font-size: 22px; line-height: 22px; }
.hud-gems { display: flex; align-items: center; gap: 6px; }
.gem { display: inline-block; width: 10px; height: 10px; background: var(--a3); border: 2px solid var(--ink); transform: rotate(45deg) scaleY(1.2); }
.hud-key { width: 30px; height: 30px; margin: -4px 0; opacity: 0; transition: opacity 0.2s; }
.hud-key.on { opacity: 1; }
.hud-level { position: absolute; right: 16px; top: 12px; text-align: right; }
.hud-level b { display: block; font-size: 22px; line-height: 22px; }
.hud-level span { color: var(--dim); font-size: 16px; letter-spacing: 1px; }
.hud-items { position: absolute; left: 16px; bottom: 16px; right: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
/* Items: an icon each, bare on the floor, a count if more than one; their
   name and line over them on hover, as plain text like the rest of the HUD. */
.item { position: relative; width: 38px; height: 38px; pointer-events: auto; cursor: default; font-size: 22px; line-height: 38px; text-align: center; }
.item img { display: block; width: 38px; height: 38px; transition: transform 0.12s; }
.item:hover img { transform: translateY(-3px); }
.item.off img { opacity: 0.3; }
.item i { position: absolute; right: -8px; bottom: -6px; font-style: normal; font-size: 16px; line-height: 16px; }
.tip { position: absolute; max-width: min(320px, calc(100% - 32px)); opacity: 0; transform: translateY(4px); transition: opacity 0.15s, transform 0.15s; pointer-events: none; }
.tip.on { opacity: 1; transform: translateY(0); }
.tip b { display: block; font-size: 22px; line-height: 22px; }
.tip span { display: block; color: var(--dim); font-size: 17px; line-height: 19px; }

/* Captions, toasts, prompts. */
.caption { position: absolute; left: 0; right: 0; top: 64px; text-align: center; opacity: 0; transition: opacity 0.5s; }
.caption.on { opacity: 1; }
.caption b { display: block; font-size: 28px; line-height: 30px; letter-spacing: 3px; }
.caption span { display: block; color: var(--dim); font-size: 18px; letter-spacing: 2px; }
.caption.big b { font-size: 44px; line-height: 44px; letter-spacing: 6px; }
.caption.big span { font-size: 22px; margin-top: 4px; }
.toast, .prompt {
  position: absolute; left: 50%; bottom: 56px; transform: translate(-50%, 8px); opacity: 0;
  background: var(--w); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  padding: 6px 12px 8px; min-width: 220px; max-width: min(440px, calc(100% - 32px)); text-align: center;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.on, .prompt.on { opacity: 1; transform: translate(-50%, 0); }
.toast b, .prompt b { display: block; font-size: 22px; line-height: 24px; }
.toast span, .prompt span { display: block; color: var(--dim); }
.prompt em { display: block; font-style: normal; margin-top: 2px; }
.prompt { bottom: 110px; }

/* Screens: a card in the middle; a full one covers the game. */
.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(238, 241, 240, 0.72); pointer-events: auto; }
.screen.on { display: flex; }
.screen.full { background: var(--bg); }
.card { background: var(--w); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 18px 22px 16px; min-width: 300px; max-width: min(620px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto; }
.card h1 { margin: 0; font-size: 96px; line-height: 88px; font-weight: 400; letter-spacing: 10px; padding-left: 10px; text-align: center; }   /* the padding evens out the spacing after the last letter */
.card h2 { margin: 0 0 10px; font-size: 32px; line-height: 34px; font-weight: 400; letter-spacing: 3px; text-align: center; }
.card h3 { margin: 0 0 6px; font-size: 18px; font-weight: 400; color: var(--dim); letter-spacing: 2px; }
.card p { margin: 0 0 8px; font-size: 19px; line-height: 22px; }
.card .sub { text-align: center; color: var(--dim); margin: 6px 0 18px; letter-spacing: 1px; }
.card .dim { color: var(--dim); }
.s-title .card, .s-end .card { border: none; box-shadow: none; background: transparent; }
.menu { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; align-items: stretch; }
.menu button { padding: 4px 12px; font-size: 20px; background: var(--w); border: 2px solid var(--ink); cursor: pointer; text-align: center; }
.menu button.sel { background: var(--ink); color: var(--w); }
.hint { margin-top: 12px; text-align: center; color: var(--dim); }
.record { font-size: 22px !important; line-height: 26px !important; max-width: 460px; }
.s-read .card { min-width: 360px; }
.controls { border-collapse: collapse; width: 100%; }
.controls td { padding: 3px 8px; font-size: 17px; vertical-align: top; }
.controls td:first-child { color: var(--dim); white-space: nowrap; }
.records { display: flex; gap: 14px; min-height: 180px; }
.rec-list { display: grid; grid-template-columns: repeat(4, 34px); gap: 4px; align-content: start; }
.rec-list button { font-size: 15px; padding: 2px 0; background: var(--w); border: 2px solid var(--ink); cursor: pointer; }
.rec-list button:disabled { border-color: var(--a2); color: var(--a3); cursor: default; }
.rec-list button.sel { background: var(--ink); color: var(--w); }
.rec-body { flex: 1; min-width: 200px; }
.stats { display: grid; gap: 2px; margin: 8px auto 0; max-width: 260px; font-size: 19px; }
.stats div { display: flex; justify-content: space-between; gap: 20px; }
.stats span { color: var(--dim); }
.s-end h2, .s-stopped h2 { font-size: 30px; }

