:root {
  --navy: #041428;
  --navy-2: #061830;
  --navy-3: #0A2448;
  --pko: #054C8E;
  --pko-bright: #1A6BB8;
  --gold: #E8C547;
  --gold-2: #F3D06A;
  --coin: #D15D1D;
  --ruby: #C8102E;
  --cream: #F6EFE0;
  --mist: rgba(246, 239, 224, 0.72);
  --line: rgba(232, 197, 71, 0.28);
  --rail: 4.6rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--navy);
  color: var(--cream);
  font-family: Sora, system-ui, sans-serif;
  max-width: 100%;
}

body {
  overscroll-behavior: none;
  touch-action: manipulation;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

#app {
  position: relative;
  height: 100dvh;
  height: 100svh;
  overflow: hidden;
  max-width: 100%;
}

.velvet {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(5, 76, 142, 0.45), transparent 55%),
    radial-gradient(80% 50% at 100% 100%, rgba(209, 93, 29, 0.18), transparent 50%),
    linear-gradient(180deg, #071a33 0%, var(--navy) 42%, #020910 100%);
}

.dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff, transparent),
    radial-gradient(1px 1px at 72% 18%, var(--gold), transparent),
    radial-gradient(1.4px 1.4px at 88% 64%, #fff, transparent),
    radial-gradient(1px 1px at 28% 78%, var(--gold-2), transparent);
}

.filigree {
  position: absolute;
  inset: 0.45rem;
  pointer-events: none;
  z-index: 8;
}

.cn {
  position: absolute;
  width: 1.35rem;
  height: 1.35rem;
  border: 1.5px solid var(--gold);
  opacity: 0.7;
}

.cn.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.cn.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.cn.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.cn.br { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.screen {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  flex-direction: column;
  min-height: 0;
}

.screen.on {
  display: flex;
}

#site-shell {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
}

#site-shell.is-on {
  display: block;
}

#site-shell .screen {
  top: 0;
  bottom: calc(var(--rail) + var(--safe-b) + 0.35rem);
}

.mark {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

h1, h2 {
  font-family: Cinzel, serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.05rem, 4.6vw, 1.7rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
h2 { font-size: clamp(1.15rem, 4.6vw, 1.5rem); }

.lede {
  color: var(--mist);
  font-size: clamp(0.82rem, 3.4vw, 0.95rem);
  line-height: 1.45;
}

.lede.tight {
  margin: 0 0 0.85rem;
}

.boot-well {
  margin: auto;
  width: min(88vw, 22rem);
  text-align: center;
  padding-top: var(--safe-t);
}

.boot-halo {
  width: 6.4rem;
  height: 6.4rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 28px rgba(232, 197, 71, 0.35), inset 0 0 18px rgba(5, 76, 142, 0.65);
  overflow: hidden;
}

.boot-halo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.boot-well h1 { margin: 0.35rem 0 0.45rem; }

.boot-track {
  margin-top: 1.15rem;
  height: 0.42rem;
  border-radius: 99px;
  background: #0c2748;
  overflow: hidden;
  border: 1px solid var(--line);
}

.boot-track i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--pko), var(--gold));
}

.crest-bar {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: calc(0.55rem + var(--safe-t)) 0.9rem 0.5rem;
  border-bottom: 1px solid var(--line);
  min-height: 3.4rem;
}

.crest-bar img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold);
}

.plaque {
  min-width: 2.4rem;
  height: 2.15rem;
  padding: 0 0.55rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-weight: 800;
  border-radius: 0.35rem 0.85rem 0.35rem 0.85rem;
  background: linear-gradient(180deg, rgba(5, 76, 142, 0.45), rgba(4, 20, 40, 0.8));
  font-variant-numeric: tabular-nums;
}

.page-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0.9rem 1.1rem;
  -webkit-overflow-scrolling: touch;
}

.hero-frame {
  position: relative;
  border-radius: 1.1rem;
  overflow: hidden;
  min-height: min(38dvh, 16.5rem);
  border: 1px solid var(--line);
  margin-bottom: 0.75rem;
}

