:root {
  --velvet: #07140f;
  --velvet-2: #0c2418;
  --panel: #10291c;
  --emerald: #149a4a;
  --leaf: #1db954;
  --gold: #d4af37;
  --gold-bright: #f3d36a;
  --ruby: #9b1b3a;
  --cream: #f3e6c4;
  --mist: #c9d7c4;
  --leque: 96px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  height: 100%;
  background: var(--velvet);
  color: var(--cream);
  font-family: Outfit, "Segoe UI", sans-serif;
}

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

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

#app {
  position: relative;
  min-height: 100dvh;
  max-width: 100vw;
  overflow-x: hidden;
}

.velvet-wash {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(90% 50% at 50% -8%, rgba(212, 175, 55, 0.22) 0%, transparent 48%),
    radial-gradient(70% 40% at 110% 80%, rgba(20, 154, 74, 0.28) 0%, transparent 50%),
    linear-gradient(180deg, #0a1c14 0%, #07140f 48%, #04100b 100%);
  z-index: 0;
}

.canopy-veil {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--leque) + var(--safe-b) - 10px);
  width: 100%;
  height: 32vh;
  object-fit: cover;
  object-position: bottom;
  opacity: 0.16;
  pointer-events: none;
  z-index: 1;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}

.screen,
.site-shell {
  position: relative;
  z-index: 2;
}

.screen {
  display: none;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-t)) 12px 16px;
}

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

.boot-jewel {
  width: min(100%, 340px);
  max-width: 100%;
  text-align: center;
  padding: 22px 12px 18px;
  overflow: hidden;
  border-radius: 28px 12px 28px 12px;
  background:
    linear-gradient(160deg, rgba(212, 175, 55, 0.18), transparent 42%),
    linear-gradient(180deg, #143322, #0a1c14);
  border: 1.5px solid rgba(212, 175, 55, 0.55);
  box-shadow: 0 0 0 1px rgba(20, 154, 74, 0.35), 0 18px 40px rgba(0, 0, 0, 0.45);
}

.boot-crest {
  width: 112px;
  height: 112px;
  margin: 0 auto 12px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 24px rgba(212, 175, 55, 0.45);
}

.eyebrow {
  font-family: Syne, sans-serif;
  font-size: clamp(9px, 2.6vw, 12px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.wordmark {
  font-family: Cinzel, serif;
  font-weight: 800;
  line-height: 0.92;
  margin: 6px 0 10px;
  font-size: clamp(22px, 8vw, 42px);
}

.wordmark span:first-child {
  display: block;
  color: var(--gold-bright);
}

.wordmark span:last-child {
  display: block;
  color: var(--cream);
  font-size: 0.72em;
}

.boot-line {
  font-size: 13px;
  color: var(--mist);
  min-height: 18px;
}

.boot-track {
  margin-top: 16px;
  height: 7px;
  border-radius: 99px;
  background: #082016;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

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

.site-shell {
  display: none;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
  padding:
    calc(12px + var(--safe-t))
    12px
    calc(var(--leque) + var(--safe-b) + 10px);
}

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

.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

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

.brand-crest {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  object-fit: cover;
  border: 1.5px solid var(--gold);
  flex: 0 0 auto;
}

.brand-copy {
  min-width: 0;
}

.brand-copy .wordmark {
  font-size: clamp(18px, 5.4vw, 26px);
  margin: 0;
}

.lantern-orb {
  width: 48px;
  height: 48px;
  border-radius: 50% 50% 46% 50%;
  overflow: hidden;
  border: 1.5px solid var(--gold);
  flex: 0 0 auto;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.35);
}

.lantern-orb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page {
  display: none;
  width: min(100%, 520px);
  margin: 0 auto;
  padding-bottom: 8px;
}

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

.page-title {
  font-family: Cinzel, serif;
  font-size: clamp(24px, 7vw, 34px);
  margin: 4px 0 8px;
}

.lede {
  color: var(--mist);
  font-size: clamp(13px, 3.6vw, 15px);
  line-height: 1.45;
  margin-bottom: 14px;
}

.orla-stage {
  position: relative;
  height: clamp(168px, 38vw, 230px);
  border-radius: 28px 8px 32px 8px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1.5px solid rgba(212, 175, 55, 0.5);
  box-shadow: inset 0 0 40px rgba(7, 20, 15, 0.35);
}

.orla-sky {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.orla-hero {
  position: absolute;
  left: 6%;
  bottom: -8%;
  height: 92%;
  width: auto;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45));
}

.orla-token,
.orla-gem {
  position: absolute;
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--gold);
}

.orla-token {
  right: 16%;
  top: 14%;
}

.orla-gem {
  right: 8%;
  bottom: 16%;
  width: 46px;
  height: 46px;
}

.cortejo-play {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #1a5c2e, #0e3a22 55%, #14301f);
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 1px rgba(20, 154, 74, 0.4), 0 10px 24px rgba(0, 0, 0, 0.35);
  margin-bottom: 14px;
}

.cortejo-play img {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--gold-bright);
}

