:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1c1b18;
  --muted: #5d5a52;
  --line: #e3e0d6;
  --accent: #8a6a00;
  --accent-strong: #6b5200;
  --accent-bg: #f4e7b8;
  --maze-bg: #17140a;
  --maze-text: #efe9d2;
  --maze-accent: #e8d27a;
  --radius: 14px;
  --max: 1040px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101113;
    --surface: #181a1d;
    --text: #ecebe6;
    --muted: #a3a199;
    --line: #2a2d31;
    --accent: #e8c95a;
    --accent-strong: #f3da7f;
    --accent-bg: #2c2610;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -0.01em; font-size: 1.15rem; }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand:hover { color: var(--text); }
.nav { display: flex; gap: 18px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }

/* Hero */
.hero { padding-block: 64px 40px; }
.eyebrow { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; margin: 0 0 10px; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 16px; text-wrap: balance; }
h2 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 12px; text-wrap: balance; }
h3 { font-size: 1.2rem; margin: 0 0 6px; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; margin: 0; }

section { padding-block: 28px; }
.section-head { margin-bottom: 22px; }
.section-head p { color: var(--muted); margin: 0; max-width: 640px; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.card p { margin: 0; color: var(--muted); }
.card .tag { align-self: flex-start; font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent-bg); color: var(--accent-strong); }
.card ul { margin: 0; padding-left: 20px; color: var(--muted); }
.card .links { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; font-size: 0.95rem; }
.app-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-bg); }
.app-icon svg { width: 28px; height: 28px; stroke: var(--accent-strong); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; font-weight: 700; text-decoration: none; border: 2px solid transparent; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { color: var(--bg); opacity: 0.9; }
.btn-secondary { border-color: var(--line); color: var(--text); background: var(--surface); }
.btn-secondary:hover { color: var(--text); border-color: var(--muted); }

/* Maze feature panel (always dark, matches the game) */
.maze-panel { background: var(--maze-bg); color: var(--maze-text); border-radius: var(--radius); padding: 32px 24px; display: grid; gap: 24px; grid-template-columns: 1.3fr 1fr; align-items: center;
  background-image: repeating-linear-gradient(90deg, rgba(232,210,122,0.05) 0 2px, transparent 2px 46px), radial-gradient(ellipse at top left, rgba(232,210,122,0.18), transparent 60%); }
.maze-panel h2 { color: var(--maze-accent); font-family: "Courier New", ui-monospace, monospace; letter-spacing: 0.06em; }
.maze-panel p { color: #d9d2b8; margin: 0 0 12px; }
.maze-panel .btn-maze { background: var(--maze-accent); color: #17140a; }
.maze-panel .btn-maze:hover { color: #17140a; opacity: 0.9; }
.maze-panel .note { font-size: 0.85rem; color: #b5ad90; }
.maze-panel a:not(.btn) { color: var(--maze-accent); }
.hall { aspect-ratio: 4 / 3; border-radius: 10px; border: 1px solid rgba(232,210,122,0.25); width: 100%; height: auto; display: block; }
@media (max-width: 720px) { .maze-panel { grid-template-columns: 1fr; } }

/* Long-form documents */
.doc { max-width: 760px; padding-block: 40px 64px; }
.doc h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.doc h2 { font-size: 1.25rem; margin-top: 32px; }
.doc h3 { margin-top: 24px; }
.doc .meta { color: var(--muted); border-left: 3px solid var(--accent); padding-left: 12px; margin: 0 0 24px; }
.doc .meta p { margin: 0; }
.doc ul { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc p, .doc li { overflow-wrap: anywhere; }
.crumbs { font-size: 0.9rem; color: var(--muted); margin: 0 0 12px; }
.crumbs a { color: var(--muted); }

.kbd-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.kbd-list dt { font-weight: 700; }
.kbd-list dd { margin: 0; color: var(--muted); }
kbd { font-family: ui-monospace, "Courier New", monospace; background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: 0.9em; }
.callout { background: var(--accent-bg); border-radius: 10px; padding: 14px 16px; margin: 18px 0; }
.callout p { margin: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 32px 0; margin-top: 40px; font-size: 0.92rem; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; }
.site-footer h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); margin-bottom: 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.copyright { margin-top: 24px; }

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
