/* Shared look for the hub and every game. Palette follows the Roman Serius
   "RR" monogram: gold on deep blue with a red accent. Swap values here. */
:root {
  --bg: #0d1730;
  --panel: #15234a;
  --panel-2: #1d2e5c;
  --ink: #f3ead3;
  --muted: #a9b2cc;
  --gold: #e3b448;
  --red: #c8423b;
  --hit: #4f9a5b;      /* right letter, right spot */
  --near: #c99a2e;     /* right letter, wrong spot */
  --miss: #39466b;     /* not in word */
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--gold); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--panel-2);
}
.topbar .brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-decoration: none;
}
.topbar .brand span { color: var(--red); }
.topbar nav { display: flex; gap: 6px; }

.icon-btn {
  background: none;
  border: 1px solid var(--panel-2);
  color: var(--ink);
  border-radius: 8px;
  min-width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--gold); }

.btn {
  background: var(--gold);
  color: var(--bg);
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.btn.secondary { background: var(--panel-2); color: var(--ink); }

/* Modal dialogs (help, stats) */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 25, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal.open { display: flex; }
.modal .card {
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: 14px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 20px 22px;
  position: relative;
}
.modal h2 { font-family: var(--serif); color: var(--gold); margin: 0 0 10px; }
.modal .close { position: absolute; top: 10px; right: 10px; }

.toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 60;
}
.toast.show { opacity: 1; }

/* Stats block reused by every game */
.stat-row { display: flex; justify-content: space-around; text-align: center; margin: 8px 0 14px; }
.stat-row b { display: block; font-size: 1.6rem; }
.stat-row small { color: var(--muted); font-size: 0.72rem; }
.dist { display: grid; gap: 4px; margin-bottom: 14px; }
.dist .bar { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 0.85rem; }
.dist .fill { background: var(--miss); padding: 2px 6px; text-align: right; min-width: 22px; border-radius: 3px; }
.dist .fill.today { background: var(--hit); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Cipher wheel (shared/wheel.js) ---------- */
.wheel { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wheel-head { width: 100%; display: flex; justify-content: space-between; align-items: baseline; }
.wheel-title { font-family: var(--serif); color: var(--gold); font-size: 1.15rem; }
.wheel-shift { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }
.wheel-shift b { color: var(--gold); }
.wheel-stage { width: 240px; height: 240px; touch-action: none; cursor: grab; border-radius: 50%; outline: none; }
.wheel-stage:active { cursor: grabbing; }
.wheel-stage:focus-visible { box-shadow: 0 0 0 3px rgba(227, 180, 72, 0.5); }
.wheel-svg { width: 100%; height: 100%; display: block; user-select: none; }
.w-outer { fill: var(--panel); stroke: var(--gold); stroke-width: 2; }
.w-plain { fill: var(--ink); font: 700 13px var(--mono); text-anchor: middle; dominant-baseline: central; }
.w-plain.top { fill: var(--gold); }
.w-inner { transform-origin: 120px 120px; transition: transform 0.25s ease; }
.w-inner.instant { transition: none; }
.w-disk { fill: var(--panel-2); stroke: var(--red); stroke-width: 2; }
.w-tick { stroke: rgba(243, 234, 211, 0.12); stroke-width: 1; }
.w-cipher { fill: var(--gold); font: 700 12px var(--mono); text-anchor: middle; dominant-baseline: central; }
.w-hub { fill: var(--bg); stroke: var(--panel-2); }
.w-hubnum { fill: var(--gold); font: 700 26px var(--serif); text-anchor: middle; }
.w-hublabel { fill: var(--muted); font: 10px var(--sans); text-anchor: middle; letter-spacing: 0.15em; text-transform: uppercase; }
.w-pointer { fill: var(--red); }
.wheel-buttons { display: flex; align-items: center; gap: 12px; }
.wheel-pair { font-family: var(--mono); color: var(--ink); min-width: 64px; text-align: center; }
.wheel-try { width: 100%; display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.wheel-try input {
  background: var(--bg); color: var(--ink); border: 1px solid var(--panel-2); border-radius: 8px;
  padding: 8px 10px; font: 600 1rem var(--mono); text-transform: uppercase; letter-spacing: 0.15em;
}
.wheel-try input:focus { outline: none; border-color: var(--gold); }
.wheel-out { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wheel-out div { background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.wheel-out small { display: block; color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; }
.wheel-out code { font-family: var(--mono); color: var(--gold); letter-spacing: 0.12em; font-size: 1rem; }
.wheel-use { width: 100%; }
.wheel-hint { color: var(--muted); font-size: 0.75rem; margin: 0; text-align: center; }