.cortejo-play em {
  display: block;
  font-style: normal;
  font-family: Cinzel, serif;
  font-size: clamp(16px, 4.6vw, 20px);
}

.cortejo-play small {
  color: var(--gold-bright);
}

.pulse-clock {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, #123224, #0a1d14);
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.pulse-clock h2 {
  font-family: Syne, sans-serif;
  font-size: 16px;
}

.pulse-clock p {
  font-size: 13px;
  color: var(--mist);
  line-height: 1.4;
}

.pulse-face {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background:
    conic-gradient(from 180deg, #0b3a24, #d4af37 42%, #9b1b3a 70%, #0b3a24);
  position: relative;
  box-shadow: inset 0 0 16px #04100b;
}

.pulse-face i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 26px;
  background: var(--cream);
  transform-origin: bottom center;
  transform: translate(-50%, -100%) rotate(20deg);
  border-radius: 2px;
}

.teaser-stack {
  display: grid;
  gap: 10px;
}

.jewel-card {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 18px 6px 18px 6px;
  background: rgba(16, 41, 28, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.jewel-card img {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 14px;
}

.jewel-card h2 {
  font-family: Syne, sans-serif;
  font-size: 16px;
  margin-bottom: 4px;
}

.jewel-card p {
  font-size: 13px;
  color: var(--mist);
  line-height: 1.35;
}

.run-frame {
  position: relative;
  width: 100%;
  height: calc(100dvh - var(--safe-t) - 12px);
  border-radius: 18px;
  overflow: hidden;
  background: #04110c;
  border: 1.5px solid rgba(212, 175, 55, 0.4);
}

#runCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.run-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(7, 20, 15, 0.72);
  border: 1px solid var(--gold);
  font-size: 12px;
  font-family: Syne, sans-serif;
}

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

.hud-cluster span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hudScore {
  display: block;
  font-family: Cinzel, serif;
  font-size: 20px;
}

#hudSamba {
  font-size: 11px;
  color: var(--gold-bright);
}

.hud-lives {
  display: flex;
  gap: 4px;
}

.hud-lives i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 8px var(--gold);
}

.hud-lives i.off {
  background: #2a3d30;
  box-shadow: none;
}

.tide-hud {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(7, 20, 15, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.key-hud {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 6px;
}

.key-hud img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--gold);
  opacity: 0.35;
}

.key-hud img.is-on {
  opacity: 1;
  box-shadow: 0 0 10px var(--gold);
}

.run-hint {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  z-index: 3;
  text-align: center;
  font-size: 12px;
  color: var(--cream);
  text-shadow: 0 1px 8px #000;
}

.run-veil {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 16, 11, 0.72);
  z-index: 4;
  padding: 18px;
}

.run-veil.is-on {
  display: flex;
}

.veil-card {
  width: min(100%, 320px);
  padding: 18px 16px;
  border-radius: 22px 8px 22px 8px;
  background: linear-gradient(180deg, #173526, #0b1f16);
  border: 1.5px solid var(--gold);
  text-align: center;
}

.veil-card h2 {
  font-family: Cinzel, serif;
  margin-bottom: 8px;
}

.veil-card p {
  color: var(--mist);
  font-size: 14px;
  margin-bottom: 14px;
}

.veil-actions {
  display: grid;
  gap: 8px;
}

.trail-ribbon {
  display: grid;
  gap: 12px;
}

.trail-card {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 10px;
  padding: 8px;
  border-radius: 20px 8px 22px 8px;
  background: #10291c;
  border: 1px solid rgba(212, 175, 55, 0.3);
  overflow: hidden;
}

.trail-card.is-on {
  border-color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.22);
}

.trail-card.is-locked {
  opacity: 0.55;
}

.trail-card img {
  width: 108px;
  height: 108px;
  object-fit: cover;
  border-radius: 14px;
}

.trail-card h3 {
  font-family: Syne, sans-serif;
  font-size: 16px;
}

.trail-card p {
  font-size: 12px;
  color: var(--mist);
  margin: 4px 0 8px;
}

.pick-trail {
  width: 100%;
  padding: 9px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1a5c2e, #123820);
  border: 1px solid var(--gold);
  font-family: Syne, sans-serif;
  font-size: 13px;
}

.pick-trail:disabled {
  opacity: 0.45;
}

.vault-hero {
  display: grid;
  grid-template-columns: 56px 1fr 56px 1fr;
  gap: 8px;
  align-items: center;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: #10291c;
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.vault-hero img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 50%;
}

.vault-hero h3 {
  font-size: 11px;
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.vault-hero strong {
  font-family: Cinzel, serif;
  font-size: 22px;
}

.note-grid {
  display: grid;
  gap: 10px;
}

.note-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: #10291c;
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.note-card.is-muted {
  opacity: 0.5;
}

.note-card img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
}

