@font-face { font-family: "VT323"; src: url("VT323-Regular.ttf") format("truetype"); font-display: swap; }
:root {
  --bg: #16181c; --panel: #191b1f; --panel-2: #24282e; --btn: #353b44; --line: #4a4f57;
  --text: #ece6d6; --dim: #9a968c; --gold: #e8b33a; --gold-hi: #ffdf5d; --orange: #f98814;
  --font-pixel: "VT323", ui-monospace, Menlo, Consolas, monospace;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-ui); }
a { color: var(--gold); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.site-head { padding: 36px 0 8px; }
.site-head .crumb { font: 22px/1 var(--font-pixel); color: var(--dim); letter-spacing: .05em; }
.site-head h1 { margin: 6px 0 4px; font: 400 64px/1 var(--font-pixel); color: var(--gold-hi);
  text-shadow: 3px 3px 0 #5a140a; letter-spacing: .03em; }
.site-head p { margin: 0; color: var(--dim); font-size: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; padding: 24px 0 48px; }
.card { display: flex; flex-direction: column; background: var(--panel); border: 2px solid var(--line);
  border-radius: 6px; overflow: hidden; text-decoration: none; color: inherit; transition: transform .12s, border-color .12s; }
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: var(--gold); outline: none; }
.card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; image-rendering: pixelated; background: #000; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h2 { margin: 0; font: 400 34px/1 var(--font-pixel); color: var(--text); letter-spacing: .03em; }
.card p { margin: 0; color: var(--dim); font-size: 14.5px; line-height: 1.45; flex: 1; }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.tag { font: 18px/1 var(--font-pixel); color: var(--dim); border: 1px solid var(--line); border-radius: 3px; padding: 4px 7px 3px; }
.btn { display: inline-block; font: 24px/1 var(--font-pixel); letter-spacing: .05em; color: #1a1205;
  background: linear-gradient(var(--gold-hi), var(--orange)); border: 0; border-radius: 4px; padding: 10px 20px 8px; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { color: var(--text); background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.35); font-size: 20px; padding: 7px 12px 5px; }
.foot { color: var(--dim); font-size: 13px; padding: 0 0 36px; }
.empty { color: var(--dim); padding: 40px 0; }

/* game page */
body.game { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 48px; }
.bar .back { font: 22px/1 var(--font-pixel); text-decoration: none; color: var(--dim); }
.bar .back:hover { color: var(--gold); }
.bar h1 { margin: 0; font: 400 30px/1 var(--font-pixel); color: var(--gold-hi); flex: 1; letter-spacing: .03em; }
.bar .ver { font-size: 12px; color: var(--dim); }
.stage-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 0 16px; min-height: 0; }
.stage { position: relative; background: #000; border: 2px solid var(--line); border-radius: 4px; overflow: hidden;
  aspect-ratio: 16 / 9; width: min(100%, calc((100vh - 130px) * 16 / 9)); width: min(100%, calc((100dvh - 130px) * 16 / 9)); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.stage .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.stage .shade { position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(0,0,0,.75)); }
