/* ============================================================
   EVERMARCH — Amberfall Reach : fantasy UI
   Palette: amber gold on deep umber, faction accents.
   ============================================================ */

:root {
  --gold: #ffc247;
  --gold-bright: #ffe6a3;
  --gold-dim: #8a6a2f;
  --umber: #17110b;
  --umber-2: #241a10;
  --parchment: #f3e2bb;
  --blood: #c03a2b;
  --focus: #ffb52e;
  --dawnguard: #4f8ff0;
  --wildbound: #ffc247;
  --veil: #a86ef5;
  --panel-bg: linear-gradient(160deg, rgba(36,26,16,.96), rgba(20,14,9,.97));
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { width: 100%; height: 100%; overflow: hidden; background: #0b0805; }

body {
  font-family: 'Spectral', Georgia, serif;
  color: var(--parchment);
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ============================ TITLE ============================ */

#title-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 62%, rgba(20,12,4,.18) 0%, rgba(10,6,2,.72) 100%);
  transition: opacity 1.4s ease;
}
#title-screen.fading { opacity: 0; pointer-events: none; }

.title-inner { text-align: center; z-index: 2; transform: translateY(-4vh); }

.title-crests { display: flex; gap: 26px; justify-content: center; margin-bottom: 10px; }
.crest {
  width: 18px; height: 18px; transform: rotate(45deg);
  border: 2px solid rgba(255,230,170,.8);
  box-shadow: 0 0 14px currentColor;
}
.crest.dawnguard { color: var(--dawnguard); background: color-mix(in srgb, var(--dawnguard) 70%, black); }
.crest.wildbound { color: var(--wildbound); background: color-mix(in srgb, var(--wildbound) 70%, black); }
.crest.veil { color: var(--veil); background: color-mix(in srgb, var(--veil) 70%, black); }

.game-logo {
  font-family: 'Cinzel', serif; font-weight: 900;
  font-size: clamp(56px, 9vw, 118px);
  letter-spacing: .14em;
  background: linear-gradient(180deg, #fff3d0 0%, var(--gold) 45%, #b4791c 78%, #7a4c10 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 26px rgba(255,190,80,.45)) drop-shadow(0 3px 2px rgba(0,0,0,.85));
}

.title-sub {
  font-family: 'Cinzel', serif; font-weight: 700; letter-spacing: .5em;
  font-size: clamp(13px, 1.6vw, 20px); color: var(--gold-bright);
  margin-top: 4px; text-shadow: 0 0 16px rgba(255,200,100,.5);
}

.title-tag {
  margin-top: 18px; font-style: italic; font-size: 15px;
  color: rgba(243,226,187,.82); text-shadow: 0 2px 6px rgba(0,0,0,.9);
}

#btn-start {
  margin-top: 34px; padding: 15px 54px;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 19px; letter-spacing: .18em;
  color: var(--gold-bright); background: linear-gradient(180deg, rgba(90,60,18,.92), rgba(48,30,10,.95));
  border: 1px solid var(--gold); outline: 1px solid rgba(0,0,0,.7);
  box-shadow: 0 0 24px rgba(255,190,70,.28), inset 0 0 18px rgba(255,200,90,.14);
  cursor: pointer; transition: all .25s ease;
}
#btn-start:hover {
  box-shadow: 0 0 44px rgba(255,200,80,.55), inset 0 0 26px rgba(255,210,110,.3);
  transform: translateY(-2px); color: #fff6dd;
}

.title-hint { margin-top: 26px; font-size: 13px; letter-spacing: .08em; color: rgba(243,226,187,.55); }

.title-vignette { position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 24vmin 8vmin rgba(5,3,1,.85); }

/* ============================ HUD SHARED ============================ */

#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }

.bar {
  position: relative; height: 16px;
  background: linear-gradient(180deg, #120c07, #1e150c);
  border: 1px solid rgba(255,194,71,.55);
  box-shadow: 0 2px 6px rgba(0,0,0,.7), inset 0 0 8px rgba(0,0,0,.8);
  overflow: hidden;
}
.bar-fill { position: absolute; inset: 0; width: 100%; transform-origin: left;
  transition: transform .18s ease-out; }
.bar-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; letter-spacing: .06em; color: #fff2d5; text-shadow: 0 1px 2px #000;
  font-weight: 600;
}

.hp-bar .bar-fill { background: linear-gradient(180deg, #ff7a53, #c03a2b 55%, #7e1f14); }
.focus-bar .bar-fill { background: linear-gradient(180deg, #ffe08a, #ffb52e 55%, #a86a0c); }
.xp-bar { height: 6px; }
.xp-bar .bar-fill { background: linear-gradient(180deg, #c9a2ff, #8d5fd6); }
.wxp-bar { height: 7px; }
.wxp-bar .bar-fill { background: linear-gradient(180deg, #ffe6a3, #ffc247 60%, #b4791c); }

/* ============================ HERO PLATE ============================ */

#hero-plate {
  position: absolute; left: 22px; top: 20px; display: flex; gap: 12px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.6));
}
#portrait {
  position: relative; width: 84px; height: 84px; flex: none;
  background: var(--panel-bg);
  border: 2px solid var(--gold); outline: 2px solid rgba(0,0,0,.75);
  box-shadow: 0 0 18px rgba(255,190,70,.25), inset 0 0 12px rgba(0,0,0,.8);
  display: flex; align-items: center; justify-content: center;
}
#level-badge {
  position: absolute; right: -9px; bottom: -9px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 13px; color: #1c1206;
  background: radial-gradient(circle at 35% 30%, #ffe9ad, var(--gold) 60%, #a06f16);
  border: 1px solid #5d420f; transform: rotate(45deg);
}
#level-num { display: block; transform: rotate(-45deg); }
#plate-bars { width: 240px; display: flex; flex-direction: column; gap: 5px; padding-top: 4px; }
.plate-name {
  font-family: 'Cinzel', serif; font-size: 13px; font-weight: 700; letter-spacing: .1em;
  color: var(--gold-bright); text-shadow: 0 1px 3px #000, 0 0 12px rgba(255,190,80,.35);
}

/* ============================ WEAPON PLATE ============================ */

#weapon-plate {
  position: absolute; right: 22px; top: 232px; width: 252px;
  display: flex; gap: 10px; align-items: center;
  background: var(--panel-bg);
  border: 1px solid rgba(255,194,71,.5); outline: 1px solid rgba(0,0,0,.7);
  padding: 9px 11px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.55));
}
#weapon-icon { width: 54px; height: 54px; flex: none;
  border: 1px solid var(--gold-dim); background: #120d07;
  box-shadow: inset 0 0 10px rgba(0,0,0,.9); }
#weapon-info { flex: 1; display: flex; flex-direction: column; gap: 5px; }
#weapon-name { font-family: 'Cinzel', serif; font-size: 12px; font-weight: 700;
  color: var(--gold-bright); letter-spacing: .04em; }