.note-card h3 {
  font-family: Syne, sans-serif;
  font-size: 15px;
}

.note-card p {
  font-size: 13px;
  color: var(--mist);
}

.lore-sheet {
  margin-bottom: 14px;
  padding: 10px;
  border-radius: 20px 8px 20px 8px;
  background: #10291c;
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.lore-sheet img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 10px;
}

.lore-sheet h3 {
  font-family: Cinzel, serif;
  margin-bottom: 6px;
}

.lore-sheet p {
  font-size: 14px;
  color: var(--mist);
  line-height: 1.45;
}

.mark-hero {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  margin: 8px 0 12px;
  border-radius: 18px;
  background: linear-gradient(90deg, #173526, #0b1f16);
  border: 1.5px solid var(--gold);
}

.mark-hero img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
}

.mark-hero strong {
  font-family: Cinzel, serif;
  font-size: 32px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.stat-pill {
  padding: 12px;
  border-radius: 14px;
  background: #10291c;
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.stat-pill span {
  display: block;
  font-size: 11px;
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-pill b {
  font-family: Cinzel, serif;
  font-size: 20px;
}

.medal-row {
  display: grid;
  gap: 8px;
}

.medal-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  background: #10291c;
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.medal-chip img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
}

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

.guide-steps li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: #10291c;
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.guide-steps img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
}

.guide-steps h3 {
  font-family: Syne, sans-serif;
  margin-bottom: 4px;
}

.guide-steps p {
  font-size: 13px;
  color: var(--mist);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: #10291c;
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.danger-chip {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #2a1218;
  border: 1px solid var(--ruby);
  color: #f3c4c4;
}

.leque {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  padding: 0 8px calc(8px + var(--safe-b));
  background:
    linear-gradient(180deg, transparent, #07140f 28%);
}

.leque-vine {
  height: 10px;
  margin: 0 18px -4px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 10% 50%, var(--gold-bright) 0 3px, transparent 4px),
    radial-gradient(circle at 30% 50%, var(--emerald) 0 3px, transparent 4px),
    radial-gradient(circle at 50% 50%, var(--gold) 0 4px, transparent 5px),
    radial-gradient(circle at 70% 50%, var(--emerald) 0 3px, transparent 4px),
    radial-gradient(circle at 90% 50%, var(--gold-bright) 0 3px, transparent 4px),
    linear-gradient(90deg, transparent, #d4af37, #149a4a, #d4af37, transparent);
  opacity: 0.9;
}

.leque-arc {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 8px 4px 2px;
}

.folha {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding-top: 10px;
}

.folha .joia {
  width: clamp(38px, 11vw, 48px);
  height: clamp(38px, 11vw, 48px);
  border-radius: 18px 18px 22px 8px;
  overflow: hidden;
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  background: #0c2418;
  transform: rotate(-8deg);
}

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

.folha-nome {
  font-size: clamp(8px, 2.4vw, 10px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mist);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folha.is-on .joia {
  border-color: var(--gold-bright);
  transform: rotate(0deg) translateY(-8px) scale(1.08);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.55);
}

.folha.is-on .folha-nome {
  color: var(--gold-bright);
}

.brand-copy .eyebrow {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cortejo-play em,
.cortejo-play small,
.lede,
.jewel-card p,
.lore-sheet p,
.page-title {
  overflow-wrap: break-word;
}

body.is-playing {
  overflow: hidden;
  height: 100dvh;
}

body.is-playing .topo,
body.is-playing .leque,
body.is-playing .canopy-veil {
  display: none;
}

body.is-playing .site-shell {
  padding: calc(6px + var(--safe-t)) 8px calc(6px + var(--safe-b));
}

body.is-playing #screen-run {
  width: 100%;
  max-width: none;
}

@media (max-width: 400px) {
  :root {
    --leque: 132px;
  }

  .leque-arc {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 4px;
  }

  .folha {
    padding-top: 4px;
  }

  .orla-stage {
    height: 150px;
  }

  .jewel-card,
  .trail-card,
  .guide-steps li,
  .note-card {
    grid-template-columns: 60px 1fr;
  }

  .jewel-card img,
  .trail-card img,
  .guide-steps img,
  .note-card img {
    width: 60px;
    height: 60px;
  }

  .vault-hero {
    grid-template-columns: 44px 1fr 44px 1fr;
  }

  .pulse-clock {
    grid-template-columns: 56px 1fr;
  }

  .pulse-face {
    width: 56px;
    height: 56px;
  }

  .folha .joia {
    width: 36px;
    height: 36px;
  }
}

body.is-calm .orla-token,
body.is-calm .orla-gem,
body.is-calm .folha .joia {
  transform: none;
}

body.is-calm .folha.is-on .joia {
  transform: translateY(-4px);
}

@media (min-width: 420px) {
  .lore-sheet img {
    height: 170px;
  }
}