.hero-art {
  width: 100%;
  height: min(38dvh, 16.5rem);
  object-fit: cover;
  filter: saturate(1.05) contrast(1.05);
}

.press-cta {
  position: absolute;
  left: 50%;
  bottom: 0.7rem;
  transform: translateX(-50%);
  width: min(86%, 16.5rem);
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  align-items: center;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 1.4rem 0.4rem 1.4rem 0.4rem;
  background: linear-gradient(135deg, #0a2a56 0%, #051526 55%, #3a1608 100%);
  border: 1.5px solid var(--gold);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(232, 197, 71, 0.22);
}

.press-cta img {
  grid-row: 1 / span 2;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  object-fit: cover;
}

.press-cta strong {
  font-family: Cinzel, serif;
  font-size: 0.92rem;
}

.press-cta small {
  color: var(--mist);
  font-size: 0.68rem;
}

.cta-spin {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(from 120deg, transparent 60%, rgba(232, 197, 71, 0.55), transparent 78%);
  animation: spin 4.8s linear infinite;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  padding: 1.5px;
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

.keeper-strip {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: 0.7rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(5, 76, 142, 0.28), rgba(4, 20, 40, 0.4));
  border-radius: 0.9rem;
  margin-bottom: 0.75rem;
}

.keeper-strip img {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 0.7rem;
  object-fit: cover;
}

.keeper-strip p:last-child {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--mist);
  margin-top: 0.2rem;
}