#weapon-mats { font-size: 11px; color: rgba(243,226,187,.72); }
#weapon-plate.evolved { border-color: var(--gold);
  box-shadow: 0 0 26px rgba(255,200,90,.35); }

/* ============================ ABILITY BAR ============================ */

#ability-bar {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; gap: 9px; padding: 10px 14px;
  background: linear-gradient(180deg, rgba(30,21,12,.88), rgba(16,11,7,.94));
  border: 1px solid rgba(255,194,71,.45); outline: 1px solid rgba(0,0,0,.75);
  border-radius: 3px;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.65));
}
.ability {
  position: relative; width: 56px; height: 56px;
  border: 1px solid var(--gold-dim); outline: 1px solid rgba(0,0,0,.8);
  background: #0f0a06; overflow: hidden;
}
.ability canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ability .cd {
  position: absolute; inset: 0; background: rgba(8,5,2,.78);
  transform-origin: bottom; transform: scaleY(0); pointer-events: none;
}
.ability .key {
  position: absolute; right: 2px; bottom: 1px; font-size: 10px; font-weight: 700;
  color: var(--gold-bright); text-shadow: 0 1px 2px #000; letter-spacing: .02em;
  font-family: 'Cinzel', serif; z-index: 2;
}
.ability.locked { filter: saturate(.15) brightness(.55); }
.ability.locked::after {
  content: '🔒'; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-size: 18px; opacity: .85;
}
.ability.flash { box-shadow: 0 0 18px rgba(255,210,110,.9); border-color: var(--gold-bright); }
.ability.nofocus { border-color: rgba(120,60,40,.9); }

/* ============================ MINIMAP ============================ */

#minimap-wrap {
  position: absolute; right: 22px; top: 20px;
  border: 2px solid var(--gold-dim); outline: 2px solid rgba(0,0,0,.75);
  background: #0d0906;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.6));
}
#minimap { display: block; }
#minimap-label {
  text-align: center; font-family: 'Cinzel', serif; font-size: 11px; font-weight: 700;
  letter-spacing: .18em; color: var(--gold-bright); padding: 3px 0 4px;
  background: linear-gradient(180deg, rgba(50,34,14,.9), rgba(24,16,8,.95));
  border-top: 1px solid rgba(255,194,71,.35);
}

