:root {
  --obsidian: #0a0d0b;
  --emerald: #073d32;
  --jungle: #102a20;
  --antique: #d8a83e;
  --gold: #f7ce68;
  --bronze: #8a632f;
  --relic: #55d99a;
  --glow: #a2ffd1;
  --ember: #e77837;
  --ivory: #fff5de;
  --sand: #cebfa1;
  --pad-top: env(safe-area-inset-top, 0px);
  --pad-bottom: env(safe-area-inset-bottom, 0px);
  --pad-left: env(safe-area-inset-left, 0px);
  --pad-right: env(safe-area-inset-right, 0px);
  --trail: 64px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--obsidian);
  color: var(--ivory);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-user-select: none;
  user-select: none;
}
body {
  overflow: hidden;
  padding: var(--pad-top) var(--pad-right) 0 var(--pad-left);
}
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

.xq-stage {
  position: relative;
  height: 100dvh;
  height: 100svh;
  overflow: hidden;
  background: var(--obsidian);
}
.xq-wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 13, 11, 0.6), rgba(10, 13, 11, 0.6)),
    url("../glyphs/sanctuary.webp") center / cover no-repeat;
  pointer-events: none;
}
.xq-stage[data-hall="temple"] .xq-wash {
  background:
    linear-gradient(180deg, rgba(10, 13, 11, 0.48), rgba(10, 13, 11, 0.72)),
    url("../glyphs/sanctuary.webp") center / cover no-repeat;
}
.xq-stage[data-hall="temple"][data-free="yes"] .xq-wash {
  background:
    linear-gradient(180deg, rgba(10, 13, 11, 0.48), rgba(10, 13, 11, 0.72)),
    url("../glyphs/free_background.webp") center / cover no-repeat;
}

.xq-boot, .xq-oath, .xq-shell {
  position: relative;
  z-index: 1;
  height: 100%;
}
.xq-boot {
  display: grid;
  place-items: center;
  color: var(--ivory);
  font-size: 17px;
}
.xq-oath {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  overflow: auto;
  text-align: center;
  gap: 20px;
}
.xq-oath img { width: 126px; height: 126px; }
.xq-hidden { display: none !important; }

.xq-shell {
  display: grid;
  grid-template-rows: 1fr auto;
}
.xq-pages {
  min-height: 0;
  overflow: hidden;
}
.xq-page {
  display: none;
  height: 100%;
  overflow: auto;
  padding: 12px 18px 16px;
  -webkit-overflow-scrolling: touch;
}
.xq-page.xq-focus { display: block; }
.xq-page[data-vista="temple"] { padding: 6px 12px 8px; }

.xq-trail {
  display: flex;
  gap: 6px;
  padding: 5px 16px calc(5px + var(--pad-bottom));
  background: var(--obsidian);
}
.xq-trail button {
  flex: 1;
  min-height: 49px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--sand);
  font-size: 12px;
}
.xq-trail button img { width: 23px; height: 23px; }
.xq-trail button.xq-focus {
  background: rgba(7, 61, 50, 0.65);
  color: var(--gold);
  font-weight: 700;
}

.xq-toast {
  position: absolute;
  z-index: 8;
  left: 16px;
  right: 16px;
  top: calc(48px + var(--pad-top));
  background: rgba(10, 13, 11, 0.9);
  color: var(--gold);
  text-align: center;
  border-radius: 12px;
  padding: 10px;
  font-size: 14px;
}

@media (orientation: landscape) {
  .xq-page[data-vista="temple"] .xq-temple {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: stretch;
  }
  .xq-page[data-vista="temple"] .xq-cabinet { flex: 0 0 58%; }
  .xq-page[data-vista="temple"] .xq-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .xq-page[data-vista="temple"] .xq-deck { order: 3; }
}
