:root {
  --ink: #14060c;
  --wine: #3a0a14;
  --velvet: #1c0810;
  --gold: #e8b44a;
  --gold2: #f6e7c3;
  --ruby: #c8102e;
  --emerald: #0f8a4b;
  --sapphire: #1f4fd0;
  --cream: #f6e7c3;
  --mute: rgba(246, 231, 195, 0.72);
  --safe-t: max(10px, env(safe-area-inset-top));
  --safe-b: max(8px, env(safe-area-inset-bottom));
  --safe-l: max(8px, env(safe-area-inset-left));
  --safe-r: max(8px, env(safe-area-inset-right));
  --nav-h: clamp(78px, 13.5vh, 96px);
  --head-h: clamp(52px, 9vh, 64px);
}

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

html, body {
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  font-family: Outfit, sans-serif;
  user-select: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}

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

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

h1, h2, .eyebrow, .diadem-mark strong, .moves-chip strong, .hub-core span {
  font-family: Cinzel, serif;
}

#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(90% 55% at 50% -10%, rgba(232, 180, 74, 0.22), transparent 52%),
    radial-gradient(70% 45% at 100% 80%, rgba(200, 16, 46, 0.2), transparent 48%),
    radial-gradient(60% 40% at 0% 90%, rgba(31, 79, 208, 0.16), transparent 46%),
    var(--ink);
}

.haze, .grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.haze {
  background:
    radial-gradient(circle at 20% 20%, rgba(232, 180, 74, 0.08), transparent 28%),
    radial-gradient(circle at 80% 70%, rgba(200, 16, 46, 0.08), transparent 30%);
}

.grain {
  background-image: repeating-linear-gradient(
    24deg,
    rgba(246, 231, 195, 0.03) 0 1px,
    transparent 1px 5px
  );
  mix-blend-mode: overlay;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 24px);
  text-align: center;
  background:
    radial-gradient(120% 80% at 50% 20%, rgba(232, 180, 74, 0.18), transparent 55%),
    var(--ink);
}

.screen.is-on {
  display: flex;
}

.boot-crest {
  width: min(42vw, 160px);
  opacity: 0.55;
  margin-bottom: -18px;
  filter: drop-shadow(0 10px 18px rgba(232, 180, 74, 0.35));
}

.boot-mark {
  width: min(28vw, 108px);
  animation: pulse 2.4s ease-in-out infinite;
}

.eyebrow {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.62rem;
  color: var(--gold);
  margin: 12px 0 8px;
}

h1, h2, .gold-launch em, .lede, .mission {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.boot-line {
  margin-top: 10px;
  color: var(--mute);
  font-size: 0.92rem;
}

.boot-track {
  width: min(64vw, 240px);
  height: 6px;
  margin-top: 22px;
  border-radius: 99px;
  background: rgba(246, 231, 195, 0.12);
  overflow: hidden;
  border: 1px solid rgba(232, 180, 74, 0.35);
}

.boot-track i {
  display: block;
  height: 100%;
  width: 8%;
  background: linear-gradient(90deg, #8a5a12, var(--gold), var(--gold2));
  box-shadow: 0 0 12px var(--gold);
}

.site-shell {
  display: none;
  position: relative;
  z-index: 1;
  height: 100%;
  padding:
    calc(var(--safe-t) + 6px)
    var(--safe-r)
    calc(var(--nav-h) + var(--safe-b))
    var(--safe-l);
}

.site-shell.is-on {
  display: flex;
  flex-direction: column;
}

.diadem {
  height: var(--head-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
}

.diadem-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.diadem-mark img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(232, 180, 74, 0.45));
}

.diadem-mark .eyebrow {
  margin: 0 0 2px;
}

.diadem-mark strong {
  font-size: 0.92rem;
  display: block;
  white-space: nowrap;
}

.sound-chip {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(232, 180, 74, 0.55);
  background: radial-gradient(circle at 30% 20%, #5a1a22, #1a070c);
  overflow: hidden;
  flex: 0 0 auto;
}

.sound-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sound-chip.is-off {
  opacity: 0.45;
  filter: grayscale(0.7);
}

#pages {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.page {
  position: absolute;
  inset: 0;
  display: none;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 14px 12px;
}

.page.is-on {
  display: block;
}

#screen-mesa.page.is-on {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 4px;
}

.plaza-hero {
  position: relative;
  height: clamp(168px, 32vh, 250px);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(232, 180, 74, 0.38);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(246, 231, 195, 0.08);
}

.hero-shot {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
}

.hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 6, 12, 0.12) 0%, rgba(20, 6, 12, 0.82) 78%);
}

.hero-copy {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
}

.lede {
  margin-top: 6px;
  color: var(--mute);
  font-size: 0.9rem;
  line-height: 1.35;
}

