:root {
  --bg: #f6f4f1; --panel: #ffffff; --text: #1c1a17; --muted: #6b655c; --line: #e4dfd7;
  --accent: #a21caf; --accent-text: #ffffff; --ok: #15803d; --err: #b91c1c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15131a; --panel: #1f1c25; --text: #ece8f1; --muted: #9b94a6; --line: #332e3b;
    --accent: #d946ef; --accent-text: #15131a; --ok: #4ade80; --err: #f87171;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { margin: 0; font-size: 1.9rem; letter-spacing: -0.02em; }
h2 { margin: 4px 0 16px; font-size: 1.6rem; line-height: 1.2; }
h3 { margin: 24px 0 8px; font-size: 1rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.tagline { margin: 8px 0 12px; }
.scorebar { font-size: 1.1rem; }
.scorebar strong { font-size: 1.4rem; color: var(--accent); }
header { margin-bottom: 20px; }
header p { margin: 2px 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }

form { display: flex; gap: 8px; }
input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px; padding: 10px 16px; background: var(--accent); color: var(--accent-text); font-weight: 600; }
button:disabled { opacity: 0.6; cursor: progress; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 500; text-decoration: underline; }

.hint { margin: 8px 0 0; }

.row-between { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.misses { list-style: none; padding: 0; margin: 8px 0 0; color: var(--err); font-size: 0.9rem; }

.feedback { min-height: 1.5em; margin: 12px 4px; font-weight: 500; }
.feedback.ok { color: var(--ok); }
.feedback.error { color: var(--err); }
.feedback.info { color: var(--muted); }

.history { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.row { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.row img, .noimg { width: 56px; aspect-ratio: 146 / 204; border-radius: 4px; flex: none; object-fit: cover; }
.noimg { display: grid; place-items: center; background: var(--bg); color: var(--muted); }
.row-body { flex: 1; min-width: 0; }
.row-prompt { font-size: 0.8rem; color: var(--muted); }
.row-card { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 0.85rem; color: var(--muted); }
.row-pts { font-weight: 700; font-size: 1.2rem; color: var(--accent); padding-right: 6px; }

.reveals { padding-left: 18px; margin: 0; display: grid; gap: 10px; }
footer { margin-top: 32px; }
#next { margin-left: 4px; }
.row-card a { color: inherit; text-decoration: none; }
.row-card a:hover { text-decoration: underline; }
.noimg.vg { font-size: 1.4rem; font-weight: 700; color: var(--accent); }

/* ---------- navigation ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.current { color: var(--text); border-bottom-color: var(--accent); }
.modes { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.modes a, .modes button { font: inherit; font-size: 0.9rem; font-weight: 600; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; cursor: pointer; }
.modes .current { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.archive { margin: 0 0 12px; padding: 14px; }
.archive form { flex-wrap: wrap; align-items: center; }
.archive label { width: 100%; font-size: 0.9rem; color: var(--muted); }
.archive input { flex: 0 1 200px; }
.archive-list { list-style: none; margin: 12px 0 0; padding: 0; max-height: 240px; overflow-y: auto; }
.archive-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 2px; border-top: 1px solid var(--line); font-size: 0.9rem; }

/* ---------- background art (Magic version): Slippery Bogle, Eventide, art by Dave Allsop ---------- */
.bg-art { display: none; position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.game-mtg .bg-art { display: block; }
/* The scan is small (616 px wide), so a light blur hides the upscaling; the overlay keeps text readable. */
.bg-art::before { content: ""; position: absolute; inset: -20px; background: url("../assets/bg/slippery-bogle-eve.jpg") center 30% / cover no-repeat; filter: blur(3px) saturate(1.1); }
.bg-art::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 62%, transparent); }

/* ---------- background cards (Magic version), in front of the art ---------- */
main { position: relative; z-index: 2; }
.bg-cards { display: none; position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.game-mtg .bg-cards { display: block; }
/* Each card sits centred in the margin beside the 640px column, sized to fit it. */
.bg-cards { --gutter: calc((100vw - 640px) / 2); --w: min(340px, calc(var(--gutter) - 70px)); }
.bg-cards img { position: absolute; top: 50%; width: var(--w); border-radius: 4.5%;
  opacity: 1; box-shadow: 0 20px 50px rgb(0 0 0 / 0.5); }
.bg-left { left: calc((var(--gutter) - var(--w)) / 2); transform: translateY(-50%) rotate(-9deg); }
.bg-right { right: calc((var(--gutter) - var(--w)) / 2); transform: translateY(-46%) rotate(8deg); }
@media (max-width: 1100px) {
  .bg-cards img { width: 300px; opacity: 0.12; }
  .bg-left { left: -90px; }
  .bg-right { right: -90px; }
}