.stage .cta { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 12px 4vmin; text-align: center; }
.stage .cta[hidden], .stage .poster[hidden], .stage .shade[hidden] { display: none; }
.stage .cta .btn { font-size: clamp(26px, 5vw, 46px); padding: .45em 1.3em .3em; }
.stage .cta .hint { font-size: clamp(11px, 1.7vw, 14px); color: #ddd; text-shadow: 0 1px 3px #000; max-width: 640px; }
.stage .fs { position: absolute; right: 8px; bottom: 8px; z-index: 3; }
.stage .fs[hidden] { display: none; }
.rotate { display: none; position: absolute; inset: 0; z-index: 4; background: rgba(0,0,0,.86); color: var(--text);
  align-items: center; justify-content: center; flex-direction: column; gap: 10px; text-align: center; padding: 16px; font: 26px/1.2 var(--font-pixel); }
.rotate .ico { font-size: 56px; display: inline-block; animation: tilt 1.6s ease-in-out infinite; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 70%, 100% { transform: rotate(-90deg); } }
.note { text-align: center; color: var(--dim); font-size: 13px; padding: 10px 16px 18px; }
.privacy { text-align: center; color: var(--dim); font-size: 13px; padding: 0 16px 16px; }
.privacy a { color: var(--gold); }
body.embed .privacy, body.playing .privacy { display: none; }
.err { padding: 60px 16px; text-align: center; color: var(--dim); }
.err[hidden], .stage-wrap[hidden] { display: none; }

/* phone held upright: ask for landscape */
@media (orientation: portrait) and (max-width: 700px) {
  .stage { width: 100%; }
  /* a banner at the top of the stage, so Play stays tappable (people with rotation lock on can still try) */
  .rotate { display: flex; inset: 0 0 auto 0; flex-direction: row; gap: 10px; font-size: 18px; padding: 8px 10px; background: rgba(0,0,0,.82); pointer-events: none; }
  .rotate .ico { font-size: 30px; }
  .stage.running .rotate { inset: 0; flex-direction: column; background: rgba(0,0,0,.92); font-size: 24px; }
  .bar h1 { font-size: 24px; }
}
/* short landscape screens (phones): use nearly the whole screen */
@media (orientation: landscape) and (max-height: 520px) {
  .bar { min-height: 32px; padding: 4px 12px; }
  .bar h1 { font-size: 22px; }
  .stage { width: min(100%, calc((100vh - 40px) * 16 / 9)); width: min(100%, calc((100dvh - 40px) * 16 / 9)); }
  .stage-wrap { padding: 0 8px; }
  .note { display: none; }
  .site-head { padding-top: 14px; }
  .site-head h1 { font-size: 44px; }
}
/* embed mode (inside someone else's iframe): just the stage */
body.embed .bar, body.embed .note { display: none; }
body.embed .stage-wrap { padding: 0; }
body.embed .stage { width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; }
body.embed.game { height: 100vh; height: 100dvh; }

/* iPhone: no Fullscreen API, so a small tip (Add to Home Screen) shows instead of the button */
.stage .iostip { position: absolute; right: 8px; bottom: 8px; z-index: 3; max-width: calc(100% - 16px);
  font: 18px/1.1 var(--font-pixel); color: var(--text); background: rgba(0,0,0,.7); border: 1px solid rgba(255,255,255,.3);
  border-radius: 4px; padding: 6px 10px 4px; pointer-events: none; }
.stage .iostip[hidden] { display: none; }
/* notch / home bar safe areas (viewport-fit=cover) */
body.game { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom); }
body.embed.game { padding: 0; }

/* PHONES AND TABLETS IN LANDSCAPE, after PLAY (Agent PY, 2 Nov): the game gets the WHOLE visible screen.
   No bar, no border, no side margins, no 16:9 box: the game uses the extra width itself (it lays out up to 23:9). */
#probe { position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
@media (pointer: coarse) and (orientation: landscape) {
  body.game.playing { position: fixed; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; overflow: hidden; overscroll-behavior: none; }
  body.playing .bar, body.playing .note { display: none; }
  body.playing .stage-wrap { position: fixed; inset: 0; padding: 0; display: block; }
  body.playing .stage { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; }
  body.playing .iostip { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}

/* SEO pass (11 Nov): readable text under the player and on the hub. Hidden while playing and when embedded. */
.site-head .crumb a { color: inherit; text-decoration: none; }
.site-head .crumb a:hover { color: var(--gold); }
.about, .hub-about { max-width: 760px; margin: 0 auto; padding: 8px 16px 40px; color: var(--text); font-size: 15.5px; line-height: 1.6; }
.hub-about { padding: 0 0 24px; margin: 0; color: var(--dim); }
.about h2 { font: 400 36px/1 var(--font-pixel); color: var(--gold-hi); letter-spacing: .03em; margin: 18px 0 10px; }
.about h3 { font: 400 26px/1 var(--font-pixel); color: var(--gold); letter-spacing: .03em; margin: 22px 0 6px; }
.about p { margin: 0 0 12px; }
.about ul { margin: 0 0 12px; padding-left: 20px; }
.about li { margin: 4px 0; }
.about .links { color: var(--dim); font-size: 14px; margin-top: 20px; }
body.embed .about, body.playing .about { display: none; }
@media (orientation: landscape) and (max-height: 520px) { .about { padding-top: 24px; } }
