/*
 * The public site's one stylesheet (/, /help, /privacy, /terms, the 404): the
 * "ANSI Door" design, the game's own CGA palette on black, always, whatever the
 * system theme. Tokens are the design system's. Two font families, self-hosted
 * (fonts/): the page's, and the demo terminal's. No script but site.js (and, once
 * the visitor presses Play, the demo's /play/play.js). The demo's chat tabs are
 * the exception to the palette: each is drawn after its app (below).
 */
/* IBM Plex Mono, SIL OFL 1.1 (fonts/IBMPlexMono-LICENSE.txt). Self-hosted so a visit reaches no one but Cloudflare (privacy.html). */
@font-face {
  font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap;
  src: url("/fonts/IBMPlexMono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-weight: 700; font-display: swap;
  src: url("/fonts/IBMPlexMono-700.woff2") format("woff2");
}
/* A VGA-style 9×16 text-mode font: Modern DOS by Jayvee Enaguas, CC0 1.0 (fonts/ModernDOS-LICENSE.txt). */
@font-face {
  font-family: "Modern DOS 9x16"; font-display: block;
  src: url("/fonts/ModernDOS9x16.woff2") format("woff2");
}
:root {
  --bg: #000; --ink: #aaa; --ink-muted: #0aa;
  --accent: #a50; --accent-2: #5ff; --accent-3: #55f;
  --gold: #ff5; --on-gold: #000; --frame: var(--ink-muted);
  --banner: #a00; --on-banner: #000; --rule: #a00; --signal: #f55;

  --space-1: 4px; --space-2: 8px; --space-3: 16px; --space-4: 24px; --space-5: 32px; --space-6: 48px;
  --play-width: 720px; --measure-prose: 640px;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/24px var(--font-mono); }
.wrap { max-width: 960px; margin: 0 auto; padding-inline: var(--space-5); }
main { padding-top: var(--space-6); }
a { color: var(--accent-2); text-underline-offset: 3px; }
/* Reverse video, as a highlighted menu bar would be. */
a:focus-visible { outline: none; background: var(--ink); color: var(--bg); text-decoration: none; }
strong { font-weight: 700; }
p, ul, ol { margin: 0 0 var(--space-3); }
ul { padding-left: 2ch; }
li::marker { content: "* "; color: var(--rule); }
/* Steps keep their numbers. */
ol { padding-left: 4ch; }
ol > li::marker { content: counter(list-item) ". "; color: inherit; }

/* Brown on black is the game's own pair, at 4:1: headings stay this large. */
h2 { margin: var(--space-2) 0 var(--space-3); color: var(--accent); font-size: 24px; line-height: 32px; }
h3 { margin: var(--space-3) 0 var(--space-2); color: var(--accent); font-size: 20px; line-height: 28px; }
/* The reading width, for a band's words: its asterisks run the full width. */
p.prose, .band.prose > * { max-width: var(--measure-prose); }

/* Each band starts with a row of red asterisks, cut off at the band's edge; decoration only. */
.band { margin-top: var(--space-6); }
.band::before {
  content: "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *" / "";
  display: block; overflow: hidden; white-space: pre; color: var(--rule); line-height: 16px; margin-bottom: var(--space-2);
}
/* Two bands' worth of text on one row. */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-5); }
.two::before { grid-column: 1 / -1; }
.two > section { min-width: 0; }

/* The game's header, its title the page's <h1>. 68 columns shrink to fit a phone. */
.woa-banner {
  width: fit-content; max-width: 100%; margin: 0 auto; white-space: pre;
  font-size: min(17px, calc((100vw - 2 * var(--space-3)) / 40.8)); line-height: 1.53;
}
.woa-banner .box { display: block; width: fit-content; background: var(--banner); color: var(--on-banner); font-weight: 700; }
.woa-banner h1 { display: inline; margin: 0; font: inherit; }
.woa-banner .ver { display: block; margin-top: var(--space-3); color: var(--accent); }
.woa-banner .rating { display: block; margin-top: var(--space-3); color: var(--accent-3); }

/* A link or button that is an action: cyan-ringed, or (the demo's Play) gold. */
.button {
  display: inline-block; padding: var(--space-1) var(--space-3); border: 0; border-radius: 0;
  background: var(--bg); color: var(--accent-2); box-shadow: inset 0 0 0 2px var(--accent-2);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--accent-2); color: var(--bg); }
