:root {
  --stone-900: #101420;
  --stone-800: #161b28;
  --stone-700: #1d2330;
  --stone-600: #272f40;
  --iron:      #39445a;
  --parchment: #e6dbc2;
  --parchment-dim: #a89b80;
  --gold:      #c9a227;
  --gold-soft: #e0c469;
  --alliance:  #3d7fd6;
  --horde:     #b3282c;

  /* Reassigned once a faction is decided. */
  --accent: var(--gold);
  --accent-soft: var(--gold-soft);

  --rule: 1px solid rgba(201, 162, 39, 0.22);
  --shell: min(1180px, 100% - 3rem);
}

:root[data-faction="Alliance"] { --accent: #4a8ee2; --accent-soft: #8fc0f5; }
:root[data-faction="Horde"]    { --accent: #c9393d; --accent-soft: #e8898b; }

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--stone-900);
  color: var(--parchment);
  font: 400 1.0625rem/1.55 'Alegreya Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 620px at 28% 8%, rgba(60, 76, 110, 0.38), transparent 68%),
    radial-gradient(900px 700px at 92% 100%, rgba(var(--glow-rgb, 201, 162, 39), 0.10), transparent 70%),
    var(--stone-900);
  transition: background 900ms ease;
}

:root[data-faction="Alliance"] .backdrop { --glow-rgb: 74, 142, 226; }
:root[data-faction="Horde"] .backdrop { --glow-rgb: 201, 57, 61; }

/* ---------- masthead ---------- */

.masthead {
  width: var(--shell);
  margin: clamp(2rem, 6vw, 4rem) auto 0;
  max-width: 46rem;
}

.masthead h1 {
  margin: 0;
  font-family: 'Grenze', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: 0.005em;
  color: var(--parchment);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.lede {
  margin: 0.9rem 0 0;
  max-width: 34rem;
  color: var(--parchment-dim);
  font-size: 1.0625rem;
}

/* ---------- layout ---------- */

.table {
  width: var(--shell);
  margin: clamp(2rem, 5vw, 3.5rem) auto clamp(3rem, 7vw, 5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 26rem);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

/* ---------- wheel ---------- */

.stage { display: grid; justify-items: center; gap: 1.25rem; }

.wheel-frame {
  position: relative;
  width: min(100%, 34rem);
  aspect-ratio: 1;
}

#wheel { width: 100%; height: 100%; display: block; }

.pointer {
  position: absolute;
  top: -2px;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 30px solid var(--accent);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.65));
  transition: border-top-color 700ms ease;
}

.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
}

.hub span {
  font-family: 'Grenze', Georgia, serif;
  font-size: clamp(0.9rem, 2.2vw, 1.2rem);
  line-height: 1.12;
  white-space: pre-line;
  color: var(--accent-soft);
  transition: color 700ms ease;
}

.status {
  margin: 0;
  min-height: 1.5rem;
  color: var(--parchment-dim);
  font-size: 0.95rem;
}

/* ---------- ledger ---------- */

.ledger {
  background: linear-gradient(180deg, var(--stone-700), var(--stone-800));
  border: 1px solid var(--iron);
  border-top: 3px solid var(--accent);
  padding: 1.5rem clamp(1.25rem, 3vw, 1.75rem) 1.5rem;
  transition: border-top-color 700ms ease;
}

.slots { list-style: none; margin: 0; padding: 0; }

.slot {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.85rem 0;
  border-bottom: var(--rule);
}

.slot:first-child { padding-top: 0; }

.slot-name {
  color: var(--parchment-dim);
  font-size: 0.95rem;
}

.slot-value {
  display: none;
  font-family: 'Grenze', Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.1;
  color: var(--parchment);
}

.slot.resolved .slot-choice { display: none; }
.slot.resolved .slot-value { display: block; }
.slot.resolved .slot-name { color: var(--accent-soft); }

.slot.landing .slot-value { animation: strike 620ms ease-out; }

@keyframes strike {
  0%   { opacity: 0; transform: translateY(6px) scale(0.96); color: var(--accent-soft); }
  40%  { opacity: 1; color: var(--accent-soft); }
  100% { opacity: 1; transform: none; color: var(--parchment); }
}

.slot-choice {
  appearance: none;
  min-width: 11.5rem;
  max-width: 100%;
  padding: 0.45rem 2.1rem 0.45rem 0.7rem;
  background:
    linear-gradient(45deg, transparent 50%, var(--parchment-dim) 50% 54%, transparent 54%) right 1.05rem center / 9px 9px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--parchment-dim) 50% 54%, transparent 54%) right 0.65rem center / 9px 9px no-repeat,
    var(--stone-600);
  border: 1px solid var(--iron);
  border-radius: 2px;
  color: var(--parchment);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.slot-choice:hover { border-color: var(--accent); }
.slot-choice option { background: var(--stone-700); }

/* ---------- verdict ---------- */

.verdict {
  margin-top: 1.4rem;
  padding: 1.1rem 1.15rem;
  background: rgba(0, 0, 0, 0.28);
  border-left: 3px solid var(--accent);
}

.verdict-line {
  margin: 0;
  font-family: 'Grenze', Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.25;
}

.verdict-new {
  margin: 0.55rem 0 0;
  color: var(--gold-soft);
  font-size: 0.9rem;
}

.verdict-new::before { content: '★ '; }

/* ---------- actions ---------- */

.actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn {
  flex: 1 1 100%;
  padding: 0.85rem 1.4rem;
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  border: 1px solid rgba(0, 0, 0, 0.45);
  border-radius: 2px;
  color: #12151d;
  font-family: 'Grenze', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 150ms ease, background 700ms ease;
}

.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.ghost {
  flex: 1 1 calc(50% - 0.3rem);
  background: transparent;
  border-color: var(--iron);
  color: var(--parchment);
  font-size: 1.05rem;
}

.btn.ghost:hover { border-color: var(--accent); }

:is(.btn, .slot-choice):focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

/* ---------- colophon ---------- */

.colophon {
  width: var(--shell);
  margin: 0 auto clamp(2.5rem, 6vw, 4rem);
  padding-top: 1.5rem;
  border-top: var(--rule);
  color: var(--parchment-dim);
  font-size: 0.9rem;
  max-width: 44rem;
}

.colophon p { margin: 0; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  :root { --shell: min(640px, 100% - 2.5rem); }
  .table { grid-template-columns: minmax(0, 1fr); }
  .wheel-frame { width: min(100%, 26rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
