/* The single shared stylesheet for every page — content (home, docs) and app
   (library, explore, play) alike. Dark terminal theme: tokens, site chrome
   (nav + content frame), readable prose, and the shared app components. Linked
   stably as /site.css; the explorer/player screens bundle their own CSS atop
   these tokens. */

:root {
  color-scheme: dark;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  --bg: #0c0d12;
  --fg: #e3e3e3;
  --muted: #888;
  --accent: #9be65c;
  --error: #ff6b6b;
  --border: #1f2230;
  --code-bg: #06070b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
}

/* ── Site chrome: nav header + page frame (every page) ─────────────── */

.site-nav {
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
  max-width: 840px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--accent);
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.content {
  max-width: 840px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/* Site footer: license + legality line on every page. */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  max-width: 840px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.site-footer a:hover {
  color: var(--accent);
}

/* ── Prose (home + docs) ───────────────────────────────────────────────
   Typography is scoped to .prose (content pages only) so the app screens
   nested in #app keep their dense, purpose-built layout. Readability comes
   from a generous line-height and consistent vertical rhythm between blocks. */

.prose {
  line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3 {
  line-height: 1.3;
  margin: 2.6rem 0 0.85rem;
  text-wrap: balance;
}

.prose h1 {
  margin-top: 0;
  color: var(--accent);
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote {
  margin: 0 0 1.25rem;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
}

.prose blockquote {
  padding: 0.7rem 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  background: var(--code-bg);
  color: var(--muted);
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose p {
  text-wrap: pretty;
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
}

.prose li {
  margin-bottom: 0.45rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.prose code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

.prose pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1.25rem;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  text-align: left;
}

.doc-list {
  line-height: 2;
  padding-left: 1.1rem;
}

/* ── Shared app components (library + the screens' common chrome) ──── */

header h1 {
  margin: 0 0 0.25rem;
  color: var(--accent);
}

.subtitle {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

button {
  font: inherit;
  background: #1a1d28;
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  margin-right: 0.5rem;
}

button:hover {
  background: #232838;
}

button.secondary {
  color: var(--muted);
}

button.primary {
  background: #2a2f44;
  border-color: #3a4060;
}

.game-list ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.game-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.game-row .name {
  flex: 1;
}

.game-row .game-id {
  color: var(--muted);
  font-size: 0.85em;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.error {
  color: var(--error);
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--error);
  border-radius: 4px;
}

.unsupported {
  padding: 2rem;
}

.unsupported code {
  color: var(--accent);
}

.unsupported .hint {
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: rgba(255, 217, 102, 0.05);
}

.unsupported .hint ol {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

/* The library flash banner and the missing-game / permission message rendered
   by app/shared.ts — shared across screens, so they live here. */
.flash {
  color: var(--error);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--error);
  border-radius: 4px;
  margin-bottom: 1rem;
}

.page-message {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

a.back-link {
  color: var(--fg);
}

/* <a> elements styled as buttons (library Play / Explore links). */
a.button {
  display: inline-block;
  font: inherit;
  background: #1a1d28;
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  margin-right: 0.5rem;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
}

a.button.secondary {
  opacity: 0.85;
}
