#bg-rotator {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
#bg-rotator .bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.4s ease;
  filter: saturate(.7) contrast(.9);
}
#bg-rotator .bg-layer.show { opacity: .9; }

:root {
  --bg-deep: #050608;
  --bg-mid: #0b0d12;
  --bg-fade: rgba(6, 8, 14, 0.55);
  --ink: #f1f3f8;
  --ink-soft: #c9ceda;
  --ink-muted: #9aa1b3;
  --accent: #d6dbff;
  --accent-strong: #6c7bff;
  --line: rgba(180, 190, 255, 0.16);
  --line-strong: rgba(214, 219, 255, 0.32);
  --pill-bg: rgba(10, 15, 30, 0.82);
  --pill-glow: rgba(199, 205, 255, 0.18);
  --success: #6cffb4;
  --danger: #ff6c8c;
  --font-brand: "Cinzel", "Trajan Pro", "Playfair Display", Georgia, serif;
  --font-ui: "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 16px/1.55 var(--font-ui);
  color: var(--ink);
  background: var(--bg-deep);
  position: relative;
}

.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.wrap { width: min(1280px, 96vw); margin: 0 auto; padding: clamp(16px, 3vw, 40px) 0; }

.ambient { position: fixed; inset: 0; z-index: -2; overflow: hidden; }
.ambient__layer {
  position: absolute; inset: 0;
  background: radial-gradient(1400px 900px at 50% 35%, rgba(255,255,255,.08) 0%, rgba(7,9,16,.9) 72%, rgba(5,6,8,1) 100%);
  opacity: .88;
}
.ambient__veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(140vw 80vh at 50% -15%, rgba(220,224,255,.38), transparent 50%),
    linear-gradient(120deg, rgba(0,0,0,.82) 0%, rgba(4,6,12,.82) 60%, rgba(4,5,9,.92) 100%);
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: .25;
}

.masthead { display: flex; justify-content: space-between; align-items: flex-end; gap: clamp(24px, 4vw, 60px); position: relative; z-index: 1; }
.masthead__brand { max-width: 60ch; text-transform: lowercase; }
.wordmark {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  letter-spacing: .6rem;
  text-indent: .6rem;
  color: var(--ink);
  text-shadow: 0 10px 30px rgba(0,0,0,.65);
}
.motto-primary {
  margin: 0.2rem 0 0;
  font-family: var(--font-brand);
  letter-spacing: .35rem;
  font-size: clamp(0.85rem,2.4vw,1.2rem);
  color: var(--accent);
  text-transform: uppercase;
}
.motto-secondary {
  margin: .2rem 0 0;
  font-size: clamp(.85rem,2.2vw,1rem);
  letter-spacing: .18rem;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.masthead__nav { display: flex; gap: 1.1rem; align-items: center; text-transform: uppercase; font-size: .78rem; letter-spacing: .28em; }
.masthead__nav a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid transparent; padding-bottom: 4px; }
.masthead__nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.board {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(180px, .95fr) minmax(0, 2.3fr) minmax(240px, 1.2fr);
  gap: clamp(18px, 3vw, 32px);
  margin-bottom: clamp(36px, 6vw, 82px);
}

.panel {
  background: linear-gradient(175deg, rgba(7,10,18,.92), rgba(5,6,10,.78));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(20px, 2.8vw, 32px);
  box-shadow: 0 40px 90px rgba(0,0,0,.55), inset 0 0 28px rgba(17,21,38,.65);
  backdrop-filter: blur(18px);
}

.ladder { color: var(--ink-soft); font-size: .9rem; display: flex; flex-direction: column; gap: 16px; }
.ladder h3 { margin: 0; text-transform: uppercase; letter-spacing: .32em; font-size: .75rem; color: var(--ink-muted); }
.ladder ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column-reverse; gap: 8px;
}
.ladder li {
  display: flex; justify-content: space-between; align-items: center;
  padding: .45rem .7rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(10,14,24,.55);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.ladder li.current {
  border-color: var(--line-strong);
  background: rgba(35,45,85,.65);
  color: var(--accent);
}
.ladder li.gleam { animation: ladderGlow 1.2s ease-out; }
@keyframes ladderGlow { from{box-shadow:0 0 20px rgba(255,255,255,.3);} to{box-shadow:none;} }
.ladder .amt { font-family: var(--font-brand); letter-spacing: .18rem; }

.stage { display: flex; flex-direction: column; gap: clamp(18px, 3vw, 26px); }
.stage__hud { display: flex; justify-content: space-between; align-items: center; gap: clamp(16px, 3vw, 24px); flex-wrap: wrap; }
.hud__group { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hud__group--right { margin-left: auto; }

.btn {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(27,32,56,.9), rgba(8,10,18,.95));
  color: var(--ink);
  padding: .55rem 1.2rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  font-size: .75rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .35; cursor: not-allowed; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,0,0,.4); }
