:root {
  --caldera-abyss: #110806;
  --basalt-core: #161110;
  --basalt-ridge: #261B18;
  --amber-vein: #FF9E2C;
  --volcano-core: #FF5500;
  --molten-gold: #FFD75E;
  --bronze-warm: #CD8A39;
  --aegis-teal: #2DF5E6;
  --parchment: #FFF6EC;
  --ash-stone: #C7A693;
  --font-rune: "Philosopher", Georgia, serif;
  --font-ui: "Karla", -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  min-width: 0;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--caldera-abyss);
  color: var(--parchment);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
}

#forge-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

/* CHISELED VOLCANIC BASALT TABLET WITH GLOWING AMBER RUNE SEAM */
.basalt-tablet {
  background:
    radial-gradient(120% 95% at 50% 0%, rgba(255, 158, 44, 0.12) 0%, rgba(22, 17, 16, 0) 62%),
    linear-gradient(180deg, #211816 0%, var(--basalt-core) 100%);
  border: 2px solid #3B2922;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.82),
    inset 0 2px 0 rgba(255, 206, 138, 0.20),
    inset 0 -2px 0 rgba(10, 5, 4, 0.90),
    0 0 0 1px rgba(255, 158, 44, 0.36),
    0 0 22px rgba(255, 110, 20, 0.16);
}

/* =========================================================================
   TOP CALDERA ALTAR (BEVELED OBSIDIAN PLAQUE, MAX-WIDTH 500PX)
   ========================================================================= */
#caldera-top-frame {
  position: relative;
  z-index: 12;
  width: calc(100% - 16px);
  max-width: 500px;
  margin: 0 auto 0 auto;
}