/* ============================ FORT STATUS ============================ */

#fort-status {
  text-align: center; font-size: 11px; letter-spacing: .06em;
  padding: 3px 4px 4px; color: var(--parchment);
  background: linear-gradient(180deg, rgba(30,20,10,.92), rgba(16,11,6,.95));
  border-top: 1px solid rgba(255,194,71,.25);
}
#fort-status[data-owner="wildbound"] { color: var(--wildbound); }
#fort-status[data-owner="dawnguard"] { color: var(--dawnguard); }
#fort-status[data-owner="veil"] { color: var(--veil); }

/* ============================ SATCHEL ============================ */

#satchel {
  font-size: 12px; letter-spacing: .1em; color: rgba(243,226,187,.85);
  padding-top: 2px; text-shadow: 0 1px 2px #000;
}

/* ============================ GATHERING ============================ */

#interact-prompt {
  position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%);
  padding: 7px 18px; font-family: 'Cinzel', serif; font-weight: 700;
  font-size: 13px; letter-spacing: .1em; color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(50,34,14,.92), rgba(24,16,8,.95));
  border: 1px solid var(--gold-dim); outline: 1px solid rgba(0,0,0,.75);
  text-shadow: 0 1px 3px #000; animation: prompt-pulse 1.6s ease-in-out infinite;
}
@keyframes prompt-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255,190,80,.15); }
  50% { box-shadow: 0 0 18px rgba(255,190,80,.45); }
}