.btn--primary { background: linear-gradient(160deg, rgba(120,130,255,.9), rgba(70,90,220,.95)); color: #0b0d14; }
.btn--ghost { background: rgba(10,14,24,.6); color: var(--ink-muted); }

.rating { display: inline-flex; gap: 6px; }
.rating .rate-thumb {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12,16,26,.7);
  color: var(--ink);
  width: 36px; height: 34px;
  cursor: pointer;
}
.rating .glyph { display: inline-block; transform: rotate(var(--rot, 0deg)); display: flex; align-items: center; justify-content: center; }

.frame { border-radius: 28px; border: 1px solid var(--line); background: linear-gradient(170deg, rgba(10,12,20,.88), rgba(5,6,10,.72)); box-shadow: inset 0 0 34px rgba(0,0,0,.55); padding: clamp(18px, 2vw, 26px); }
.question { margin: 0; font-family: var(--font-brand); font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: .12rem; line-height: 1.28; }

.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2.5vw, 22px); }
.answer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 1rem 1.3rem;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid rgba(255,255,255,.08);
  clip-path: polygon(4% 0, 96% 0, 100% 38%, 100% 62%, 96% 100%, 4% 100%, 0 62%, 0 38%);
  box-shadow: inset 0 0 38px rgba(0,0,0,.6), 0 0 32px var(--pill-glow);
  cursor: pointer;
  text-align: left;
  letter-spacing: .05em;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.answer:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.answer .label {
  min-width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.6);
  font-family: var(--font-brand);
  letter-spacing: .12em;
}
.answer.correct { border-color: var(--success); box-shadow: 0 0 32px rgba(104,255,196,.45); }
.answer.wrong { border-color: var(--danger); box-shadow: 0 0 24px rgba(255,108,140,.35); }
.answer.disabled { opacity: .35; cursor: not-allowed; }
.answer .burst { position: absolute; inset: -12px; border-radius: inherit; border: 1px solid rgba(205,255,234,.6); animation: burst .6s ease-out forwards; pointer-events: none; }
@keyframes burst { from { opacity: 1; transform: scale(.94); } to { opacity: 0; transform: scale(1.08); } }
.answer.wobble { animation: wobble .6s ease; }
@keyframes wobble { 16%{transform:translateX(-4px)} 33%{transform:translateX(4px)} 50%{transform:translateX(-3px)} 66%{transform:translateX(3px)} 83%{transform:translateX(-2px)} to{transform:translateX(0)} }

.stage__explain {
  font-size: .95rem;
  color: var(--ink-soft);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(12,16,26,.72);
  padding: 1rem 1.2rem;
  line-height: 1.5;
}

.intel { display: flex; flex-direction: column; gap: 18px; color: var(--ink-soft); font-size: .95rem; }
.intel__heading { margin: 0; text-transform: uppercase; letter-spacing: .28em; font-size: .78rem; color: var(--ink-muted); }
.ticker {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(8,10,18,.65);
  min-height: 68px;
  display: flex; align-items: center;
}
.ticker__track {
  display: inline-flex;
  gap: 2.4rem;
  animation: tickerScroll var(--ticker-duration, 70s) linear infinite;
  white-space: nowrap;
}
.ticker__item { color: var(--ink-soft); font-size: .96rem; letter-spacing: .02em; }
.ticker__item a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
.ticker__item a:hover { color: var(--accent-strong); border-bottom-color: rgba(214,219,255,.35); }
.ticker__item strong { color: var(--accent); text-transform: uppercase; letter-spacing: .22em; font-size: .78rem; margin-right: .6rem; }
@keyframes tickerScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker:hover .ticker__track { animation-play-state: paused; }
.intel__notes { font-size: .85rem; color: var(--ink-muted); line-height: 1.5; }

.intel__gallery {
  position: relative;
  flex: 1;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.12);
  overflow: hidden;
  min-height: 320px;
  display: grid;
  place-items: stretch;
  background: rgba(8,10,18,.6);
}
.intel__gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.8);
  opacity: 0;
  transition: opacity 1.2s ease;
}
.intel__gallery img.is-visible { opacity: 1; }
.intel__gallery::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5,7,12,.05) 0%, rgba(5,7,12,.5) 80%);
}
.gallery-caption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 1.2rem 1.4rem 1.8rem;
  color: var(--ink);
  font-family: var(--font-brand);
  letter-spacing: .18em;
  text-transform: uppercase;
  text-shadow: 0 10px 24px rgba(0,0,0,.75);
}
.gallery-caption span {
  display: block;
  font-family: var(--font-ui);
  letter-spacing: .06em;
  font-size: .92rem;
  color: var(--ink-soft);
  margin-top: .35rem;
}

.footer {
  position: relative;
  z-index: 1;
  padding-bottom: clamp(24px, 4vw, 48px);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .24em;
  font-size: .7rem;
}

.wizard-fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(120,130,255,.9), rgba(55,65,180,.95));
  color: #05070d;
  font-size: 1.5rem;
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 18px 42px rgba(0,0,0,.6);
  cursor: pointer;
  z-index: 3;
}
.wizard-fab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

