:root {
  --ink: #140308;
  --velvet: #2a0810;
  --crimson: #c41e3a;
  --ace: #e11d48;
  --gold: #e8c547;
  --gold-deep: #b8860b;
  --cream: #f6e7c1;
  --mute: #c9b48a;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --spine-h: 78px;
  --topo-h: 64px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  font-family: "Noto Sans Myanmar", Padauk, sans-serif;
  line-height: 1.65;
}

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

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

#app {
  position: relative;
  height: 100dvh;
  height: 100%;
  overflow: hidden;
}

.velvet-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(196, 30, 58, 0.45), transparent 55%),
    radial-gradient(80% 60% at 100% 100%, rgba(232, 197, 71, 0.12), transparent 50%),
    repeating-conic-gradient(from 45deg at 50% 50%, rgba(232, 197, 71, 0.05) 0 8deg, transparent 8deg 16deg);
  pointer-events: none;
  z-index: 0;
}

.hall-veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.18;
  mix-blend-mode: luminosity;
  pointer-events: none;
  z-index: 0;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 5;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.boot-jewel {
  width: min(88vw, 360px);
  text-align: center;
}

.boot-crest {
  width: 92px;
  height: 92px;
  margin: 0 auto 14px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(232, 197, 71, 0.35));
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-family: Cinzel, serif;
  margin-bottom: 6px;
}

.wordmark {
  font-family: Cinzel, "Noto Serif Myanmar", serif;
  font-weight: 800;
  font-size: clamp(22px, 7.2vw, 40px);
  line-height: 0.95;
  display: flex;
  flex-direction: column;
  color: var(--cream);
  overflow-wrap: break-word;
}

.wordmark span:last-child {
  color: var(--gold);
}

.boot-line {
  margin: 16px 0 10px;
  color: var(--mute);
  font-size: 13px;
}

.boot-track {
  height: 6px;
  border-radius: 99px;
  background: rgba(232, 197, 71, 0.15);
  overflow: hidden;
  border: 1px solid rgba(232, 197, 71, 0.3);
}

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

.site-shell {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  flex-direction: column;
  padding: calc(var(--safe-t) + 8px) 12px calc(var(--spine-h) + var(--safe-b) + 8px);
  min-height: 0;
}

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

.topo {
  height: var(--topo-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  padding: 0 4px 8px;
}

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

.brand-crest {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

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

.brand-copy .wordmark {
  font-size: clamp(18px, 5.4vw, 24px);
  flex-direction: row;
  gap: 8px;
}

.lantern-orb {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(232, 197, 71, 0.5);
  background: radial-gradient(circle at 40% 30%, #5a1420, #140308);
  overflow: hidden;
}

.lantern-orb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.15);
}

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

.page {
  display: none;
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 10px;
  min-width: 0;
}

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

#screen-hunt.is-on {
  display: flex;
  overflow: hidden;
}

.lede {
  font-size: clamp(13px, 3.6vw, 15px);
  color: var(--mute);
  margin: 10px 0 14px;
  overflow-wrap: break-word;
}

.lede.tight {
  margin-top: 4px;
}

.orla-stage {
  position: relative;
  height: min(34vh, 240px);
  border-radius: 18px;
  overflow: hidden;
  clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%);
  border: 1px solid rgba(232, 197, 71, 0.35);
}

.orla-sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.orla-token {
  position: absolute;
  right: 16%;
  top: 18%;
  width: 22%;
  animation: floaty 3.4s ease-in-out infinite;
}

.orla-gem {
  position: absolute;
  right: 6%;
  bottom: 10%;
  width: 16%;
  animation: floaty 2.8s ease-in-out infinite reverse;
}

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

.cortejo-play {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  background: linear-gradient(120deg, #7a1424, #c41e3a 42%, #e8c547);
  color: #1a0508;
  clip-path: polygon(0 18%, 12% 0, 100% 0, 100% 82%, 88% 100%, 0 100%);
  margin-bottom: 14px;
  min-height: 64px;
}

.cortejo-play img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: rgba(20, 3, 8, 0.25);
  border-radius: 12px;
}

.cortejo-play em {
  display: block;
  font-style: normal;
  font-weight: 700;
  font-size: 16px;
}

.cortejo-play small {
  display: block;
  font-size: 12px;
  opacity: 0.8;
}