.gold-launch {
  width: 100%;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 8px 14px 8px 8px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, #f3d27a 0%, #e8b44a 42%, #9a6a14 100%);
  color: #2a1208;
  box-shadow:
    0 10px 24px rgba(232, 180, 74, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  position: relative;
  overflow: hidden;
}

.gold-launch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.28) 48%, transparent 70%);
  transform: translateX(-120%);
  animation: shine 3.2s ease-in-out infinite;
}

.gold-launch img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 14px;
  flex: 0 0 auto;
}

.gold-launch span {
  text-align: left;
  position: relative;
  z-index: 1;
  min-width: 0;
}

.gold-launch em {
  font-style: normal;
  font-family: Cinzel, serif;
  font-size: 1.02rem;
  font-weight: 700;
  display: block;
}

.gold-launch small {
  display: block;
  font-size: 0.78rem;
  opacity: 0.8;
  margin-top: 2px;
}

.pulse-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.pulse-chip {
  min-width: 0;
  padding: 10px 8px;
  border-radius: 14px;
  background: rgba(58, 10, 20, 0.72);
  border: 1px solid rgba(232, 180, 74, 0.28);
  text-align: center;
}

.pulse-chip small {
  display: block;
  color: var(--gold);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pulse-chip strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
}

.teaser-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.facet-card, .lore-pane, .about-pane, .codex-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(58, 10, 20, 0.72), rgba(20, 6, 12, 0.88));
  border: 1px solid rgba(232, 180, 74, 0.22);
}

.facet-card img, .lore-pane img, .about-pane img, .codex-list img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
  flex: 0 0 auto;
  background: #0a0306;
}

.facet-card h2, .lore-pane h2, .about-pane h2, .codex-list h2 {
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.facet-card p, .lore-pane p, .about-pane p, .codex-list p, .page-intro p {
  color: var(--mute);
  font-size: 0.86rem;
  line-height: 1.4;
}

.page-intro {
  text-align: center;
  padding: 6px 8px 14px;
}

.page-intro img {
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(232, 180, 74, 0.28));
}

.lore-pane {
  margin-bottom: 10px;
}

.codex-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.record-board {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(232, 180, 74, 0.3);
  background: rgba(20, 6, 12, 0.55);
}

.record-board h2 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.record-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.about-pane {
  margin-top: 12px;
}

.table-hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 52px;
}

.hud-ghost, .undo-chip, .text-close, .gold-mini {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(232, 180, 74, 0.4);
  background: rgba(58, 10, 20, 0.7);
  color: var(--gold2);
  font-size: 0.78rem;
  white-space: nowrap;
}

.hud-mid {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}

.hud-mid .eyebrow {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission {
  font-size: 0.78rem;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.moves-chip {
  min-width: 54px;
  padding: 6px 8px;
  border-radius: 14px;
  text-align: center;
  background: linear-gradient(180deg, rgba(232, 180, 74, 0.2), rgba(58, 10, 20, 0.8));
  border: 1px solid rgba(232, 180, 74, 0.5);
}

.moves-chip small {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.moves-chip strong {
  font-size: 1.25rem;
  line-height: 1.1;
}

.table-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  gap: 6px;
}

.wheel {
  position: relative;
  width: min(78vw, 46dvh, 340px);
  aspect-ratio: 1;
  flex: 0 0 auto;
}

.wheel-plate {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(232, 180, 74, 0.7);
  box-shadow:
    0 0 0 6px rgba(20, 6, 12, 0.65),
    0 0 28px rgba(232, 180, 74, 0.28);
}

.wheel-face {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}

.wheel-dim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(20, 6, 12, 0.1) 20%, rgba(20, 6, 12, 0.72) 72%);
}

.socket-layer {
  position: absolute;
  inset: 0;
}

.socket {
  position: absolute;
  width: 20%;
  height: 20%;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 30% 25%, #4a2030, #12040a 70%);
  border: 2px solid rgba(232, 180, 74, 0.45);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.socket.is-port {
  box-shadow: 0 0 14px var(--port, var(--gold)), inset 0 0 8px rgba(0, 0, 0, 0.5);
  border-color: var(--port, var(--gold));
}

.socket.is-on {
  outline: 2px solid var(--gold2);
  outline-offset: 2px;
}

.socket.is-locked {
  border-style: dashed;
  opacity: 0.55;
}

.socket img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  mix-blend-mode: screen;
}

.hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  z-index: 3;
}

.hub-core {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, #f3d27a, #c48a1c 58%, #6a420c);
  color: #2a1208;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), 0 0 16px rgba(232, 180, 74, 0.45);
  flex: 0 0 auto;
}