#gather-bar {
  position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%);
  width: 260px; text-align: center;
}
.gather-label {
  font-family: 'Cinzel', serif; font-size: 11px; font-weight: 700;
  letter-spacing: .16em; color: var(--gold-bright);
  text-shadow: 0 1px 3px #000; margin-bottom: 4px;
}
.gather-progress { height: 10px; }
.gather-progress .bar-fill {
  background: linear-gradient(180deg, #d9f0a0, #8fae52 60%, #55702c);
  transition: transform .08s linear;
}

/* ============================ TOASTS / FEED ============================ */

#toasts {
  position: absolute; right: 22px; bottom: 30px; width: 320px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.toast {
  padding: 7px 14px; font-size: 13px; max-width: 100%;
  background: linear-gradient(90deg, rgba(24,16,8,0), rgba(24,16,8,.92) 18%);
  border-right: 2px solid var(--gold);
  color: var(--parchment); text-shadow: 0 1px 2px #000;
  animation: toast-in .3s ease-out, toast-out .8s ease-in forwards;
  animation-delay: 0s, var(--life, 4.5s);
}
.toast.loot { border-right-color: var(--gold-bright); color: #ffe9b0; }
.toast.war-dawnguard { border-right-color: var(--dawnguard); }
.toast.war-veil { border-right-color: var(--veil); }
.toast.war-wildbound { border-right-color: var(--wildbound); }
.toast.danger { border-right-color: var(--blood); color: #ffc9be; }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateX(24px); opacity: 0; } }

/* ============================ ANNOUNCE ============================ */

#announce {
  position: absolute; left: 50%; top: 26%; transform: translateX(-50%);
  text-align: center; pointer-events: none;
}
.announce-line {
  font-family: 'Cinzel', serif; font-weight: 900; letter-spacing: .22em;
  font-size: 44px;
  background: linear-gradient(180deg, #fff3d0, var(--gold) 55%, #a06f16);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(255,190,80,.5)) drop-shadow(0 2px 2px rgba(0,0,0,.9));
  animation: announce 3.4s ease-out forwards;
}
.announce-sub {
  font-size: 16px; color: var(--gold-bright); letter-spacing: .1em; margin-top: 6px;
  text-shadow: 0 1px 4px #000; animation: announce 3.4s ease-out forwards;
}
.announce-line.veil-tint { background: linear-gradient(180deg, #ecd9ff, var(--veil) 55%, #5b2f96);
  -webkit-background-clip: text; background-clip: text; }
@keyframes announce {
  0% { opacity: 0; transform: scale(.82); }
  12% { opacity: 1; transform: scale(1.04); }
  20% { transform: scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.02) translateY(-8px); }
}

/* ============================ ELITE BAR ============================ */

#elite-bar {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  width: 420px; text-align: center;
}
#elite-name {
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 15px; letter-spacing: .14em;
  color: #e8c9ff; text-shadow: 0 0 12px rgba(150,80,240,.7), 0 1px 3px #000; margin-bottom: 4px;
}
.elite-hp { height: 13px; border-color: rgba(168,110,245,.7); }
.elite-hp .bar-fill { background: linear-gradient(180deg, #c99cff, #7a3fd1 55%, #45217a); }

/* ============================ PANELS ============================ */

.panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  min-width: 380px; max-width: 560px; padding: 26px 34px;
  background: var(--panel-bg);
  border: 1px solid var(--gold); outline: 2px solid rgba(0,0,0,.8);
  box-shadow: 0 0 60px rgba(0,0,0,.8), 0 0 30px rgba(255,190,70,.12), inset 0 0 40px rgba(0,0,0,.5);
  pointer-events: auto;
}
.panel h2 {
  font-family: 'Cinzel', serif; font-size: 20px; letter-spacing: .12em; font-weight: 700;
  color: var(--gold-bright); text-align: center; margin-bottom: 16px;
  text-shadow: 0 0 14px rgba(255,190,80,.4);
}
.panel table { width: 100%; border-collapse: collapse; font-size: 14px; }
.panel td { padding: 5px 10px; border-bottom: 1px solid rgba(255,194,71,.12); }
.panel td:first-child { font-family: 'Cinzel', serif; font-weight: 700; font-size: 12px;
  color: var(--gold); letter-spacing: .06em; white-space: nowrap; }
.panel em { color: rgba(243,226,187,.6); font-size: 12px; }
.panel-hint { margin-top: 14px; text-align: center; font-size: 12px; font-style: italic;
  color: rgba(243,226,187,.6); }

/* Talent panel */
#talent-points { color: var(--parchment); font-size: 14px; margin-left: 10px; }
#talent-branches { display: flex; gap: 18px; }
.branch { flex: 1; }
.branch h3 {
  font-family: 'Cinzel', serif; font-size: 13px; letter-spacing: .1em; text-align: center;
  color: var(--gold); margin-bottom: 10px; border-bottom: 1px solid rgba(255,194,71,.3);
  padding-bottom: 5px;
}
.talent-node {
  position: relative; margin: 8px 0; padding: 8px 10px; font-size: 12px; line-height: 1.35;
  border: 1px solid rgba(255,194,71,.25); background: rgba(12,8,5,.6);
  cursor: pointer; transition: all .15s ease;
}
.talent-node:hover { border-color: var(--gold); background: rgba(40,28,12,.75); }
.talent-node .t-name { font-family: 'Cinzel', serif; font-weight: 700; font-size: 11.5px;
  letter-spacing: .04em; color: var(--gold-bright); display: block; margin-bottom: 2px; }
.talent-node.owned { border-color: var(--gold); background: rgba(66,45,16,.8);
  box-shadow: inset 0 0 12px rgba(255,190,80,.18), 0 0 10px rgba(255,190,80,.15); }
.talent-node.owned::after { content: '◆'; position: absolute; top: 6px; right: 8px;
  color: var(--gold-bright); font-size: 11px; }
.talent-node.unavailable { opacity: .45; cursor: not-allowed; }

/* ============================ DEATH ============================ */

#death-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(ellipse at center, rgba(60,8,4,.35), rgba(12,2,1,.82));
  animation: death-fade .6s ease-out;
}
.death-text {
  font-family: 'Cinzel', serif; font-weight: 900; font-size: 74px; letter-spacing: .3em;
  color: #a01f12; text-shadow: 0 0 40px rgba(200,40,20,.6), 0 3px 4px #000;
}
.death-sub { font-style: italic; color: rgba(243,226,187,.75); letter-spacing: .06em; }
@keyframes death-fade { from { opacity: 0; } to { opacity: 1; } }

/* ============================ DAMAGE VIGNETTE ============================ */

#hud::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 18vmin 2vmin rgba(120,10,5, var(--hurt, 0));
  transition: box-shadow .35s ease-out;
}

/* ============================ LIVING WEAPON ASCENSION ============================ */

#weapon-plate.ascendant {
  border-color: #fff0b0;
  box-shadow: 0 0 34px rgba(255,220,130,.5), inset 0 0 18px rgba(255,255,255,.05);
}
#weapon-plate.ascendant[data-path="siegebreaker"] { border-color: #ff8a32; box-shadow: 0 0 34px rgba(255,110,35,.48); }
#weapon-plate.ascendant[data-path="stormwing"] { border-color: #78ddff; box-shadow: 0 0 34px rgba(90,205,255,.48); }
#weapon-plate.ascendant[data-path="thornheart"] { border-color: #91e45d; box-shadow: 0 0 34px rgba(120,225,80,.48); }

