:root {
  --bg: #0e0d0b;
  --panel: rgba(22, 20, 17, 0.88);
  --ink: #f3eee4;
  --muted: #b9b1a3;
  --accent: #d8b46a;
  --focus: #7cc4ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
#scene { position: fixed; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }

/* Start / pause overlay */
#overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(14,13,11,0.75), rgba(14,13,11,0.95)); z-index: 10; }
#overlay[hidden] { display: none; }
.card { max-width: 34rem; width: 100%; background: var(--panel); border: 1px solid rgba(216,180,106,0.35);
  padding: 28px 28px 24px; border-radius: 6px; box-shadow: 0 30px 80px rgba(0,0,0,0.6); }
.card h1 { font-weight: 400; font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: 0.04em; margin: 0 0 4px;
  text-transform: uppercase; color: var(--accent); }
.card p { margin: 0 0 14px; line-height: 1.5; color: var(--muted); }
.card p.lede { color: var(--ink); font-style: italic; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 20px; font-size: 0.95rem; }
.keys dt { margin: 0; } .keys dd { margin: 0; color: var(--muted); }
kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8em; background: #2a2723;
  border: 1px solid #4a4640; border-bottom-width: 2px; padding: 1px 6px; border-radius: 4px; color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
button { font: inherit; cursor: pointer; }
.btn { background: var(--accent); color: #1a1508; border: 0; padding: 12px 22px; border-radius: 4px;
  font-size: 1.05rem; letter-spacing: 0.03em; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid #5a5449; }
:is(button, a, input):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.seed { margin-left: auto; font-size: 0.85rem; color: var(--muted); }
.seed code { color: var(--ink); font-family: ui-monospace, Menlo, monospace; }
.card p.credits { margin: 18px 0 0; font-size: 0.78rem; color: var(--muted); }
.card p.credits a { color: var(--muted); }
.card p#status { font-size: 0.9rem; min-height: 1.4em; }
#status:empty { display: none; }
.btn:disabled { opacity: 0.55; cursor: progress; }

/* In-game HUD */
#hud { position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); display: flex;
  justify-content: space-between; align-items: flex-end; gap: 12px; pointer-events: none; z-index: 5; }
#hud[hidden] { display: none; }
#label { background: var(--panel); border-left: 3px solid var(--accent); padding: 10px 14px; max-width: 28rem;
  min-height: 1.5em; border-radius: 3px; transition: opacity .25s; }
#label:empty { opacity: 0; }
#label .t { font-style: italic; font-size: 1.05rem; } #label .a { color: var(--muted); font-size: 0.9rem; }
#stats { font-size: 0.85rem; color: var(--muted); background: var(--panel); padding: 8px 12px; border-radius: 3px; white-space: nowrap; }
#reticle { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: rgba(255,255,255,0.7); box-shadow: 0 0 0 1px rgba(0,0,0,0.5); pointer-events: none; z-index: 5; }
#reticle[hidden] { display: none; }

/* Touch controls */
#touch { position: fixed; left: 16px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 56px); z-index: 6;
  display: none; gap: 10px; }
#touch[data-on="true"] { display: flex; }
#touch button { width: 64px; height: 64px; border-radius: 50%; border: 1px solid #5a5449; background: var(--panel);
  color: var(--ink); font-size: 1.4rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { #label { transition: none; } }

/* Shown only when JavaScript is off */
.noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center;
  color: var(--ink); font-size: 1.1rem; line-height: 1.5; }