.hub-core img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.hub-core span {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.hub-spin {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(20, 6, 12, 0.82);
  border: 1px solid var(--gold);
  color: var(--gold2);
  font-size: 1.15rem;
  line-height: 1;
  z-index: 4;
  flex: 0 0 auto;
}

.vault-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.vault {
  min-width: 0;
  padding: 8px 6px 10px;
  border-radius: 16px;
  text-align: center;
  background: rgba(20, 6, 12, 0.72);
  border: 1px solid rgba(232, 180, 74, 0.28);
}

.vault img {
  width: 36px;
  height: 28px;
  object-fit: contain;
  margin: 0 auto 4px;
}

.vault small {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.vault-slots {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.vault-slots i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(246, 231, 195, 0.28);
  background: rgba(246, 231, 195, 0.08);
}

.vault-slots i.is-on {
  background: var(--fill, var(--gold));
  box-shadow: 0 0 8px var(--fill, var(--gold));
  border-color: transparent;
}

.tool-row {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.drawer-slot {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(232, 180, 74, 0.4);
  background: rgba(58, 10, 20, 0.75);
  text-align: left;
}

.drawer-slot.is-on {
  box-shadow: 0 0 0 2px var(--gold);
}

.drawer-slot img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.drawer-slot small {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.drawer-gem {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: #0a0306;
  border: 1px solid rgba(232, 180, 74, 0.35);
  flex: 0 0 auto;
  margin-left: auto;
}

.drawer-gem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.undo-chip {
  flex: 0 0 auto;
}

.sheet {
  position: absolute;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(8, 2, 6, 0.62);
  z-index: 8;
  padding: 12px;
}

.sheet.is-on {
  display: flex;
}

.sheet-card {
  width: min(100%, 420px);
  max-height: 78%;
  overflow: auto;
  padding: 16px 14px 18px;
  border-radius: 22px 22px 16px 16px;
  background:
    linear-gradient(180deg, rgba(58, 10, 20, 0.96), rgba(20, 6, 12, 0.98));
  border: 1px solid rgba(232, 180, 74, 0.4);
}

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

.result-card img {
  width: 72px;
  margin: 0 auto 8px;
}

.result-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.gold-mini {
  background: linear-gradient(180deg, #f3d27a, #c48a1c);
  color: #2a1208;
  font-family: Cinzel, serif;
  font-weight: 700;
}

.level-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.level-ticket {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(232, 180, 74, 0.28);
  background: rgba(20, 6, 12, 0.65);
  text-align: left;
}

.level-ticket.is-done {
  border-color: rgba(15, 138, 75, 0.7);
}

.level-ticket.is-live {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(232, 180, 74, 0.35);
}

.level-ticket b {
  display: block;
  font-family: Cinzel, serif;
  font-size: 0.88rem;
}

.level-ticket span {
  color: var(--mute);
  font-size: 0.75rem;
}

.collar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 0 6px var(--safe-b);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  z-index: 6;
}

.collar-arc {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 2px;
  height: 42px;
  width: 92%;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(232, 180, 74, 0.28));
}

.pendant {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 8px;
  color: var(--mute);
}

.pendant img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(232, 180, 74, 0.4);
  background: #14060c;
}

.pendant span {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.pendant:nth-child(2) {
  transform: translateY(10px);
}

.pendant:nth-child(3),
.pendant:nth-child(4) {
  transform: translateY(18px);
}

.pendant:nth-child(5) {
  transform: translateY(10px);
}

.pendant.is-on {
  color: var(--gold2);
  transform: translateY(-6px);
}

.pendant.is-on img {
  border-color: var(--gold);
  box-shadow: 0 8px 16px rgba(232, 180, 74, 0.35);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(232, 180, 74, 0.3)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 16px rgba(232, 180, 74, 0.55)); }
}

@keyframes shine {
  0%, 55% { transform: translateX(-120%); }
  80%, 100% { transform: translateX(120%); }
}

@media (max-height: 700px) {
  .wheel { width: min(70vw, 38dvh, 280px); }
  .hub-core { width: 62px; height: 62px; }
  .vault img { width: 28px; height: 22px; }
}

@media (max-height: 640px) {
  .plaza-hero { height: 150px; }
  .gold-launch { min-height: 64px; }
  .page-intro img { width: 56px; height: 56px; }
}

@media (max-height: 600px) {
  .wheel { width: min(64vw, 32dvh, 236px); }
  .plaza-hero { height: 128px; }
  .moves-chip strong { font-size: 1.05rem; }
  .table-hud { min-height: 44px; }
}

@media (max-width: 340px) {
  .diadem-mark strong { font-size: 0.8rem; }
  .pendant span { font-size: 0.6rem; }
  .hub-core { width: 56px; height: 56px; }
  .hub-spin { width: 28px; height: 28px; }
  .lore-pane, .facet-card, .codex-list li, .about-pane {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (min-width: 430px) {
  .site-shell, .screen, .collar {
    max-width: 480px;
    margin: 0 auto;
    left: 0;
    right: 0;
  }
  .collar {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
  }
}