/* Phase 1.4: every class path paints its own Living Weapon plate and choice. */
#weapon-plate.ascendant[data-path="sunforged"] { border-color: #fff09a; box-shadow: 0 0 34px rgba(255,220,95,.55); }
#weapon-plate.ascendant[data-path="stormward"] { border-color: #72e8ff; box-shadow: 0 0 34px rgba(70,210,255,.52); }
#weapon-plate.ascendant[data-path="earthwarden"] { border-color: #d9a35a; box-shadow: 0 0 34px rgba(190,125,55,.52); }
#weapon-plate.ascendant[data-path="bloodfang"] { border-color: #ff4b5d; box-shadow: 0 0 34px rgba(255,45,70,.52); }
#weapon-plate.ascendant[data-path="nightveil"] { border-color: #be72ff; box-shadow: 0 0 34px rgba(150,70,255,.55); }
#weapon-plate.ascendant[data-path="venomshade"] { border-color: #8dff65; box-shadow: 0 0 34px rgba(90,230,70,.5); }
.ascension-choice { --choice-color: var(--gold-bright); }
.ascension-choice:hover,
.ascension-choice:focus-visible { border-color: var(--choice-color); box-shadow: 0 0 26px color-mix(in srgb, var(--choice-color) 34%, transparent); }
.ascension-choice .ascension-mark,
.ascension-choice .ascension-name { color: var(--choice-color); }