.pulse-clock {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: rgba(20, 3, 8, 0.55);
  border: 1px solid rgba(232, 197, 71, 0.25);
  margin-bottom: 12px;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.pulse-face {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  overflow: hidden;
}

.pulse-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pulse-face i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 22px;
  background: var(--gold);
  transform-origin: bottom center;
  transform: translate(-50%, -100%) rotate(20deg);
  animation: spinhand 4s linear infinite;
}

@keyframes spinhand {
  to { transform: translate(-50%, -100%) rotate(380deg); }
}

.pulse-clock h2,
.jewel-card h2,
.page-title,
.annal-card h3 {
  font-family: "Noto Serif Myanmar", Cinzel, serif;
  font-size: 16px;
  color: var(--gold);
  line-height: 1.4;
}

.pulse-clock p,
.jewel-card p,
.annal-card p {
  font-size: 13px;
  color: var(--mute);
  overflow-wrap: break-word;
}

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

.jewel-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(196, 30, 58, 0.18), rgba(20, 3, 8, 0.7));
  border: 1px solid rgba(232, 197, 71, 0.22);
  min-width: 0;
}

.jewel-card img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.page-kicker {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.14em;
  font-family: Cinzel, serif;
}

.page-title {
  font-size: clamp(20px, 6vw, 26px);
  margin-bottom: 4px;
}

.chamber-rail,
.vault-grid,
.annal-stack,
.lamp-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.chamber-card {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: rgba(20, 3, 8, 0.62);
  border: 1px solid rgba(232, 197, 71, 0.28);
  text-align: left;
  min-width: 0;
}

.chamber-card img {
  width: 86px;
  height: 64px;
  object-fit: cover;
  clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}

.chamber-card h3 {
  font-size: 15px;
  color: var(--cream);
}

.chamber-card p {
  font-size: 12px;
  color: var(--mute);
}

.chamber-card .lock {
  font-size: 11px;
  color: var(--gold);
  writing-mode: vertical-rl;
}

.chamber-card.is-on {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(232, 197, 71, 0.35);
}

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

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

.vault-cell {
  padding: 10px 8px;
  text-align: center;
  background: rgba(20, 3, 8, 0.6);
  border: 1px solid rgba(232, 197, 71, 0.2);
  min-width: 0;
}

.vault-cell img {
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  object-fit: contain;
}

.vault-cell.is-ghost img {
  filter: grayscale(1) brightness(0.35);
}

.vault-cell h3 {
  font-size: 13px;
  color: var(--gold);
}

.vault-cell p {
  font-size: 11px;
  color: var(--mute);
  overflow-wrap: break-word;
}

.annal-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  background: rgba(20, 3, 8, 0.58);
  border: 1px solid rgba(232, 197, 71, 0.2);
}

.annal-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  clip-path: polygon(0 0, 100% 8%, 100% 100%, 0 92%);
}

.lamp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 12px;
  background: rgba(20, 3, 8, 0.6);
  border: 1px solid rgba(232, 197, 71, 0.22);
  font-size: 15px;
}

.lamp-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--gold);
}

.fine-print {
  margin-top: 16px;
  font-size: 12px;
  color: var(--mute);
  overflow-wrap: break-word;
}

.seal-btn,
.ghost-seal {
  min-height: 44px;
  padding: 10px 16px;
  width: 100%;
}

