:root {
  --ink: #0c1024;
  --paper: #fff8ea;
  --gold: #ffc43a;
  --gold-deep: #f5a623;
  --amber: #ff8a3d;
  --rose: #ff5d7a;
  --violet: #7c5cff;
  --indigo: #2a1b6b;
  --navy: #0b1238;
  --cyan: #3ee0c6;
  --lime: #7dff9a;
  --sky: #6ecbff;
  --ok: #3ee0a0;
  --no: #ff6b7d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: "Source Sans 3", sans-serif;
  color: var(--paper);
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(255, 138, 61, .45), transparent 55%),
    radial-gradient(800px 480px at 110% 10%, rgba(124, 92, 255, .55), transparent 50%),
    radial-gradient(700px 420px at 50% 120%, rgba(62, 224, 198, .28), transparent 50%),
    linear-gradient(165deg, #14083a 0%, #0b1238 42%, #1a0a32 100%);
  overflow-x: hidden;
}

.veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(255, 196, 58, .12), transparent 28%),
    radial-gradient(circle at 80% 20%, rgba(110, 203, 255, .12), transparent 30%);
}

.veil::before,
.veil::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .7;
}

.veil::before {
  width: 180px;
  height: 180px;
  top: 8%;
  right: 7%;
  background: radial-gradient(circle, #ffc43a 0%, transparent 70%);
  animation: float 8s ease-in-out infinite;
}

.veil::after {
  width: 140px;
  height: 140px;
  bottom: 12%;
  left: 6%;
  background: radial-gradient(circle, #3ee0c6 0%, transparent 70%);
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

.frame {
  position: fixed;
  inset: 12px;
  border: 2px solid rgba(255, 196, 58, .28);
  border-radius: 28px;
  pointer-events: none;
  box-shadow: inset 0 0 40px rgba(124, 92, 255, .12);
}

#app {
  position: relative;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 36px 18px 56px;
}

.screen { display: none; width: min(780px, 100%); }
.screen.active { display: block; animation: rise .5s ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.panel {
  background:
    linear-gradient(180deg, rgba(42, 27, 107, .72), rgba(12, 16, 36, .88));
  border: 1px solid rgba(255, 196, 58, .35);
  border-radius: 28px;
  padding: 40px 36px;
  box-shadow:
    0 24px 60px rgba(8, 6, 30, .55),
    0 0 0 1px rgba(255, 255, 255, .04) inset;
  backdrop-filter: blur(10px);
}

.home-panel {
  text-align: center;
}

.eyebrow, .q-ref, .books {
  font-family: "Cinzel", serif;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 12px;
}

h1 {
  font-family: "Cinzel", serif;
  font-size: clamp(34px, 7vw, 58px);
  color: #fff;
  line-height: 1.08;
  text-shadow: 0 0 28px rgba(255, 196, 58, .35);
}

.home-panel h1 {
  background: linear-gradient(90deg, #fff 10%, #ffc43a 50%, #ff8a3d 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

h2 {
  font-family: "Cinzel", serif;
  font-size: 20px;
  color: #fff;
}

.illumination, .map-lead, .intro-rules {
  color: #efe6ff;
  line-height: 1.7;
  margin: 16px 0 20px;
  font-size: 16px;
}

blockquote {
  font-family: "Cormorant Garamond", serif;
  font-size: 24px;
  font-style: italic;
  margin: 8px auto 26px;
  max-width: 34ch;
  color: #fff;
}

cite {
  display: block;
  margin-top: 10px;
  font-style: normal;
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--gold);
  font-family: "Cinzel", serif;
}

.difficulty {
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 196, 58, .2);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 18px;
}

.difficulty span {
  display: block;
  font-family: "Cinzel", serif;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1;
  background: rgba(11, 18, 56, .7);
  color: var(--paper);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  padding: 11px 8px;
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-size: 12px;
  transition: .2s ease;
}
.seg button:hover { border-color: var(--gold); }
.seg button.on {
  background: linear-gradient(180deg, #ffe27a, #ff8a3d);
  color: #2a1200;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(255, 138, 61, .35);
}
.diff-hint { font-size: 13px; color: #d7c9ff; margin: 12px 0 0; }

.home-actions { display: grid; gap: 10px; }
.panel > .btn-gold, .panel > .btn-ghost { margin-top: 10px; }

.btn-gold, .btn-ghost, .btn-text {
  appearance: none;
  cursor: pointer;
  font-family: "Cinzel", serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 700;
}

.btn-gold {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe27a 0%, #ffc43a 40%, #ff8a3d 100%);
  color: #2a1200;
  padding: 15px 18px;
  box-shadow: 0 10px 24px rgba(255, 138, 61, .38);
  transition: transform .15s ease, filter .15s ease;
}
.btn-gold:hover { filter: brightness(1.08); transform: translateY(-1px); }

.btn-ghost {
  width: 100%;
  background: rgba(124, 92, 255, .16);
  color: #efe6ff;
  border: 1px solid rgba(124, 92, 255, .55);
  border-radius: 999px;
  padding: 13px 18px;
}
.btn-ghost:hover { background: rgba(124, 92, 255, .28); }

.btn-text {
  background: none;
  border: 0;
  color: var(--gold);
  font-size: 12px;
}

.home-stats, .result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}
.home-stats div, .result-stats div {
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .05);
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
}
.home-stats dt, .result-stats dt {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  font-family: "Cinzel", serif;
}
.home-stats dd, .result-stats dd {
  font-size: 24px;
  font-family: "Cormorant Garamond", serif;
  margin-top: 4px;
  color: #fff;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(12, 16, 36, .55);
  border: 1px solid rgba(255, 196, 58, .22);
  border-radius: 999px;
}

.journey { list-style: none; display: grid; gap: 12px; }

.era {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  background: rgba(18, 14, 52, .78);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 20px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  width: 100%;
  font: inherit;
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease;
}
.era::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
}
.era:nth-child(1)::before { background: linear-gradient(#ffc43a, #ff8a3d); }
.era:nth-child(2)::before { background: linear-gradient(#7c5cff, #6ecbff); }
.era:nth-child(3)::before { background: linear-gradient(#3ee0c6, #6ecbff); }
.era:nth-child(4)::before { background: linear-gradient(#ff5d7a, #ffc43a); }
.era:nth-child(5)::before { background: linear-gradient(#7c5cff, #ff8a3d); }
.era:nth-child(6)::before { background: linear-gradient(#6ecbff, #7dff9a); }
.era:nth-child(7)::before { background: linear-gradient(#ff8a3d, #7c5cff); }
.era:nth-child(8)::before { background: linear-gradient(#ffc43a, #3ee0c6); }

.era:hover:not(.locked) {
  transform: translateY(-2px);
  border-color: rgba(255, 196, 58, .55);
}
.era.locked { opacity: .42; cursor: not-allowed; }
.era.done {
  border-color: rgba(62, 224, 160, .55);
  box-shadow: 0 0 18px rgba(62, 224, 160, .18);
}

.era-num {
  font-family: "Cinzel", serif;
  color: var(--gold);
  font-size: 13px;
  text-align: center;
}
.era h3 {
  font-family: "Cinzel", serif;
  font-size: 17px;
  color: #fff;
}
.era p { font-size: 13px; color: #d7c9ff; margin-top: 3px; }
.stars { color: var(--gold); letter-spacing: 3px; font-size: 16px; }

.intro-modes { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.intro-modes li {
  border: 0;
  background: linear-gradient(180deg, rgba(124, 92, 255, .35), rgba(62, 224, 198, .2));
  padding: 7px 12px;
  font-size: 12px;
  color: #fff;
  border-radius: 999px;
  font-family: "Cinzel", serif;
  letter-spacing: .06em;
}

.play-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-family: "Cinzel", serif;
  font-size: 12px;
  color: #fff;
  background: rgba(12, 16, 36, .55);
  border: 1px solid rgba(255, 196, 58, .22);
  border-radius: 999px;
  padding: 10px 14px;
}
.hud-left, .hud-right { display: flex; gap: 10px; align-items: center; }
#hud-score {
  background: linear-gradient(180deg, #ffe27a, #ff8a3d);
  color: #2a1200;
  border-radius: 999px;
  padding: 4px 10px;
  min-width: 42px;
  text-align: center;
}
#hud-combo { color: var(--cyan); }
.badge {
  border: 0;
  background: rgba(124, 92, 255, .35);
  padding: 4px 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 10px;
  border-radius: 999px;
  color: #fff;
}
.lamps { display: flex; gap: 7px; }
.lamp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2a2458;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.lamp.on {
  background: radial-gradient(circle at 35% 30%, #fff6c2, #ffc43a 45%, #ff8a3d);
  box-shadow: 0 0 12px #ffc43a;
}

.progress-wrap {
  height: 8px;
  background: rgba(255, 255, 255, .08);
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 999px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7c5cff, #3ee0c6, #ffc43a);
  transition: width .3s ease;
}

.play-panel h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(24px, 4.4vw, 34px);
  font-weight: 600;
  line-height: 1.3;
  margin: 8px 0 22px;
  text-transform: none;
  letter-spacing: 0;
  color: #fff;
}

.options { display: grid; gap: 10px; }
.option {
  text-align: left;
  background: rgba(255, 255, 255, .06);
  color: var(--paper);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  padding: 14px 16px;
  cursor: pointer;
  font: 16px "Source Sans 3", sans-serif;
  transition: .18s ease;
}
.option:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(255, 196, 58, .12);
  transform: translateX(4px);
}
.option.correct {
  background: rgba(62, 224, 160, .22);
  border-color: var(--ok);
  color: #d9ffe8;
}
.option.wrong {
  background: rgba(255, 93, 122, .2);
  border-color: var(--no);
}
.option:disabled { cursor: default; }

.blank {
  display: inline-block;
  min-width: 88px;
  border-bottom: 3px solid var(--gold);
  color: var(--gold);
  padding: 0 4px;
}

.feedback {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--gold);
  background: rgba(255, 196, 58, .12);
  border-radius: 0 14px 14px 0;
  line-height: 1.55;
  color: #fff8ea;
}
.hidden { display: none !important; }

.seals { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.seal {
  border: 0;
  background: linear-gradient(180deg, #ffe27a, #ff8a3d);
  color: #2a1200;
  font-family: "Cinzel", serif;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 999px;
}

.result-list, .codex-list {
  list-style: none;
  margin: 8px 0 20px;
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}
.result-list li, .codex-list li {
  font-size: 14px;
  color: #efe6ff;
  background: rgba(255, 255, 255, .05);
  border-radius: 12px;
  padding: 10px 12px;
}
.ok { color: var(--ok); }
.no { color: var(--no); }
.map-blessing {
  margin-top: 20px;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 20px;
  text-align: center;
  color: #ffc43a;
}

.codex-list {
  background: rgba(12, 16, 36, .45);
  border: 1px solid rgba(255, 196, 58, .2);
  border-radius: 20px;
  padding: 12px;
}

@media (max-width: 620px) {
  .panel { padding: 26px 16px; }
  .home-stats, .result-stats { grid-template-columns: 1fr 1fr; }
  .era { grid-template-columns: 52px 1fr; }
  .stars { grid-column: 2; }
  .play-hud { flex-wrap: wrap; border-radius: 20px; }
  .frame { inset: 6px; border-radius: 18px; }
}