dialog { border: 1px solid var(--line); border-radius: 18px; padding: 1.5rem; background: rgba(10,12,20,.94); color: var(--ink); max-width: 420px; }
dialog::backdrop { background: rgba(5,6,10,.7); backdrop-filter: blur(3px); }
dialog textarea { width: 100%; min-height: 140px; border-radius: 12px; background: rgba(5,6,12,.8); border: 1px solid var(--line); color: var(--ink); padding: .75rem; font-family: var(--font-ui); }
.dlg-actions { margin-top: 1rem; display: flex; gap: .6rem; justify-content: flex-end; }
.dlg-actions button { border-radius: 999px; border: 1px solid var(--line); background: rgba(12,14,24,.7); color: var(--ink); padding: .45rem .9rem; cursor: pointer; }

@media (max-width: 1020px) {
  .board { grid-template-columns: 1fr; }
  .masthead { flex-direction: column; align-items: flex-start; }
  .masthead__nav { margin-top: 16px; }
  .hud__group--right { margin-left: 0; }
}

@media (max-width: 720px) {
  .answers { grid-template-columns: 1fr; }
  .wordmark { letter-spacing: .4rem; font-size: clamp(2rem, 9vw, 3.4rem); }
  .masthead__nav { flex-wrap: wrap; row-gap: 8px; }
  .wizard-fab { bottom: 22px; right: 22px; }
}

.genie-button {
  position: fixed;
  bottom: 96px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(214,219,255,.25);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.7), rgba(80,88,148,.9));
  color: #0b0d14;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 22px 48px rgba(0,0,0,.55);
  z-index: 60;
}
.genie-button:hover { transform: translateY(-1px); }

.genie-panel {
  position: fixed;
  inset: 32px 28px auto auto;
  width: min(420px, 92vw);
  max-height: calc(100vh - 64px);
  background: rgba(8,10,18,.96);
  border: 1px solid rgba(214,219,255,.18);
  border-radius: 28px;
  box-shadow: 0 38px 88px rgba(0,0,0,.7);
  z-index: 70;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.genie-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.genie-panel__inner { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.genie-panel__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.6rem 1.6rem 1rem; }
.genie-panel__title { margin: 0; font-family: var(--font-brand); letter-spacing: .3rem; font-size: 1.1rem; text-transform: uppercase; color: var(--accent); }
.genie-panel__subtitle { margin: .2rem 0 0; font-size: .85rem; color: var(--ink-muted); letter-spacing: .08em; }
.genie-close { border: none; background: rgba(20,24,40,.8); color: var(--ink); border-radius: 12px; width: 36px; height: 36px; cursor: pointer; font-size: 1.5rem; }
.genie-panel__question { padding: 0 1.6rem; }
.genie-panel__prompt { font-size: 1rem; line-height: 1.5; color: var(--ink-soft); margin-bottom: .8rem; }
.genie-panel__choices { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.genie-choice { padding: .35rem .7rem; border-radius: 12px; border: 1px solid rgba(214,219,255,.12); background: rgba(12,16,28,.65); font-size: .9rem; color: var(--ink-muted); }
.genie-choice.is-correct { border-color: var(--success); color: var(--ink); }
.genie-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .25rem; padding: 0 1.6rem 1rem; }
.genie-tab { border: 1px solid rgba(214,219,255,.12); border-radius: 12px; padding: .45rem .4rem; background: rgba(15,18,30,.7); color: var(--ink-muted); font-size: .8rem; letter-spacing: .09em; text-transform: uppercase; cursor: pointer; }
.genie-tab.is-active { background: rgba(120,130,255,.16); color: var(--ink); border-color: rgba(120,130,255,.45); }
.genie-content { flex: 1; padding: 0 1.6rem 1.6rem; overflow-y: auto; }
.genie-info { font-size: .95rem; line-height: 1.5; color: var(--ink-soft); }
.genie-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.genie-table td { border-top: 1px solid rgba(214,219,255,.12); padding: .55rem .4rem; color: var(--ink-soft); }
.genie-list { margin: 0; padding-left: 1.2rem; color: var(--ink-soft); font-size: .92rem; line-height: 1.6; }
.genie-section { display: grid; gap: .8rem; font-size: .92rem; color: var(--ink-soft); }
.genie-label { font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-muted); }
.genie-textarea, .genie-select { width: 100%; border-radius: 12px; border: 1px solid rgba(214,219,255,.18); background: rgba(12,16,28,.8); color: var(--ink); padding: .6rem .7rem; }
.genie-action { justify-self: flex-start; border: 1px solid rgba(120,130,255,.45); border-radius: 999px; padding: .45rem 1.1rem; background: rgba(120,130,255,.18); color: var(--ink); cursor: pointer; letter-spacing: .1em; text-transform: uppercase; }

@media (max-width: 720px) {
  .genie-button { bottom: 84px; right: 18px; }
  .genie-panel { inset: 12px 12px auto auto; width: min(360px, 94vw); }
}