.ascension-panel {
  width: min(860px, calc(100vw - 48px));
  max-width: 860px;
  padding: 28px 30px 24px;
}
.ascension-intro {
  max-width: 690px;
  margin: -4px auto 20px;
  text-align: center;
  color: rgba(243,226,187,.78);
  line-height: 1.45;
  font-size: 14px;
}
.ascension-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.ascension-choice {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 270px;
  padding: 18px 16px 16px;
  border: 1px solid rgba(255,194,71,.36);
  background: linear-gradient(180deg, rgba(46,31,16,.88), rgba(14,9,5,.95));
  color: var(--parchment);
  text-align: left;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.ascension-choice:hover,
.ascension-choice:focus-visible {
  transform: translateY(-3px);
  border-color: var(--gold-bright);
  box-shadow: 0 0 22px rgba(255,194,71,.22), inset 0 0 20px rgba(255,255,255,.03);
  outline: none;
}
.ascension-choice.siege:hover,
.ascension-choice.siege:focus-visible { border-color: #ff8a32; box-shadow: 0 0 26px rgba(255,110,35,.28); }
.ascension-choice.storm:hover,
.ascension-choice.storm:focus-visible { border-color: #78ddff; box-shadow: 0 0 26px rgba(90,205,255,.28); }
.ascension-choice.thorn:hover,
.ascension-choice.thorn:focus-visible { border-color: #91e45d; box-shadow: 0 0 26px rgba(120,225,80,.28); }
.ascension-mark {
  align-self: center;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 9px;
  color: var(--gold-bright);
  text-shadow: 0 0 14px currentColor;
}
.ascension-choice.siege .ascension-mark,
.ascension-choice.siege .ascension-name { color: #ff9a4e; }
.ascension-choice.storm .ascension-mark,
.ascension-choice.storm .ascension-name { color: #8be4ff; }
.ascension-choice.thorn .ascension-mark,
.ascension-choice.thorn .ascension-name { color: #a3eb76; }
.ascension-name {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: .08em;
  text-align: center;
  margin-bottom: 6px;
}
.ascension-role {
  min-height: 34px;
  text-align: center;
  color: rgba(243,226,187,.62);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ascension-copy {
  flex: 1;
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(243,226,187,.82);
}
.ascension-art {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: var(--gold-bright);
}
.ascension-memory {
  margin-top: 7px;
  font-size: 11px;
  color: rgba(243,226,187,.58);
}
.ascension-warning {
  margin-top: 17px;
  text-align: center;
  color: #ffd3a0;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ascension-cancel {
  display: block;
  margin: 13px auto 0;
  padding: 9px 24px;
  border: 1px solid rgba(255,194,71,.45);
  background: rgba(18,12,7,.9);
  color: rgba(243,226,187,.78);
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .12em;
  cursor: pointer;
}
.ascension-cancel:hover,
.ascension-cancel:focus-visible { border-color: var(--gold-bright); color: #fff0c0; }

@media (max-width: 760px) {
  .ascension-panel { max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 18px; }
  .ascension-grid { grid-template-columns: 1fr; }
  .ascension-choice { min-height: 0; }
  #ability-bar { gap: 5px; padding: 7px 8px; }
  .ability { width: 46px; height: 46px; }
}


/* ============================ CLASS SELECT ============================ */
.title-inner { width: min(980px, calc(100vw - 32px)); }
#class-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px auto 0; max-width: 800px; }
.class-card {
  display: flex; flex-direction: column; gap: 3px; align-items: center; min-height: 92px; padding: 12px 10px;
  color: var(--parchment); background: linear-gradient(180deg, rgba(34,23,14,.9), rgba(13,9,6,.95));
  border: 1px solid rgba(255,194,71,.28); cursor: pointer; font-family: 'Spectral', serif;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.class-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.class-card.selected { outline: 1px solid currentColor; box-shadow: 0 0 26px color-mix(in srgb, currentColor 35%, transparent); transform: translateY(-2px); }
.class-card.wildbound { color: var(--wildbound); }
.class-card.dawnguard { color: var(--dawnguard); }
.class-card.veil { color: var(--veil); }
.class-card b { font-family: 'Cinzel', serif; font-size: 17px; letter-spacing: .08em; color: currentColor; }
.class-card small { color: rgba(243,226,187,.72); font-size: 12px; }
.class-faction { font-size: 9px; letter-spacing: .2em; color: rgba(243,226,187,.55); }
#selected-class-copy { margin: 10px auto -12px; max-width: 660px; min-height: 22px; font-size: 13px; color: rgba(243,226,187,.74); font-style: italic; }
#class-resource-detail { min-height: 15px; font-size: 11px; letter-spacing: .08em; color: rgba(243,226,187,.72); }
#class-resource-detail .combo-pip { display: inline-block; width: 11px; height: 11px; margin-right: 4px; transform: rotate(45deg); border: 1px solid #b88be7; background: rgba(80,38,120,.5); }
#class-resource-detail .combo-pip.active { background: #c78cff; box-shadow: 0 0 7px #a86ef5; }
#hud[data-class="bastion"] .focus-bar .bar-fill { background: linear-gradient(180deg, #9ed9ff, #4f8ff0 58%, #2456a0); }
#hud[data-class="nightblade"] .focus-bar .bar-fill { background: linear-gradient(180deg, #e0b8ff, #a86ef5 58%, #5d2d9b); }

/* ============================ CONSTELLATION ATLAS ============================ */
.constellation-panel {
  width: min(1180px, calc(100vw - 36px)); height: min(820px, calc(100vh - 36px)); max-width: none; padding: 18px;
  display: grid; grid-template-rows: auto auto auto 1fr auto; gap: 9px;
}
.constellation-head { display: flex; justify-content: space-between; align-items: center; }
.constellation-head h2 { margin: 0; text-align: left; }
#constellation-count { font-size: 11px; letter-spacing: .12em; color: rgba(243,226,187,.55); margin-top: 2px; }
#talent-close { width: 36px; height: 36px; border: 1px solid rgba(255,194,71,.4); background: rgba(15,10,6,.8); color: var(--gold-bright); font-size: 25px; cursor: pointer; }
#constellation-tabs { display: flex; gap: 8px; }
.constellation-tab { flex: 1; padding: 8px 12px; border: 1px solid rgba(255,194,71,.25); background: rgba(12,8,5,.7); color: rgba(243,226,187,.7); font-family: 'Cinzel', serif; cursor: pointer; }
.constellation-tab.active { color: var(--class-color, var(--gold)); border-color: var(--class-color, var(--gold)); box-shadow: inset 0 0 14px color-mix(in srgb, var(--class-color, var(--gold)) 16%, transparent); }
.constellation-tab.locked-class::after { content: ' · inspect'; font-family: 'Spectral', serif; font-size: 10px; color: rgba(243,226,187,.45); }
#constellation-toolbar { display: flex; align-items: center; gap: 12px; font-size: 11px; color: rgba(243,226,187,.56); }
#constellation-toolbar button { margin-left: auto; padding: 5px 12px; border: 1px solid rgba(255,194,71,.3); background: rgba(12,8,5,.8); color: var(--parchment); cursor: pointer; }
#constellation-viewport { position: relative; min-height: 0; overflow: hidden; cursor: grab; border: 1px solid rgba(255,194,71,.24); background: radial-gradient(circle at center, rgba(66,45,20,.38), rgba(8,5,4,.95) 68%); }
#constellation-viewport.dragging { cursor: grabbing; }
#constellation-stage { position: absolute; left: 50%; top: 50%; width: 1500px; height: 1100px; transform-origin: 0 0; }
#constellation-lines { position: absolute; inset: 0; width: 1500px; height: 1100px; overflow: visible; }
.constellation-edge { stroke: rgba(255,220,145,.18); stroke-width: 3; fill: none; }
.constellation-edge.owned { stroke: var(--class-color, var(--gold)); filter: drop-shadow(0 0 4px var(--class-color, var(--gold))); }
#constellation-nodes { position: absolute; inset: 0; }
.star-node {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; transform: rotate(45deg);
  border: 1px solid rgba(255,225,170,.35); background: #17100a; color: rgba(255,230,180,.6); cursor: pointer;
  box-shadow: 0 0 8px rgba(0,0,0,.7); transition: box-shadow .14s ease, background .14s ease, opacity .14s ease;
}
.star-node.major { width: 48px; height: 48px; margin: -24px 0 0 -24px; border-width: 2px; }
.star-node::after { content: ''; position: absolute; inset: 8px; border: 1px solid currentColor; }
.star-node.major::after { inset: 10px; border-width: 2px; }
.star-node.available { border-color: var(--class-color, var(--gold)); color: var(--class-color, var(--gold)); box-shadow: 0 0 12px color-mix(in srgb, var(--class-color, var(--gold)) 35%, transparent); }
.star-node.owned { background: var(--class-color, var(--gold)); color: #fff8df; box-shadow: 0 0 18px var(--class-color, var(--gold)); }
.star-node.unavailable { opacity: .35; cursor: not-allowed; }
.star-node.other-class { opacity: .42; cursor: default; }
#constellation-core { position: absolute; left: 750px; top: 550px; transform: translate(-50%,-50%); width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid var(--class-color, var(--gold)); font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: .12em; color: var(--class-color, var(--gold)); box-shadow: 0 0 30px color-mix(in srgb, var(--class-color, var(--gold)) 35%, transparent), inset 0 0 25px rgba(0,0,0,.8); }
#constellation-detail { min-height: 58px; display: grid; grid-template-columns: 230px 1fr; gap: 14px; align-items: center; padding: 9px 12px; border: 1px solid rgba(255,194,71,.18); background: rgba(10,7,5,.65); }
#constellation-detail b { font-family: 'Cinzel', serif; color: var(--class-color, var(--gold)); }
#constellation-detail span { font-size: 12px; color: rgba(243,226,187,.68); }
#help-class-copy { margin: -7px 0 12px; text-align: center; color: rgba(243,226,187,.7); font-style: italic; }

@media (max-height: 820px) {
  .title-inner { transform: scale(.88); }
}
@media (max-width: 760px) {
  #class-select { grid-template-columns: 1fr; max-height: 250px; overflow-y: auto; }
  .class-card { min-height: 70px; }
  .constellation-panel { width: calc(100vw - 16px); height: calc(100vh - 16px); padding: 10px; }
  #constellation-detail { grid-template-columns: 1fr; gap: 3px; }
}
#constellation-stage { left: 0; top: 0; }

/* ====================== PHASE 1.5 EVOLVING CONSTELLATION ====================== */
#constellation-paths {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
}
.constellation-path-seal {
  position: absolute; width: 150px; min-height: 54px; padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--path-color) 60%, transparent);
  background: color-mix(in srgb, #090706 88%, var(--path-color));
  color: var(--path-color); text-align: center; transform: translate(-50%, -50%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--path-color) 22%, transparent);
}
.constellation-path-seal:nth-child(1) { left: 165px; top: 550px; }
.constellation-path-seal:nth-child(2) { left: 750px; top: 80px; }
.constellation-path-seal:nth-child(3) { left: 1335px; top: 550px; }
.constellation-path-seal b { display:block; font-family:'Cinzel',serif; letter-spacing:.08em; font-size:13px; }
.constellation-path-seal span { display:block; margin-top:3px; font-size:10px; color:rgba(243,226,187,.62); }
.constellation-path-seal.preview { opacity:.42; filter:saturate(.45); }
.constellation-path-seal.chosen { opacity:1; border-width:2px; box-shadow:0 0 28px color-mix(in srgb, var(--path-color) 38%, transparent); }

.star-node {
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  touch-action: manipulation; z-index: 2;
}
.star-node.major { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
.star-node::before { content:''; position:absolute; inset:-10px; }
.star-node.stage-1 { border-radius: 3px; }
.star-node.stage-2 { border-width: 2px; }
.star-node.stage-3 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.star-node.keystone {
  width: 72px; height: 72px; margin: -36px 0 0 -36px; border-width: 3px;
  clip-path: polygon(50% 0, 63% 32%, 98% 35%, 72% 58%, 81% 94%, 50% 74%, 19% 94%, 28% 58%, 2% 35%, 37% 32%);
}
.star-node.keystone::after { inset: 22px; }
.star-node.keystone.available { animation: keystone-call 2.2s ease-in-out infinite; }
@keyframes keystone-call {
  0%, 100% { box-shadow: 0 0 14px color-mix(in srgb, var(--class-color, var(--gold)) 40%, transparent); }
  50% { box-shadow: 0 0 30px color-mix(in srgb, var(--class-color, var(--gold)) 75%, transparent); }
}
.star-node.selected { outline: 3px solid #fff2bd; outline-offset: 5px; z-index: 5;
  box-shadow: 0 0 26px color-mix(in srgb, var(--class-color, var(--gold)) 80%, transparent); }

.constellation-branch-label {
  position: absolute; transform: translate(-50%, -50%);
  font-family: 'Cinzel', serif; font-size: 15px; font-weight: 700; letter-spacing: .22em;
  color: color-mix(in srgb, var(--class-color, var(--gold)) 72%, #f3e2bb);
  text-shadow: 0 0 14px color-mix(in srgb, var(--class-color, var(--gold)) 55%, transparent), 0 2px 3px #000;
  pointer-events: none; white-space: nowrap; opacity: .85; text-transform: uppercase;
}

.constellation-stars {
  position: absolute; inset: -40%; pointer-events: none; z-index: 0;
  background-repeat: repeat;
}
.constellation-stars.far {
  background-image:
    radial-gradient(1px 1px at 12% 24%, rgba(255,240,200,.55) 40%, transparent 60%),
    radial-gradient(1px 1px at 44% 68%, rgba(210,220,255,.4) 40%, transparent 60%),
    radial-gradient(1px 1px at 71% 33%, rgba(255,240,200,.45) 40%, transparent 60%),
    radial-gradient(1px 1px at 88% 79%, rgba(255,220,180,.35) 40%, transparent 60%),
    radial-gradient(1px 1px at 28% 88%, rgba(220,210,255,.4) 40%, transparent 60%);
  background-size: 260px 260px;
  animation: star-drift 160s linear infinite;
}
.constellation-stars.near {
  background-image:
    radial-gradient(1.6px 1.6px at 18% 52%, rgba(255,244,214,.8) 40%, transparent 65%),
    radial-gradient(1.4px 1.4px at 63% 18%, rgba(235,225,255,.6) 40%, transparent 65%),
    radial-gradient(1.8px 1.8px at 82% 62%, rgba(255,236,190,.7) 40%, transparent 65%);
  background-size: 420px 420px;
  animation: star-drift 90s linear infinite reverse, star-twinkle 5s ease-in-out infinite;
}
@keyframes star-drift { from { background-position: 0 0; } to { background-position: 520px 260px; } }
@keyframes star-twinkle { 0%, 100% { opacity: .9; } 50% { opacity: .55; } }
.constellation-edge.stage-1 { stroke-width: 3; }
.constellation-edge.stage-2 { stroke-width: 4; stroke-dasharray: 9 4; }
.constellation-edge.stage-3 { stroke-width: 5; }

#constellation-detail {
  grid-template-columns: minmax(210px, 270px) 1fr minmax(180px, 230px);
}
#constellation-purchase {
  min-height: 40px; padding: 8px 12px; border: 1px solid var(--class-color, var(--gold));
  background: color-mix(in srgb, var(--class-color, var(--gold)) 18%, #0b0805);
  color: #fff4d0; font-family:'Cinzel',serif; cursor:pointer;
}
#constellation-purchase:hover:not(:disabled) { box-shadow: 0 0 16px color-mix(in srgb, var(--class-color, var(--gold)) 45%, transparent); }
#constellation-purchase:disabled { opacity:.45; cursor:not-allowed; }

@media (max-width: 760px) {
  #constellation-detail { grid-template-columns: 1fr; }
  .constellation-path-seal { width: 120px; }
}