.seal-btn {
  background: linear-gradient(90deg, var(--crimson), var(--gold));
  color: #1a0508;
  font-weight: 700;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.seal-btn.danger {
  background: linear-gradient(90deg, #5a1020, var(--crimson));
  color: var(--cream);
}

.ghost-seal {
  border: 1px solid rgba(232, 197, 71, 0.4);
  color: var(--gold);
}

.hunt-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  width: 100%;
  gap: 8px;
}

.hunt-ribbon {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: center;
  min-width: 0;
}

.hunt-name small {
  display: block;
  font-size: 10px;
  color: var(--gold);
  font-family: Cinzel, serif;
}

.hunt-name strong {
  font-size: 14px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reel-strip {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.reel {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(232, 197, 71, 0.4);
  background: #1a0508;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.reel img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}

.reel.is-hot {
  box-shadow: 0 0 12px rgba(225, 29, 72, 0.8);
  border-color: var(--ace);
}

.reel.is-spin img {
  animation: reelspin 0.45s linear infinite;
}

@keyframes reelspin {
  to { transform: rotate(360deg); }
}

.hunt-stats {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--gold);
  white-space: nowrap;
}

.board-wrap {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 2, 4, 0.55);
  border: 1px solid rgba(232, 197, 71, 0.28);
  overflow: hidden;
}

#huntCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.board-veil {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  background: rgba(12, 2, 6, 0.72);
}

.board-veil[hidden] {
  display: none;
}

.board-veil p {
  overflow-wrap: break-word;
}

.pad-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.diamond-pad {
  width: min(46vw, 168px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 4px;
  margin: 0 auto;
}

.diamond-pad button {
  background: linear-gradient(180deg, #4a1220, #1a0508);
  border: 1px solid rgba(232, 197, 71, 0.35);
  color: var(--gold);
  font-size: 14px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.diamond-pad button[data-dir="up"] { grid-column: 2; grid-row: 1; }
.diamond-pad button[data-dir="left"] { grid-column: 1; grid-row: 2; }
.diamond-pad button[data-dir="right"] { grid-column: 3; grid-row: 2; }
.diamond-pad button[data-dir="down"] { grid-column: 2; grid-row: 3; }

.pad-core {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
}

.pad-core img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.hunt-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(38vw, 132px);
}

.ace-spine {
  position: absolute;
  left: 50%;
  bottom: calc(8px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  width: min(94vw, 520px);
  padding: 7px 10px 6px;
  background: linear-gradient(180deg, rgba(70, 12, 20, 0.94), rgba(12, 2, 6, 0.98));
  border: 1px solid rgba(232, 197, 71, 0.45);
  clip-path: polygon(6% 0, 94% 0, 100% 58%, 94% 100%, 6% 100%, 0 58%);
}

.spine-node {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--mute);
}

.spine-node img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  border: 1px solid rgba(232, 197, 71, 0.25);
}

.spine-node span {
  font-size: 9px;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spine-node.is-on {
  color: var(--gold);
  transform: translateY(-6px);
}

.spine-node.is-on img {
  width: 36px;
  height: 36px;
  box-shadow: 0 0 12px rgba(232, 197, 71, 0.55);
  border-color: var(--gold);
}

.veil-modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 1, 3, 0.72);
}

.veil-modal[hidden] {
  display: none;
}

.veil-card {
  width: min(92vw, 360px);
  padding: 18px 16px;
  background: linear-gradient(180deg, #3a0c14, #140308);
  border: 1px solid rgba(232, 197, 71, 0.45);
  text-align: center;
  display: grid;
  gap: 10px;
}

.veil-card img {
  width: 88px;
  height: 88px;
  margin: 0 auto;
  object-fit: contain;
}

.veil-card h2 {
  font-family: "Noto Serif Myanmar", serif;
  color: var(--gold);
  font-size: 18px;
}

.veil-card p {
  color: var(--mute);
  font-size: 13px;
  overflow-wrap: break-word;
}

.reduce .orla-token,
.reduce .orla-gem,
.reduce .pulse-face i,
.reduce .reel.is-spin img {
  animation: none;
}

@media (max-width: 360px) {
  :root { --spine-h: 72px; --topo-h: 56px; }
  .spine-node span { font-size: 8px; }
  .spine-node img { width: 26px; height: 26px; }
  .orla-stage { height: min(30vh, 190px); }
  .jewel-card { grid-template-columns: 56px 1fr; }
  .jewel-card img { width: 56px; height: 56px; }
  .cortejo-play img { width: 46px; height: 46px; }
  .vault-grid { grid-template-columns: 1fr; }
  .hunt-stats { font-size: 11px; gap: 6px; }
}

@media (min-width: 430px) {
  .site-shell { padding-left: 18px; padding-right: 18px; }
  .vault-grid { grid-template-columns: 1fr 1fr; }
  .annal-card { grid-template-columns: 140px 1fr; align-items: center; }
  .annal-card img { height: 100px; }
}

@media (max-height: 680px) {
  .orla-stage { height: min(26vh, 170px); }
  .teaser-stack { gap: 8px; }
  .reel { width: 36px; height: 36px; }
  .diamond-pad { width: min(40vw, 140px); }
}

@media (max-height: 600px) {
  .orla-stage { height: 140px; }
  .pad-row { grid-template-columns: auto 1fr; }
  .hunt-actions { flex-direction: row; width: auto; }
}