.stat-plaques {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.stat-plaques div {
  min-width: 0;
  padding: 0.55rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: rgba(5, 76, 142, 0.18);
  text-align: center;
}

.stat-plaques span {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.stat-plaques strong {
  display: block;
  margin-top: 0.2rem;
  font-size: clamp(0.78rem, 3.2vw, 0.95rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-link {
  width: 100%;
  padding: 0.7rem;
  border: 1px dashed var(--line);
  border-radius: 0.8rem;
  color: var(--gold-2);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.play {
  background: radial-gradient(70% 50% at 50% 28%, rgba(5, 76, 142, 0.28), transparent 70%);
}

.play-hud {
  display: grid;
  grid-template-columns: 2.4rem 1fr 2.4rem;
  gap: 0.45rem;
  align-items: center;
  padding: calc(0.4rem + var(--safe-t)) 0.7rem 0.35rem;
}

.glyph, .pulse-btn {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  border: 1px solid var(--gold);
  background: #0a2244;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--gold);
}

.pulse-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.62rem;
}

.hud-pips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
}

.pip {
  min-width: 0;
  text-align: center;
  padding: 0.25rem 0.15rem;
  border-radius: 0.5rem;
  background: rgba(4, 20, 40, 0.7);
  border: 1px solid rgba(232, 197, 71, 0.16);
}

.pip.gold { border-color: var(--gold); }
.pip.heat { border-color: var(--coin); }

.pip span {
  display: block;
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mist);
}

.pip strong {
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission-ribbon {
  margin: 0 0.7rem 0.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.65rem;
  background: linear-gradient(90deg, rgba(209, 93, 29, 0.28), rgba(5, 76, 142, 0.35));
  border: 1px solid rgba(209, 93, 29, 0.45);
  font-size: clamp(0.62rem, 2.8vw, 0.78rem);
  line-height: 1.35;
  color: var(--cream);
  overflow-wrap: anywhere;
}

.play-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0.55rem 0.2rem;
  overflow: hidden;
}

.dial-well {
  position: relative;
  width: min(70vw, 38dvh, 19rem);
  height: min(70vw, 38dvh, 19rem);
  flex: 0 0 auto;
}

.dial-under {
  position: absolute;
  inset: 6%;
  width: 88%;
  height: 88%;
  object-fit: cover;
  border-radius: 50%;
  opacity: 0.42;
  filter: saturate(1.15);
  pointer-events: none;
  z-index: 0;
}

#dial-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.impuls-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 27%;
  height: 27%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: radial-gradient(circle at 35% 30%, #1a5aa8, #071526 68%);
  box-shadow: 0 0 18px rgba(232, 197, 71, 0.4);
  display: grid;
  place-items: center;
  overflow: hidden;
  z-index: 2;
}

.impuls-core img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}

.impuls-core b {
  position: relative;
  z-index: 1;
  font-size: clamp(0.95rem, 4.2vw, 1.2rem);
  font-weight: 800;
  color: var(--cream);
  text-shadow: 0 1px 4px #000;
}

.impuls-core small {
  position: absolute;
  bottom: 12%;
  z-index: 1;
  font-size: 0.42rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 700;
}

.chamber-legend {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.32rem;
  margin-top: 0.4rem;
  max-width: 22rem;
  flex: 0 0 auto;
}

.chamber-legend button {
  min-width: 0;
  padding: 0.32rem 0.2rem 0.28rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: rgba(6, 24, 48, 0.85);
  text-align: center;
}

.chamber-legend b {
  display: block;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.chamber-legend span {
  display: block;
  font-size: 0.55rem;
  color: var(--mist);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.15;
  max-height: 1.5em;
}

.chamber-legend button.is-hot {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(232, 197, 71, 0.28);
}

.event-toast {
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.4rem;
  z-index: 5;
  padding: 0.55rem 0.7rem;
  border-radius: 0.7rem;
  background: rgba(200, 16, 46, 0.92);
  border: 1px solid var(--gold);
  font-size: 0.75rem;
  line-height: 1.35;
}

.event-toast.hidden { display: none; }

.lock-rail {
  position: absolute;
  left: 0.35rem;
  right: 0.35rem;
  bottom: calc(0.2rem + var(--safe-b));
  z-index: 6;
  height: var(--rail);
  padding: 0.28rem 0.2rem 0.22rem;
  border-radius: 1.4rem 0.45rem 1.4rem 0.45rem;
  background:
    linear-gradient(180deg, rgba(14, 42, 82, 0.95), rgba(4, 16, 32, 0.98));
  border: 1.5px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 0 18px rgba(5, 76, 142, 0.35);
  overflow: hidden;
}

.rail-track {
  position: relative;
  height: 0.42rem;
  margin: 0 0.55rem 0.22rem;
}

.rail-track .hashes {
  display: block;
  height: 100%;
  background:
    repeating-linear-gradient(90deg, var(--gold) 0 1px, transparent 1px 7px);
  opacity: 0.45;
  border-radius: 99px;
}

.bolt {
  position: absolute;
  top: -0.12rem;
  left: 0;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--gold);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  filter: drop-shadow(0 0 6px var(--gold));
  transition: left 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rail-discs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.18rem;
  height: calc(var(--rail) - 1.05rem);
}

.rail-discs button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  border-radius: 50% 50% 0.35rem 0.35rem;
  padding: 0.08rem;
}

.rail-discs img {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid transparent;
}

