:root {
  --gold: #f7cf6b;
  --gold2: #ffefb0;
  --ink: #f3ecff;
  --muted: #a89cc8;
  --panel: rgba(22, 16, 46, 0.72);
  --line: rgba(255, 225, 160, 0.18);
  --hp: #ff4d6d;
  --mana: #4aa3ff;
  --shield: #3dffa0;
  --bg1: #1a1040; --bg2: #2a1458; --bg3: #07040f;
  --maxw: 520px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #07040f; color: var(--ink);
  font-family: 'Nunito', system-ui, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: 'Cinzel', serif; margin: 0; }
.muted { color: var(--muted); }

#bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; }
#app { position: fixed; inset: 0; will-change: transform; z-index: 1; }
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }
#float-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }

.screen {
  position: absolute; inset: 0; display: none; flex-direction: column;
  max-width: var(--maxw); margin: 0 auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.screen.active { display: flex; animation: screenIn 0.35s ease-out; }
@keyframes screenIn { from { opacity: 0; transform: scale(0.98); } }


/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 12px 22px; font-weight: 900; letter-spacing: 0.3px;
  background: linear-gradient(180deg, rgba(80, 60, 150, 0.55), rgba(26, 16, 58, 0.75));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 1px rgba(255, 215, 150, 0.3), 0 3px 0 rgba(8, 4, 20, 0.8), 0 6px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s, filter 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.95); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn.gold {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #fff3b8, #ffd15a 30%, #f2a93b 60%, #c9731a);
  color: #3a1d00; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 0 #8a4a0a, 0 8px 24px rgba(255, 170, 50, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.btn.gold::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 100%;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.65) 50%, transparent 70%);
  animation: sheen 3.2s ease-in-out infinite; pointer-events: none; transform: translateX(-100%);
}
/* transform-only animations run on the GPU compositor without repainting */
@keyframes sheen { 0%, 55% { transform: translateX(-100%); } 85%, 100% { transform: translateX(100%); } }
.btn.gold:active { transform: translateY(3px) scale(0.98); box-shadow: 0 1px 0 #8a4a0a, 0 4px 12px rgba(255, 170, 50, 0.3); }
.btn.ghost { background: rgba(255, 255, 255, 0.06); }
.btn.big { font-size: 22px; padding: 16px 44px; border-radius: 18px; font-family: 'Cinzel', serif; }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn.tiny { padding: 6px 12px; font-size: 13px; opacity: 0.75; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; font-size: 20px; font-weight: 900;
  background: linear-gradient(180deg, rgba(80, 60, 150, 0.55), rgba(26, 16, 58, 0.75));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 1px rgba(255, 215, 150, 0.3), 0 3px 0 rgba(8, 4, 20, 0.8);
}

/* ---------- title: painted key art, logo artwork, painted plaque buttons ---------- */
#title { max-width: none; overflow: hidden; background: #07040f; }
.title-art { position: absolute; inset: -4%; background: url(../assets/scenes/title.jpg) 50% 30% / cover no-repeat; animation: kenburns 30s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1) translateY(0); } to { transform: scale(1.08) translateY(-1.5%); } }
.title-rays { position: absolute; left: 50%; top: 18%; width: 160vmax; height: 160vmax; transform: translate(-50%, -50%); pointer-events: none; opacity: 0.22;
  background: repeating-conic-gradient(from 0deg, rgba(255, 210, 140, 0.35) 0 4deg, transparent 4deg 14deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 45%); mask: radial-gradient(circle, #000 0, transparent 45%); }
#title-gems { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.title-shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(7, 4, 15, 0.3) 0%, transparent 20%, transparent 45%, rgba(7, 4, 15, 0.6) 66%, rgba(7, 4, 15, 0.95) 100%); }
.title-inner { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: clamp(14px, 3.5vh, 34px);
  padding: 24px 18px calc(30px + env(safe-area-inset-bottom)); }
.logo { margin: 0; width: min(96vw, 560px); line-height: 0; animation: logoIn 1s 0.1s cubic-bezier(.2, 1.3, .4, 1) both; }
.logo img { width: 100%; height: auto; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 30px rgba(170, 120, 255, 0.35)); }
@keyframes logoIn { from { transform: scale(0.8) translateY(12px); opacity: 0; filter: brightness(2); } }
.title-menu { width: min(92vw, 380px); display: flex; flex-direction: column; align-items: center; gap: 10px; animation: menuIn 0.6s 0.7s both; }
@keyframes menuIn { from { opacity: 0; transform: translateY(14px); } }

/* painted plaque buttons: the art is the button, the label sits in its centre panel */
.plaque { position: relative; border: 0; padding: 0; background: center / 100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif; font-weight: 900; letter-spacing: 1.5px; color: #fff3d6; cursor: pointer; transition: transform 0.12s, filter 0.2s;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)); -webkit-tap-highlight-color: transparent; }
.plaque:active { transform: scale(0.96); filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)) brightness(1.15); }
.plaque span { text-shadow: 0 2px 0 rgba(30, 10, 50, 0.9), 0 0 12px rgba(0, 0, 0, 0.6); }
.plaque.gold { width: 100%; aspect-ratio: 823 / 219; background-image: url(../assets/ui/plaque-gold.png); font-size: clamp(20px, 6.2vw, 27px); }
.plaque.gold span { background: linear-gradient(180deg, #fffbe6 15%, #ffd977 55%, #e9a23b 90%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(40, 10, 60, 0.95)); text-shadow: none; }
.plaque.gold small { margin-top: 1px; font-family: 'Nunito'; font-size: clamp(10px, 2.9vw, 12px); font-weight: 800; letter-spacing: 0.5px; color: #e6d6ff; text-shadow: 0 1px 2px #000; }
.plaque.gold small:empty { display: none; }
.plaque.gold::after { content: ''; position: absolute; inset: 22% 16%; border-radius: 6px; pointer-events: none; overflow: hidden;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.22) 50%, transparent 60%) -120% 0 / 220% 100% no-repeat; animation: plaqueSheen 4.5s 1.5s ease-in-out infinite; }
@keyframes plaqueSheen { 0%, 70% { background-position: -120% 0; } 100% { background-position: 120% 0; } }
.title-row { display: flex; gap: 8px; width: 100%; justify-content: center; }
.plaque.dark { flex: 0 1 50%; aspect-ratio: 896 / 300; background-image: url(../assets/ui/plaque-dark.png); font-size: clamp(12px, 3.6vw, 15px); color: #ecdcb8; }

/* wide screens: the painting fills the window, logo and menu sit centred in the lower half */
.title-art-sharp { display: none; }
@media (min-aspect-ratio: 1/1) {
  /* the portrait painting shows whole in the centre; a blurred copy fills the sides */
  .title-art { background-position: 50% 30%; filter: blur(28px) brightness(0.5) saturate(1.2); animation: none; transform: scale(1.15); }
  .title-art-sharp { display: block; position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); aspect-ratio: 2 / 3; max-width: 100%;
    background: url(../assets/scenes/title.jpg) center / cover no-repeat;
    -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
  .title-shade { background: radial-gradient(ellipse 60% 70% at 50% 60%, transparent 40%, rgba(7, 4, 15, 0.55) 100%),
    linear-gradient(180deg, rgba(7, 4, 15, 0.25) 0%, transparent 30%, rgba(7, 4, 15, 0.55) 70%, rgba(7, 4, 15, 0.9) 100%); }
  .title-inner { justify-content: flex-end; padding-bottom: 5vh; gap: 2.5vh; }
  .logo { width: min(48vw, 620px, 66vh); }
  .title-menu { width: min(30vw, 400px, 52vh); min-width: 300px; }
  .plaque.gold { font-size: clamp(20px, 2.6vh, 28px); }
  .plaque.dark { font-size: clamp(13px, 1.7vh, 16px); }
}
@media (max-height: 640px) { .logo { width: min(88vw, 470px); } }

/* ---------- top bars ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: linear-gradient(180deg, rgba(10, 6, 24, 0.92), rgba(18, 10, 40, 0.7));
  border-bottom: 1px solid transparent; position: relative; z-index: 2;
  border-image: linear-gradient(90deg, transparent, rgba(255, 210, 130, 0.7), transparent) 1;
}
.topbar h2 { flex: 1; font-size: 20px; text-align: center; color: var(--gold2); }
.hero-chip { flex: 1; display: flex; align-items: center; gap: 10px; }
.hero-chip .lvl {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-family: 'Cinzel'; font-weight: 900; font-size: 20px; color: #3a1d00;
  background: radial-gradient(circle at 35% 30%, #fff3b0, #f2a93b 60%, #9a5410);
  box-shadow: 0 0 0 3px rgba(255, 220, 140, 0.25), 0 0 18px rgba(255, 190, 80, 0.4);
}
.hero-chip .xp { flex: 1; }
.xp-label { font-size: 13px; font-weight: 800; }
.xp-label small { color: var(--muted); font-weight: 700; margin-left: 6px; }
.xpbar { height: 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-top: 4px; }
.xpbar .fill { height: 100%; background: linear-gradient(90deg, #8a5cff, #e0a0ff); box-shadow: 0 0 10px #b886ff; border-radius: 9px; transition: width 0.8s; }
.gold-chip, .sp-chip {
  padding: 8px 12px; border-radius: 12px; font-weight: 900; color: var(--gold);
  background: rgba(255, 200, 80, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 200, 80, 0.3);
}

/* ---------- map ---------- */
.map-scroll { flex: 1; overflow-y: auto; padding: 12px 10px 24px; display: flex; flex-direction: column; gap: 14px; }
.zone {
  position: relative; flex: 0 0 auto; border-radius: 22px; overflow: hidden;
  background: var(--zimg) center / cover no-repeat, #120a26;
  box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #c8902a, 0 0 0 5px #3a1d00, 0 14px 34px rgba(0, 0, 0, 0.6);
}
.zone::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 4, 20, 0.75), rgba(8, 4, 20, 0.05) 18%, rgba(8, 4, 20, 0.05) 85%, rgba(8, 4, 20, 0.5)),
              radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.45));
}
.zone.locked { filter: grayscale(0.85) brightness(0.45); }
.zone-head { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 0; }
.zone-head h3 { color: #fff4dc; font-size: 21px; text-shadow: 0 2px 0 #000, 0 0 16px color-mix(in srgb, var(--za) 80%, transparent); }
.zone-head span { font-size: 12px; color: #f0e4ff; font-weight: 800; text-shadow: 0 1px 3px #000; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; overflow: visible; }
.trail path { fill: none; stroke: rgba(30, 16, 8, 0.75); stroke-width: 10; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trail path.lit { stroke: #ffd77a; stroke-width: 4; stroke-dasharray: 0 99999; filter: drop-shadow(0 0 6px #ffb340); transition: stroke-dasharray 1s ease-out; }
.node {
  position: absolute; z-index: 2; transform: translate(-50%, -50%); width: 54px; height: 54px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; font-family: 'Cinzel'; font-weight: 900; font-size: 18px; color: #2a1600;
  background: radial-gradient(circle at 35% 30%, #fff4cc, #c8a46a 55%, #6a4a20);
  box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #c8902a, 0 0 0 5px #2a1400, inset 0 -4px 8px rgba(0, 0, 0, 0.35), 0 6px 12px rgba(0, 0, 0, 0.6);
}
.node img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; border-radius: 50%; }
.node .num { line-height: 1; }
.node.done { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--za) 50%, white), color-mix(in srgb, var(--za) 70%, black) 75%); color: #10081e; }
.node.current {
  background: radial-gradient(circle at 35% 30%, #fff7c0, #ffc23a 55%, #a0560a); color: #3a1d00;
  box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #fff0b0, 0 0 0 5px #2a1400, 0 0 26px rgba(255, 200, 80, 0.9), 0 6px 12px rgba(0, 0, 0, 0.6);
  animation: nodeBob 1.6s ease-in-out infinite;
}
@keyframes nodeBob { 50% { transform: translate(-50%, -58%) scale(1.06); } }
.node.locked { filter: grayscale(1) brightness(0.55); cursor: default; }
.node.boss { width: 64px; height: 64px; font-size: 24px; }
.node.big { width: 74px; height: 74px; box-shadow: 0 0 0 2px #1a0c00, 0 0 0 5px #ffcf5a, 0 0 0 6px #2a1400, 0 0 22px rgba(255, 180, 60, 0.6), 0 8px 14px rgba(0, 0, 0, 0.6); }
.node.big.current { box-shadow: 0 0 0 2px #1a0c00, 0 0 0 5px #fff0b0, 0 0 0 6px #2a1400, 0 0 30px rgba(255, 200, 80, 1), 0 8px 14px rgba(0, 0, 0, 0.6); }
.node .stars { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #ffd84a; letter-spacing: -1px; white-space: nowrap; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.node .tag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%); padding: 1px 7px; border-radius: 8px; font-family: 'Nunito'; font-size: 10px; font-weight: 900;
  color: #fff; background: linear-gradient(180deg, #c0203f, #6a0018); box-shadow: 0 0 0 1px #ffcf5a; letter-spacing: 0.5px; text-transform: uppercase;
}
.camp-node {
  position: absolute; z-index: 3; right: 12px; top: 46px; border: 0; width: 52px; height: 52px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; line-height: 1; color: #fff;
  background: radial-gradient(circle at 40% 35%, #ffb35a, #c0400a 60%, #3a1000);
  box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #c8902a, 0 0 20px rgba(255, 120, 30, 0.7);
}
.camp-node small { font-size: 9px; font-weight: 900; text-transform: uppercase; margin-top: 2px; }
.bottomnav {
  display: flex; padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); gap: 6px; background: linear-gradient(0deg, rgba(10, 6, 24, 0.97), rgba(18, 10, 40, 0.88));
  border-top: 1px solid transparent; border-image: linear-gradient(90deg, transparent, rgba(255, 210, 130, 0.7), transparent) 1;
}
.navbtn { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 800; color: #e0d4f5; padding: 4px; border-radius: 12px; position: relative; }
.navbtn span {
  font-size: 20px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 30%, #3a2a6a, #120a28 75%);
  box-shadow: 0 0 0 2px #1a0e30, 0 0 0 3px #c8902a, inset 0 2px 6px rgba(255, 255, 255, 0.12);
}
.navbtn:active span { transform: scale(0.92); }
.navbtn .dot { position: absolute; top: 2px; right: calc(50% - 24px); width: 12px; height: 12px; border-radius: 50%; background: #ff4d6d; display: none; box-shadow: 0 0 8px #ff4d6d, 0 0 0 2px #1a0e30; }
.navbtn .dot.on { display: block; animation: nodePulse 1.2s infinite; }
@keyframes nodePulse { 50% { transform: scale(1.25); } }

/* ---------- camp ---------- */
#camp { max-width: none; overflow: hidden; }
.camp-scene { position: absolute; inset: 0; overflow: hidden; background: #0a0618; }
.camp-art, .camp-spots {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: max(100vw, 66.6vh); height: max(150vw, 100vh); max-width: 900px; max-height: 1350px;
}
.camp-art { background: url(../assets/scenes/camp.jpg) center / cover no-repeat; }
.camp-art::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 60%, transparent 50%, rgba(0, 0, 0, 0.55)); }
.spot {
  position: absolute; transform: translate(-50%, -50%); border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0;
}
.spot i {
  font-style: normal; font-size: 22px; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 30%, rgba(80, 50, 140, 0.85), rgba(16, 8, 36, 0.9) 75%);
  box-shadow: 0 0 0 2px #1a0e30, 0 0 0 4px #e8b84a, 0 0 18px rgba(255, 200, 100, 0.55); animation: spotPulse 2.4s ease-in-out infinite;
}
@keyframes spotPulse { 50% { box-shadow: 0 0 0 2px #1a0e30, 0 0 0 4px #fff0b0, 0 0 30px rgba(255, 210, 120, 0.9); } }
.spot span { font-family: 'Cinzel'; font-weight: 900; font-size: 12px; color: #fff4dc; padding: 2px 8px; border-radius: 8px; background: rgba(10, 5, 20, 0.75); text-shadow: 0 1px 2px #000; white-space: nowrap; }
.spot b { position: absolute; top: -4px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #ff4d6d; color: #fff; font-size: 12px; line-height: 20px; box-shadow: 0 0 0 2px #1a0e30; }
.spot:active i { transform: scale(0.92); }
.camp-top { position: relative; z-index: 3; background: linear-gradient(180deg, rgba(10, 6, 24, 0.85), rgba(10, 6, 24, 0)); border-image: none; border-bottom: 0; }
.camp-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: center; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(10, 6, 24, 0.85), transparent); }
.sheet { position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end; background: rgba(4, 2, 12, 0); pointer-events: none; transition: background 0.3s; }
.sheet.open { background: rgba(4, 2, 12, 0.55); pointer-events: auto; }
.sheet-card {
  position: relative; width: 100%; max-width: var(--maxw); margin: 0 auto; max-height: 78vh; overflow-y: auto; padding: 22px 16px calc(22px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0; transform: translateY(105%); transition: transform 0.35s cubic-bezier(.2, 1.2, .4, 1);
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 190, 90, 0.18), transparent 60%), linear-gradient(180deg, #2a1a40, #140c26);
  box-shadow: 0 0 0 1px #000, 0 -2px 0 3px #c8902a, 0 -20px 40px rgba(0, 0, 0, 0.6);
}
.sheet.open .sheet-card { transform: none; }
.sheet-card h2 { color: var(--gold2); font-size: 22px; margin-bottom: 4px; }
.sheet-card > div > .muted { margin: 0 0 10px; font-size: 13px; }
.sheet-x { position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; font-size: 14px; }

/* ---------- battle ---------- */
#battle { max-width: none; }
#battle > * { width: 100%; max-width: var(--maxw); margin-left: auto; margin-right: auto; }
#battle.hurt { animation: hurt 0.45s; }
@keyframes hurt { 20% { box-shadow: inset 0 0 120px rgba(255, 0, 40, 0.75); } }
.b-top {
  display: flex; align-items: stretch; gap: 10px; padding: 8px 8px 4px;
}
.foe-card {
  position: relative; flex: 0 0 auto; width: clamp(88px, 25vw, 124px); aspect-ratio: 1; border-radius: 18px; overflow: hidden;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--za, #b06bff) 40%, #1a1036), #0c0720 75%);
  box-shadow: inset 0 0 0 2px rgba(255, 215, 150, 0.55), inset 0 0 24px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(10, 5, 20, 0.7), 0 8px 20px rgba(0, 0, 0, 0.5);
}
.foe-card.imminent { animation: foeDanger 0.8s infinite; }
@keyframes foeDanger { 50% { box-shadow: inset 0 0 0 2px #ff4d6d, inset 0 0 30px rgba(255, 0, 40, 0.45), 0 0 0 3px rgba(10, 5, 20, 0.7), 0 0 22px rgba(255, 40, 70, 0.75); } }
#enemy-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.icon-btn.flee { position: absolute; left: 4px; top: 4px; width: 28px; height: 28px; border-radius: 9px; font-size: 14px; opacity: 0.85; z-index: 2; }
.foe-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.stage-label { font-family: 'Cinzel'; font-weight: 800; font-size: 11px; color: var(--gold2); opacity: 0.8; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enemy-name {
  font-family: 'Cinzel'; font-weight: 900; font-size: clamp(14px, 4.2vw, 19px); line-height: 1.1; color: #fff4e0;
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(0, 0, 0, 0.9), 0 0 24px rgba(255, 220, 160, 0.35);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.enemy-name.boss { color: #ffb86b; text-shadow: 0 0 14px rgba(255, 120, 40, 0.8), 0 2px 4px #000; }
.foe-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.enemy-traits { display: flex; gap: 3px; flex-wrap: nowrap; overflow: hidden; min-width: 0; }
.trait { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 7px; white-space: nowrap; background: linear-gradient(180deg, rgba(60, 30, 40, 0.75), rgba(20, 8, 16, 0.8)); box-shadow: inset 0 0 0 1px rgba(255, 170, 130, 0.35); }
.trait.weak { background: linear-gradient(180deg, rgba(40, 70, 30, 0.8), rgba(10, 26, 8, 0.85)); box-shadow: inset 0 0 0 1px rgba(160, 255, 120, 0.5); }
.intent {
  flex: 0 0 auto; display: flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 9px; font-size: 12px;
  background: linear-gradient(180deg, rgba(90, 10, 30, 0.8), rgba(30, 0, 10, 0.85)); box-shadow: inset 0 0 0 1px rgba(255, 80, 100, 0.5);
}
.intent .intent-ic { font-size: 12px; }
.intent > b { color: #ff8a9a; font-size: 13px; }
.intent small { font-size: 10px; color: var(--muted); font-weight: 800; }
.intent small b { color: #fff; font-size: 12px; }
.intent.hazard { background: linear-gradient(180deg, rgba(20, 60, 90, 0.8), rgba(4, 16, 30, 0.85)); box-shadow: inset 0 0 0 1px rgba(140, 220, 255, 0.6); }
.intent.hazard > b { color: #bfeaff; }
.intent.hazard.poison { background: linear-gradient(180deg, rgba(30, 80, 20, 0.8), rgba(6, 22, 4, 0.85)); box-shadow: inset 0 0 0 1px rgba(140, 255, 110, 0.6); }
.intent.hazard.poison > b { color: #b8ff9a; }
.intent.imminent { animation: imminent 0.8s infinite; }
@keyframes imminent { 50% { filter: brightness(1.5); box-shadow: inset 0 0 0 1px #fff, 0 0 12px rgba(255, 60, 90, 0.8); } }
.moves {
  flex: 0 0 auto; width: clamp(64px, 17vw, 84px); border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #3a2a7a, #140c30 80%);
  box-shadow: inset 0 0 0 2px rgba(255, 215, 150, 0.55), inset 0 0 18px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(10, 5, 20, 0.7), 0 8px 20px rgba(0, 0, 0, 0.5);
}
.moves b {
  font-family: 'Cinzel'; font-weight: 900; font-size: clamp(28px, 8.5vw, 40px); line-height: 1; display: inline-block;
  background: linear-gradient(180deg, #fff8d8, #f7cf6b 55%, #c46a10); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #3a1500);
}
.moves small { font-size: 10px; font-weight: 900; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.moves.low { animation: foeDanger 0.9s infinite; }
.moves.low b { background-image: linear-gradient(180deg, #ffd0d0, #ff4d6d 55%, #8a0020); }
.moves b.bump { animation: movesBump 0.45s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes movesBump { 40% { transform: scale(1.5); filter: drop-shadow(0 0 12px #ffe08a); } }

.bar {
  position: relative; height: 20px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), rgba(30, 20, 50, 0.6));
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 215, 150, 0.4), 0 0 0 3px rgba(10, 5, 20, 0.7);
}
.bar .fill, .bar .ghost { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; }
.bar .fill { overflow: hidden; }
.bar .fill::before {
  content: ''; position: absolute; left: 3px; right: 3px; top: 1px; height: 42%; border-radius: 10px;
  background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.05));
}
.bar .fill::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 100%;
  background: linear-gradient(100deg, transparent 38%, rgba(255, 255, 255, 0.5) 50%, transparent 62%);
  animation: barSheen 3.5s ease-in-out infinite; transform: translateX(-100%);
}
@keyframes barSheen { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.bar .fill { transition: width 0.18s ease-out; }
.bar .ghost { background: rgba(255, 255, 255, 0.55); transition: width 0.6s ease-in; }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 900; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.bar i { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); z-index: 2; font-style: normal; font-size: 12px; text-shadow: 0 0 4px #000; }
.hpbar .fill { background: linear-gradient(180deg, #ff8a9a, #ff2d55 50%, #b0102e); box-shadow: 0 0 12px rgba(255, 45, 85, 0.6); }
.hpbar.enemy { height: 15px; }
.hpbar.enemy span { font-size: 11px; }
.hpbar.enemy .fill { background: linear-gradient(180deg, #ffb070, #ff5a2a 50%, #a02a00); }

.board-zone { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 4px; }
#board-wrap {
  position: relative; border-radius: 18px; padding: 4px;
  background: linear-gradient(145deg, #fff0b8, #c8902a 20%, #5a3006 46%, #e8b84a 68%, #fff0b8 80%, #6a3c08);
  box-shadow: 0 0 0 1px #1a0c00, 0 0 0 4px rgba(10, 5, 20, 0.6), 0 0 40px rgba(255, 190, 90, 0.22), 0 26px 60px rgba(0, 0, 0, 0.75);
}
#board-wrap::before {
  content: ''; position: absolute; inset: 3px; border-radius: 15px; pointer-events: none; z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(40, 20, 0, 0.9), inset 0 0 22px rgba(0, 0, 0, 0.7);
}
#board-wrap::after {
  content: ''; position: absolute; inset: -6px; pointer-events: none; z-index: 2;
  --jewel: radial-gradient(circle at 40% 35%, #fff 0 1.5px, #ff8aa0 2.5px, #e0203f 5px, #5a0010 8px, #e8b84a 9px, #6a3c08 11px, transparent 12px);
  background: var(--jewel) top left / 24px 24px no-repeat, var(--jewel) top right / 24px 24px no-repeat,
              var(--jewel) bottom left / 24px 24px no-repeat, var(--jewel) bottom right / 24px 24px no-repeat;
  filter: drop-shadow(0 0 4px rgba(255, 60, 90, 0.6));
}
#board-cv { display: block; touch-action: none; border-radius: 15px; }

.player-zone { padding: 2px 8px 10px; display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; }
.p-row { display: flex; gap: 8px; align-items: center; }
.hp-wrap { flex: 1; position: relative; display: flex; align-items: center; padding-left: 18px; }
.hp-wrap .bar { flex: 1; height: 26px; border-radius: 13px; padding-left: 0; }
.hp-wrap .bar span { font-size: 13px; padding-left: 14px; }
.heart-medal {
  position: absolute; left: -2px; z-index: 3; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-size: 18px; color: #fff; text-shadow: 0 1px 2px #000;
  background: radial-gradient(circle at 35% 30%, #ff9aae, #e0203f 55%, #5a0010);
  box-shadow: 0 0 0 2px #2a0a10, 0 0 0 4px #e8b84a, 0 0 0 5px #3a1d00, 0 0 14px rgba(255, 60, 90, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}
.medal {
  position: relative; width: 50px; height: 50px; border-radius: 50%; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  background: radial-gradient(circle at 40% 30%, #3a2a6a, #120a28 75%);
  box-shadow: 0 0 0 2px #1a0e30, 0 0 0 4px #c8902a, 0 0 0 5px #3a1d00, inset 0 2px 6px rgba(255, 255, 255, 0.12), 0 6px 12px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.3s;
}
.medal i { font-style: normal; font-size: 16px; }
.medal b { font-size: 13px; font-weight: 900; margin-top: 2px; }
.medal.gold { color: var(--gold); }
.medal.shield.on { box-shadow: 0 0 0 2px #1a0e30, 0 0 0 4px #3dffa0, 0 0 0 5px #0a3a20, 0 0 18px rgba(61, 255, 160, 0.6); color: #c8ffe6; }

.belt-wrap { position: relative; }
.belt {
  display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 8px;
  min-height: 70px; border-radius: 16px; align-items: center;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #4a2c1a, #2a170c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 3px rgba(232, 184, 74, 0.55), inset 0 0 0 4px rgba(0, 0, 0, 0.5),
    inset 0 8px 16px rgba(0, 0, 0, 0.45), 0 6px 14px rgba(0, 0, 0, 0.5);
}
.belt::-webkit-scrollbar { display: none; }
.belt.busy .item-slot { filter: saturate(0.6) brightness(0.8); }
.belt-empty { color: #d8c0a0; font-size: 12px; font-weight: 700; padding: 0 8px; opacity: 0.8; }
.item-slot {
  --rc: #c9c3d6;
  position: relative; flex: 0 0 54px; height: 54px; border: 0; border-radius: 12px; padding: 4px;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rc) 28%, #1a1030), #0c0618 80%);
  box-shadow: inset 0 0 0 2px var(--rc), inset 0 0 14px color-mix(in srgb, var(--rc) 40%, transparent), 0 3px 0 rgba(0, 0, 0, 0.6);
  transition: transform 0.12s;
}
.item-slot img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.item-slot .emo { font-size: 26px; line-height: 46px; }
.item-slot .cnt {
  position: absolute; right: -3px; bottom: -3px; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 5px;
  font-size: 12px; line-height: 20px; color: #fff; background: #1a0e30; box-shadow: 0 0 0 2px var(--rc);
}
.item-slot.sel { transform: translateY(-4px) scale(1.06); box-shadow: inset 0 0 0 2px #fff, 0 0 18px var(--rc), 0 3px 0 rgba(0, 0, 0, 0.6); }
.item-slot:active { transform: scale(0.94); }
.r-common { --rc: #c9c3d6; } .r-uncommon { --rc: #5fe08a; } .r-rare { --rc: #4aa8ff; } .r-epic { --rc: #c07bff; } .r-legendary { --rc: #ffb340; }
.item-slot.r-legendary, .item-slot.r-epic { animation: rarePulse 2.4s ease-in-out infinite; }
@keyframes rarePulse { 50% { box-shadow: inset 0 0 0 2px var(--rc), inset 0 0 20px var(--rc), 0 0 14px color-mix(in srgb, var(--rc) 70%, transparent), 0 3px 0 rgba(0, 0, 0, 0.6); } }
.item-pop {
  --rc: #c9c3d6;
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 30; padding: 12px 14px; border-radius: 16px;
  background: linear-gradient(180deg, #2a1d48, #150d2c);
  box-shadow: 0 0 0 1px #000, 0 0 0 3px var(--rc), 0 0 24px color-mix(in srgb, var(--rc) 45%, transparent), 0 14px 30px rgba(0, 0, 0, 0.7);
  display: none; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
}
.item-pop.open { display: grid; animation: cardIn 0.25s cubic-bezier(.2, 1.4, .4, 1); }
.ip-head { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; }
.ip-head img { width: 44px; height: 44px; object-fit: contain; }
.ip-head b { font-family: 'Cinzel'; font-size: 16px; color: #fff; display: block; }
.ip-head small { font-weight: 900; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--rc); }
.item-pop p { margin: 0; font-size: 13px; font-weight: 700; color: #e6dcf5; }
.item-pop .btn { min-width: 76px; }
.skill-name.r-uncommon { color: #c8ffd8; text-shadow: 0 0 20px #3dff8a, 0 2px 0 #000; }
.skill-name.r-rare { color: #cfe6ff; text-shadow: 0 0 20px #4aa3ff, 0 2px 0 #000; }
.skill-name.r-epic { color: #ecd6ff; text-shadow: 0 0 24px #b86bff, 0 2px 0 #000; }
.skill-name.r-legendary { color: #fff0c0; text-shadow: 0 0 28px #ffb340, 0 2px 0 #000; }

/* ---------- floating text ---------- */
.ftext {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-weight: 900; pointer-events: none;
  animation: floatUp 1.1s ease-out forwards; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 12px rgba(0, 0, 0, 0.6);
}
.ftext span { display: inline-block; }
.ftext span.bump { animation: bump 0.18s ease-out; }
@keyframes bump { 40% { transform: scale(1.35); } }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  25% { transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(0.95); }
}
.num.dmg { font-size: 34px; color: #fff; font-family: 'Cinzel'; -webkit-text-stroke: 1.5px #7a0a1a; animation-duration: 1.4s; }
.num.dmg.crit { font-size: 44px; color: #ffe066; -webkit-text-stroke: 2px #a03000; }
.num.hurt { font-size: 30px; color: #ff4d6d; font-family: 'Cinzel'; -webkit-text-stroke: 1px #400010; }
.num.small { font-size: 16px; }
.num.heal { color: #ff9cd2; }
.num.mana { color: #9cd0ff; }
.num.shield { color: #8affc8; }
.num.gold { color: #ffd84a; }
.crit-label { font-size: 18px; color: #ffe066; letter-spacing: 2px; font-family: 'Cinzel'; animation-duration: 1s; }
.crit-label.weak { color: #b8ff7a; font-size: 20px; }
.bonus-line { margin: 0 0 12px; font-weight: 800; color: var(--gold2); }
.bonus-line b { color: var(--gold); }
.combo {
  font-family: 'Cinzel'; font-size: 38px; letter-spacing: 1px; animation: comboPop 1.1s cubic-bezier(.2, 1.4, .4, 1) forwards;
  background: linear-gradient(180deg, #fff, #ffe58a 50%, #ff9a2a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5a1d00) drop-shadow(0 0 18px rgba(255, 170, 60, 0.7)); text-shadow: none;
}
.combo.c4, .combo.c5 { font-size: 46px; background-image: linear-gradient(180deg, #fff, #ffb0f0 50%, #b040ff); filter: drop-shadow(0 3px 0 #3a0060) drop-shadow(0 0 22px rgba(200, 80, 255, 0.85)); }
.combo.c6, .combo.c7, .combo.c8 { font-size: 54px; background-image: linear-gradient(90deg, #ff6a6a, #ffe066, #6aff9a, #6ab8ff, #d06aff); filter: drop-shadow(0 3px 0 #000) drop-shadow(0 0 26px rgba(255, 255, 255, 0.85)); }
@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.4) rotate(-6deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(0.9) rotate(2deg); }
  28% { transform: translate(-50%, -50%) scale(1.05) rotate(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1); }
}
.combo-sub { font-size: 16px; color: #fff; letter-spacing: 2px; font-family: 'Cinzel'; }
.skill-name { font-family: 'Cinzel'; font-size: 30px; color: #cfe6ff; text-shadow: 0 0 20px #4aa3ff, 0 2px 0 #000; animation: comboPop 1s forwards; }
.banner {
  font-family: 'Cinzel'; font-size: 52px; font-weight: 900; animation: comboPop 1.8s cubic-bezier(.2, 1.4, .4, 1) forwards;
  background: linear-gradient(180deg, #fff8d8, #f7cf6b 50%, #c46a10); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #4a1d00) drop-shadow(0 0 30px rgba(255, 190, 80, 0.8)); text-shadow: none;
}
.banner.small { font-size: 30px; }
.banner.defeat { background-image: linear-gradient(180deg, #ffd0d0, #ff4d6d 50%, #600010); filter: drop-shadow(0 4px 0 #200) drop-shadow(0 0 30px rgba(255, 40, 70, 0.7)); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(4, 2, 12, 0.82); }
.modal.open { display: flex; animation: fade 0.25s; }
@keyframes fade { from { opacity: 0; } }
.modal-card {
  width: 100%; max-width: 400px; max-height: 88vh; overflow-y: auto; padding: 24px 20px 20px; border-radius: 24px; text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(160, 110, 255, 0.25), transparent 60%), linear-gradient(170deg, #2a1a5a, #160e34 60%, #0e0822);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 0 1px rgba(255, 215, 150, 0.6), 0 0 0 5px #120a26, 0 0 0 6px rgba(255, 215, 150, 0.3), 0 0 50px rgba(160, 110, 255, 0.25), 0 30px 80px rgba(0, 0, 0, 0.7);
  animation: cardIn 0.4s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes cardIn { from { transform: scale(0.8) translateY(20px); opacity: 0; } }
.modal-card h2 { font-size: 26px; color: var(--gold2); margin-bottom: 8px; }
.modal-card h3 { font-size: 16px; color: var(--gold); margin: 14px 0 8px; }
.modal-btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.modal-btns .btn { flex: 1; min-width: 90px; }

.pre-portrait {
  display: block; height: 200px; max-width: 100%; margin: 4px auto 6px; object-fit: contain;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--glow) 55%, transparent)) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6));
  -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent);
  animation: cardIn 0.5s cubic-bezier(.2, 1.4, .4, 1);
}
.pre-zone { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.pre h2.boss { color: #ffb86b; text-shadow: 0 0 16px rgba(255, 120, 40, 0.8); }
.pre-tag { font-weight: 900; color: #ffb86b; margin-bottom: 6px; }
.pre-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.pre-stats div, .stat-grid div { background: rgba(0, 0, 0, 0.3); border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; }
.pre-stats small, .stat-grid small { font-size: 11px; color: var(--muted); font-weight: 800; }
.pre-stats b, .stat-grid b { font-size: 17px; }
.pre-traits { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pre-vs { margin-top: 14px; font-size: 13px; color: var(--muted); }
.pre-vs b { color: var(--ink); }

.result h2 { font-size: 36px; }
.result.lose h2 { color: #ff8a9a; }
.big-stars { display: flex; justify-content: center; gap: 4px; margin: 4px 0 10px; }
.big-stars span { display: inline-block; width: 52px; height: 52px; filter: grayscale(1) brightness(0.35); opacity: 0.6; }
.big-stars span:nth-child(2) { width: 64px; height: 64px; margin-top: -8px; }
.big-stars span .ic { width: 100%; height: 100%; }
.big-stars span.on { filter: drop-shadow(0 0 12px rgba(255, 200, 80, 0.9)); opacity: 1; animation: starIn 0.6s cubic-bezier(.2, 1.8, .4, 1) both; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } }
.rewards { display: flex; gap: 10px; justify-content: center; margin: 10px 0 14px; }
.rewards div { flex: 1; background: rgba(0, 0, 0, 0.3); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; align-items: center; }
.rewards .ic { width: 34px; height: 34px; }
.rewards em { font-style: normal; color: var(--gold); }
.rewards b { font-size: 22px; color: var(--gold2); }
.rewards small { color: var(--muted); font-weight: 800; }
.levelup {
  margin: 0 0 14px; padding: 12px; border-radius: 14px; font-family: 'Cinzel'; font-weight: 900; font-size: 20px; color: #3a1d00;
  background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 30px rgba(255, 190, 80, 0.6); animation: cardIn 0.6s 0.4s both;
  display: flex; flex-direction: column;
}
.levelup small { font-family: 'Nunito'; font-size: 12px; font-weight: 800; }

/* Victory meters: XP and Loot fill in turn, flash when full, then roll over */
.meter { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 12px 8px 8px; border-radius: 14px; text-align: left;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.22)); box-shadow: inset 0 0 0 1px var(--line); }
.meter-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; }
.meter-ic img { max-width: 100%; max-height: 100%; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); }
.meter-body { flex: 1; min-width: 0; }
.meter-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.meter-label b { font-family: 'Cinzel'; font-size: 14px; color: var(--gold2); }
.meter-label small { font-size: 11px; font-weight: 800; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter-bar { position: relative; height: 14px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(180deg, #120a24, #241640); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 220, 150, 0.35); }
.meter-bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 10px; transition: width 0.7s cubic-bezier(.3, .8, .3, 1); }
.meter-bar .fill::after { content: ''; position: absolute; inset: 1px 2px 55%; border-radius: 8px; background: rgba(255, 255, 255, 0.35); }
.xp-meter .fill { background: linear-gradient(90deg, #6a3cff, #b47bff 70%, #f0d0ff); box-shadow: 0 0 12px #b886ff; }
.loot-meter .fill { background: linear-gradient(90deg, #b8650a, #f7b733 70%, #fff0a0); box-shadow: 0 0 12px #ffb340; }
.meter.full { animation: meterFull 0.45s; }
@keyframes meterFull { 50% { transform: scale(1.04); box-shadow: inset 0 0 0 2px var(--gold), 0 0 26px rgba(255, 210, 120, 0.9); } }
.meter-note { display: flex; align-items: center; justify-content: center; gap: 6px; font-family: 'Cinzel'; font-weight: 900; color: var(--gold); animation: cardIn 0.5s both; }
.meter-note .ic { width: 22px; height: 22px; }
#chest-wrap:not([hidden]) { animation: cardIn 0.5s both; }

/* painted interface icons */
.ic { display: inline-block; width: 1.25em; height: 1.25em; object-fit: contain; vertical-align: -0.28em; pointer-events: none; }
.btn .ic { width: 1.4em; height: 1.4em; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.medal.pulse { animation: bump 0.25s; }

.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; margin: 12px 0; }
.legend div { background: rgba(0, 0, 0, 0.3); padding: 8px 10px; border-radius: 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.legend.specials div { grid-template-columns: 1fr; }
.legend b { font-size: 13px; }
.legend small { grid-column: 2; font-size: 11px; color: var(--muted); font-weight: 700; }
.legend.specials small { grid-column: 1; }
.sw { grid-row: span 2; width: 22px; height: 22px; border-radius: 6px; background: radial-gradient(circle at 35% 30%, white, var(--c) 45%, black 130%); box-shadow: 0 0 10px var(--c); transform: rotate(45deg) scale(0.8); }

/* ---------- skill tree: branch tabs, painted backdrop, framed skill tiles ---------- */
.tree-tabs { display: flex; gap: 6px; padding: 8px 10px 0; }
.ttab { flex: 1; position: relative; border: 0; padding: 7px 4px 6px; border-radius: 14px 14px 6px 6px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-family: 'Cinzel'; font-weight: 900; font-size: 13px; color: color-mix(in srgb, var(--bc) 60%, #999);
  background: linear-gradient(180deg, rgba(30, 20, 56, 0.9), rgba(14, 8, 30, 0.9)); box-shadow: inset 0 0 0 1px rgba(255, 220, 150, 0.15); opacity: 0.75; }
.ttab .ic { width: 30px; height: 30px; filter: grayscale(0.6) brightness(0.8); }
.ttab small { font-family: 'Nunito'; font-size: 10px; color: var(--muted); }
.ttab.on { opacity: 1; color: var(--bc); background: linear-gradient(180deg, color-mix(in srgb, var(--bc) 28%, #1e1438), #120a26);
  box-shadow: inset 0 0 0 1px var(--bc), 0 0 16px color-mix(in srgb, var(--bc) 40%, transparent); }
.ttab.on .ic { filter: drop-shadow(0 0 6px var(--bc)); }
.ttab .dot { position: absolute; top: 4px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: #ff4d6d; box-shadow: 0 0 6px #ff4d6d; }
.tree-scroll { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.tree { position: relative; min-height: 100%; border-radius: 6px 6px 20px 20px; overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 4, 18, 0.35), rgba(8, 4, 18, 0.75)), var(--tart) center / cover no-repeat, #120a26;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bc) 50%, transparent), inset 0 0 60px rgba(0, 0, 0, 0.7); display: flex; flex-direction: column; }
.tree-blurb { margin: 0; padding: 10px 16px 0; text-align: center; font-size: 13px; font-weight: 800; color: #e8dcff; text-shadow: 0 1px 3px #000; }
.tree-path { position: relative; flex: 1; min-height: 440px; }
.links { position: absolute; inset: 0; width: 100%; height: 100%; }
.links line { stroke: rgba(255, 240, 210, 0.22); stroke-width: 3; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.links line.lit { stroke: var(--bc); stroke-dasharray: none; filter: drop-shadow(0 0 4px var(--bc)); }
.tnode { position: absolute; transform: translate(-50%, -50%); width: 74px; height: 74px; padding: 0; border: 0; border-radius: 16px; background: #0c0618;
  box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #8a6a3a, 0 0 0 5px #1a0c00, 0 8px 16px rgba(0, 0, 0, 0.6); transition: transform 0.15s, box-shadow 0.3s; }
.tnode img { width: 100%; height: 100%; border-radius: 14px; object-fit: cover; filter: grayscale(0.85) brightness(0.55); transition: filter 0.3s; }
.tnode.owned img, .tnode.can img { filter: none; }
.tnode.owned { box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #f2c35a, 0 0 0 5px #1a0c00, 0 0 18px color-mix(in srgb, var(--bc) 70%, transparent), 0 8px 16px rgba(0, 0, 0, 0.6); }
.tnode.maxed { box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #fff0b0, 0 0 0 5px #1a0c00, 0 0 26px var(--bc), 0 8px 16px rgba(0, 0, 0, 0.6); }
.tnode.capstone { width: 82px; height: 82px; border-radius: 50%; }
.tnode.capstone img { border-radius: 50%; }
.tnode.locked img { filter: grayscale(1) brightness(0.3); }
.tnode .lock { position: absolute; inset: 0; display: grid; place-items: center; }
.tnode .lock .ic { width: 30px; height: 30px; opacity: 0.85; }
.tnode.can { animation: canLearn 1.6s ease-in-out infinite; }
@keyframes canLearn { 50% { box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #fff0b0, 0 0 0 5px #1a0c00, 0 0 24px rgba(255, 220, 120, 0.9); } }
.tnode.sel { transform: translate(-50%, -50%) scale(1.1); z-index: 2; }
.tnode.sel::after { content: ''; position: absolute; inset: -9px; border-radius: inherit; border: 2px solid var(--gold); box-shadow: 0 0 14px var(--gold); }
.tnode.capstone.sel::after { border-radius: 50%; }
.tnode.learned { animation: learnPop 0.5s; }
@keyframes learnPop { 40% { transform: translate(-50%, -50%) scale(1.3); } }
.pips { display: inline-flex; gap: 3px; }
.pips b { width: 8px; height: 8px; transform: rotate(45deg); background: rgba(0, 0, 0, 0.7); box-shadow: 0 0 0 1px #8a6a3a; }
.pips b.on { background: linear-gradient(135deg, #fff6c8, #f2a93b); box-shadow: 0 0 0 1px #3a1d00, 0 0 6px #ffcf5a; }
.tnode .pips { position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); padding: 2px 5px; border-radius: 6px; background: rgba(10, 5, 20, 0.85); }
.tnode .tname { position: absolute; top: calc(100% + 9px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-family: 'Cinzel'; font-weight: 900; font-size: 11px; color: #fff4dc; text-shadow: 0 1px 2px #000, 0 0 6px #000; }
.tnode.locked .tname { color: #9a90b0; }
.tree-detail { padding: 12px 16px 16px; background: linear-gradient(180deg, rgba(26, 16, 48, 0.97), rgba(10, 6, 24, 0.98)); border-top: 1px solid transparent; border-image: linear-gradient(90deg, transparent, rgba(255, 210, 130, 0.7), transparent) 1; min-height: 140px; }
.td-empty { color: var(--muted); text-align: center; margin: 14px 0 10px; font-weight: 700; }
.tree-detail .btn.tiny { display: block; margin: 0 auto; }
.td-head { display: flex; gap: 12px; align-items: center; }
.td-head img { width: 54px; height: 54px; border-radius: 12px; box-shadow: 0 0 0 2px #1a0c00, 0 0 0 3px #f2c35a, 0 0 12px color-mix(in srgb, var(--bc) 60%, transparent); }
.td-head > div { display: flex; flex-direction: column; gap: 3px; }
.td-head h3 { font-size: 18px; color: var(--gold2); }
.td-head small { color: var(--muted); font-weight: 800; font-size: 11px; }
.tree-detail p { margin: 8px 0; font-weight: 700; font-size: 14px; }
.tree-detail .td-next { color: var(--muted); font-size: 13px; margin-top: -2px; }
.tree-detail .td-next b { color: var(--gold2); }
.tree-detail .warn { color: #ff9a8a; font-size: 13px; }
.tree-detail .warn .ic { width: 16px; height: 16px; }
.td-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.td-actions .btn.tiny { margin: 0 auto 0 0; }

/* skill effects in battle */
#battle.berserk::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 4; box-shadow: inset 0 0 70px rgba(255, 30, 40, 0.55); animation: rage 1.2s ease-in-out infinite; }
@keyframes rage { 50% { box-shadow: inset 0 0 110px rgba(255, 30, 40, 0.75); } }
.foe-status { position: absolute; left: 4px; right: 4px; bottom: 4px; display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; pointer-events: none; z-index: 3; }
.foe-status .st { font-size: 9px; font-weight: 900; padding: 1px 5px; border-radius: 6px; color: #fff; text-shadow: 0 1px 1px #000; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.st.burn { background: linear-gradient(180deg, #ff8a3a, #b02a00); }
.st.sunder { background: linear-gradient(180deg, #ff5a6a, #7a0018); }
.st.exec { background: linear-gradient(180deg, #ffd84a, #a35a00); color: #2a1400; text-shadow: none; }
#enemy-stage.burning { box-shadow: inset 0 0 0 2px #ff8a3a, inset 0 0 26px rgba(255, 110, 30, 0.6); }
.num.burn > span, .ftext.burn { color: #ffb070; }
.crit-label.burn { color: #ffb070; }
.crit-label.chill { color: #bfefff; }

/* ---------- camp ---------- */
.camp-scroll { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--panel); border-radius: 20px; padding: 14px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 215, 150, 0.25), 0 10px 30px rgba(0, 0, 0, 0.45); }
.panel h3 { color: var(--gold); font-size: 16px; margin-bottom: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.records { margin-top: 10px; font-size: 12px; color: var(--muted); font-weight: 800; text-align: center; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.shop-item:first-of-type { border-top: 0; }
.si-art {
  flex: 0 0 52px; height: 52px; border-radius: 12px; padding: 4px; display: grid; place-items: center; font-size: 26px;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rc, #c8902a) 28%, #1a1030), #0c0618 80%); box-shadow: inset 0 0 0 2px var(--rc, rgba(255, 215, 150, 0.4));
}
.si-art img { width: 100%; height: 100%; object-fit: contain; }
.si-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.si-text em { font-style: normal; font-size: 12px; color: var(--gold); margin-left: 4px; }
.si-text em.rar { margin: 0; font-size: 10px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--rc, var(--gold)); }
.si-text small { color: var(--muted); font-weight: 700; font-size: 12px; }
.qty { font-family: 'Cinzel'; font-weight: 900; font-size: 18px; color: var(--gold2); }
.sold { font-weight: 900; color: var(--muted); font-size: 13px; }

/* ---------- chests ---------- */
.chest-box { margin: 4px 0 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chest-name { font-family: 'Cinzel'; font-weight: 900; font-size: 18px; color: var(--gold2); text-shadow: 0 0 14px rgba(255, 200, 80, 0.6); }
.chest { border: 0; background: none; padding: 0; position: relative; display: flex; flex-direction: column; align-items: center; animation: chestShake 1.6s ease-in-out infinite; }
.chest img { width: 130px; height: 110px; object-fit: contain; filter: drop-shadow(0 0 18px rgba(255, 200, 80, 0.6)) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.6)); }
.chest.t-royal img { filter: drop-shadow(0 0 26px rgba(200, 100, 255, 0.9)) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.6)); }
.chest span { font-weight: 900; font-size: 12px; color: #fff; padding: 3px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.5); margin-top: -6px; }
@keyframes chestShake { 0%, 60%, 100% { transform: none; } 65% { transform: rotate(-4deg) scale(1.03); } 72% { transform: rotate(4deg) scale(1.05); } 79% { transform: rotate(-3deg); } 86% { transform: rotate(2deg); } }
.chest-box.open .chest { animation: chestPop 0.5s forwards; }
@keyframes chestPop { 40% { transform: scale(1.3); } 100% { transform: scale(0); height: 0; opacity: 0; } }
.loot { display: none; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chest-box.open .loot { display: flex; }
.loot-card {
  width: 96px; padding: 8px 6px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; text-align: center;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--rc) 30%, #1a1030), #0c0618 85%);
  box-shadow: inset 0 0 0 2px var(--rc), 0 0 18px color-mix(in srgb, var(--rc) 50%, transparent);
  animation: lootIn 0.6s cubic-bezier(.2, 1.6, .4, 1) both;
}
.loot-card img { width: 60px; height: 60px; object-fit: contain; }
.loot-card b { font-size: 11px; line-height: 1.2; margin-top: 4px; }
.loot-card small { font-size: 9px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--rc); }
.loot-card.gold { --rc: #ffd84a; }
.loot-card:not([class*="r-"]):not(.gold) { --rc: #c9c3d6; }
.loot-card.gold span { font-size: 34px; line-height: 60px; color: var(--gold); }
.loot-card.r-legendary { animation: lootIn 0.8s cubic-bezier(.2, 1.6, .4, 1) both, rarePulse 2s 1s ease-in-out infinite; }
@keyframes lootIn { from { transform: scale(0) rotate(-20deg); opacity: 0; } }

@media (max-width: 380px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .tnode { width: 46px; height: 46px; }
  .tnode.active-skill { width: 50px; height: 50px; }
}
@media (max-height: 700px) {
  .belt { min-height: 62px; padding: 6px; }
  .item-slot { flex-basis: 48px; height: 48px; }
}
.sheet:not(.open) .sheet-card { box-shadow: none; visibility: hidden; transition: transform 0.35s, visibility 0s 0.35s; }

/* ---------- painted icon sizing per context ---------- */
.gold-chip, .sp-chip { display: inline-flex; align-items: center; gap: 6px; }
.gold-chip .ic { width: 22px; height: 22px; }
.navbtn span .ic { width: 34px; height: 34px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.navbtn.muted span .ic { filter: grayscale(1) brightness(0.6); }
.navbtn.muted span::after { content: ''; position: absolute; width: 34px; height: 3px; border-radius: 2px; background: #ff4d6d; transform: rotate(-40deg); box-shadow: 0 0 0 1px #1a0e30; }
.navbtn span { position: relative; }
.spot i .ic { width: 38px; height: 38px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7)); }
.heart-medal .ic { width: 30px; height: 30px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.heart-medal { background: radial-gradient(circle at 40% 30%, #4a1a2a, #1a0610 75%); }
.medal i .ic { width: 24px; height: 24px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.intent .intent-ic .ic { width: 18px; height: 18px; vertical-align: -4px; }
.trait .ic { width: 14px; height: 14px; vertical-align: -3px; }
.pre-tag .ic, .zone-head .ic { width: 20px; height: 20px; }
.camp-node .ic { width: 30px; height: 30px; }
.node .ic.num { width: 70%; height: 70%; }
.node .stars { display: flex; gap: 0; letter-spacing: 0; }
.node .stars .ic { width: 15px; height: 15px; filter: grayscale(1) brightness(0.4); }
.node .stars .ic.on { filter: drop-shadow(0 0 3px rgba(255, 200, 80, 0.9)); }
.records .ic { width: 18px; height: 18px; }
.legend .ic { width: 18px; height: 18px; }
.btn.small .ic { width: 1.2em; height: 1.2em; }

/* Set Out: an engraved two-part plaque instead of a plain arrow button */
#camp-go { display: inline-flex; align-items: center; gap: 12px; padding: 14px 34px; letter-spacing: 1px; }
#camp-go small { font-family: 'Nunito'; font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: 2px; opacity: 0.75; }
#camp-go b { font-size: 26px; margin-left: -6px; }
#camp-go .go-sep { width: 10px; height: 10px; transform: rotate(45deg); background: linear-gradient(135deg, #fff6c8, #a35a00); box-shadow: 0 0 0 2px rgba(90, 40, 0, 0.6); }
[hidden] { display: none !important; }
.modal-btns .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }

/* ---------- weapon slot: painted weapon inside a charge ring ---------- */
.gear-row { display: flex; gap: 8px; align-items: center; }
.gear-row .belt-wrap { flex: 1; min-width: 0; }
.weapon-slot {
  --ch: 0; --rc: #c9c3d6;
  position: relative; flex: 0 0 auto; width: 70px; height: 70px; border: 0; padding: 0; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #3a2a6a, #0e0820 75%);
  box-shadow: 0 0 0 2px #1a0e30, 0 6px 14px rgba(0, 0, 0, 0.6);
}
.weapon-slot .ring {
  position: absolute; inset: -4px; border-radius: 50%;
  background: conic-gradient(from -90deg, #ffd84a calc(var(--ch) * 360deg), rgba(255, 255, 255, 0.08) 0);
  -webkit-mask: radial-gradient(circle, transparent 33px, #000 34px); mask: radial-gradient(circle, transparent 33px, #000 34px);
  box-shadow: 0 0 0 1px var(--rc);
}
.weapon-slot img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7)) saturate(0.8) brightness(0.85); transition: filter 0.3s, transform 0.3s; }
.weapon-slot .wready {
  position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); padding: 1px 7px; border-radius: 8px; white-space: nowrap;
  font-family: 'Cinzel'; font-size: 10px; font-weight: 900; color: #3a1d00; background: linear-gradient(180deg, #ffe58a, #f2a93b);
  box-shadow: 0 0 0 1px #3a1d00; opacity: 0; transition: opacity 0.3s;
}
.weapon-slot.ready img { filter: drop-shadow(0 0 10px #ffd84a) brightness(1.15); transform: scale(1.08) rotate(-6deg); }
.weapon-slot.ready .wready { opacity: 1; }
.weapon-slot.ready { animation: weaponReady 1.1s ease-in-out infinite; }
@keyframes weaponReady { 50% { box-shadow: 0 0 0 2px #1a0e30, 0 0 24px rgba(255, 210, 90, 0.9), 0 6px 14px rgba(0, 0, 0, 0.6); } }
.weapon-slot.r-uncommon { --rc: #5fe08a; } .weapon-slot.r-rare { --rc: #4aa8ff; }
.weapon-slot.r-epic { --rc: #c07bff; } .weapon-slot.r-legendary { --rc: #ffb340; }
@media (max-height: 700px) { .weapon-slot { width: 62px; height: 62px; } .weapon-slot .ring { -webkit-mask: radial-gradient(circle, transparent 29px, #000 30px); mask: radial-gradient(circle, transparent 29px, #000 30px); } }

/* ---------- weapon cards, forge and armory ---------- */
.wcard { --rc: #c9c3d6; display: flex; gap: 12px; padding: 12px; margin: 10px 0; border-radius: 16px; text-align: left;
  background: radial-gradient(ellipse at 0% 0%, color-mix(in srgb, var(--rc) 22%, transparent), transparent 65%), linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 55%, transparent), 0 6px 16px rgba(0, 0, 0, 0.35); }
.wcard.r-uncommon, .arm-row.r-uncommon, .loot-card.weapon.r-uncommon { --rc: #5fe08a; }
.wcard.r-rare, .arm-row.r-rare, .loot-card.weapon.r-rare { --rc: #4aa8ff; }
.wcard.r-epic, .arm-row.r-epic, .loot-card.weapon.r-epic { --rc: #c07bff; }
.wcard.r-legendary, .arm-row.r-legendary, .loot-card.weapon.r-legendary { --rc: #ffb340; }
.wcard.r-legendary { animation: rarePulse 2.4s ease-in-out infinite; }
.wc-art { flex: 0 0 84px; height: 84px; border-radius: 14px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rc) 35%, #1a0e30), #0c0618 75%); box-shadow: inset 0 0 0 2px var(--rc); }
.wc-art img { width: 90%; height: 90%; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.7)); }
.wc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wc-name { font-family: 'Cinzel'; font-size: 16px; color: var(--rc); line-height: 1.15; }
.wc-name .plus { color: var(--gold); }
.wc-body .rar { font-style: normal; font-size: 10px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.wc-power { font-weight: 900; font-size: 14px; color: var(--ink); }
.wc-power small { color: var(--muted); font-size: 11px; margin-left: 6px; }
.wc-ability { font-size: 12px; font-weight: 800; color: var(--gold2); }
.wc-ability small { display: block; color: var(--muted); font-weight: 700; }
.gemdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); margin: 0 3px 0 2px; vertical-align: -1px; }
.wc-unique { font-size: 12px; font-weight: 900; color: #ffcf70; padding: 4px 8px; border-radius: 8px; background: rgba(255, 170, 40, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 180, 60, 0.4); }
.wc-aff { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 800; color: #9fd0ff; }
.wc-aff::before { content: '◆'; color: var(--rc); font-size: 8px; margin-right: 6px; }
.wc-aff { justify-content: flex-start; }
.wc-aff .reroll { margin-left: auto; border: 0; width: 26px; height: 26px; border-radius: 50%; font-weight: 900; color: var(--gold2);
  background: rgba(255, 220, 140, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.4); }
.smith-purse { display: flex; gap: 14px; justify-content: center; font-weight: 900; color: var(--gold2); margin: 6px 0 2px; }
.smith-purse .ic { width: 20px; height: 20px; }
.forge-row { display: flex; justify-content: center; }
.forge-row .btn { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 26px; }
.forge-row .btn small { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.forge-row .btn small .ic { width: 16px; height: 16px; }
.small-note { font-size: 12px; text-align: center; margin: 6px 0; }
.armory-h { margin: 16px 0 4px; display: flex; justify-content: space-between; align-items: baseline; }
.armory-h small { font-family: 'Nunito'; font-size: 12px; color: var(--muted); }
.arm-row { --rc: #c9c3d6; display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.arm-row .si-art { box-shadow: inset 0 0 0 2px var(--rc); }
.arm-row .si-text b { color: var(--rc); font-size: 14px; }
.arm-row .up, .loot-card .up { color: #5fe08a; font-style: normal; font-weight: 900; }
.arm-row .down { color: #ff8a9a; font-weight: 900; }
.arm-btns { display: flex; flex-direction: column; gap: 5px; }
.arm-btns .btn { padding: 6px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 3px; justify-content: center; }
.merch-weapon { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 8px; }
.merch-weapon .wcard { width: 100%; margin-bottom: 4px; }
.loot-card.weapon .up { font-size: 10px; }
.wardbar { position: relative; height: 14px; margin-top: 3px; border-radius: 7px; overflow: hidden; background: rgba(0, 0, 0, 0.55); box-shadow: inset 0 0 0 1px rgba(160, 240, 255, 0.6), 0 0 10px rgba(120, 220, 255, 0.5); }
.wardbar .fill { position: absolute; inset: 0 auto 0 0; transition: width 0.3s; background: repeating-linear-gradient(135deg, #7fe6ff 0 6px, #4ab8ff 6px 12px); box-shadow: 0 0 10px #7fe6ff; }
.wardbar span { position: relative; display: block; text-align: center; font-size: 10px; font-weight: 900; line-height: 14px; color: #fff; text-shadow: 0 1px 2px #000; }
.pow-chip { float: right; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 900; color: #ffb0b8; }
.pow-chip .ic { width: 16px; height: 16px; }
.power-cmp { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 12px 0 4px; padding: 8px 10px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); --pc: #5fe08a; box-shadow: inset 0 0 0 1px var(--pc); }
.power-cmp.risky { --pc: #ffcf5a; } .power-cmp.danger { --pc: #ff5a6a; }
.power-cmp div { display: flex; flex-direction: column; align-items: center; }
.power-cmp small { font-size: 10px; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.power-cmp b { font-family: 'Cinzel'; font-size: 22px; color: var(--ink); }
.power-cmp .verdict { font-family: 'Cinzel'; font-weight: 900; font-size: 14px; color: var(--pc); padding: 3px 10px; border-radius: 10px; background: color-mix(in srgb, var(--pc) 15%, transparent); }
.boss-note { color: #ffcf9a; }
.tip { position: absolute; left: 50%; top: 10px; z-index: 6; width: min(92%, 420px); transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; font-size: 14px; font-weight: 800; color: #fff4dc;
  background: linear-gradient(180deg, rgba(40, 24, 70, 0.96), rgba(18, 10, 36, 0.96)); box-shadow: 0 0 0 1px #c8902a, 0 8px 24px rgba(0, 0, 0, 0.6); transition: opacity 0.3s, transform 0.3s; }
.tip.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.tip .ic { width: 30px; height: 30px; flex: none; }

/* ---------- Queen Bean, the final boss ---------- */
.node.final { width: 86px; height: 86px; box-shadow: 0 0 0 2px #1a0c00, 0 0 0 5px #ffd84a, 0 0 0 7px #7a3a00, 0 0 34px rgba(255, 200, 60, 0.9), 0 8px 14px rgba(0, 0, 0, 0.6); animation: finalGlow 2s ease-in-out infinite; }
.node.final.locked { filter: grayscale(0.4) brightness(0.8); }
.node.final .tag { background: linear-gradient(180deg, #ffd84a, #b8650a); color: #2a1400; box-shadow: 0 0 0 1px #3a1d00; white-space: nowrap; }
@keyframes finalGlow { 50% { box-shadow: 0 0 0 2px #1a0c00, 0 0 0 5px #fff0b0, 0 0 0 7px #7a3a00, 0 0 50px rgba(255, 210, 80, 1), 0 8px 14px rgba(0, 0, 0, 0.6); } }
.pre-splash { display: block; width: 100%; max-height: 260px; object-fit: cover; object-position: 50% 20%; border-radius: 16px; margin: 6px 0 8px;
  box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #ffd84a, 0 0 30px rgba(255, 200, 60, 0.6); }
.pre-tag.final { color: #ffd84a; font-family: 'Cinzel'; font-size: 16px; letter-spacing: 1px; }
.pre-quote { margin: 2px 0 8px; font-family: 'Cinzel'; font-weight: 900; color: #fff0b0; font-size: 14px; text-shadow: 0 0 10px rgba(255, 200, 60, 0.7); }
.boss-splash { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; background: #000; animation: splashIn 0.5s ease-out; }
.boss-splash img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; animation: splashZoom 3.8s ease-out both; }
.boss-splash::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10, 4, 0, 0.92) 0%, transparent 45%), radial-gradient(ellipse at 50% 40%, transparent 50%, rgba(0, 0, 0, 0.5)); }
.bs-text { position: relative; z-index: 1; padding: 0 20px calc(40px + env(safe-area-inset-bottom)); text-align: center; animation: cardIn 0.6s 0.5s both; }
.bs-text small { display: block; font-family: 'Cinzel'; font-weight: 900; letter-spacing: 4px; text-transform: uppercase; color: #ffcf3a; }
.bs-text h2 { font-size: 32px; color: #fff0b0; text-shadow: 0 0 24px rgba(255, 190, 60, 0.9), 0 3px 0 #5a2a00; line-height: 1.1; margin: 6px 0; }
.bs-text p { margin: 0; font-family: 'Cinzel'; font-weight: 900; font-size: 18px; color: #fff; text-shadow: 0 2px 6px #000; }
.boss-splash.out { opacity: 0; transition: opacity 0.45s; }
@keyframes splashIn { from { opacity: 0; } }
@keyframes splashZoom { from { transform: scale(1.25); } to { transform: scale(1.02); } }

/* ---------- victory flow: watch → open the chest → choose ---------- */
.modal-btns.locked { display: none; }
.modal-btns { animation: btnsIn 0.4s ease-out both; }
@keyframes btnsIn { from { opacity: 0; transform: translateY(12px); } }
.v-progress { overflow: hidden; max-height: 600px; transition: max-height 0.35s ease-in, opacity 0.3s; }
.v-progress.gone { max-height: 0; opacity: 0; }
.levelup { display: flex; flex-direction: row; align-items: center; gap: 10px; margin: 2px 0 6px; padding: 9px 14px; border-radius: 12px;
  font-family: 'Nunito'; font-size: 14px; font-weight: 800; color: #efe2ff; text-align: left;
  background: linear-gradient(90deg, rgba(140, 80, 255, 0.35), rgba(140, 80, 255, 0.08)); box-shadow: inset 0 0 0 1px rgba(200, 160, 255, 0.55), 0 0 18px rgba(150, 90, 255, 0.35); animation: cardIn 0.5s both; }
.levelup .ic { width: 28px; height: 28px; flex: none; }
.levelup b { font-family: 'Cinzel'; font-size: 16px; color: #fff; margin-right: 4px; }
#chest-wrap .chest img { width: 170px; height: 170px; }
#chest-wrap .chest::before { content: ''; position: absolute; left: 50%; top: 42%; width: 200px; height: 200px; transform: translate(-50%, -50%); border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255, 210, 110, 0.55), transparent 65%); animation: chestHalo 1.6s ease-in-out infinite; }
@keyframes chestHalo { 50% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.7; } }
#chest-wrap .chest span { font-family: 'Cinzel'; font-size: 15px; padding: 6px 16px; background: linear-gradient(180deg, #ffe58a, #f2a93b); color: #3a1d00; box-shadow: 0 3px 0 #8a4a0a; animation: tapPulse 1.2s ease-in-out infinite; }
@keyframes tapPulse { 50% { transform: scale(1.06); } }
#chest-wrap .chest-name { font-size: 22px; margin-top: 8px; }

/* modal buttons: a gold plaque for the main action, dark glass with a gold edge for the other */
.modal-btns .btn { min-height: 52px; font-size: 16px; font-family: 'Cinzel'; letter-spacing: 0.5px; }
.modal-btns .btn .ic { width: 22px; height: 22px; }
.modal-btns .btn.ghost { color: #f3e6c8; background: linear-gradient(180deg, rgba(48, 32, 84, 0.95), rgba(20, 12, 40, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 210, 130, 0.55), 0 3px 0 rgba(8, 4, 20, 0.9), 0 6px 14px rgba(0, 0, 0, 0.45); }
.modal-btns .btn.ghost:active { transform: translateY(2px); }

/* ---------- drawn control glyphs (no emoji, no font symbols) ---------- */
.icon-btn { display: inline-grid; place-items: center; color: #f2c35a; }
.icon-btn .glyph { width: 22px; height: 22px; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.6)); }
.icon-btn.flee .glyph { width: 16px; height: 16px; }
.wc-aff .reroll { display: inline-grid; place-items: center; color: #f2c35a; }
.wc-aff .reroll .glyph { width: 15px; height: 15px; }

/* ---------- lettered plaque buttons: an inner gold rule and engraved text instead of icons ---------- */
.btn.gold, .modal-btns .btn.ghost, .btn.glass { position: relative; }
.btn.gold::before, .modal-btns .btn.ghost::before, .btn.glass::before {
  content: ''; position: absolute; inset: 4px; border-radius: inherit; pointer-events: none;
  border: 1px solid rgba(255, 245, 210, 0.55); box-shadow: inset 0 0 0 1px rgba(120, 60, 0, 0.25);
}
.modal-btns .btn.ghost::before, .btn.glass::before { border-color: rgba(255, 210, 130, 0.28); box-shadow: none; }
.btn.gold { text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); }
.modal-btns .btn, .btn.glass { font-family: 'Cinzel'; letter-spacing: 1px; }
.modal-btns .btn.gold { color: #3a1d00; }

/* ---------- pre-battle: portrait banner, stats strip, gem matchup — fits one phone screen ---------- */
.modal { padding: 12px; }
.modal-card { max-height: min(88vh, calc(100dvh - 24px)); }
.modal-card:has(.pre2) { padding: 12px 12px 14px; }
.pre2 { text-align: left; }
.pre-hero { position: relative; height: min(30dvh, 230px); margin: 0 0 8px; border-radius: 16px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 70%, color-mix(in srgb, var(--ec) 45%, #120a26), #0a0618 75%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--za) 60%, transparent), 0 0 0 3px #0e0822, 0 0 0 4px color-mix(in srgb, var(--za) 35%, transparent); }
.pre2.boss .pre-hero { box-shadow: inset 0 0 0 1px #ffcf5a, 0 0 0 3px #0e0822, 0 0 0 4px rgba(255, 200, 90, 0.5), 0 0 24px rgba(255, 180, 60, 0.35); }
.ph-art { position: absolute; left: 50%; top: 0; height: 118%; transform: translateX(-50%); object-fit: contain; object-position: 50% 0; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6)); }
.ph-art.cover { left: 0; transform: none; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
canvas.ph-art { left: 0; transform: none; width: 100%; height: 100%; }
.pre-hero::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(0deg, rgba(8, 4, 18, 0.95) 0%, rgba(8, 4, 18, 0.5) 30%, transparent 55%), linear-gradient(180deg, rgba(8, 4, 18, 0.6), transparent 22%); }
.ph-top { position: absolute; left: 12px; top: 9px; z-index: 1; font-size: 11px; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; color: var(--za); text-shadow: 0 1px 3px #000; }
.ph-bot { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 1; }
.ph-bot h2 { margin: 0; font-size: clamp(19px, 5.6vw, 26px); line-height: 1.1; color: #fff0d0; text-shadow: 0 2px 4px #000, 0 0 18px rgba(0, 0, 0, 0.8); }
.pre2.boss .ph-bot h2 { color: #ffd88a; }
.ph-tag { display: inline-block; margin-bottom: 4px; padding: 2px 9px; border-radius: 6px; font-family: 'Cinzel'; font-weight: 900; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: #2a1400; background: linear-gradient(180deg, #ffe58a, #e09a2a); box-shadow: 0 0 0 1px #3a1d00; }
.pre2:not(.boss) .ph-tag { display: none; }
.pre-strip { display: grid; grid-template-columns: 1fr 1.5fr 1fr; margin-bottom: 10px; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px rgba(255, 215, 150, 0.2); }
.pre-strip div { display: flex; flex-direction: column; align-items: center; padding: 7px 4px; text-align: center; }
.pre-strip div + div { border-left: 1px solid rgba(255, 215, 150, 0.15); }
.pre-strip small { font-size: 10px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.pre-strip b { font-family: 'Cinzel'; font-size: 20px; color: var(--ink); line-height: 1.2; }
.pre-strip em { font-style: normal; font-size: 10px; font-weight: 800; color: #ff9aa8; }
.matchup { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.mu { display: flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 12px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.2)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.mu .gem-ic, .mu .ic { width: 30px; height: 30px; flex: none; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.mu span { display: flex; flex-direction: column; min-width: 0; }
.mu small { font-size: 10px; font-weight: 900; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); }
.mu b { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu.weak { box-shadow: inset 0 0 0 1px rgba(120, 255, 150, 0.5); background: linear-gradient(180deg, rgba(60, 200, 110, 0.18), rgba(0, 0, 0, 0.2)); }
.mu.weak b { color: #8dffb0; }
.mu.weak .gem-ic { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5)); animation: weakPulse 1.6s ease-in-out infinite; }
@keyframes weakPulse { 50% { transform: scale(1.12); } }
.mu.resist .gem-ic { width: 28px; height: 28px; filter: saturate(0.6) brightness(0.85); }
.mu.resist .gem-ic + .gem-ic { margin-left: -12px; }
.mu.resist b { color: #ffb0b8; }
.pre-note { margin: 0 0 8px; padding: 7px 10px; border-radius: 10px; font-size: 13px; font-weight: 800; color: #ffd9a8; background: rgba(255, 150, 60, 0.1); box-shadow: inset 3px 0 0 #ffb340; }
.pre2 .power-cmp { margin: 0; padding: 5px 10px; }
.pre2 .power-cmp b { font-size: 18px; }
.pre2 .power-cmp .verdict { font-size: 12px; }
.modal-card:has(.pre2) .modal-btns { margin-top: 12px; }
.trait { display: inline-flex; align-items: center; gap: 3px; }
.trait .gem-ic { width: 15px; height: 15px; object-fit: contain; }
.trait.resist { background: linear-gradient(180deg, rgba(70, 30, 40, 0.8), rgba(24, 8, 16, 0.85)); }
.trait.resist .gem-ic { filter: grayscale(0.4) brightness(0.8); }
.trait.resist .gem-ic + .gem-ic { margin-left: -6px; }
.matchup:has(.mu:nth-child(3)) { grid-template-columns: repeat(3, 1fr); }
.matchup:has(.mu:nth-child(3)) .mu { flex-direction: column; text-align: center; gap: 3px; padding: 6px 4px; }
.matchup:has(.mu:nth-child(3)) .mu span { align-items: center; }
.matchup:has(.mu:nth-child(3)) .mu b { font-size: 13px; }
.mu .gems { display: flex; flex: none; font-style: normal; }
.mu.resist .gems .gem-ic + .gem-ic { margin-left: -10px; }
.pre2.final .pre-hero { height: min(27dvh, 210px); }

/* ---------- armory: tap a weapon to inspect it; Equip and Salvage live far apart inside ---------- */
.arm-item { --rc: #c9c3d6; margin: 6px 0; border-radius: 14px; background: rgba(0, 0, 0, 0.25); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 35%, transparent); transition: box-shadow 0.2s; }
.arm-item.r-uncommon { --rc: #5fe08a; } .arm-item.r-rare { --rc: #4aa8ff; } .arm-item.r-epic { --rc: #c07bff; } .arm-item.r-legendary { --rc: #ffb340; }
.arm-item.open { box-shadow: inset 0 0 0 1px var(--rc), 0 0 18px color-mix(in srgb, var(--rc) 30%, transparent); background: rgba(0, 0, 0, 0.4); }
.arm-item .arm-row { width: 100%; border: 0; border-top: 0; background: none; padding: 9px 10px; text-align: left; color: inherit; display: flex; align-items: center; gap: 10px; }
.arm-row .si-art { flex-basis: 50px; height: 50px; }
.arm-row .delta { display: flex; flex-direction: column; align-items: center; min-width: 40px; font-family: 'Cinzel'; font-weight: 900; font-size: 16px; color: var(--muted); }
.arm-row .delta small { font-family: 'Nunito'; font-size: 9px; letter-spacing: 1px; text-transform: uppercase; }
.arm-row .delta.up { color: #5fe08a; } .arm-row .delta.down { color: #ff8a9a; }
.arm-row .chev { display: grid; color: #f2c35a; transition: transform 0.2s; }
.arm-row .chev .glyph { width: 20px; height: 20px; }
.arm-item.open .chev { transform: rotate(180deg); }
.arm-detail { padding: 0 10px 12px; animation: cardIn 0.3s both; }
.arm-detail .wcard { margin: 0 0 8px; }
.arm-compare { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.arm-compare .up { color: #5fe08a; } .arm-compare .down { color: #ff8a9a; }
.arm-actions { display: flex; justify-content: space-between; align-items: stretch; gap: 28px; }
.arm-actions .btn { min-height: 50px; font-family: 'Cinzel'; letter-spacing: 0.5px; }
.arm-actions .equip { flex: 1; font-size: 18px; }
.arm-actions .salvage { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 14px; font-size: 13px; color: #ffb0b8;
  background: linear-gradient(180deg, rgba(70, 20, 30, 0.85), rgba(30, 8, 14, 0.9)); box-shadow: inset 0 0 0 1px rgba(255, 120, 140, 0.45), 0 3px 0 rgba(8, 4, 20, 0.9); }
.arm-actions .salvage small { font-family: 'Nunito'; font-size: 11px; font-weight: 800; color: #d8a0aa; }
.trait.resist, .trait.icon { padding: 2px 4px; }
.trait.resist { position: relative; }
.trait.resist::after { content: ''; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; background: #ff5a6a; transform: rotate(-35deg); box-shadow: 0 0 2px #000; }
.trait .ic { width: 14px; height: 14px; }


/* ---------- performance: glow pulses fade a pre-drawn halo (opacity is composited, box-shadow repaints) ---------- */
@keyframes glowFade { 50% { opacity: 1; } }
.spot i { animation: none; position: relative; }
.spot i::after { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 4px #fff0b0, 0 0 30px rgba(255, 210, 120, 0.9); animation: glowFade 2.4s ease-in-out infinite; }
.item-slot.r-legendary, .item-slot.r-epic, .wcard.r-legendary { animation: none; }
.item-slot.r-legendary::before, .item-slot.r-epic::before, .wcard.r-legendary::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  box-shadow: inset 0 0 0 2px var(--rc), inset 0 0 20px var(--rc), 0 0 14px color-mix(in srgb, var(--rc) 70%, transparent); animation: glowFade 2.4s ease-in-out infinite; }
.wcard.r-legendary { position: relative; }
.weapon-slot.ready { animation: none; }
.weapon-slot.ready::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none; opacity: 0;
  box-shadow: 0 0 24px rgba(255, 210, 90, 0.95); animation: glowFade 1.1s ease-in-out infinite; }
.node.final { animation: none; }
.tnode.can { animation: none; }
.tnode.can::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; z-index: 1;
  box-shadow: 0 0 0 4px #fff0b0, 0 0 24px rgba(255, 220, 120, 0.9); animation: glowFade 1.6s ease-in-out infinite; }
/* the logo's light rays turn far too slowly to notice; hold them still and skip the blend mode */
.title-rays { animation: none; mix-blend-mode: normal; opacity: 0.22; transform: translate(-50%, -50%); }

/* ---------- Reduce Motion (iPhone setting): stop every looping animation ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-iteration-count: 1 !important; }
  .title-art { animation: none; }
}

/* ---------- sound settings ---------- */
.vol-row { display: grid; grid-template-columns: 70px 1fr 36px; align-items: center; gap: 10px; margin: 14px 0; text-align: left; }
.vol-row label { font-family: 'Cinzel'; font-weight: 900; color: var(--gold2); }
.vol-row b { text-align: right; color: var(--muted); font-size: 13px; }
.vol-row input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: 6px; background: linear-gradient(180deg, #120a24, #241640); box-shadow: inset 0 1px 3px #000, 0 0 0 1px rgba(255, 220, 150, 0.35); }
.vol-row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff4c0, #f2b84a 60%, #8a4a0a); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6); }
.vol-row input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff4c0, #f2b84a 60%, #8a4a0a); }
.mute-btn { width: 100%; margin-top: 4px; }

/* ---------- Legendary bosses (tier 2): crimson and violet, a step below the Queen's gold ---------- */
.node.tier-legend { width: 80px; height: 80px; box-shadow: 0 0 0 2px #14000a, 0 0 0 5px #c0103a, 0 0 0 7px #3a0014, 0 0 28px rgba(200, 30, 80, 0.8), 0 8px 14px rgba(0, 0, 0, 0.6); }
.node.tier-legend.locked { filter: grayscale(0.4) brightness(0.8); }
.node.tier-legend .tag { background: linear-gradient(180deg, #ff4a6a, #7a0020); color: #fff; box-shadow: 0 0 0 1px #ffb0c0; }
.pre2.tier-legend .pre-hero { box-shadow: inset 0 0 0 1px #ff4a6a, 0 0 0 3px #0e0822, 0 0 0 4px rgba(200, 30, 80, 0.6), 0 0 24px rgba(200, 30, 80, 0.4); }
.pre2.tier-legend .ph-tag { color: #fff; background: linear-gradient(180deg, #ff4a6a, #7a0020); box-shadow: 0 0 0 1px #ffb0c0; }
.pre2.tier-legend .ph-bot h2 { color: #ffb0c0; }
.pre2.tier-legend .pre-hero { height: min(27dvh, 210px); }
.boss-splash.tier-legend .bs-text small { color: #ff6a8a; }
.boss-splash.tier-legend .bs-text h2 { color: #ffd0d8; text-shadow: 0 0 24px rgba(220, 40, 90, 0.9), 0 3px 0 #3a0014; }
.bs-text em { display: block; font-style: normal; font-family: 'Cinzel'; font-weight: 900; font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: #e0c8ff; margin: -2px 0 6px; }
.matchup:has(.mu:nth-child(4)) { grid-template-columns: repeat(4, 1fr); gap: 4px; }
.matchup:has(.mu:nth-child(4)) .mu { padding: 5px 2px; }
.matchup:has(.mu:nth-child(4)) .mu small { font-size: 9px; letter-spacing: 0.3px; }
.matchup:has(.mu:nth-child(4)) .mu b { font-size: 11px; white-space: normal; line-height: 1.15; }
.pre-note b { color: #fff; }

/* ---------- merchant extras and ascension ---------- */
.merch-chest .si-art img { transform: scale(1.15); }
.restock-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.restock-row .btn { flex: none; display: inline-flex; align-items: center; gap: 5px; }
.restock-row .ic { width: 18px; height: 18px; }
.forge-row { flex-wrap: wrap; gap: 10px; }
.forge-row .btn.ascend { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 18px; }
.forge-row .btn.ascend small { font-family: 'Nunito'; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.forge-row .btn.ascend small .ic { width: 16px; height: 16px; }

/* ---------- Paths: choice tiers, sealed Paths ---------- */
.tree-path { min-height: 520px; }
.tnode { width: 68px; height: 68px; }
.tnode.capstone { width: 74px; height: 74px; border-radius: 16px; }
.tnode.capstone img { border-radius: 14px; }
.tnode.forsaken { opacity: 0.45; filter: grayscale(0.7); }
.tier-or { position: absolute; left: 50%; transform: translate(-50%, -50%); z-index: 1; padding: 2px 8px; border-radius: 8px; font-family: 'Cinzel'; font-weight: 900; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: #f3e6c8; background: rgba(10, 5, 20, 0.85); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.4); }
.tree-path.sealed .tnode { filter: grayscale(1) brightness(0.45); }
.sealed-note { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; width: 78%; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 14px; border-radius: 14px; background: rgba(10, 5, 20, 0.9); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.5); }
.sealed-note .ic { width: 30px; height: 30px; }
.sealed-note b { font-family: 'Cinzel'; color: var(--gold2); }
.sealed-note span { font-size: 13px; font-weight: 700; color: var(--muted); }
.ttab.sealed { opacity: 0.5; }
.ttab small { white-space: nowrap; }
.plaque.gold small { position: absolute; top: 100%; left: 0; right: 0; margin-top: 3px; text-align: center; color: #d9c8f5; }
.title-menu:has(#play-sub:not(:empty)) .title-row { margin-top: 18px; }