#caldera-altar {
  position: relative;
  width: 100%;
  min-height: 50px;
  padding: 5px 8px;
  border-radius: 14px;
  border-bottom: 2px solid var(--amber-vein);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.altar-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.altar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.carved-pts {
  padding: 4px 7px;
  border-radius: 8px;
  background: #0F0A09;
  border: 1px solid rgba(255, 158, 44, 0.34);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.75);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 800;
  color: var(--molten-gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rune-stone-btn {
  height: 32px;
  padding: 0 7px;
  border-radius: 9px;
  background: linear-gradient(180deg, #31221D 0%, #19110F 100%);
  border: 1.5px solid rgba(255, 158, 44, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 224, 178, 0.22);
  color: var(--parchment);
  font-family: var(--font-rune);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.rune-stone-btn:active {
  transform: scale(0.94);
}

.rune-stone-btn.lit {
  border-color: var(--amber-vein);
  background: linear-gradient(180deg, #472816 0%, #24130B 100%);
  color: var(--molten-gold);
  box-shadow: 0 0 12px rgba(255, 158, 44, 0.28);
}

/* CENTER DIAMOND AMBER MAGMA CRYSTAL (Philosopher 700) */
.crystal-socket {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.amber-crystal {
  width: 48px;
  height: 48px;
  transform: rotate(45deg);
  border-radius: 9px;
  background: radial-gradient(circle at 35% 35%, #FFBE42 0%, #D84B00 68%, #6B1700 100%);
  border: 2px solid var(--molten-gold);
  box-shadow:
    0 0 18px rgba(255, 158, 44, 0.52),
    inset 0 0 8px rgba(255, 245, 200, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.amber-crystal.active-run {
  background: radial-gradient(circle at 35% 35%, #FFF2A6 0%, #FF7B00 58%, #A61C00 100%);
  box-shadow:
    0 0 26px rgba(255, 158, 44, 0.88),
    inset 0 0 12px rgba(255, 255, 255, 0.72);
}

.crystal-inner {
  transform: rotate(-45deg);
  width: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.crystal-mult {
  font-family: var(--font-rune);
  font-size: 14px;
  font-weight: 700;
  color: #FFFDF7;
  text-shadow: 0 1px 3px rgba(20, 4, 0, 0.95);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* =========================================================================
   RIGHT-EDGE VERTICAL RUNE LADDER (ANCHORED TO STAGE CORRIDOR)
   ========================================================================= */
#pillar-ladder {
  position: absolute;
  right: max(8px, calc(50vw - 294px));
  top: 74px;
  bottom: 136px;
  width: 54px;
  z-index: 10;
  padding: 6px 4px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(26, 17, 15, 0.88), rgba(15, 9, 8, 0.92));
  border: 1.5px solid rgba(255, 158, 44, 0.42);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.68), inset 0 0 10px rgba(255, 158, 44, 0.10);
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
}

#pillar-ladder::-webkit-scrollbar {
  display: none;
}

#ladder-rungs {
  display: flex;
  flex-direction: column-reverse;
  gap: 5px;
  margin-top: auto;
}

.rung-chip {
  height: 26px;
  border-radius: 7px;
  background: #1E1412;
  border: 1px solid rgba(199, 166, 147, 0.28);
  color: var(--ash-stone);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
}

.rung-chip.passed {
  background: rgba(45, 245, 230, 0.18);
  border-color: var(--aegis-teal);
  color: var(--aegis-teal);
}

.rung-chip.standing {
  background: linear-gradient(135deg, #FF5500, #FF9E2C);
  border-color: var(--molten-gold);
  color: #1A0804;
  box-shadow: 0 0 12px rgba(255, 158, 44, 0.72);
}

.rung-chip.phoenix-top {
  border-color: var(--molten-gold);
  color: var(--molten-gold);
  background: rgba(255, 215, 94, 0.20);
}

/* =========================================================================
   BOTTOM OBSIDIAN RUNE DOCK (SCULPTED STONE BAR, MAX-WIDTH 520PX)
   ========================================================================= */
#obsidian-dock {
  position: relative;
  z-index: 12;
  width: calc(100% - 16px);
  max-width: 520px;
  margin: 0 auto max(10px, env(safe-area-inset-bottom)) auto;
  padding: 8px 10px;
  border-radius: 16px;
  border-top: 2px solid var(--amber-vein);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Compact Rune-Slot Strip: Flame Trial Cycler + Tribute Stone + Aegis Orb */
.rune-slot-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1.02fr) auto;
  align-items: center;
  gap: 6px;
}

.trial-cycler-stone {
  height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  background: linear-gradient(180deg, #2D1D18 0%, #170F0D 100%);
  border: 1.5px solid rgba(255, 158, 44, 0.50);
  color: var(--amber-vein);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s ease;
}

.trial-cycler-stone:active:not(:disabled) {
  transform: scale(0.96);
}

.trial-cycler-stone:disabled,
.tribute-stone.sealed {
  opacity: 0.44;
  pointer-events: none;
}

.tribute-stone {
  height: 34px;
  border-radius: 9px;
  background: #120B09;
  border: 1.5px solid rgba(205, 138, 57, 0.52);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  overflow: hidden;
}

.tribute-arrow {
  height: 100%;
  border: none;
  background: rgba(255, 158, 44, 0.14);
  color: var(--molten-gold);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tribute-arrow:active {
  background: rgba(255, 158, 44, 0.32);
}

.tribute-num {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 800;
  color: var(--parchment);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.aegis-orb-btn {
  height: 34px;
  padding: 0 9px;
  border-radius: 17px;
  background: linear-gradient(165deg, #163A3E 0%, #0B1F22 100%);
  border: 1.5px solid var(--aegis-teal);
  color: var(--aegis-teal);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.aegis-orb-btn:disabled {
  opacity: 0.40;
  cursor: default;
}

.aegis-orb-btn.ward-lit {
  background: linear-gradient(165deg, #2DF5E6 0%, #10969B 100%);
  border-color: #FFFFFF;
  color: #061A1D;
  box-shadow: 0 0 18px rgba(45, 245, 230, 0.70);
}

.orb-gem {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFFFFF, var(--aegis-teal));
  box-shadow: 0 0 6px var(--aegis-teal);
  flex-shrink: 0;
}

.orb-txt {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Main Altar Buttons: Warm Bronze HARVEST + Volcano-Core STRIDE RUNE */
.altar-main-stones {
  display: grid;
  grid-template-columns: 0.94fr 1.36fr;
  gap: 8px;
  width: 100%;
}

.altar-stone {
  height: 52px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  white-space: nowrap;
  overflow: hidden;
  transition: transform 0.1s ease, opacity 0.15s ease, box-shadow 0.16s ease;
}

.altar-stone:active:not(:disabled) {
  transform: scale(0.96);
}

.altar-stone:disabled {
  opacity: 0.38;
  cursor: default;
}

.stone-heading {
  font-family: var(--font-rune);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.08;
  white-space: nowrap;
}

.stone-caption {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.harvest-stone {
  background: linear-gradient(170deg, #DFA04E 0%, #9E601B 100%);
  border-color: #FFE3A8;
  color: #1F0E04;
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 214, 0.55),
    0 4px 16px rgba(205, 138, 57, 0.36);
}

.harvest-stone:not(:disabled) {
  animation: bronzePulse 1.35s ease-in-out infinite;
}

@keyframes bronzePulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(255, 215, 94, 0.40); }
  50% { box-shadow: 0 0 24px rgba(255, 215, 94, 0.86); }
}

.stride-stone {
  background:
    radial-gradient(90% 100% at 50% 0%, rgba(255, 215, 94, 0.36) 0%, rgba(255, 85, 0, 0) 65%),
    linear-gradient(170deg, #FF6D00 0%, #C82300 100%);
  border-color: var(--molten-gold);
  color: #FFF9F0;
  text-shadow: 0 1px 2px rgba(34, 6, 0, 0.85);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 179, 0.50),
    0 5px 22px rgba(255, 85, 0, 0.56);
}

/* =========================================================================
   FORGE RELIC MODAL & HERALD PLACARD
   ========================================================================= */
.sheet-veil {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(9, 4, 2, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.sheet-stone {
  width: 100%;
  max-width: 410px;
  max-height: 82dvh;
  padding: 14px;
  border-radius: 16px;
  border-color: var(--amber-vein);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sheet-head-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-heading {
  font-family: var(--font-rune);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--molten-gold);
  white-space: nowrap;
}

.sheet-record {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  color: var(--amber-vein);
  font-variant-numeric: tabular-nums;
}

.relic-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.relic-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: #1F1513;
  border: 1px solid rgba(255, 158, 44, 0.34);
}

.relic-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.relic-title {
  font-family: var(--font-rune);
  font-size: 14px;
  font-weight: 700;
  color: var(--parchment);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.relic-perk {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--ash-stone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.relic-btn {
  height: 34px;
  min-width: 88px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1.5px solid var(--amber-vein);
  background: rgba(255, 85, 0, 0.24);
  color: var(--molten-gold);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.relic-btn.forged {
  border-color: var(--aegis-teal);
  background: rgba(45, 245, 230, 0.18);
  color: var(--aegis-teal);
}

.herald-box {
  position: absolute;
  top: 43%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  width: min(310px, calc(100vw - 28px));
  padding: 15px 18px;
  border-radius: 16px;
  background: #17100E;
  border: 2px solid var(--molten-gold);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 28px rgba(255, 158, 44, 0.50);
  text-align: center;
  pointer-events: none;
  animation: heraldPop 0.22s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.herald-box.singed {
  border-color: var(--volcano-core);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 28px rgba(255, 85, 0, 0.60);
}

.herald-top {
  font-family: var(--font-rune);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--aegis-teal);
  white-space: nowrap;
}

.herald-box.singed .herald-top {
  color: var(--amber-vein);
}

.herald-mid {
  margin: 4px 0;
  font-family: var(--font-rune);
  font-size: 25px;
  font-weight: 700;
  color: var(--molten-gold);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.herald-bot {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--ash-stone);
  white-space: nowrap;
}

.concealed {
  display: none !important;
}

@keyframes heraldPop {
  from { transform: translate(-50%, -44%) scale(0.85); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