.button.primary { background: var(--gold); color: var(--on-gold); box-shadow: none; }
.button.primary:hover { background: var(--accent-2); color: var(--bg); }
.button:focus-visible, .button.primary:focus-visible { outline: none; background: var(--ink); color: var(--bg); box-shadow: none; }
.button:disabled { cursor: progress; }

/* The game's own lines (the 404), in a double-ruled frame. */
.screen { width: fit-content; max-width: 100%; padding: var(--space-3) var(--space-4); border: 6px double var(--frame); font-size: 15px; line-height: 20px; }
.screen p { margin: 0; }
.screen .signal { color: var(--signal); }

/* The demo area: a double-ruled frame, like the ╔═╗ frames of the game's era, with its label notched into the top edge. */
.demo {
  position: relative; width: fit-content; max-width: 100%; margin: var(--space-5) auto var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3); border: 6px double var(--frame);
}
/* Its tabs, Original, Slack, Teams, Discord: a menu bar, the tab picked in reverse video. */
.demo-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1) var(--space-3); margin: var(--space-4) 0 0; }
.demo-tabs [role="tab"] {
  padding: 0 var(--space-2); border: 0; border-radius: 0; background: var(--bg); color: var(--ink-muted);
  font: inherit; font-weight: 700; cursor: pointer;
}
.demo-tabs [role="tab"]:hover { color: var(--accent-2); }
.demo-tabs [role="tab"][aria-selected="true"] { background: var(--ink-muted); color: var(--bg); }
.demo-tabs [role="tab"]:focus-visible { outline: none; background: var(--ink); color: var(--bg); }
.demo-tabs + .demo, .demo-tabs ~ .demo { margin-top: var(--space-4); }
.demo-caption { max-width: var(--play-width); margin: var(--space-2) 0 0; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.demo-label { position: absolute; top: -15px; left: var(--space-3); padding: 0 var(--space-2); background: var(--bg); color: var(--accent-2); font-weight: 700; }
/* Play, in the page's font; the terminal replaces it. */
.term-screen.term-ready .go { margin-top: var(--space-3); font: 16px/24px var(--font-mono); }

/*
 * The homepage demo's terminal (Play it now, /play/play.js): the original's
 * 80×25 screen, in the game's 16 colours (the harness's classes). The font's cell
 * is 9×16 at its true 16px, where its pixels are sharp, so 80 columns are 720px and
 * rows are solid; the frame's padding is its margin, since the game draws to the
 * last column. Narrower screens scroll sideways rather than reflow it.
 */
.term {
  --c0: #000; --c1: #a00; --c2: #0a0; --c3: #a50; --c4: #00a; --c5: #a0a; --c6: #0aa; --c7: #aaa;
  --c8: #555; --c9: #f55; --c10: #5f5; --c11: #ff5; --c12: #55f; --c13: #f5f; --c14: #5ff; --c15: #fff;
  position: relative; width: var(--play-width); max-width: 100%;
}
.term-screen {
  height: calc(25 * 16px + 2 * var(--space-3)); overflow: auto; padding: var(--space-3) 0;
  background: var(--c0); color: var(--c7); cursor: text;
  font: 16px/16px "Modern DOS 9x16", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.term-screen.term-ready { height: auto; padding: 0; cursor: auto; line-height: 20px; }
.term-screen.term-ready p { margin: 0; }
.term-screen.term-ready noscript p { margin-top: var(--space-2); }
.term .line { white-space: pre; min-height: 16px; width: max-content; min-width: 100%; }
/* Each run fills its line's height, so a background (the title's red box) is solid between lines. */
.term .line > span { display: inline-block; vertical-align: top; }
.term .cursor { display: inline-block; width: 9px; height: 16px; background: var(--c7); vertical-align: -3px; }
/* The game's dim blue text is 1.6:1 on black: as the design has it, lifted to bright blue. Backgrounds keep it. */
.term .fg0 { color: var(--c0); } .term .fg1 { color: var(--c1); } .term .fg2 { color: var(--c2); } .term .fg3 { color: var(--c3); }
.term .fg4 { color: var(--c12); } .term .fg5 { color: var(--c5); } .term .fg6 { color: var(--c6); } .term .fg7 { color: var(--c7); }
.term .b.fg0 { color: var(--c8); } .term .b.fg1 { color: var(--c9); } .term .b.fg2 { color: var(--c10); } .term .b.fg3 { color: var(--c11); }
.term .b.fg4 { color: var(--c12); } .term .b.fg5 { color: var(--c13); } .term .b.fg6 { color: var(--c14); } .term .b.fg7 { color: var(--c15); }
.term .b.fgd { color: var(--c15); }
.term .bg0 { background: var(--c0); } .term .bg1 { background: var(--c1); } .term .bg2 { background: var(--c2); } .term .bg3 { background: var(--c3); }
.term .bg4 { background: var(--c4); } .term .bg5 { background: var(--c5); } .term .bg6 { background: var(--c6); } .term .bg7 { background: var(--c7); }
/* Typing goes to this input (it brings up a phone's keyboard); the screen shows what is typed. */
.term-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; }
.term-keys {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding-top: var(--space-2); border-top: 1px solid var(--frame); font-size: 14px;
}
.term-hint { color: var(--ink-muted); }
/* For touch screens: Enter, as the keyboard's. */
.term-enter { padding: 0 var(--space-2); border: 0; border-radius: 0; background: var(--bg); color: var(--accent-2); box-shadow: inset 0 0 0 2px var(--accent-2); font: inherit; font-weight: 700; cursor: pointer; }
.term-enter:hover { background: var(--accent-2); color: var(--bg); }
.term-enter:focus-visible { outline: none; background: var(--ink); color: var(--bg); box-shadow: none; }
.term-note { margin: var(--space-2) 0 0; font-size: 14px; }
.term-note:empty { display: none; }
.term-cover {
  position: absolute; inset: 0; width: 100%; border: 0; cursor: pointer;
  background: rgb(0 0 0 / 0.85); color: var(--accent-2); font: inherit; font-weight: 700;
}

/*
 * The demo's chat tabs (Phase 10, /play/play.js's chat-dom.ts): each app's
 * desktop client in dark mode, drawn after screenshots of the real thing,
 * holding what the real bot sends. Our own CSS, with the visitor's system
 * fonts; no app's logos, fonts or images. Colors are per app (--ch-*).
 */
.chat {
  --ch-bg: #1a1d21; --ch-ink: #d1d2d3; --ch-muted: #9a9b9e; --ch-name: #fff; --ch-line: #35373b;
  --ch-code-bg: #222529; --ch-code-line: #35373b; --ch-code-ink: #d1d2d3; --ch-input-bg: #222529;
  --ch-btn-bg: transparent; --ch-btn-line: #565856; --ch-btn-ink: #d1d2d3; --ch-primary: #007a5a; --ch-focus: #1d9bd1;
  --ch-app-bg: #35373b; --ch-app-ink: #b9babd; --ch-you: #4a154b; --ch-modal-bg: #222529;
  --ch-avatar-radius: 6px; --ch-btn-radius: 4px;
  position: relative; display: flex; flex-direction: column; width: var(--play-width); max-width: 100%; height: 600px;
  overflow: hidden; border-radius: 6px; background: var(--ch-bg); color: var(--ch-ink);
  font: 15px/1.46 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
.chat-teams {
  --ch-bg: #1f1f1f; --ch-ink: #d6d6d6; --ch-muted: #adadad; --ch-name: #adadad; --ch-line: #3d3d3d;
  --ch-code-bg: transparent; --ch-code-line: transparent; --ch-code-ink: #d6d6d6; --ch-input-bg: #292929;
  --ch-btn-bg: #292929; --ch-btn-line: #5c5c5c; --ch-btn-ink: #fff; --ch-primary: #4f52b2; --ch-focus: #7f85f5;
  --ch-you: #2f2f4a; --ch-modal-bg: #292929; --ch-avatar-radius: 50%; --ch-btn-radius: 4px;
}
.chat-discord {
  --ch-bg: #1f2023; --ch-ink: #dbdee1; --ch-muted: #949ba4; --ch-name: #f2f3f5; --ch-line: #2e2f34;
  --ch-code-bg: #1f2130; --ch-code-line: #34374a; --ch-code-ink: #dbdee1; --ch-input-bg: #2a2b30;
  --ch-btn-bg: #3c3e45; --ch-btn-line: #3c3e45; --ch-btn-ink: #f2f3f5; --ch-primary: #5865f2; --ch-focus: #00a8fc;
  --ch-app-bg: #5865f2; --ch-app-ink: #fff; --ch-you: #5865f2; --ch-modal-bg: #2b2d31;
  --ch-avatar-radius: 50%; --ch-btn-radius: 8px;
}
/* Before Play: the app's window, waiting. */
.chat .chat-ready { margin: auto; padding: var(--space-4); text-align: center; }
.chat .chat-ready p { margin: 0 0 var(--space-3); }
.chat .chat-ready .go { font: 16px/24px var(--font-mono); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--ch-line); color: var(--ch-name); font-size: 16px; }
.chat-head .chat-avatar { width: 24px; height: 24px; }
.chat-teams .chat-head { color: #fff; }
.chat-at { color: var(--ch-muted); font-size: 20px; }
.chat-tab { margin-left: var(--space-2); padding-bottom: 2px; border-bottom: 2px solid currentColor; color: var(--ch-ink); font-size: 13px; font-weight: 600; }
.chat-log { flex: 1; overflow-x: hidden; overflow-y: auto; padding: 12px 0; outline: none; }
.chat-log:focus-visible { box-shadow: inset 0 0 0 2px var(--ch-focus); }
.cm { display: flex; gap: 10px; padding: 6px 16px 2px; }
.cm.cont { padding-top: 0; }
.chat-slack .cm:hover, .chat-discord .cm:hover { background: rgb(255 255 255 / 0.03); }
.chat-teams .cm:hover .cm-hover-time { visibility: hidden; }
.cm-gutter { flex: 0 0 40px; }
.chat-avatar { display: block; width: 40px; height: 40px; border-radius: var(--ch-avatar-radius); }
.chat-avatar.you { display: grid; place-items: center; background: var(--ch-you); color: #fff; font-weight: 700; }
.cm-hover-time { display: block; visibility: hidden; color: var(--ch-muted); font-size: 10px; line-height: 22px; text-align: right; white-space: nowrap; }
.cm:hover .cm-hover-time { visibility: visible; }
.cm-main { flex: 1; min-width: 0; }
.cm-head { display: flex; align-items: baseline; gap: 6px; }
.cm-name { color: var(--ch-name); font-weight: 700; }
.cm-app { padding: 0 4px; border-radius: 3px; background: var(--ch-app-bg); color: var(--ch-app-ink); font-size: 10px; font-weight: 700; line-height: 15px; }
.cm-time { color: var(--ch-muted); font-size: 12px; }
.cm-code {
  width: fit-content; max-width: 100%; margin: 4px 0; padding: 8px; overflow-x: auto; white-space: pre;
  border: 1px solid var(--ch-code-line); border-radius: 4px; background: var(--ch-code-bg); color: var(--ch-code-ink);
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.chat-slack .cm-code { width: auto; }
.cm-code .b { font-weight: 700; }
/* A run on a background fills its line's height, so a box (the title, the GOLD bar) is solid. */
.chat-discord .cm-code [class*="d-bg"] { display: inline-block; vertical-align: top; }
.cm-text, .cm-subtle { margin: 2px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-text .b, .cm-subtle .b { font-weight: 700; }
.cm-subtle { color: var(--ch-muted); font-size: 12px; }
.cm-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.cm-buttons + .cm-buttons { margin-top: 0; }
.cm-btn {
  min-height: 32px; padding: 2px 14px; border: 1px solid var(--ch-btn-line); border-radius: var(--ch-btn-radius);
  background: var(--ch-btn-bg); color: var(--ch-btn-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.cm-btn:hover { filter: brightness(1.2); }
.cm-btn.primary { border-color: var(--ch-primary); background: var(--ch-primary); color: #fff; }
.cm-btn:focus-visible { outline: 2px solid var(--ch-focus); outline-offset: 2px; }
.chat.busy .cm-btn { cursor: progress; }
.cm-emoji { margin-right: 6px; }
.cm-edited { color: var(--ch-muted); font-size: 10px; }
.chat-composer { display: flex; gap: 8px; margin: 0 16px 16px; padding: 10px 12px; border: 1px solid var(--ch-line); border-radius: 8px; background: var(--ch-input-bg); }
.chat-discord .chat-composer { border-color: transparent; }
.chat-teams .chat-composer { border-bottom: 2px solid var(--ch-primary); border-radius: 4px; }
.chat-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ch-ink); font: inherit; }
.chat-input::placeholder { color: var(--ch-muted); }
.chat-send { border: 0; background: transparent; color: var(--ch-muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.chat-send:hover, .chat-send:focus-visible { color: var(--ch-ink); outline: none; }
/* Teams: the bot's messages are cards; yours, bubbles on the right. */
.chat-teams .cm-head { font-size: 12px; }
.chat-teams .cm.cont { padding-top: 6px; }
.chat-teams .cm.bot .cm-body { width: 100%; max-width: 640px; padding: 12px 16px; border-radius: 6px; background: #2e2e2e; }
.chat-teams .cm.bot .cm-code { margin: 0; padding: 0; border: 0; font-size: 13px; }
.chat-teams .cm.you { flex-direction: row-reverse; }
.chat-teams .cm.you .cm-gutter { display: none; }
.chat-teams .cm.you .cm-main { display: flex; flex-direction: column; align-items: flex-end; }
.chat-teams .cm.you .cm-body { padding: 6px 12px; border-radius: 6px; background: var(--ch-you); }
.chat-teams .t-attention { color: #e5918f; } .chat-teams .t-good { color: #7aa86a; } .chat-teams .t-warning { color: #e8d18e; }
.chat-teams .t-accent { color: #9b9ef0; } .chat-teams .t-accent.b { color: #b2b5ff; } .chat-teams .b:not([class*="t-"]) { color: #fff; }
/* Discord's ansi code block colors (desktop); the backgrounds take the same hues. */
.chat-discord .d-fg0 { color: #4f545c; } .chat-discord .d-fg1 { color: #dc322f; } .chat-discord .d-fg2 { color: #859900; } .chat-discord .d-fg3 { color: #b58900; }
.chat-discord .d-fg4 { color: #268bd2; } .chat-discord .d-fg5 { color: #d33682; } .chat-discord .d-fg6 { color: #2aa198; } .chat-discord .d-fg7 { color: #fff; }
.chat-discord .d-bg1 { background: #dc322f; } .chat-discord .d-bg2 { background: #859900; } .chat-discord .d-bg3 { background: #b58900; }
.chat-discord .d-bg4 { background: #268bd2; } .chat-discord .d-bg5 { background: #d33682; } .chat-discord .d-bg6 { background: #2aa198; } .chat-discord .d-bg7 { background: #eee8d5; }
/* Discord's modal: a text prompt's form. */
.chat-modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / 0.7); }
.chat-modal-box { width: min(440px, calc(100% - 32px)); padding: 20px; border-radius: 8px; background: var(--ch-modal-bg); }
.chat-modal-title { margin: 0 0 16px; color: var(--ch-name); font-size: 20px; line-height: 24px; }
.chat-modal-label { display: block; color: var(--ch-ink); font-size: 14px; font-weight: 600; }
.chat-req { color: #f23f43; }
.chat-modal-input {
  display: block; width: 100%; margin-top: 8px; padding: 10px; border: 1px solid #3f4147; border-radius: 8px;
  background: #1e1f22; color: var(--ch-ink); font: inherit; font-weight: 400;
}
.chat-modal-input:focus { outline: 2px solid var(--ch-focus); }
.chat-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.chat-modal-cancel, .chat-modal-submit { min-height: 38px; padding: 2px 16px; border: 0; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chat-modal-cancel { background: transparent; color: var(--ch-ink); }
.chat-modal-submit { background: var(--ch-primary); color: #fff; }
.chat-cover {
  position: absolute; inset: 0; width: 100%; border: 0; cursor: pointer;
  background: rgb(0 0 0 / 0.85); color: var(--accent-2); font: 16px/24px var(--font-mono); font-weight: 700;
}
.chat-note { margin: 0 16px 12px; color: var(--ch-muted); font-size: 13px; }
.chat-note:empty { display: none; }

/* "Your choice?", then " [K] item" along a line, the way the game prints a menu. */
.prompt { margin: var(--space-6) 0 0; font-size: 18px; }
.cursor::after { color: var(--accent); font-weight: 700; }
.prompt .cursor::after { content: "_"; }
.menu { display: flex; flex-wrap: wrap; gap: 0 3ch; list-style: none; padding: 0; margin: var(--space-4) 0 var(--space-1); }
.menu li::marker { content: none; }
.menu a { color: var(--ink-muted); text-decoration: none; }
.menu a:hover .item { text-decoration: underline; }
.menu a:focus-visible { color: var(--bg); }
.menu .k { color: var(--accent); font-weight: 700; }
.menu a:focus-visible .k { color: inherit; }

footer { padding-bottom: var(--space-5); color: var(--ink-muted); font-size: 14px; }
footer p { margin: 0 0 var(--space-1); }
footer a { color: inherit; }

/* Both two-up rows stack, and the page takes the phone's gutter; the screen scrolls inside its frame. */
@media (max-width: 719px) {
  .wrap { padding-inline: var(--space-3); }
  .two { grid-template-columns: 1fr; }
  .two > section + section { margin-top: var(--space-4); }
  .demo { padding-inline: var(--space-2); }
  .chat { height: 70vh; min-height: 420px; }
  .cm-gutter { flex-basis: 32px; }
  .chat-avatar { width: 32px; height: 32px; }
}