.rail-discs span {
  font-size: 0.52rem;
  letter-spacing: 0.02em;
  color: var(--mist);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-discs button.on {
  transform: translateY(-0.22rem);
}

.rail-discs button.on img {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(232, 197, 71, 0.55);
}

.rail-discs button.on span {
  color: var(--gold);
}

.rail-discs button.core img {
  width: 1.7rem;
  height: 1.7rem;
  box-shadow: 0 0 8px rgba(209, 93, 29, 0.45);
}

.floor-stack, .lesson-stack {
  display: grid;
  gap: 0.6rem;
}

.floor-card, .lesson-card, .seal-card {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: linear-gradient(160deg, rgba(5, 76, 142, 0.22), rgba(4, 20, 40, 0.55));
  overflow: hidden;
}

.floor-card {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  min-height: 4.4rem;
}

.floor-card img {
  width: 4.2rem;
  height: 100%;
  min-height: 4.6rem;
  object-fit: cover;
}

.floor-card div, .lesson-card, .seal-card {
  padding: 0.65rem 0.7rem;
}

.floor-card h3, .lesson-card h3, .seal-card h3 {
  font-family: Cinzel, serif;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.floor-card p, .lesson-card p, .seal-card p {
  font-size: 0.74rem;
  color: var(--mist);
  line-height: 1.4;
}

.floor-card.is-locked {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.floor-card.is-live {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(232, 197, 71, 0.18);
}

.seal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.seal-card {
  text-align: center;
}

.seal-card img {
  width: 3.4rem;
  height: 3.4rem;
  margin: 0 auto 0.4rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold);
}

.seal-card.is-off img {
  filter: grayscale(1) brightness(0.55);
  border-color: #38506e;
}

.seal-card.is-off h3 { color: #8aa0b8; }

.lesson-card {
  width: 100%;
  text-align: left;
}

.lesson-card.is-open {
  border-color: var(--gold);
}

.lesson-body {
  display: none;
  margin-top: 0.45rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--cream);
}

.lesson-card.is-open .lesson-body {
  display: block;
}

.bars-card {
  display: grid;
  grid-template-columns: 4.6rem 1fr;
  gap: 0.65rem;
  margin-top: 0.7rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  align-items: center;
}

.bars-card img {
  width: 4.6rem;
  height: 4.6rem;
  border-radius: 0.7rem;
  object-fit: cover;
}

.bars-card p:last-child {
  font-size: 0.76rem;
  color: var(--mist);
  line-height: 1.4;
  margin-top: 0.2rem;
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: rgba(2, 8, 16, 0.78);
  display: grid;
  place-items: center;
  padding: 0.8rem;
}

.veil.hidden { display: none; }

.sheet {
  width: min(92vw, 22rem);
  max-width: calc(100% - 0.1rem);
  max-height: min(82dvh, 34rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0.95rem 0.95rem;
  border-radius: 1.1rem;
  border: 1.5px solid var(--gold);
  background: linear-gradient(180deg, #0c2a52, #07101e);
  text-align: center;
}

.sheet h2 {
  overflow-wrap: anywhere;
}

.sheet.tall { max-height: min(86dvh, 38rem); }

.sheet img {
  width: 4.2rem;
  height: 4.2rem;
  margin: 0 auto 0.55rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold);
}

.sheet p {
  color: var(--mist);
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0.35rem 0 0.8rem;
}

.sheet-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.sheet-grid div {
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
}

.sheet-grid span {
  display: block;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.btn {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.72rem 0.6rem;
  border-radius: 0.8rem;
  border: 1px solid var(--line);
  background: #0a2244;
  font-weight: 700;
}

.btn.gold {
  background: linear-gradient(180deg, var(--gold-2), #c49a28);
  color: #1a1204;
  border-color: #f7e7a1;
}

.rule-list {
  text-align: left;
  padding-left: 1.1rem;
  margin: 0.2rem 0 0.9rem;
  color: var(--mist);
  font-size: 0.78rem;
  line-height: 1.45;
}

.rule-list li { margin-bottom: 0.4rem; }

@media (max-height: 700px) {
  .hero-frame, .hero-art { min-height: 10.5rem; height: 10.5rem; }
  .dial-well {
    width: min(64vw, 34dvh, 16.2rem);
    height: min(64vw, 34dvh, 16.2rem);
  }
  .crest-bar { padding-top: calc(0.3rem + var(--safe-t)); }
  .keeper-strip img { width: 2.8rem; height: 2.8rem; }
}

@media (max-width: 360px) {
  :root { --rail: 4.25rem; }
  .rail-discs span { font-size: 0.44rem; }
  .rail-discs img { width: 1.25rem; height: 1.25rem; }
  .rail-discs button.core img { width: 1.45rem; height: 1.45rem; }
  .press-cta { width: 94%; }
  .stat-plaques { gap: 0.28rem; }
  .pip strong { font-size: 0.7rem; }
}

@media (min-width: 430px) and (min-height: 780px) {
  .dial-well {
    width: min(74vw, 42dvh, 21.5rem);
    height: min(74vw, 42dvh, 21.5rem);
  }
}
