:root {
  color-scheme: light;
  --cp-bg: #f7f4ef;
  --cp-bg-elevated: #fcfbf8;
  --cp-surface: #ffffff;
  --cp-surface-soft: #f5f5f5;
  --cp-border: #dedede;
  --cp-border-strong: #919191;
  --cp-text: #242424;
  --cp-text-muted: #5c5c5c;
  --cp-text-soft: #6f6f6f;
  --cp-accent: #b11f4b;
  --cp-accent-hover: #9a1a41;
  --cp-accent-soft: rgba(177, 31, 75, 0.08);
  --cp-accent-fg: #ffffff;
  --cp-success: #16a34a;
  --cp-danger: #dc2626;
  --cp-warning: #f59e0b;
  --cp-link: #0067b8;
  --cp-shadow: 0 18px 48px rgba(0, 0, 0, 0.12);
  --cp-overlay: rgba(255, 255, 255, 0.8);
  --cp-panel: rgba(255, 255, 255, 0.86);
  --cp-panel-strong: rgba(255, 255, 255, 0.96);
  --cp-sheen: rgba(255, 255, 255, 0.55);
  --cp-highlight: rgba(177, 31, 75, 0.12);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --cp-bg: #3d3b3a;
  --cp-bg-elevated: #343231;
  --cp-surface: #292929;
  --cp-surface-soft: #2e2e2e;
  --cp-border: #474747;
  --cp-border-strong: #5f5f5f;
  --cp-text: #dedede;
  --cp-text-muted: #a8a8a8;
  --cp-text-soft: #b0b0b0;
  --cp-accent: #fd8ea1;
  --cp-accent-hover: #fb7b91;
  --cp-accent-soft: rgba(253, 142, 161, 0.14);
  --cp-accent-fg: #1a1a1a;
  --cp-success: #4ade80;
  --cp-danger: #f87171;
  --cp-warning: #fbbf24;
  --cp-link: #6cb6ff;
  --cp-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --cp-overlay: rgba(41, 41, 41, 0.88);
  --cp-panel: rgba(41, 41, 41, 0.72);
  --cp-panel-strong: rgba(41, 41, 41, 0.96);
  --cp-sheen: rgba(255, 255, 255, 0.04);
  --cp-highlight: rgba(253, 142, 161, 0.12);
}

/* ---- page chrome (themed) ---- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--cp-bg);
  color: var(--cp-text);
  font-family: "Segoe UI", Aptos, Calibri, -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
}
main {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.page-title {
  margin: 0;
  font-family: Consolas, "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--cp-text-muted);
  text-transform: uppercase;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- retro terminal game frame ---- */
#wrap {
  position: relative;
  /* Shrinks (keeping its aspect ratio) when the title and hint rows need the room, so the
     whole page stays visible in whatever viewport the cabinet gives the game. */
  min-height: 0;
  height: min(88vh, 860px);
  aspect-ratio: 480 / 640;
  border-radius: 10px;
  box-shadow: 0 0 2px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.14), 0 18px 48px rgba(0,0,0,0.28);
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 10px;
  background: #0d1117;
}
.scanlines {
  position: absolute; inset: 0;
  border-radius: 10px;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.18) 3px, rgba(0,0,0,0.18) 4px
  );
  mix-blend-mode: multiply;
}
.hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: 16px;
  font-family: Consolas, "Courier New", Courier, monospace;
  font-size: 12px;
  color: var(--cp-text-muted);
}
.hint b { color: var(--cp-text); font-weight: 600; }
.pause-button {
  min-height: 32px;
  min-width: 44px;
  padding: 0 10px;
  border: 1px solid var(--cp-text-muted);
  border-radius: 4px;
  background: transparent;
  color: var(--cp-text);
  font: 600 12px Consolas, "Courier New", Courier, monospace;
  cursor: pointer;
}
.pause-button:hover { border-color: var(--cp-text); }
.pause-button:focus-visible {
  outline: 2px solid var(--cp-link);
  outline-offset: 2px;
}
.standalone .page-title,
.standalone .hint { max-width: calc(100% - 24px); }
.standalone #wrap {
  height: min(88vh, 860px, calc((100vw - 24px) * 4 / 3), calc(100vh - 92px));
}
.arcade-link:not([hidden]) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  color: var(--cp-link);
  text-underline-offset: 3px;
}
.arcade-link:hover { color: var(--cp-text); }
.arcade-link:focus-visible {
  outline: 2px solid var(--cp-link);
  outline-offset: 2px;
}
