: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: 'Spectral', Georgia, 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: 'Spectral'; 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-blue.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 top / 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: 'Spectral'; 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-living.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;
  --m1: #fff0b8; --m2: #c8902a; --m3: #5a3006; --m4: #e8b84a; --m5: #6a3c08; --halo: rgba(255, 190, 90, 0.22);
  --j1: #ff8aa0; --j2: #e0203f; --j3: #5a0010; --jg: rgba(255, 60, 90, 0.6);
  background: linear-gradient(145deg, var(--m1), var(--m2) 20%, var(--m3) 46%, var(--m4) 68%, var(--m1) 80%, var(--m5));
  box-shadow: 0 0 0 1px #1a0c00, 0 0 0 4px rgba(10, 5, 20, 0.6), 0 0 40px var(--halo), 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, var(--j1) 2.5px, var(--j2) 5px, var(--j3) 8px, var(--m4) 9px, var(--m5) 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 var(--jg));
}
/* each zone's board frame: woods bronze and emerald, caverns silver and sapphire, peaks blackened copper and
   ember, citadel pewter and amethyst; the Rift keeps the gold and ruby */
#battle[data-zone="0"] #board-wrap { --m1: #f4e2b0; --m2: #b98a48; --m3: #7a5a2a; --m4: #d4a860; --m5: #8a6430; --halo: rgba(120, 255, 160, 0.18);
  --j1: #9dffc4; --j2: #19b866; --j3: #04402a; --jg: rgba(60, 255, 150, 0.55); }
#battle[data-zone="1"] #board-wrap { --m1: #ffffff; --m2: #a8bcd4; --m3: #5a7090; --m4: #d4e2f2; --m5: #6a7f9c; --halo: rgba(120, 200, 255, 0.24);
  --j1: #b5dcff; --j2: #2f8bff; --j3: #0a2a75; --jg: rgba(80, 170, 255, 0.6); }
#battle[data-zone="2"] #board-wrap { --m1: #ffc89a; --m2: #b05a2a; --m3: #6a2a12; --m4: #d87a40; --m5: #7a3418; --halo: rgba(255, 120, 40, 0.26);
  --j1: #ffd08a; --j2: #ff6a1a; --j3: #6a1a00; --jg: rgba(255, 110, 30, 0.65); }
#battle[data-zone="3"] #board-wrap { --m1: #f2eeff; --m2: #a69ec0; --m3: #5c5474; --m4: #cfc6e4; --m5: #6a6284; --halo: rgba(170, 110, 255, 0.22);
  --j1: #e2c4ff; --j2: #a24bff; --j3: #330a75; --jg: rgba(170, 90, 255, 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: 'Spectral'; 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: 'Spectral'; 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: 'Spectral'; 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: 'Spectral'; 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: 'Spectral'; 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: 'Spectral'; 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: 'Spectral'; 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; }
/* the slider itself is a tall, easy touch target; the thin track is drawn inside it */
.vol-row input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; margin: 0; background: none; cursor: pointer; }
.vol-row input[type=range]::-webkit-slider-runnable-track { 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]::-moz-range-track { height: 10px; border-radius: 6px; background: linear-gradient(180deg, #120a24, #241640); }
.vol-row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -8px; 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; }
.set-head { margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid rgba(255, 220, 150, 0.25); font: 900 17px 'Cinzel', serif; color: var(--gold2); text-align: center; }
.calm-note { margin: 6px 0 8px; font-size: 14px; line-height: 1.35; }

/* ---------- 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: 'Spectral'; 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; }
.title-art .orbit, .title-art-sharp .orbit { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* =====================================================================================
   Premium UI kit (matches the home screen): painted frames stretch around any size via
   9-slice border images; buttons are painted plaques; headings get an ornate divider.
   ===================================================================================== */
:root {
  --kit-frame: url(../assets/ui/frame-panel.png);
  --kit-inset: url(../assets/ui/frame-inset.png);
  --kit-gold: url(../assets/ui/plaque-gold.png);
  --kit-dark: url(../assets/ui/plaque-blue.png);
  --kit-bar: url(../assets/ui/bar-frame.png);
}

/* pop-ups and camp sheets */
.modal-card {
  background: none; box-shadow: none; border: 22px solid transparent; padding: 12px 10px 10px;
  border-image: var(--kit-frame) 130 fill / 46px stretch;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.7));
}
.modal-card:has(.pre2) { padding: 6px 4px 6px; }
.sheet-card {
  background: none; box-shadow: none; border: 22px solid transparent; border-bottom-width: 0; padding: 10px 8px calc(16px + env(safe-area-inset-bottom));
  border-image: var(--kit-frame) 130 130 0 fill / 46px 46px 0 stretch; border-radius: 0;
}
.sheet-x { top: 4px; right: 4px; }

/* headings: engraved gold with an ornate divider beneath */
.modal-card h2, .sheet-card h2, .result h2 {
  background: linear-gradient(180deg, #fffbe6 10%, #ffd977 50%, #d98e2b 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(40, 10, 60, 0.95)) drop-shadow(0 0 14px rgba(255, 190, 90, 0.35));
}
.modal-card > h2::after, .sheet-card h2::after, .result h2::after {
  content: ''; display: block; height: 20px; margin: 6px auto 4px; width: min(86%, 300px); background: url(../assets/ui/divider.png) center / contain no-repeat;
}
.result.win h2 { font-size: 40px; letter-spacing: 1px; }
.result.lose h2 { background: linear-gradient(180deg, #ffe4e4 10%, #ff8a9a 55%, #b0263c 95%); -webkit-background-clip: text; background-clip: text; }

/* inset panels: stats, rewards, meters, power, matchups */
.rewards > div, .meter, .pre-strip, .power-cmp, .mu, .stat-grid > div, .smith-purse, .records {
  background: none !important; box-shadow: none !important; border: 10px solid transparent; border-radius: 0;
  border-image: var(--kit-inset) 70 fill / 20px stretch;
}
.rewards > div { padding: 2px 4px; }
.meter { padding: 0 4px 0 0; }
.pre-strip { padding: 0; }
.pre-strip div + div { border-left: 1px solid rgba(255, 210, 130, 0.25); }
.power-cmp { padding: 0 4px; }
.power-cmp.risky .verdict { color: #ffd36a; } .power-cmp.danger .verdict { color: #ff7a8a; }
.mu { padding: 2px 4px; }
.mu.weak { border-image: var(--kit-inset) 70 fill / 20px stretch; filter: drop-shadow(0 0 6px rgba(90, 255, 140, 0.35)); }

/* buttons: the gold plaque for the main action, obsidian for the rest */
.btn.gold, .modal-btns .btn.gold, .btn.ghost, .modal-btns .btn.ghost, .btn.glass {
  background: none !important; box-shadow: none !important; border-radius: 0; border: 0 solid transparent; border-width: 0 34px;
  border-image: var(--kit-gold) 0 200 fill / 0 34px stretch; padding: 12px 6px; min-height: 48px;
  font-family: 'Cinzel', serif; font-weight: 900; letter-spacing: 1px; color: #fff1cf; text-shadow: 0 2px 0 rgba(30, 8, 50, 0.95), 0 0 10px rgba(0, 0, 0, 0.5);
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.55));
}
.btn.ghost, .modal-btns .btn.ghost, .btn.glass { border-image: var(--kit-dark) 0 160 fill / 0 30px stretch; border-width: 0 30px; color: #ecdcb8; }
.btn.gold::before, .btn.gold::after, .btn.ghost::before, .btn.glass::before { display: none !important; }
.btn.gold:active, .btn.ghost:active, .btn.glass:active { transform: scale(0.96); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55)) brightness(1.15); }
.btn[disabled] { filter: grayscale(0.8) brightness(0.6); opacity: 1; }
.btn.small { min-height: 38px; padding: 6px 2px; border-width: 0 24px; border-image-width: 0 24px; font-size: 13px; }
.btn.tiny { min-height: 34px; padding: 4px 2px; border-width: 0 20px; border-image-width: 0 20px; font-size: 12px; opacity: 1; }
.btn.big { padding: 14px 10px; border-width: 0 44px; border-image-width: 0 44px; }
.modal-btns { gap: 8px; }
.modal-btns .btn { min-height: 54px; font-size: 16px; }

/* health and progress bars sit in the painted gauge frame */
.bar.hpbar, .meter-bar, .xpbar, .wardbar {
  border: 0 solid transparent; border-width: 3px 16px; border-image: var(--kit-bar) 30 70 fill / 8px 20px stretch; box-shadow: none !important; background-clip: padding-box;
}

/* chips and top bars */
.gold-chip, .sp-chip { background: none; box-shadow: none; border: 8px solid transparent; border-image: var(--kit-inset) 70 fill / 18px stretch; border-radius: 0; padding: 2px 8px; }
.icon-btn { background: none; box-shadow: none; border: 8px solid transparent; border-image: var(--kit-inset) 70 fill / 18px stretch; border-radius: 0; }
.pre-hero { border-radius: 0; box-shadow: none !important; }
.pre-hero > .ph-frame { position: absolute; inset: 0; z-index: 2; pointer-events: none; border: 12px solid transparent; border-image: var(--kit-inset) 70 / 22px stretch; }

/* map, top bars and navigation in the kit style */
.zone { border-radius: 0; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6); border: 14px solid transparent; border-image: var(--kit-frame) 130 / 34px stretch; }
.topbar { border-bottom: 0; background: linear-gradient(180deg, rgba(14, 8, 30, 0.97), rgba(22, 12, 46, 0.9)); }
.topbar::after, .bottomnav::before { content: ''; position: absolute; left: 0; right: 0; height: 18px; pointer-events: none;
  background: url(../assets/ui/divider.png) center / auto 100% no-repeat, linear-gradient(90deg, transparent, rgba(232, 184, 74, 0.9) 15%, rgba(232, 184, 74, 0.9) 85%, transparent) center / 100% 2px no-repeat; }
.topbar::after { bottom: -9px; }
.camp-top::after { display: none; }
.bottomnav { position: relative; border-top: 0; border-image: none; background: linear-gradient(0deg, rgba(10, 6, 24, 0.98), rgba(22, 12, 46, 0.94)); }
.bottomnav::before { top: -9px; }
.navbtn span { box-shadow: 0 0 0 2px #1a0e30, 0 0 0 4px #d9a441, 0 0 0 5px #3a1d00, 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 2px 6px rgba(255, 255, 255, 0.12); }
.navbtn { font-family: 'Cinzel'; font-weight: 900; letter-spacing: 0.5px; color: #f1e2bf; }
.hero-chip .lvl { box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #f2c35a, 0 0 0 5px #3a1d00, 0 0 14px rgba(255, 200, 90, 0.5); }
.sheet-card { border-width: 22px; border-image: var(--kit-frame) 130 fill / 46px stretch; padding-bottom: 14px; margin-bottom: env(safe-area-inset-bottom); }
.icon-btn { border: 0; border-image: none; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #3a2a6a, #120a28 75%);
  box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #e0b04a, 0 0 0 5px #3a1d00, 0 4px 10px rgba(0, 0, 0, 0.6); }
.sheet-x { top: 12px; right: 14px; width: 34px; height: 34px; }

/* skill tree in the kit style */
.ttab { background: none; box-shadow: none !important; border: 9px solid transparent; border-radius: 0; border-image: var(--kit-inset) 70 fill / 20px stretch; opacity: 0.7; }
.ttab.on { opacity: 1; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--bc) 70%, transparent)); }
.tree { border-radius: 0; border: 14px solid transparent; border-image: var(--kit-frame) 130 / 34px stretch; box-shadow: none; }
.tree-detail { border: 18px solid transparent; border-bottom-width: 0; border-image: var(--kit-frame) 130 130 0 fill / 40px 40px 0 stretch; background: none; padding: 6px 10px 14px; }
.tier-or { box-shadow: none; border: 6px solid transparent; border-image: var(--kit-inset) 70 fill / 12px stretch; border-radius: 0; background: none; }

/* battle HUD: health bars keep their own look; the cards around them get the kit frames */
.bar.hpbar, .wardbar { border: 0; border-image: none; }
.foe-card, .moves { border: 10px solid transparent !important; border-image: var(--kit-inset) 70 / 22px stretch !important; }
.belt { border: 12px solid transparent; border-image: var(--kit-frame) 130 fill / 30px stretch; box-shadow: none !important; background: none !important; border-radius: 0; }

/* =====================================================================================
   Slim premium style (v2), modelled on the home screen: hairline gold frames with gem
   studs at the corners, borderless boxes where a frame adds nothing, one button size.
   Overrides the heavier kit rules above.
   ===================================================================================== */
:root {
  --stud: url(../assets/ui/stud.png);
  --gold-line: linear-gradient(135deg, #f7da86, #a8741f 35%, #f7da86 55%, #8a5a17 85%, #e8c065);
  --panel-bg: radial-gradient(ellipse at 50% 0%, rgba(150, 100, 255, 0.16), transparent 60%), linear-gradient(170deg, #22144a, #150c2e 60%, #0d0720);
  --studs: var(--stud) left 3px top 3px / 13px auto no-repeat, var(--stud) right 3px top 3px / 13px auto no-repeat,
           var(--stud) left 3px bottom 3px / 13px auto no-repeat, var(--stud) right 3px bottom 3px / 13px auto no-repeat;
}

/* framed surfaces: pop-ups, sheets, the skill tree's panels */
.modal-card, .sheet-card, .tree-detail {
  border: 1.5px solid transparent !important; border-image: var(--gold-line) 1 !important; border-radius: 0;
  background: var(--studs), var(--panel-bg) !important;
  box-shadow: inset 0 0 0 5px rgba(13, 7, 32, 0.9), inset 0 0 0 6px rgba(247, 218, 134, 0.22), 0 22px 50px rgba(0, 0, 0, 0.7);
  filter: none;
}
.modal-card { padding: 22px 18px 18px; }
.modal-card:has(.pre2) { padding: 14px 12px 14px; }
.sheet-card { padding: 20px 14px calc(16px + env(safe-area-inset-bottom)); border-bottom: 0 !important; }
.tree-detail { padding: 14px 16px 16px; border-bottom: 0 !important; }
.modal-card > h2::after, .sheet-card h2::after, .result h2::after { height: 14px; width: min(70%, 230px); margin: 4px auto 6px; }

/* map zones and the skill tree board: a hairline frame with corner studs over the painting */
.zone, .tree { border: 1.5px solid transparent !important; border-image: var(--gold-line) 1 !important; border-radius: 0; }
.zone::after, .tree::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 4; background: var(--studs); }
.tree { position: relative; }

/* boxes inside panels: no frame, just a soft inset */
.rewards > div, .meter, .pre-strip, .power-cmp, .mu, .stat-grid > div, .smith-purse, .records, .ttab, .tier-or, .gold-chip, .sp-chip {
  border: 0 !important; border-image: none !important; border-radius: 10px;
  background: rgba(8, 4, 20, 0.45) !important; box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.16) !important;
}
.rewards > div { padding: 10px 6px; }
.meter { padding: 8px 12px 8px 8px; }
.pre-strip div + div { border-left: 1px solid rgba(247, 218, 134, 0.14); }
.power-cmp { padding: 6px 10px; }
.mu { padding: 6px 9px; }
.mu.weak { box-shadow: inset 0 0 0 1px rgba(120, 255, 150, 0.4) !important; filter: none; }
.ttab { padding: 6px 4px; }
.ttab.on { box-shadow: inset 0 0 0 1px var(--bc), 0 0 14px color-mix(in srgb, var(--bc) 40%, transparent) !important; }
.tier-or { padding: 2px 8px; }
.gold-chip, .sp-chip { padding: 6px 10px; }
.meter-bar, .xpbar { border: 0; border-image: none; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(247, 218, 134, 0.3) !important; }

/* buttons: one family, consistent heights, labels always fit */
.btn.gold, .modal-btns .btn.gold, .btn.ghost, .modal-btns .btn.ghost, .btn.glass {
  height: 46px; min-height: 0 !important; padding: 0 2px !important; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  border: 0 solid transparent !important; border-width: 0 24px !important;
  border-image: url(../assets/ui/plaque-primary.png) 0 100 fill / 0 24px stretch !important;
  font-family: 'Cinzel', serif; font-size: 14px !important; font-weight: 900; letter-spacing: 0.5px; white-space: nowrap; line-height: 1.15;
  color: #fff1cf; text-shadow: 0 1px 0 rgba(20, 6, 40, 0.95), 0 0 8px rgba(0, 0, 0, 0.6); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}
.btn.ghost, .modal-btns .btn.ghost, .btn.glass { border-image: url(../assets/ui/plaque-blue.png) 0 110 fill / 0 24px stretch !important; color: #ecdcb8; }
.btn.small { height: 36px; font-size: 12px !important; border-width: 0 18px !important; border-image-width: 0 18px !important; }
.btn.tiny { height: 32px; font-size: 11px !important; border-width: 0 16px !important; border-image-width: 0 16px !important; }
.btn.big { height: 54px; font-size: 18px !important; border-width: 0 30px !important; border-image-width: 0 30px !important; }
.btn small { font-family: 'Spectral'; font-size: 11px; font-weight: 800; letter-spacing: 0; }
.btn:has(small) { height: 52px; }
.modal-btns { gap: 10px; margin-top: 16px; }
.modal-btns .btn { flex: 1 1 0; min-width: 0; }
.forge-row .btn, .forge-row .btn.ascend { padding: 0 6px !important; }
.arm-actions .salvage { border-image: url(../assets/ui/plaque-blue.png) 0 110 fill / 0 18px stretch !important; border-width: 0 18px !important; height: 46px; padding: 0 2px; }

/* home screen plaques: correct proportions (gold art is 896×300, dark 823×219) */
.plaque.gold { aspect-ratio: 896 / 300; }
.plaque.dark { aspect-ratio: 823 / 219; }

/* pre-battle portrait: a hairline frame, no heavy border */
.pre-hero > .ph-frame { display: none; }
.pre-hero { border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.6) !important; }

/* ---------- battle header: big portrait, slim info, medallion move counter ---------- */
.b-top { gap: 10px; padding: 8px 8px 2px; align-items: stretch; }
.foe-card { width: clamp(108px, 32vw, 150px); aspect-ratio: 4 / 5; border-radius: 12px; border: 0 !important; border-image: none !important;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.55), inset 0 0 30px rgba(0, 0, 0, 0.6), 0 8px 18px rgba(0, 0, 0, 0.5) !important;
  background: var(--stud) left 3px top 3px / 12px auto no-repeat, var(--stud) right 3px top 3px / 12px auto no-repeat,
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--za, #b06bff) 40%, #1a1036), #0c0720 75%); }
.foe-info { justify-content: flex-end; gap: 5px; padding-bottom: 2px; }
.foe-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.foe-top .stage-label { flex: 1; }
.pause-btn { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; display: grid; place-items: center; color: #f2c35a; padding: 0;
  background: rgba(10, 5, 22, 0.7); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.5); }
.pause-btn .glyph { width: 16px; height: 16px; }
.enemy-name { font-size: clamp(16px, 4.8vw, 21px); -webkit-line-clamp: 2; }
.foe-row { gap: 8px; align-items: center; margin-top: 2px; }

/* intent: crossed swords, damage, and diamonds counting down the moves */
.intent { padding: 0; background: none !important; box-shadow: none !important; gap: 4px; flex: 0 0 auto; }
.intent .intent-ic .ic { width: 20px; height: 20px; vertical-align: -4px; }
.intent > b { font-family: 'Cinzel'; font-size: 17px; color: #ff9aa8; text-shadow: 0 1px 2px #000; }
.intent.hazard > b { color: #bfeaff; } .intent.hazard.poison > b { color: #b8ff9a; }
.intent .cd { display: inline-flex; gap: 2px; margin-left: 2px; }
.intent .cd i { width: 7px; height: 7px; transform: rotate(45deg); background: rgba(255, 255, 255, 0.12); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); }
.intent .cd i.on { background: linear-gradient(135deg, #ffd0d8, #ff4d6d); box-shadow: 0 0 5px #ff4d6d; }
.intent.hazard .cd i.on { background: linear-gradient(135deg, #e0f6ff, #4aa8ff); box-shadow: 0 0 5px #4aa8ff; }
.intent.imminent { animation: none; }
.intent.imminent > b, .intent.imminent .cd i.on { animation: pulseRed 0.8s infinite; }
@keyframes pulseRed { 50% { filter: brightness(1.6) drop-shadow(0 0 6px #ff4d6d); } }

/* traits: gem and icon badges, no pills */
.enemy-traits { flex: 1; gap: 6px; align-items: center; }
.trait { background: none !important; box-shadow: none !important; padding: 0; font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; color: #9fffb8; gap: 3px; }
.trait .gem-ic { width: 20px; height: 20px; }
.trait.weak .gem-ic { filter: drop-shadow(0 0 5px rgba(120, 255, 150, 0.9)); }
.trait.resist .gem-ic { width: 18px; height: 18px; }
.trait .ic { width: 18px; height: 18px; }

/* moves: a gold-ringed medallion */
.moves { flex: 0 0 auto; width: 58px; height: 58px; border-radius: 50% !important; border: 0 !important; border-image: none !important; margin-left: auto;
  background: radial-gradient(circle at 50% 35%, #3a2a7a, #120a2c 75%) !important;
  box-shadow: 0 0 0 2px #1a0c00, 0 0 0 3.5px #e9bd5a, 0 0 0 5px #3a1d00, 0 6px 14px rgba(0, 0, 0, 0.6) !important; }
.moves b { font-size: 26px; }
.moves small { font-size: 8px; letter-spacing: 1px; margin-top: -2px; }
.moves.low { animation: none; box-shadow: 0 0 0 2px #1a0c00, 0 0 0 3.5px #ff4d6d, 0 0 0 5px #3a0010, 0 0 16px rgba(255, 60, 90, 0.7) !important; }

/* item belt: slim tray */
.belt { border: 0 !important; border-image: none !important; border-radius: 14px; background: rgba(8, 4, 20, 0.55) !important;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.3), inset 0 2px 10px rgba(0, 0, 0, 0.6) !important; }
#chest-wrap .chest span { animation: tapPulse 1.2s ease-in-out infinite; background: none; box-shadow: none; color: #fff1cf; font-size: 13px; padding: 0 2px; height: 36px; display: inline-flex; align-items: center;
  border: 0 solid transparent; border-width: 0 18px; border-image: url(../assets/ui/plaque-primary.png) 0 100 fill / 0 18px stretch; text-shadow: 0 1px 0 rgba(20, 6, 40, 0.95); }
.forge-row .btn { height: 58px !important; min-width: 220px; font-size: 13px !important; }
.forge-row .btn small { font-size: 12px; }

/* ---------- victory header: winged crest, title on the ribbon, turning light behind ---------- */
.result.win { position: relative; }
.v-crest { position: relative; margin: -6px auto 0; width: min(100%, 340px); }
.v-crest img { position: relative; z-index: 1; width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6)); animation: crestIn 0.7s cubic-bezier(.2, 1.4, .4, 1) both; }
.v-crest h2 { position: absolute; z-index: 2; left: 0; right: 0; top: 61%; transform: translateY(-50%); margin: 0; font-size: clamp(20px, 6.4vw, 27px) !important; letter-spacing: 2px;
  animation: cardIn 0.5s 0.35s both; }
.v-crest h2::after { display: none !important; }
.v-rays { position: absolute; z-index: 0; left: 50%; top: 58%; width: 150%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; opacity: 0.55;
  background: repeating-conic-gradient(from 0deg, rgba(255, 216, 120, 0.35) 0 5deg, transparent 5deg 16deg);
  -webkit-mask: radial-gradient(circle, #000 10%, transparent 62%); mask: radial-gradient(circle, #000 10%, transparent 62%); animation: vRays 14s linear infinite; }
@keyframes vRays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.v-sub { margin: 2px 0 0; font-family: 'Cinzel'; font-weight: 900; font-size: 15px; color: #ffd88a; text-shadow: 0 0 12px rgba(255, 190, 90, 0.6); }
.result.win .big-stars { margin-top: 4px; position: relative; z-index: 1; }
.result.win .big-stars span.on { filter: drop-shadow(0 0 14px rgba(255, 200, 80, 1)); }

/* small speaker toggle on every screen */
.snd-btn { flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; color: #f2c35a; cursor: pointer;
  background: rgba(10, 5, 22, 0.72); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.5), 0 2px 6px rgba(0, 0, 0, 0.5); }
.snd-btn svg { width: 18px; height: 18px; }
.snd-btn.off { color: #9a8fb3; }
.title-snd { position: absolute; z-index: 3; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 38px; height: 38px; }
.foe-top .snd-btn { width: 30px; height: 30px; }
.modal-btns:has(.btn:nth-child(3)) .btn { font-size: 12px !important; border-width: 0 18px !important; border-image-width: 0 18px !important; }

/* ---------- result screens: cover the battle completely, open reward layout ---------- */
.modal:has(.result) { background: radial-gradient(ellipse at 50% 32%, rgba(90, 50, 170, 0.5), transparent 65%), rgba(4, 2, 12, 0.97); }
.modal-card:has(.result) { width: min(100%, 420px); }
.result .rewards { gap: 0; margin: 4px 0 2px; align-items: center; }
.result .rewards > div { flex: 1; flex-direction: row; gap: 7px; padding: 4px 6px !important; background: none !important; box-shadow: none !important; }
.result .rewards > div + div { border-left: 1px solid transparent !important; border-image: linear-gradient(transparent, rgba(247, 218, 134, 0.55), transparent) 1 !important; }
.result .rewards .ic { width: 30px; height: 30px; }
.result .rewards b { font-family: 'Cinzel'; font-size: 26px; line-height: 1; }
.result .rewards small { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: #cdb88a; }
.v-bonus { margin: 2px 0 0; font-size: 12px; font-weight: 800; color: var(--gold); }
.result #xp-meter { margin-top: 12px; padding-top: 14px !important; position: relative; }
.result #xp-meter::before { content: ''; position: absolute; top: 0; left: 8%; right: 8%; height: 1px; background: linear-gradient(90deg, transparent, rgba(247, 218, 134, 0.6), transparent); }
.result .meter { background: none !important; box-shadow: none !important; padding: 2px 46px 2px 0 !important; margin-bottom: 10px; }
.result .meter-ic { width: 36px; height: 36px; }

/* save transfer */
.title-link { margin-top: 14px; padding: 6px 12px; border: 0; background: none; font-family: 'Cinzel'; font-weight: 700; font-size: 13px; letter-spacing: 0.5px;
  color: #e8d3a0; text-shadow: 0 1px 3px #000, 0 0 10px rgba(0, 0, 0, 0.8); text-decoration: underline; text-decoration-color: rgba(247, 218, 134, 0.45); text-underline-offset: 4px; cursor: pointer; }
.xfer-code { margin: 14px auto 4px; padding: 12px 10px; font-family: 'Cinzel'; font-weight: 900; font-size: 26px; letter-spacing: 3px; color: #ffe7a8; user-select: all; -webkit-user-select: all;
  border-radius: 10px; background: rgba(8, 4, 20, 0.5); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.3); }
.xfer-in { width: 100%; margin: 12px 0 2px; padding: 12px; border: 0; border-radius: 10px; text-align: center; font-family: 'Cinzel'; font-weight: 900; font-size: 22px; letter-spacing: 2px; text-transform: uppercase;
  color: #ffe7a8; background: rgba(8, 4, 20, 0.6); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.45); outline: none; }
.xfer-in:focus { box-shadow: inset 0 0 0 1.5px #f2c35a, 0 0 12px rgba(242, 195, 90, 0.3); }

/* ---------- Unique tier: the hand-made bosses' signature weapons ---------- */
.r-unique, .wcard.r-unique, .arm-row.r-unique, .loot-card.weapon.r-unique, .arm-item.r-unique, .weapon-slot.r-unique { --rc: #ff5fa2; }
.skill-name.r-unique { color: #ffe0f0; text-shadow: 0 0 30px #ff3d8a, 0 0 12px #ff9ad0, 0 2px 0 #000; }
.loot-card.r-unique { animation: lootIn 0.9s cubic-bezier(.2, 1.6, .4, 1) both, uniqueGlow 1.8s 1s ease-in-out infinite; }
.loot-card.r-unique b { background: linear-gradient(90deg, #ffd1e8, #ff5fa2, #ffcf70, #ff5fa2); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes uniqueGlow { 50% { box-shadow: 0 0 22px rgba(255, 70, 150, 0.7), inset 0 0 0 1px rgba(255, 140, 200, 0.8); } }
.wcard.r-unique .rar { color: #ff8ac0; }
.wc-sig { display: block; font-style: normal; font-size: 11px; font-weight: 900; letter-spacing: 0.5px; color: #ffb3d6; margin-top: 2px; }
.wcard.r-unique .wc-unique { color: #ffd1e8; background: rgba(255, 60, 140, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 95, 162, 0.5); }
.pre-sig { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; padding: 6px 12px 6px 6px; border-radius: 10px; text-align: left;
  background: linear-gradient(90deg, rgba(255, 60, 140, 0.18), rgba(8, 4, 20, 0.45)); box-shadow: inset 0 0 0 1px rgba(255, 95, 162, 0.45); }
.pre-sig img { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(255, 70, 150, 0.8)); }
.pre-sig span { flex: 1; display: flex; flex-direction: column; }
.pre-sig small { font-size: 10px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: #ff8ac0; }
.pre-sig b { font-family: 'Cinzel'; font-size: 15px; color: #ffe0f0; }
.pre-sig em { font-style: normal; font-size: 11px; font-weight: 900; color: #ffcf70; }

/* ---------- difficulties ---------- */
.diff-bar { display: flex; gap: 6px; margin: 4px 10px 10px; padding: 4px; border-radius: 12px; background: rgba(8, 4, 20, 0.6); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.25); }
.diff-bar button { flex: 1; height: 34px; border: 0; border-radius: 9px; background: none; font-family: 'Cinzel'; font-weight: 900; font-size: 13px; color: #a99cc4; cursor: pointer; }
.diff-bar button.on { color: #fff; background: color-mix(in srgb, var(--dc) 30%, transparent); box-shadow: inset 0 0 0 1px var(--dc), 0 0 12px color-mix(in srgb, var(--dc) 40%, transparent); text-shadow: 0 0 8px var(--dc); }
.diff-bar button:disabled { opacity: 0.35; cursor: default; }
.ph-diff { color: var(--dc); text-shadow: 0 0 8px var(--dc); }
.v-unlock { margin: 6px auto 0; padding: 6px 14px; width: fit-content; border-radius: 20px; font-family: 'Cinzel'; font-weight: 900; font-size: 14px; color: #fff;
  background: rgba(255, 95, 162, 0.2); box-shadow: inset 0 0 0 1px #ff7ab8, 0 0 16px rgba(255, 95, 162, 0.5); animation: cardIn 0.5s 0.6s both; }

/* ornate gold filigree corners on pop-ups (sheets show the top two; their bottom sits at the screen edge) */
:root {
  --corner: 62px;
  --corners: url(../assets/ui/corner-tl.png) left -3px top -3px / var(--corner) auto no-repeat border-box,
             url(../assets/ui/corner-tr.png) right -3px top -3px / var(--corner) auto no-repeat border-box,
             url(../assets/ui/corner-bl.png) left -3px bottom -3px / var(--corner) auto no-repeat border-box,
             url(../assets/ui/corner-br.png) right -3px bottom -3px / var(--corner) auto no-repeat border-box;
}
.modal-card { background: var(--corners), var(--panel-bg) !important; }
.sheet-card { background: url(../assets/ui/corner-tl.png) left -3px top -3px / var(--corner) auto no-repeat border-box,
  url(../assets/ui/corner-tr.png) right -3px top -3px / var(--corner) auto no-repeat border-box, var(--panel-bg) !important; }

/* defeat: who beat you, in their own portrait */
.d-foe { position: relative; height: 200px; margin: -8px -6px 6px; border-radius: 10px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, rgba(200, 40, 70, 0.35), transparent 70%), #12081f;
  box-shadow: inset 0 0 0 1px rgba(255, 120, 140, 0.45), inset 0 -60px 50px -20px rgba(8, 3, 16, 0.95); }
.d-foe img { position: absolute; left: 50%; top: 4px; height: 200px; transform: translateX(-50%); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.7)) saturate(0.85); }
.d-foe.splash img { top: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.d-cap { position: absolute; left: 0; right: 0; bottom: 8px; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.d-cap h2 { margin: 0; line-height: 1.1; }
.d-cap h2::after { display: none !important; }
.d-cap span { font-size: 14px; font-weight: 800; color: #e8cfd6; text-shadow: 0 2px 4px #000; }
.d-cap span b { font-family: 'Cinzel'; font-size: 17px; color: #fff; }
.d-foe::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(10, 4, 18, 0.9)); }
.result.lose h2 { font-size: 30px !important; }

/* ---------- merchant: purse up top, a clear price over a full-size Buy button ---------- */
.purse { position: sticky; top: -20px; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 2px auto 12px; width: fit-content;
  padding: 6px 16px; border-radius: 20px; background: rgba(8, 4, 20, 0.85); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.45), 0 4px 10px rgba(0, 0, 0, 0.5); }
.purse .ic { width: 22px; height: 22px; }
.purse b { font-family: 'Cinzel'; font-size: 20px; color: #ffe7a8; }
.purse small { font-size: 12px; font-weight: 800; color: var(--muted); }
.buy-col { flex: none; width: 104px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.buy-col .price { display: inline-flex; align-items: center; gap: 4px; font-family: 'Cinzel'; font-weight: 900; font-size: 16px; color: #ffe7a8; }
.buy-col .price .ic { width: 18px; height: 18px; }
.buy-col .price.short { color: #ff8a9a; }
.buy-col .btn.buy { width: 100%; height: 40px; font-size: 14px !important; border-width: 0 20px !important; border-image-width: 0 20px !important; }
.buy-col .btn.buy:disabled { filter: grayscale(0.8) brightness(0.7); }
.merch-weapon { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.merch-weapon .buy-col { width: 180px; flex-direction: row; justify-content: center; gap: 12px; }
.merch-weapon .buy-col .btn.buy { width: 104px; }
.restock-row { margin-top: 6px; padding-top: 12px; }
.restock-row .btn.buy { border-image-source: url(../assets/ui/plaque-blue.png) !important; border-image-slice: 0 110 fill !important; color: #ecdcb8; }

/* Map: the next Legend or the Queen, pinned to the top of the trail */
.boss-ahead { position: sticky; top: 0; z-index: 5; flex: none; display: flex; align-items: center; gap: 10px; margin: -4px 0 -2px; padding: 6px 14px 6px 6px; border: 0; border-radius: 40px; cursor: pointer; text-align: left; color: #fff;
  background: linear-gradient(90deg, rgba(120, 10, 40, 0.92), rgba(30, 8, 30, 0.92)); box-shadow: inset 0 0 0 1px rgba(255, 90, 120, 0.55), 0 6px 18px rgba(0, 0, 0, 0.6); }
.boss-ahead.final { background: linear-gradient(90deg, rgba(120, 84, 10, 0.92), rgba(30, 20, 8, 0.92)); box-shadow: inset 0 0 0 1px rgba(255, 207, 58, 0.6), 0 6px 18px rgba(0, 0, 0, 0.6); }
.boss-ahead img { width: 46px; height: 46px; flex: none; border-radius: 50%; object-fit: cover; object-position: 50% 15%; background: rgba(0, 0, 0, 0.45); box-shadow: 0 0 0 2px var(--gold2); }
.boss-ahead span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.boss-ahead small { font-size: 10px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: #ff9fb4; }
.boss-ahead.final small { color: #ffd76a; }
.boss-ahead b { font-family: 'Cinzel'; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 #000; }
.boss-ahead em { flex: none; font-style: normal; font-family: 'Cinzel'; font-weight: 900; font-size: 14px; color: var(--gold2); }

/* Challenge rounds: cursed gems, richer rewards */
.pre2.challenge .ph-tag { display: inline-block; color: #fff; background: linear-gradient(180deg, #ff3a5a, #5a0018); box-shadow: 0 0 0 1px #ff9aac; }
.pre-challenge { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; padding: 7px 10px; border-radius: 10px; text-align: left; background: rgba(255, 40, 80, 0.12); box-shadow: inset 3px 0 0 #ff3a5a; }
.pre-challenge b { font-family: 'Cinzel'; font-size: 14px; color: #ff9aac; }
.pre-challenge span { font-size: 13px; font-weight: 800; color: #ffe0e6; }
.stage-label.challenge { color: #ff7a90; opacity: 1; }

/* Result screens: the buttons stay pinned to the bottom; a big haul scrolls above them */
.modal-card:has(.result) { display: flex; flex-direction: column; overflow: hidden; }
.modal-card:has(.result) > .result { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.modal-card:has(.result) > .result::-webkit-scrollbar { display: none; }
.modal-card:has(.result) > .modal-btns { flex: none; margin-top: 12px; }

/* Enemy info in words: what it does next, then its weakness and traits */
.foe-stats { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.intent { display: flex; align-items: center; flex-wrap: wrap; gap: 0 5px; font-size: 12px; font-weight: 800; color: #f3e6c8; line-height: 1.2; }
.intent-what b { font-family: 'Cinzel'; font-size: 17px; color: #ff9aa8; text-shadow: 0 1px 2px #000; }
.intent.hazard .intent-what b { color: #bfeaff; } .intent.hazard.poison .intent-what b { color: #b8ff9a; }
.intent small { font-size: 11px; font-weight: 800; color: #c9b8e8; }
.intent.imminent small { color: #ff7a90; }
.intent.imminent .intent-what b { animation: pulseRed 0.8s infinite; }
.enemy-traits { flex-wrap: wrap; gap: 3px 9px; overflow: visible; }
.trait { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 800; color: #e8dcff; gap: 4px; }
.trait.weak { color: #9fffb8; }
.trait.resist { color: #ffb0ba; }
.trait.resist::after { display: none; }
.trait .gem-ic, .trait.resist .gem-ic { width: 19px; height: 19px; filter: none; }
.trait.weak .gem-ic { filter: drop-shadow(0 0 4px rgba(120, 255, 150, 0.8)); }
.trait.resist .gem-ic + .gem-ic { margin-left: 1px; }

/* Boss splash waits for the player: Fight! appears once the entrance has landed */
.bs-go { display: block; margin: 18px auto 0; min-width: 200px; min-height: 54px; font-family: 'Cinzel'; font-size: 20px; letter-spacing: 1px; color: #3a1d00;
  animation: bsGo 0.5s 1.6s both; }
@keyframes bsGo { from { opacity: 0; transform: translateY(12px) scale(0.9); pointer-events: none; } }
.boss-splash img { animation-duration: 9s; }
#intent-when.delayed { animation: delayed 0.9s; }
@keyframes delayed { 0%, 60% { color: #bfefff; text-shadow: 0 0 10px #4ab8ff; transform: scale(1.15); } }
.num.chill { color: #bfefff; text-shadow: 0 0 8px #2a8cff, 0 2px 0 #001a3a; }

/* Blacksmith tabs: Weapons | Shields */
.smith-tabs { display: flex; gap: 6px; margin: 0 0 12px; padding: 4px; border-radius: 12px; background: rgba(8, 4, 20, 0.6); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.25); }
.smith-tabs button { flex: 1; height: 38px; border: 0; border-radius: 9px; background: none; font-family: 'Cinzel'; font-weight: 900; font-size: 15px; color: #a99cc4; cursor: pointer; }
.smith-tabs button.on { color: #3a1d00; background: linear-gradient(180deg, #ffe9a8, #e8b84a); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.crit-label.block { color: #fff3c4; text-shadow: 0 0 12px #ffb340, 0 2px 0 #5a3000; }

/* ---------- pets ---------- */
/* battle: the pet sits beside the weapon inside a ring that fills in its gem colour */
.pet-slot { --ch: 0; --gc: #ffd84a; --rc: #c9c3d6; position: relative; flex: 0 0 auto; width: 54px; height: 54px; 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); }
.pet-slot .ring { position: absolute; inset: -4px; border-radius: 50%;
  background: conic-gradient(from -90deg, var(--gc) calc(var(--ch) * 360deg), rgba(255, 255, 255, 0.08) 0);
  -webkit-mask: radial-gradient(circle, transparent 26px, #000 27px); mask: radial-gradient(circle, transparent 26px, #000 27px); box-shadow: 0 0 0 1px var(--rc); }
.pet-slot img { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); object-fit: cover; object-position: 50% 30%; border-radius: 50%; }
.pet-slot .plv { position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; font-size: 11px; line-height: 18px; text-align: center;
  color: #3a1d00; background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 1px #3a1d00; }
.pet-slot.ready { animation: weaponReady 1.1s ease-in-out infinite; }
.pet-slot.r-uncommon { --rc: #5fe08a; } .pet-slot.r-rare { --rc: #4aa8ff; } .pet-slot.r-epic { --rc: #c07bff; } .pet-slot.r-legendary { --rc: #ffb340; }

/* taming: no health, gear or belt; the score bar and the clock do the talking */
#battle.taming .player-zone { visibility: hidden; height: 0; padding: 0; overflow: hidden; }
#battle.taming #enemy-hp .fill { background: linear-gradient(180deg, #ffb0dc, #e0409a); }
#battle.taming .stage-label { color: #ff9ad0; opacity: 1; }

/* a wild pet appears / joins / gets away */
.pet-offer { text-align: center; }
.pet-offer .po-art { width: 180px; height: 180px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, rgba(255, 180, 230, 0.35), transparent 70%); animation: cardIn 0.6s both; }
.pet-offer .po-art img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6)); }
.pet-offer .po-art.gone img { filter: grayscale(0.6) opacity(0.6); }
.pet-offer h2 { margin-bottom: 2px; }
.pet-offer .rar { display: block; margin-bottom: 8px; }
.pet-offer .po-ab { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); font-size: 13px; font-weight: 700; color: #e8dcff; }
.pet-offer .po-ab b { color: var(--gold2); font-family: 'Cinzel'; }
.pet-offer.r-common .rar { color: #c9c3d6; } .pet-offer.r-uncommon .rar { color: #5fe08a; } .pet-offer.r-rare .rar { color: #4aa8ff; }
.pet-offer.r-epic .rar { color: #c07bff; } .pet-offer.r-legendary .rar { color: #ffb340; }

/* the Den */
.pet-card { display: flex; gap: 12px; margin: 0 0 10px; padding: 10px; border-radius: 14px; text-align: left; background: rgba(10, 5, 24, 0.55); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.2); }
.pet-card.active { box-shadow: inset 0 0 0 2px var(--gold2), 0 0 18px rgba(255, 200, 90, 0.25); }
.pet-card .pc-art { flex: none; width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 200, 240, 0.25), transparent 70%); }
.pet-card .pc-art img { width: 100%; height: 100%; object-fit: contain; }
.pet-card .pc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pet-card .pc-body > b { font-family: 'Cinzel'; font-size: 17px; color: #fff4dc; }
.pet-card .pc-body > b small { font-family: 'Spectral'; font-size: 12px; color: var(--gold2); margin-left: 4px; }
.pet-card .pc-xp { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.pet-card .pc-xp i { display: block; height: 100%; background: linear-gradient(90deg, #ff9ad0, #ffd0f0); }
.pet-card .pc-ab, .pet-card .pc-pas { font-size: 12px; font-weight: 700; color: #e8dcff; line-height: 1.35; }
.pet-card .pc-ab b, .pet-card .pc-pas b { color: var(--gold2); }
.pet-card .pc-ab small { display: block; color: var(--muted); }
.pet-card .pc-pas.locked { opacity: 0.55; }
.pet-card .pc-pas small { color: #ffb0ba; }
.pet-card .pc-rest { font-size: 12px; font-weight: 800; color: #ffb040; }
.pet-card .pc-set { align-self: flex-start; margin-top: 4px; min-height: 34px; padding: 0 14px; font-size: 13px; }
.pet-card.r-uncommon .rar { color: #5fe08a; } .pet-card.r-rare .rar { color: #4aa8ff; } .pet-card.r-epic .rar { color: #c07bff; } .pet-card.r-legendary .rar { color: #ffb340; }

/* victory lines */
.v-moon, .v-pet { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px 0; font-weight: 800; color: #d8ccff; }
.v-moon .ic { width: 20px; height: 20px; }
.v-pet img { width: 28px; height: 28px; object-fit: contain; }

/* battle: the shield medal carries the equipped shield and its block chance; pet and shield are tappable */
button.medal { border: 0; padding: 0; font: inherit; cursor: pointer; }
.medal { position: relative; }
.medal i .ic.gear { width: 30px; height: 30px; object-fit: contain; }
.medal .blk { position: absolute; right: -6px; top: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; white-space: nowrap;
  font-size: 10px; line-height: 18px; text-align: center; font-weight: 900; color: #3a1d00; background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 1px #3a1d00; }
/* with a shield equipped its art fills the medal and the shield points sit across the bottom */
.medal.gear i { position: absolute; inset: 3px 5px 10px; display: grid; place-items: center; }
.medal.gear i .ic.gear { width: 100%; height: 100%; }
.medal.gear b { position: absolute; left: 0; right: 0; bottom: 3px; margin: 0; text-align: center; font-size: 13px; color: #fff;
  text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 6px #000; }
.medal.gear:not(.on) b { opacity: 0; }
.pet-slot { border: 0; padding: 0; cursor: pointer; }

/* poison ticks: a green label and a green flash along the health bar */
.num.poison { color: #b8ff9a; text-shadow: 0 0 10px #2a9a20, 0 2px 0 #0a3a08; }
#p-hp.poisoned { animation: poisoned 0.7s; }
@keyframes poisoned { 30% { filter: hue-rotate(95deg) brightness(1.3); box-shadow: 0 0 16px #7dff6a; } }

/* armory rows take their rarity colour from the item (the inner row used to reset it to grey) */
.arm-item .arm-row { --rc: inherit; }
.arm-item.r-unique { --rc: #ff5fa2; }
.arm-item { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--rc) 60%, transparent); }
.arm-item .arm-row .si-art { box-shadow: inset 0 0 0 2px var(--rc), 0 0 10px color-mix(in srgb, var(--rc) 35%, transparent); }

/* camp sheets: a pinned header (title, purse, close) over a scrolling body */
.sheet-card { display: flex; flex-direction: column; overflow: hidden !important; }
.sheet-head { position: relative; flex: none; padding: 0 44px 8px; text-align: center; }
.sheet-head h2 { margin-bottom: 2px; }
.sheet-head .purse { position: static; margin: 4px auto 0; }
#sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 2px 0; scrollbar-width: none; }
#sheet-body::-webkit-scrollbar { display: none; }
/* the close button sits inside the frame, level with the title */
.sheet-x { position: absolute; top: 2px !important; right: 2px !important; width: 34px; height: 34px; }

/* one purse for every sheet: amount pills inside a single dark capsule */
.purse { gap: 14px; padding: 6px 16px; }
.purse span { display: inline-flex; align-items: center; gap: 5px; }

/* every plaque button centres its label both ways (a block-level button kept its text pinned to the top) */
.btn.gold, .btn.ghost, .btn.glass { display: inline-flex; align-items: center; justify-content: center; line-height: 1.15; }
.tree-detail .btn.tiny { display: flex; width: fit-content; min-width: 180px; }
.forge-row .btn { flex-direction: column; }

/* pet traits and collars */
.pc-traits { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.pc-traits .pt { padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; color: #f0e6ff; background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 1px var(--tc, rgba(255, 255, 255, 0.2)); }
.pc-traits .pt.off { opacity: 0.55; }
.pc-traits .pt small { font-weight: 600; }
.pc-traits .pt.empty { color: var(--muted); font-style: italic; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); background: none; }
.pt.r-uncommon { --tc: #5fe08a; } .pt.r-rare { --tc: #4aa8ff; } .pt.r-epic { --tc: #c07bff; } .pt.r-legendary { --tc: #ffb340; }
.pc-collar { --cc: #c9c3d6; display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 6px 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cc) 50%, transparent); }
.pc-collar img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.pc-collar span { display: flex; flex-direction: column; min-width: 0; }
.pc-collar b { font-size: 13px; color: var(--cc); }
.pc-collar small { font-size: 11px; color: #d8ccff; line-height: 1.3; }
.pc-collar small.power { color: #ffd76a; }
.pc-collar.big { margin-bottom: 8px; }
.pc-collar.big img { width: 52px; height: 52px; }
.pc-collar.big .btn { margin-left: auto; width: 96px; }
.pc-collar.r-uncommon { --cc: #5fe08a; } .pc-collar.r-rare { --cc: #4aa8ff; } .pc-collar.r-epic { --cc: #c07bff; } .pc-collar.r-legendary { --cc: #ffb340; }
.den-tabs button { font-size: 13px; padding: 0 2px; }
.buy-col .why { font-size: 11px; font-weight: 800; color: #ffb0ba; text-align: center; }

/* Daily Trial: the map card, the briefing and the prize on the victory screen */
.trial-card { position: sticky; top: 64px; z-index: 5; flex: none; display: flex; align-items: center; gap: 10px; margin: -6px 0 -2px; padding: 8px 14px; border: 0; border-radius: 40px; cursor: pointer; text-align: left; color: #fff;
  background: linear-gradient(90deg, rgba(60, 20, 110, 0.94), rgba(20, 8, 40, 0.94)); box-shadow: inset 0 0 0 1px rgba(200, 150, 255, 0.6), 0 6px 18px rgba(0, 0, 0, 0.6); }
.trial-card span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trial-card small { font-size: 10px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: #d4a8ff; }
.trial-card b { font-family: 'Cinzel'; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trial-card em { flex: none; font-style: normal; font-family: 'Cinzel'; font-weight: 900; font-size: 13px; color: #ffd76a; }
.trial-card.done { opacity: 0.6; }
.trial { text-align: left; }
.tr-foe { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.tr-foe img { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6)); }
.tr-foe small { display: block; font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: #d4a8ff; }
.tr-foe b { font-family: 'Cinzel'; font-size: 22px; color: #fff4dc; }
.tr-mods { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.tr-mods div { padding: 7px 10px; border-radius: 10px; background: rgba(255, 60, 120, 0.1); box-shadow: inset 3px 0 0 #ff5fa2; }
.tr-mods b { font-family: 'Cinzel'; color: #ffb0d0; margin-right: 6px; }
.tr-mods span { font-size: 13px; font-weight: 700; color: #f0e0ff; }
.tr-prize { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 200, 90, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 210, 120, 0.35); }
.tr-prize .ic { width: 30px; height: 30px; flex: none; }
.tr-prize b { display: block; font-size: 13px; color: #ffe7a8; }
.tr-prize small { font-size: 12px; color: #ffb0ba; font-weight: 700; }
.v-prize { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 6px auto 8px; padding: 10px 14px; width: fit-content; border-radius: 14px; background: rgba(255, 180, 60, 0.1); box-shadow: inset 0 0 0 1px #ffb340, 0 0 20px rgba(255, 180, 60, 0.25); animation: cardIn 0.6s 0.5s both; }
.v-prize small { font-size: 11px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: #ffd76a; }
.v-prize img { width: 64px; height: 64px; object-fit: contain; }
.v-prize b { font-family: 'Cinzel'; color: #ffb340; font-size: 17px; }
.v-prize span { font-size: 12px; color: #e8dcff; font-weight: 700; }

/* pet names: chosen when a pet joins you, changed later in the Den */
.pet-card .pc-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pet-card .pc-btns:empty { display: none; }
.pet-card .pc-rename { margin-top: 4px; min-height: 34px; padding: 0 12px; font-size: 13px; gap: 4px; }
.pet-card .pc-rename .ic, .modal-btns .ic { width: 16px; height: 16px; }
.name-field { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 10px auto 4px; max-width: 240px; }
.name-field span { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #d8ccff; }
.name-field input { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; border: 0; text-align: center;
  font: 800 18px var(--font, inherit); color: #fff; background: #120a28; box-shadow: inset 0 0 0 2px #c8902a, inset 0 2px 6px rgba(0, 0, 0, 0.6); outline: none; }
.name-field input:focus { box-shadow: inset 0 0 0 2px #ffe58a, 0 0 12px rgba(255, 216, 74, 0.4); }
.small-note.short { color: #ff8a9a; }
.btn.off { opacity: 0.45; pointer-events: none; }
.pet-card .pc-rename, .modal-btns .btn { flex-direction: row !important; white-space: nowrap !important; }

/* gear level requirements */
.wcard .wc-req { display: block; font-style: normal; font-size: 12px; font-weight: 800; color: #b8a8e0; }
.wcard .wc-req.short, .arm-row .short { color: #ff8a9a; }
.loot-card .need { font-style: normal; font-size: 11px; font-weight: 900; color: #ff8a9a; }

/* critical hits: a banner over the enemy, the card flashes gold and the screen edges glow */
.crit-banner { font-family: 'Cinzel'; font-size: 46px; font-weight: 900; letter-spacing: 2px; white-space: nowrap; z-index: 3;
  background: linear-gradient(180deg, #fff, #ffe066 45%, #ff8a1a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 170, 30, 0.9)) drop-shadow(0 3px 0 #6a2000);
  animation: comboPop 1.2s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.num.dmg.crit { font-size: 54px; color: #ffe066; -webkit-text-stroke: 2px #a03000; text-shadow: 0 0 18px rgba(255, 160, 30, 0.9); }
#enemy-stage.crit-hit { animation: critHit 0.5s ease-out; }
@keyframes critHit { 0% { filter: brightness(2.6) saturate(0.4); transform: scale(1.06) rotate(-1.5deg); } 40% { transform: scale(0.98) rotate(1deg); } 100% { filter: none; transform: none; } }
#battle.crit-flash { animation: critFlash 0.55s ease-out; }
@keyframes critFlash { 15% { box-shadow: inset 0 0 140px rgba(255, 200, 60, 0.7); } }
/* Reduce flashing: no red edge when you're hit, and battle warnings hold a steady glow instead of pulsing */
.calm #battle.hurt, .calm #battle.berserk::after, .calm #p-hp.poisoned { animation: none; }
.calm .foe-card.imminent, .calm .moves.low { animation: none; box-shadow: inset 0 0 0 2px #ff4d6d, 0 0 0 3px rgba(10, 5, 20, 0.7); }
.calm .intent.imminent, .calm .intent.imminent > b, .calm .intent.imminent .cd i.on, .calm .intent.imminent .intent-what b,
.calm .weapon-slot.ready, .calm .pet-slot.ready { animation: none !important; }
.calm .weapon-slot.ready, .calm .pet-slot.ready { box-shadow: 0 0 0 2px #1a0e30, 0 0 14px rgba(255, 210, 90, 0.7); }
/* and the crit keeps its banner and jolt but loses the bright pop and the edge glow */
.calm #enemy-stage.crit-hit { animation: critHitCalm 0.5s ease-out; }
@keyframes critHitCalm { 0% { transform: scale(1.03) rotate(-1deg); } 40% { transform: scale(0.99) rotate(0.5deg); } 100% { transform: none; } }
.calm #battle.crit-flash { animation: none; }
.st.poison { background: linear-gradient(180deg, #8aff6a, #2a8a10); }

/* ---------- skill tree v2: a hero's path, class → specialisation → evolution ---------- */
#tree .tree { background: none; overflow: visible; }
.hero-head { flex: 1; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(36, 24, 70, 0.95), rgba(16, 10, 34, 0.95)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--bc, #ffd36a) 60%, transparent); }
.hero-head img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; object-position: 50% 20%; box-shadow: 0 0 0 2px var(--bc, #ffd36a); background: #0006; }
.hero-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hero-head b { font-family: 'Cinzel'; font-size: 20px; color: var(--gold); }
.hero-head small { color: var(--muted); font-weight: 800; font-size: 12px; }
.hero-head.pick { justify-content: center; text-align: center; }
.g-switch { display: inline-flex; gap: 4px; margin-top: 4px; }
.g-switch button { border: 0; border-radius: 9px; padding: 3px 10px; font: 900 11px 'Spectral', serif; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); background: #0007; box-shadow: inset 0 0 0 1px rgba(255, 220, 150, 0.2); }
.g-switch button.on { color: #2a1600; background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: none; }
.hero-head.pick .g-switch { justify-content: center; }
.ptree { display: flex; flex-direction: column; gap: 12px; padding: 10px 0 20px; }
.ptier { position: relative; }
.ptier.future { opacity: 0.7; }
.pt-label { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 6px; }
.pt-label span { font-family: 'Cinzel'; font-weight: 900; font-size: 14px; color: var(--gold2, #ffe9a0); }
.pt-label small { font-weight: 900; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.form-list { display: flex; flex-direction: column; gap: 8px; }
.form-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(36, 24, 70, 0.92), rgba(16, 10, 34, 0.92)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--bc) 55%, transparent); }
.form-card.light { box-shadow: inset 0 0 0 1.5px #c9a64a; background: linear-gradient(180deg, rgba(56, 46, 70, 0.92), rgba(20, 14, 34, 0.92)); }
.form-card.dark { box-shadow: inset 0 0 0 1.5px #b0284a; background: linear-gradient(180deg, rgba(60, 16, 34, 0.92), rgba(18, 8, 20, 0.92)); }
.form-card img { width: 84px; height: 84px; flex: 0 0 auto; border-radius: 12px; object-fit: cover; object-position: 50% 20%; background: #0006; }
.fc-body { flex: 1; min-width: 0; }
.fc-body > b { font-family: 'Cinzel'; font-size: 17px; color: var(--gold); margin-right: 6px; }
.fc-body .side { font-style: normal; font-size: 10px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 6px; border-radius: 6px; }
.fc-body .side.light { color: #ffe9a0; background: #ffe9a022; } .fc-body .side.dark { color: #ff7a94; background: #ff5a7a22; }
.fc-body small { display: block; color: var(--muted); font-weight: 700; font-size: 12px; margin-top: 2px; }
.fc-body p { margin: 4px 0 0; font-size: 12.5px; font-weight: 700; line-height: 1.35; }
.fc-body p b { color: var(--gold2, #ffe9a0); }
.form-card .pick { flex: 0 0 auto; min-height: 38px; padding: 0 14px; font-size: 13px; }
.pt-talents { display: flex; align-items: stretch; gap: 6px; }
.tn-or { align-self: center; font-style: normal; font-family: 'Cinzel'; font-weight: 900; font-size: 11px; color: var(--muted); }
.tn { flex: 1; min-width: 0; border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 14px; color: var(--text, #fff);
  background: linear-gradient(180deg, rgba(36, 24, 70, 0.92), rgba(16, 10, 34, 0.92)); box-shadow: inset 0 0 0 1px rgba(255, 220, 150, 0.18); }
.tn img { width: 54px; height: 54px; border-radius: 12px; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5); background: #0006; }
.tn-name { font-weight: 900; font-size: 12.5px; line-height: 1.15; text-align: center; }
.tn .pips { display: flex; gap: 3px; } .tn .pips b { width: 9px; height: 9px; border-radius: 50%; background: #0009; box-shadow: inset 0 0 0 1px rgba(255, 220, 150, 0.35); }
.tn .pips b.on { background: var(--bc); box-shadow: 0 0 6px var(--bc); }
.tn.owned { box-shadow: inset 0 0 0 2px var(--bc), 0 0 14px color-mix(in srgb, var(--bc) 40%, transparent); }
.tn.can { box-shadow: inset 0 0 0 2px #ffe08a; animation: weaponReady 1.6s ease-in-out infinite; }
.tn.sel { outline: 2px solid #fff; outline-offset: 2px; }
.tn.locked img, .tn.forsaken img { filter: grayscale(1) brightness(0.55); }
.tn.forsaken { opacity: 0.5; }
.tn.capstone img { width: 62px; height: 62px; box-shadow: 0 0 0 2px #ffd36a, 0 0 14px rgba(255, 200, 80, 0.5); }
.form-reveal { text-align: center; }
.form-reveal img { width: 220px; max-width: 70%; aspect-ratio: 1; border-radius: 18px; object-fit: cover; box-shadow: 0 0 0 3px var(--bc), 0 0 40px color-mix(in srgb, var(--bc) 60%, transparent); }
.form-reveal h2 { margin-top: 12px; }
#tree .tree { box-shadow: none; }
.form-card { flex-wrap: wrap; }
.form-card .pick { flex: 1 0 100%; }

/* skill tree header: points counter like the gold one, and your level up front */
.sp-chip small { font-size: 11px; font-weight: 800; color: var(--muted); margin-left: -2px; }
.sp-chip .ic { width: 22px; height: 22px; }
.hh-art { position: relative; flex: 0 0 auto; }
.hero-head .hh-medal { position: absolute; right: -8px; bottom: -8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 900 15px 'Cinzel', serif; color: #3a1d00; background: radial-gradient(circle at 35% 30%, #fff3b0, #f2a93b 60%, #9a5410);
  box-shadow: 0 0 0 2px #1a0c00, 0 0 0 3px #f2c35a, 0 0 10px rgba(255, 200, 90, 0.5); }
.hero-head .hh-level { font-weight: 800; font-size: 13px; color: var(--muted); }
.hero-head .hh-level b { font: 900 16px 'Cinzel', serif; color: #fff; }
.hh-xp { display: block; height: 6px; max-width: 170px; border-radius: 3px; background: #0009; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 220, 150, 0.2); }
.hh-xp i { display: block; height: 100%; background: linear-gradient(90deg, #8a5cff, #d9b0ff); }
.hero-head.pick .hh-xp { margin: 2px auto; }
.hero-head { gap: 18px; }

/* pet evolution */
.pc-evo { font-size: 12.5px; margin-top: 4px; } .pc-evo b { color: var(--gold2, #ffe9a0); }
.pc-evo.locked { opacity: 0.55; } .pc-evo.ready b { color: #3dffa0; }
.pc-evolve { animation: weaponReady 1.6s ease-in-out infinite; }
.evo-opts { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-top: 8px; }
.evo-opt { border: 0; border-radius: 16px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: var(--text, #fff);
  background: linear-gradient(180deg, rgba(36, 24, 70, 0.95), rgba(16, 10, 34, 0.95)); box-shadow: inset 0 0 0 1.5px rgba(255, 220, 150, 0.35); }
.evo-opt:active { transform: scale(0.97); }
.evo-opt img { width: 100%; max-width: 120px; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5)); }
.evo-opt > b { font-family: 'Cinzel'; font-size: 15px; color: var(--gold); }
.evo-opt span { font-size: 12.5px; font-weight: 800; line-height: 1.3; }
.evo-opt small { font-size: 11px; color: var(--muted); line-height: 1.3; } .evo-opt small b { color: var(--gold2, #ffe9a0); }
.modal-btns .evo-hidden { display: none; }

/* the Quest logo is taller: sit it a little lower and smaller so it clears the orbiting gems */
.logo { width: min(90vw, 520px); margin-bottom: calc(-1 * clamp(8px, 2.2vh, 22px)); }
@media (max-height: 640px) { .logo { width: min(84vw, 440px); } }
.diff-bar { flex-wrap: wrap; }
.diff-bar button { flex: 1 0 28%; }

/* Prism Rank: boosts after level 50 */
.prism-panel { margin: 10px 0 4px; padding: 12px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(90, 60, 160, 0.55), rgba(30, 18, 60, 0.9)); box-shadow: inset 0 0 0 1.5px rgba(200, 170, 255, 0.55), 0 0 18px rgba(170, 120, 255, 0.25); }
.pp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.pp-head b { font-family: 'Cinzel'; font-size: 18px; background: linear-gradient(90deg, #ffd6f6, #c9b0ff, #9fe6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pp-head span { font-size: 12px; font-weight: 800; color: var(--muted); }
.pp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.pp-row b { display: block; font-size: 14px; } .pp-row small { color: var(--muted); font-weight: 700; font-size: 12px; }
.pp-add { min-width: 44px; min-height: 34px; padding: 0 10px; font-size: 18px; }
.prism-panel .tiny { margin: 8px auto 0; display: block; }
.prism-panel .pp-add { border: 0; border-image: none; border-radius: 12px; min-width: 40px; min-height: 36px; padding: 0; font: 900 22px/1 'Spectral', serif; color: #2a1600;
  background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 2px #3a1d00, 0 3px 0 #7a4a10; }
.prism-panel .pp-add:disabled { opacity: 0.35; }

/* ---------- map v2: cut-gem stages, a stepping-stone trail, the hero marker ---------- */
.boss-ahead, .trial-card { position: relative; top: auto; margin: 0; }
.zone-head { justify-content: center; flex-direction: column; align-items: center; gap: 4px; padding: 16px 16px 0; text-align: center; }
.zone-head h3 { font-size: 24px; letter-spacing: 1px; padding: 0 22px; position: relative;
  background: linear-gradient(180deg, #fff8e0, #ffd77a 60%, #c8902a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #000) drop-shadow(0 0 10px color-mix(in srgb, var(--za) 70%, transparent)); }
.zone-head span { padding: 2px 12px; border-radius: 10px; background: rgba(8, 4, 20, 0.6); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--za) 60%, transparent); letter-spacing: 0.04em; }
.trail path { stroke: rgba(255, 236, 190, 0.28); stroke-width: 7; stroke-dasharray: 1 15; stroke-linecap: round; }
.trail path.lit { stroke: #ffd77a; stroke-width: 5; stroke-linecap: round; filter: drop-shadow(0 0 6px #ffb340) drop-shadow(0 0 2px #fff0c0); }
.node:not(.boss) { width: 58px; height: 58px; background: none; box-shadow: none; color: #fff;
  filter: drop-shadow(0 5px 6px rgba(0, 0, 0, 0.65)); }
.node:not(.boss)::before, .node:not(.boss)::after { content: ''; position: absolute; inset: 0;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
/* gold rim, then the faceted gem inside it */
.node:not(.boss)::before { background: linear-gradient(160deg, #fff3c0, #c8902a 45%, #5a3208); }
.node:not(.boss)::after { inset: 4px;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.75), transparent 32%),
    conic-gradient(from 22.5deg, var(--g1) 0 12.5%, var(--g2) 0 25%, var(--g1) 0 37.5%, var(--g3) 0 50%, var(--g2) 0 62.5%, var(--g3) 0 75%, var(--g1) 0 87.5%, var(--g2) 0); }
.node:not(.boss) { --g1: color-mix(in srgb, var(--za) 75%, white); --g2: var(--za); --g3: color-mix(in srgb, var(--za) 55%, black); }
.node:not(.boss).locked { --g1: #5a5470; --g2: #3e3a52; --g3: #24202f; filter: drop-shadow(0 5px 6px rgba(0, 0, 0, 0.65)); }
.node:not(.boss).current { --g1: #fff4b0; --g2: #ffc23a; --g3: #b86a0a; width: 66px; height: 66px;
  filter: drop-shadow(0 0 14px rgba(255, 200, 80, 0.95)) drop-shadow(0 5px 6px rgba(0, 0, 0, 0.6)); }
.node:not(.boss) .num { position: relative; z-index: 1; font-size: 20px; color: #fff; -webkit-text-stroke: 1px rgba(0, 0, 0, 0.55); text-shadow: 0 2px 2px rgba(0, 0, 0, 0.7); }
.node:not(.boss).locked .num { color: #b8b0cc; }
.node:not(.boss).current .num { color: #3a1d00; -webkit-text-stroke: 0; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); }
.node .stars { z-index: 2; }
/* boss medallions: a cleaner gold ring and a soft glow in the zone colour */
.node.boss { box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #e6b04a, 0 0 0 5px #3a1d00, 0 0 16px color-mix(in srgb, var(--za) 55%, transparent), 0 8px 14px rgba(0, 0, 0, 0.6); }
/* you are here */
.node .you { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); width: 42px; height: 42px; border-radius: 50%; z-index: 3;
  background: #120a26; box-shadow: 0 0 0 2px #1a0c00, 0 0 0 4px #ffe08a, 0 0 14px rgba(255, 210, 110, 0.8); animation: youBob 1.6s ease-in-out infinite; }
.node .you img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 20%; }
.node .you::after { content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 7px solid transparent; border-top-color: #ffe08a; margin-top: 2px; }
.node .you i { position: absolute; inset: 10px; border-radius: 50%; background: radial-gradient(circle, #fff3b0, #ffb340); }
@keyframes youBob { 50% { transform: translate(-50%, -5px); } }
.node.current:not(.boss) { animation: none; }
.node.boss.current .you { bottom: calc(100% + 16px); }

.loot-card.sold { opacity: 0.6; }
.loot-card.sold small { color: #ffd84a; }

/* ---------- map v3: stage medallions (replacing the cut gems): gold rim, zone studs, a clear number ---------- */
.node:not(.boss) { width: 58px; height: 58px; border-radius: 50%; filter: none; color: #fff4dc;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--za) 45%, #3a2a58), #140a24 72%);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--za) 55%, #000), inset 0 6px 10px rgba(255, 255, 255, 0.12),
    0 0 0 2px #1a0c00, 0 0 0 6px #d8a440, 0 0 0 7px #2a1400, 0 7px 12px rgba(0, 0, 0, 0.65); }
.node:not(.boss)::before { clip-path: none; inset: -6px; border-radius: 50%;
  background: conic-gradient(from 20deg, #fff3c0, #c8902a 15%, #6a3a0a 28%, #ffd77a 42%, #8a5a14 58%, #fff0b0 72%, #b07818 86%, #fff3c0);
  -webkit-mask: radial-gradient(circle, transparent 29px, #000 30px); mask: radial-gradient(circle, transparent 29px, #000 30px); }
.node:not(.boss)::after { clip-path: none; inset: -9px; border-radius: 50%;
  background: radial-gradient(circle at 50% 4px, var(--za) 0 3px, #2a1400 3.5px 4.5px, transparent 5px),
    radial-gradient(circle at 50% calc(100% - 4px), var(--za) 0 3px, #2a1400 3.5px 4.5px, transparent 5px),
    radial-gradient(circle at 4px 50%, var(--za) 0 3px, #2a1400 3.5px 4.5px, transparent 5px),
    radial-gradient(circle at calc(100% - 4px) 50%, var(--za) 0 3px, #2a1400 3.5px 4.5px, transparent 5px); }
.node:not(.boss) .num { font-size: 23px; color: #fff4dc; -webkit-text-stroke: 1px #2a1400; text-shadow: 0 2px 0 #000, 0 0 8px color-mix(in srgb, var(--za) 60%, transparent); }
.node:not(.boss).done { background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--za) 70%, #2a3a40), color-mix(in srgb, var(--za) 25%, #120a20) 72%); }
.node:not(.boss).locked { filter: grayscale(1) brightness(0.6); }
.node:not(.boss).locked .num { color: #e0d8ee; }
.node:not(.boss).current { width: 64px; height: 64px; background: radial-gradient(circle at 50% 30%, #fff1a8, #e89a20 60%, #7a3a00);
  box-shadow: inset 0 0 0 3px #7a3a00, 0 0 0 2px #1a0c00, 0 0 0 6px #fff0b0, 0 0 0 7px #2a1400, 0 0 26px rgba(255, 200, 80, 0.95), 0 7px 12px rgba(0, 0, 0, 0.6); filter: none; }
.node:not(.boss).current::before { -webkit-mask: radial-gradient(circle, transparent 32px, #000 33px); mask: radial-gradient(circle, transparent 32px, #000 33px); }
.node:not(.boss).current .num { color: #3a1d00; -webkit-text-stroke: 0; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); }

/* ---------- map pin: difficulty and the Daily Trial stay in view while the map scrolls ---------- */
.map-pin { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 0; position: relative; z-index: 6; }
.map-pin:empty { display: none; }
.pin-row { display: flex; gap: 8px; align-items: stretch; }
.diff-chip { flex: none; display: flex; flex-direction: column; justify-content: center; padding: 6px 14px; border: 0; border-radius: 16px; cursor: pointer; color: #fff; text-align: left;
  background: linear-gradient(180deg, color-mix(in srgb, var(--dc) 35%, #1a0e34), #140a28); box-shadow: inset 0 0 0 1.5px var(--dc), 0 4px 12px rgba(0, 0, 0, 0.5); }
.diff-chip small { font-size: 9.5px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: color-mix(in srgb, var(--dc) 60%, #fff); }
.diff-chip b { font-family: 'Cinzel'; font-size: 14px; text-shadow: 0 0 8px var(--dc); }
.map-pin .trial-card { flex: 1; min-width: 0; margin: 0; position: relative; top: auto; border-radius: 16px; padding: 8px 12px 8px 14px; overflow: hidden;
  background: linear-gradient(100deg, #6a1fb8, #2a0c5a 60%, #3a0f2a); box-shadow: inset 0 0 0 2px #ffcf5a, 0 0 18px rgba(255, 190, 80, 0.45), 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: trial-glow 2.4s ease-in-out infinite; }
.map-pin .trial-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 240, 200, 0.28) 50%, transparent 70%);
  background-size: 250% 100%; animation: trial-sheen 3.2s ease-in-out infinite; pointer-events: none; }
.map-pin .trial-card small { color: #ffd76a; font-size: 11px; }
.map-pin .trial-card b { font-size: 14px; }
.map-pin .trial-card em { padding: 6px 12px; border-radius: 10px; color: #2a1600; font-size: 13px; background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 1.5px #3a1d00, 0 2px 0 #7a4a10; }
.map-pin .trial-card.done { opacity: 1; animation: none; background: linear-gradient(100deg, #2a1d48, #1a1030); box-shadow: inset 0 0 0 1.5px rgba(200, 150, 255, 0.35); }
.map-pin .trial-card.done::after { display: none; }
.map-pin .trial-card.done em { background: none; box-shadow: none; color: #b9a6dc; padding: 0; }
@keyframes trial-glow { 50% { box-shadow: inset 0 0 0 2px #ffe9a0, 0 0 28px rgba(255, 200, 90, 0.75), 0 4px 12px rgba(0, 0, 0, 0.5); } }
@keyframes trial-sheen { 0% { background-position: 120% 0; } 60%, 100% { background-position: -120% 0; } }
.map-pin .quest-done { margin: 0; position: relative; top: auto; }
.modal-btns.stack { flex-direction: column; }
.modal-btns.stack .btn { flex: none; width: 100%; }

.logo { position: relative; }

html, body { overscroll-behavior: none; }
.pet-meter .fill { background: linear-gradient(90deg, #1a9a5a, #4fe08a 70%, #d0ffe0); box-shadow: 0 0 12px #4fe08a; }
.pet-meter .meter-ic img { width: 100%; height: 100%; object-fit: contain; }
.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 5px; padding: 0 5px; border-radius: 9px; vertical-align: 1px;
  font: 900 11px/1 'Spectral', serif; font-style: normal; color: #2a1600; background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 1px #3a1d00; }
.pp-foot { display: flex; justify-content: center; margin-top: 10px; }
.pp-foot .btn { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; margin: 0; min-width: 190px; white-space: nowrap; }
.pp-foot .btn .ic { width: 18px; height: 18px; }

/* secondary buttons: a blue plaque, so they never read as greyed out */
:root { --kit-dark: url(../assets/ui/plaque-blue.png); }
.btn.ghost, .modal-btns .btn.ghost, .btn.glass { color: #fff; text-shadow: 0 1px 0 #061430, 0 0 8px rgba(0, 20, 60, 0.8); }
.plaque.dark { background-image: url(../assets/ui/plaque-blue.png); color: #fff; }
/* long ability names (Chain Lightning) wrap inside the slot instead of running off screen */
.weapon-slot .wready { left: -2px; right: -2px; transform: none; width: auto; white-space: normal; text-align: center; line-height: 1.05; padding: 2px 4px; }
.den-restock { display: flex; justify-content: center; margin: 14px 0 4px; }
.den-restock .buy-col { width: auto; flex-direction: row; align-items: center; gap: 10px; }

/* popups only ever scroll up and down: wide decorations (wings, light rays) must never let a sideways
   drag slide the contents out of line */
.modal-card, .modal-card:has(.result) > .result, #sheet-body { overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; }
/* the light rays spread wider than the panel: clip them to its width so they can't widen it */
.v-rays-clip { position: absolute; z-index: 0; left: 0; right: 0; top: -60%; bottom: -60%; overflow: hidden; pointer-events: none; }
.v-rays-clip .v-rays { top: 53.6%; }
input[type=range] { touch-action: none; }

/* ---------- level-up perk cards ---------- */
/* a card: painted art behind the frame's window, the name on its scroll (sizes follow the card's width) */
.pcard { position: relative; display: block; width: 100%; aspect-ratio: 742 / 1131; padding: 0; border: 0; background: none; cursor: pointer;
  container-type: inline-size; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)); transition: transform 0.18s, filter 0.18s; }
.pcard:active { transform: scale(0.96); }
.pcard .pc-art { position: absolute; left: 13.2%; top: 6.9%; right: 12%; bottom: 21.9%; background: center / cover no-repeat; border-radius: 40% 40% 0 0 / 22% 22% 0 0; }
.pcard .pc-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pcard .pc-title { position: absolute; left: 17%; right: 17%; top: 82.5%; transform: translateY(-50%); text-align: center; pointer-events: none;
  font: 900 calc(min(9cqw, 80cqw / var(--len, 9)))/1 'Cinzel', serif; letter-spacing: -0.01em; color: #3a1d00; text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6); white-space: nowrap; }
/* long names (Chain Reaction II, Wrath of the Heavens) wrap onto two readable lines */
.pcard .pc-title.long { white-space: normal; font-size: 7.4cqw; line-height: 0.92; }
.pcard.legendary { aspect-ratio: 685 / 1137; }
.pcard.legendary .pc-art { left: 5.7%; top: 10.2%; right: 5.7%; bottom: 3.7%; border-radius: 45% 45% 0 0 / 20% 20% 0 0; }
.pcard.legendary .pc-title { top: 80%; left: 14%; right: 14%; }

/* the deal: three cards fly in one after another and bob gently, Legendary ones glow gold */
.perk-deal { text-align: center; }
.perk-deal > small { display: block; font: 900 12px 'Spectral', serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.perk-deal h2 { margin: 2px 0 14px !important; }
.perk-deal.legendary h2 { background: linear-gradient(180deg, #fff8e0, #ffd77a 60%, #c8902a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 10px rgba(255, 190, 80, 0.6)); }
.deal-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; }
.pcard.deal { animation: cardDeal 0.55s cubic-bezier(.2, 1.3, .4, 1) both, cardBob 3s ease-in-out infinite; animation-delay: calc(var(--i) * 0.14s), calc(0.6s + var(--i) * 0.4s); }
.pcard.deal:hover { filter: drop-shadow(0 0 14px rgba(255, 215, 130, 0.8)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)); }
.perk-deal.legendary .pcard.deal { filter: drop-shadow(0 0 16px rgba(255, 190, 80, 0.75)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)); }
@keyframes cardDeal { from { opacity: 0; transform: translateY(60px) rotate(-10deg) scale(0.6); } }
@keyframes cardBob { 50% { transform: translateY(-5px); } }
.deal-hint { margin: 12px 0 0 !important; font-size: 13px; }

/* one card up close, with what it does */
.perk-zoom .pcard { width: min(64vw, 250px, 28svh); margin: 0 auto; /* short screens (Safari's bars) shrink the card, not hide its words */ animation: cardZoom 0.35s cubic-bezier(.2, 1.3, .4, 1) both; }
.perk-zoom .pz-desc { margin: 14px 4px 0; font-weight: 800; font-size: 16px; line-height: 1.35; color: #f3e6c8; }
@keyframes cardZoom { from { opacity: 0; transform: scale(0.7); } }

/* the Perks page */
.perk-page { padding: 4px 4px 0; }
.pp-next { margin: 4px 0 12px; text-align: center; font-weight: 800; color: var(--muted); } .pp-next b { color: var(--gold2); }
.pp-empty { text-align: center; }
.perk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* a perk's name flashing over the board when it fires */
.skill-name.perk-name { color: #ffe9a0; text-shadow: 0 0 18px #ffb340, 0 2px 0 #000; }
.pcard.legendary::after { content: 'Legendary'; position: absolute; left: 20%; right: 20%; top: 90.6%; transform: translateY(-50%); text-align: center; pointer-events: none;
  font: 900 5.6cqw/1 'Cinzel', serif; letter-spacing: 0.12em; text-transform: uppercase; color: #8a5a10; }

/* "you are here": a glowing prism crystal pin standing over your next stage */
.node .you { width: 34px; height: 92px; border-radius: 0; background: none; box-shadow: none; bottom: calc(100% - 14px);
  filter: drop-shadow(0 0 10px rgba(190, 120, 255, 0.85)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7)); }
.node .you img { width: 100%; height: 100%; border-radius: 0; object-fit: contain; object-position: 50% 100%; }
.node .you::after, .node .you i { display: none; }
.node.boss.current .you { bottom: calc(100% - 4px); }
/* the Legend banner rides in the pinned strip too, slimmer */
.map-pin .boss-ahead { position: relative; top: auto; margin: 0; padding-top: 4px; padding-bottom: 4px; }
.map-pin .boss-ahead img { width: 38px; height: 38px; }

/* perk card lettering: illuminated-manuscript capitals engraved into the parchment, centred on the
   frame's scroll (measured from the art: centre 84.9% down, inner width 21%–79%) */
.pcard .pc-title { top: 84.9%; left: 21%; right: 21%; font-family: 'Uncial Antiqua', 'Cinzel', serif; font-weight: 400; letter-spacing: 0.01em;
  color: #3b1f08; text-shadow: 0 1px 0 rgba(255, 244, 214, 0.9), 0 -1px 0 rgba(60, 30, 0, 0.35); }
.pcard .pc-title.long { font-size: 7.6cqw; line-height: 0.95; }
/* an illuminated first letter: deep crimson edged in gold */
.pcard .pc-title::first-letter { color: #9a1424; font-size: 1.22em; text-shadow: 0 0 1px #c8902a, 0 1px 0 rgba(255, 236, 190, 0.9), 0 0 3px rgba(200, 144, 42, 0.6); }
/* Legendary cards: the gold ribbon is centred 80% down; two-line names shrink to sit inside it */
.pcard.legendary .pc-title { top: 79.8%; }
.pcard.legendary .pc-title, .pcard.legendary .pc-title.long { white-space: nowrap; font-size: calc(min(8.2cqw, 90cqw / var(--len, 9))); line-height: 1; }

/* ---------- the Pet Den ---------- */
#den { background: #120a1c; }
.den-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 24px; }
.den-stage { position: relative; aspect-ratio: 3 / 4; max-height: 74vh; margin: 0 auto; width: 100%;
  background: url(../assets/den/woodland.jpg) center 60% / cover no-repeat; box-shadow: inset 0 -40px 40px -20px #120a1c, inset 0 30px 30px -20px #120a1c; overflow: hidden; }
.den-stage.empty { aspect-ratio: auto; min-height: 50vh; display: grid; place-items: center; }
.den-empty { max-width: 300px; padding: 16px 20px; border-radius: 16px; text-align: center; font-weight: 800; color: #f3e6c8; background: rgba(10, 6, 20, 0.75); }

/* the pets resting at the back of the den */
.den-back { position: absolute; left: 4%; right: 4%; top: 33%; display: flex; justify-content: center; align-items: flex-end; gap: 1.5%; }
.den-rest { position: relative; width: 17%; aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; filter: brightness(0.82) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.6)); transition: transform 0.2s, filter 0.2s; }
.den-rest:hover, .den-rest:active { filter: brightness(1.05) drop-shadow(0 0 8px rgba(255, 220, 140, 0.8)); transform: translateY(-4%); }
.den-rest img { width: 100%; height: 100%; object-fit: contain; animation: denSnooze 4s ease-in-out infinite; animation-delay: calc(var(--d, 0) * 1s); }
.den-rest small { position: absolute; left: -10%; right: -10%; bottom: -14%; text-align: center; font: 800 10px 'Spectral', serif; color: #f3e6c8; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.den-rest b { position: absolute; right: -4%; top: -4%; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; display: grid; place-items: center;
  font: 900 10px 'Spectral', serif; color: #2a1600; background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 1px #3a1d00; }
.den-rest .comp-dot { position: absolute; left: -2%; top: -2%; width: 10px; height: 10px; border-radius: 50%; background: #3dffa0; box-shadow: 0 0 6px #3dffa0; }
.den-all { position: relative; width: 12%; aspect-ratio: 1; border: 0; border-radius: 50%; cursor: pointer; font: 800 10px 'Spectral', serif; color: #f3e6c8;
  background: rgba(10, 6, 20, 0.7); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.5); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.den-all b { font-size: 14px; color: var(--gold2); }
@keyframes denSnooze { 50% { transform: scale(1.02, 0.98) translateY(1%); } }

/* the pet in the spotlight, breathing on its cushion */
.den-hero { position: absolute; left: 50%; bottom: 13%; width: 56%; aspect-ratio: 1; transform: translateX(-50%); pointer-events: none; }
.den-hero .den-spot { position: absolute; inset: -30% -20% 0; background: radial-gradient(ellipse at 50% 70%, rgba(255, 230, 170, 0.35), transparent 60%); }
.den-hero .den-shadow { position: absolute; left: 18%; right: 18%; bottom: 2%; height: 9%; border-radius: 50%; background: radial-gradient(rgba(0, 0, 0, 0.55), transparent 70%); }
.den-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; pointer-events: auto; cursor: pointer;
  transform-origin: 50% 100%; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.55)); animation: denBreathe 3.2s ease-in-out infinite; }
@keyframes denBreathe { 50% { transform: scale(1.025, 0.985); } }
.den-hero img.joy { animation: denJoy 0.6s cubic-bezier(.2, 1.4, .4, 1), denBreathe 3.2s 0.6s ease-in-out infinite; }
@keyframes denJoy { 40% { transform: translateY(-16%) scale(1.05); } }
.den-hero img.hungry { animation: denHungry 0.5s ease-in-out infinite; }
@keyframes denHungry { 50% { transform: translateY(-3%) scale(1.04) rotate(-2deg); } }
.den-hero img.fed { animation: denJoy 0.7s cubic-bezier(.2, 1.4, .4, 1), denBreathe 3.2s 0.7s ease-in-out infinite; filter: drop-shadow(0 0 18px rgba(255, 216, 74, 0.9)) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.55)); }

/* name plate, top left */
.den-plate { position: absolute; left: 3%; top: 3%; max-width: 58%; padding: 8px 12px 9px; border-radius: 14px; background: rgba(12, 6, 24, 0.78); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.45); }
.den-plate b { display: block; font: 900 19px/1.05 'Cinzel', serif; color: var(--gold2); text-shadow: 0 2px 0 #000; }
.den-plate .rar { display: block; margin: 2px 0 5px; font-size: 11.5px; font-style: normal; font-weight: 900; }
.den-lvl { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: #f3e6c8; white-space: nowrap; }
.den-lvl .pc-xp { flex: 1; min-width: 50px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.25); }
.den-lvl .pc-xp i { display: block; height: 100%; background: linear-gradient(90deg, #1a9a5a, #4fe08a 70%, #d0ffe0); }

/* the collar showpiece, top right: grander the rarer it is */
.den-collar { position: absolute; right: 3%; top: 3%; width: 21%; aspect-ratio: 1; border: 0; border-radius: 16px; padding: 6px; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, rgba(60, 40, 90, 0.95), rgba(14, 8, 28, 0.95)); box-shadow: inset 0 0 0 2px var(--ccol, rgba(255, 210, 130, 0.4)), 0 0 0 3px #120a1c, 0 0 0 4px var(--ccol, rgba(255, 210, 130, 0.25));
  --ccol: rgba(255, 210, 130, 0.45); }
.den-collar img { width: 100%; height: 78%; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6)); }
.den-collar span { display: grid; place-items: center; height: 78%; font: 900 28px 'Spectral', serif; color: rgba(255, 210, 130, 0.6); }
.den-collar small { display: block; margin-top: -2px; font: 900 9.5px 'Spectral', serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ccol); }
.den-collar.r-none { background: rgba(12, 6, 24, 0.6); box-shadow: inset 0 0 0 2px rgba(255, 210, 130, 0.35); outline: 2px dashed rgba(255, 210, 130, 0.35); outline-offset: -6px; }
.den-collar.r-uncommon { --ccol: #5fe08a; }
.den-collar.r-rare { --ccol: #4aa8ff; box-shadow: inset 0 0 0 2px var(--ccol), 0 0 0 3px #120a1c, 0 0 14px var(--ccol); }
.den-collar.r-epic { --ccol: #c07bff; box-shadow: inset 0 0 0 2px var(--ccol), 0 0 0 3px #120a1c, 0 0 18px var(--ccol); animation: collarPulse 2.4s ease-in-out infinite; }
.den-collar.r-legendary, .den-collar.r-unique { --ccol: #ffd27a; background: radial-gradient(circle at 50% 40%, rgba(120, 80, 20, 0.95), rgba(30, 14, 4, 0.95));
  box-shadow: inset 0 0 0 2px #ffe08a, 0 0 0 3px #3a1d00, 0 0 0 5px #c8902a, 0 0 26px rgba(255, 190, 80, 0.85); animation: collarPulse 2s ease-in-out infinite; }
.den-collar.r-legendary::before, .den-collar.r-unique::before { content: ''; position: absolute; inset: -18%; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 220, 140, 0.35) 0 8deg, transparent 8deg 24deg); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); animation: spin 9s linear infinite; }
@keyframes collarPulse { 50% { filter: brightness(1.18); } }

/* actions, along the bottom of the stage */
.den-acts { position: absolute; left: 0; right: 0; bottom: 2.5%; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 0 10px; }
.den-comp { padding: 6px 14px; border-radius: 12px; font: 900 12px 'Spectral', serif; color: #3dffa0; background: rgba(10, 6, 20, 0.75); box-shadow: inset 0 0 0 1px rgba(61, 255, 160, 0.5); }
.den-acts .btn { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; white-space: nowrap; }
.den-acts .btn .ic { width: 16px; height: 16px; }

/* powers as illuminated cards, traits and the treat basket */
.den-h { margin: 16px 14px 8px; font: 900 15px 'Cinzel', serif; color: var(--gold2); }
.den-h small { margin-left: 6px; font: 800 11.5px 'Spectral', serif; color: var(--muted); }
.den-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 12px; }
.den-card { animation: cardDeal 0.5s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: calc(var(--i) * 0.08s); }
.den-card .pc-art.contain { background-size: 92% auto; background-position: 50% 75%; background-color: #2b1c3c;
  background-image: var(--a), radial-gradient(circle at 50% 60%, #4a3268, #1c1028); background-size: 92% auto, cover; background-repeat: no-repeat; }
.den-kind { position: absolute; left: 50%; top: 2.5%; transform: translateX(-50%); padding: 1px 6px; border-radius: 6px; font: 900 6.5cqw/1.3 'Spectral', serif; font-style: normal;
  letter-spacing: 0.06em; text-transform: uppercase; color: #3b1f08; background: rgba(255, 240, 205, 0.92); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); white-space: nowrap; }
.den-card.locked .pc-art { filter: grayscale(0.9) brightness(0.5); }
.den-lock { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px;
  font: 900 7.5cqw/1 'Spectral', serif; font-style: normal; color: #f3e6c8; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.den-lock .ic { width: 22cqw; height: 22cqw; }
.den-card.ready { filter: drop-shadow(0 0 10px rgba(255, 215, 120, 0.9)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)); animation: cardDeal 0.5s both, readyPulse 1.6s ease-in-out infinite; }
@keyframes readyPulse { 50% { transform: translateY(-3px) scale(1.03); } }
.den-traits { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; padding: 0 12px; }
.den-trait { display: flex; flex-direction: column; padding: 7px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px var(--line); }
.den-trait b { font-size: 13px; } .den-trait small { font-size: 11.5px; font-weight: 800; color: var(--muted); }
.den-trait.open { align-items: center; justify-content: center; min-height: 44px; font-size: 12px; font-weight: 800; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); outline: 1px dashed rgba(255, 255, 255, 0.15); outline-offset: -5px; }
.den-trait.r-uncommon { box-shadow: inset 0 0 0 1px #5fe08a; } .den-trait.r-rare { box-shadow: inset 0 0 0 1px #4aa8ff; }
.den-trait.r-epic { box-shadow: inset 0 0 0 1px #c07bff; } .den-trait.r-legendary { box-shadow: inset 0 0 0 1px #ffb340; }
.den-basket { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 12px; margin: 0 12px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(120, 72, 30, 0.35), rgba(60, 34, 12, 0.45)); box-shadow: inset 0 0 0 2px rgba(200, 144, 42, 0.45); }
.den-basket .muted { margin: 6px 4px; font-size: 13px; }
.den-treat { width: 58px; height: 58px; padding: 6px; border: 0; border-radius: 14px; cursor: grab; touch-action: none; background: rgba(0, 0, 0, 0.3); box-shadow: inset 0 0 0 1.5px var(--tc, rgba(255, 255, 255, 0.2)); }
.den-treat img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.den-treat.r-uncommon { --tc: #5fe08a; } .den-treat.r-rare { --tc: #4aa8ff; } .den-treat.r-epic { --tc: #c07bff; } .den-treat.r-legendary { --tc: #ffb340; }
.treat-ghost { position: fixed; z-index: 90; width: 70px; height: 70px; object-fit: contain; pointer-events: none; transform: translate(-50%, -60%) scale(1.15); filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.6)); }
.den-foot { display: flex; justify-content: center; margin: 18px 0 6px; }

/* collar chooser and all-pets grid (in a popup) */
.den-collars { text-align: left; }
.den-collars h2 { text-align: center; }
.collar-show { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 8px 0 12px; padding: 14px; border-radius: 16px; text-align: center;
  background: radial-gradient(circle at 50% 30%, rgba(80, 56, 120, 0.6), rgba(10, 6, 20, 0.6)); box-shadow: inset 0 0 0 1.5px var(--ccol, rgba(255, 210, 130, 0.45)); }
.collar-show img { width: 110px; height: 110px; object-fit: contain; filter: drop-shadow(0 0 16px var(--ccol, transparent)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)); }
.collar-show b { font: 900 17px 'Cinzel', serif; color: var(--gold2); } .collar-show small { color: var(--muted); font-weight: 700; }
.collar-show.r-rare { --ccol: #4aa8ff; } .collar-show.r-epic { --ccol: #c07bff; } .collar-show.r-legendary, .collar-show.r-unique { --ccol: #ffd27a; }
.den-allgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 8px; margin: 10px 0 18px; }
.den-allgrid .den-rest { width: 100%; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.6)); }

/* Den v2: everything on one screen. A shorter stage with the treat basket right under the pet, then the
   actions and the power cards; traits below. */
.den-stage { aspect-ratio: auto; height: min(54vh, 470px); max-height: none; background-position: center 66%; }
.den-hero { bottom: 15%; height: 62%; width: auto; aspect-ratio: 1; }
.den-pets { position: absolute; left: 3%; top: calc(3% + 84px); display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 8px; border: 0; border-radius: 12px; cursor: pointer;
  font: 900 12.5px 'Spectral', serif; color: #f3e6c8; background: rgba(12, 6, 24, 0.78); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.5); }
.den-pets .ic { width: 18px; height: 18px; }
.den-pets b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; color: #2a1600; background: linear-gradient(180deg, #ffe58a, #f2a93b); }
.den-stage .den-basket { position: absolute; left: 3%; right: 3%; bottom: 2.5%; margin: 0; padding: 6px 8px; display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none;
  border-radius: 14px; background: linear-gradient(180deg, rgba(90, 52, 20, 0.85), rgba(46, 26, 8, 0.9)); box-shadow: inset 0 0 0 2px rgba(200, 144, 42, 0.6), 0 4px 10px rgba(0, 0, 0, 0.5); }
.den-stage .den-basket::-webkit-scrollbar { display: none; }
.den-stage .den-treat { flex: none; width: 48px; height: 48px; padding: 5px; }
.den-notreat { padding: 8px 6px; font: 800 12px 'Spectral', serif; color: rgba(243, 230, 200, 0.8); }
.den-acts { position: static; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 10px 10px 4px; }
.den-cards { margin-top: 6px; }
.den-rest.on { filter: drop-shadow(0 0 10px rgba(255, 215, 120, 0.95)); }
.comp-dot.inline { position: static; display: inline-block; vertical-align: middle; width: 9px; height: 9px; border-radius: 50%; background: #3dffa0; box-shadow: 0 0 6px #3dffa0; margin-right: 4px; }
.den-shop { flex: none; margin-left: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 56px; height: 48px; border: 0; border-radius: 12px; cursor: pointer;
  font: 900 10px 'Spectral', serif; color: #2a1600; background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 1.5px #3a1d00, 0 2px 0 #7a4a10; }
.den-shop .ic { width: 20px; height: 20px; }
.den-cards { display: flex; justify-content: center; }
.den-cards .den-card { flex: 0 0 23%; }

/* Den lettering: no plain UI font anywhere. Names are illuminated Uncial, labels are Cinzel, and
   sentences are set in Spectral, a crisp book face. */
.den-plate b { font: 400 22px/1.05 'Uncial Antiqua', 'Cinzel', serif; color: #ffe9a8; text-shadow: 0 2px 0 #000, 0 0 10px rgba(255, 190, 80, 0.35); }
.den-plate b::first-letter { color: #ff6a6a; font-size: 1.2em; text-shadow: 0 0 1px #c8902a, 0 2px 0 #000, 0 0 6px rgba(255, 120, 80, 0.5); }
.den-plate .rar { font: 700 11.5px 'Cinzel', serif; letter-spacing: 0.04em; }
.den-lvl { font: 700 12px 'Cinzel', serif; letter-spacing: 0.02em; }
.den-pets, .den-comp, .den-shop, .den-notreat { font-family: 'Cinzel', serif; font-weight: 700; letter-spacing: 0.02em; }
.den-pets { font-size: 12px; } .den-comp { font-size: 12px; } .den-shop { font-size: 9.5px; } .den-notreat { font-size: 12px; }
.den-collar small { font: 700 9px 'Cinzel', serif; letter-spacing: 0.08em; }
.den-kind { font-family: 'Cinzel', serif; font-weight: 700; letter-spacing: 0.04em; }
.den-lock { font-family: 'Cinzel', serif; font-weight: 700; }
.den-h small { font: 700 11px 'Cinzel', serif; letter-spacing: 0.02em; text-transform: none; }
.den-trait b { font: 700 13px 'Cinzel', serif; color: var(--gold2); }
.den-trait small { font: 700 11.5px/1.2 'Spectral', serif; color: #e8dcc0; }
.den-trait.open { font: 700 12px 'Cinzel', serif; }
.den-allgrid .den-rest small { font: 700 10px 'Cinzel', serif; }
/* card and treat descriptions read like a book */
.perk-zoom .pz-desc { font: 700 16px/1.3 'Spectral', serif; color: #f3e6c8; }
.perk-zoom .pz-desc b { font-family: 'Cinzel', serif; font-size: 15px; color: var(--gold2); }
.perk-zoom .pz-desc small { font-size: 15px; }
.den-plate, .den-pets, .den-collar { z-index: 3; }
.den-hero { z-index: 1; }
.den-badge { position: absolute; right: 10px; top: 9px; padding: 2px 7px; border-radius: 8px; font: 700 9.5px 'Cinzel', serif; font-style: normal; letter-spacing: 0.04em;
  color: #0d2a1c; background: linear-gradient(180deg, #8affc4, #3dffa0); box-shadow: 0 0 8px rgba(61, 255, 160, 0.5); }
.den-plate { padding-right: 12px; min-width: 52%; }
.den-hero .den-shadow { bottom: calc(var(--feet, 0px) - 3%); }
.den-stage { background-position: center 86%; }

/* ---------- the Pet Market ---------- */
#market { background: #120a1c; }
.mk-stall { position: relative; aspect-ratio: 16 / 10; background: url(../assets/den/market.jpg) center 60% / cover no-repeat;
  box-shadow: inset 0 -40px 40px -20px #120a1c, inset 0 30px 30px -20px #120a1c; }
.mk-sign { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-radius: 14px; white-space: nowrap;
  background: rgba(12, 6, 24, 0.82); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.5), 0 4px 12px rgba(0, 0, 0, 0.5); }
.mk-sign b { font: 700 13px 'Cinzel', serif; color: var(--gold2); }
.mk-sign .btn { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; }
.mk-sign .btn .ic, .mk-price .ic { width: 16px; height: 16px; }
.mk-pets { display: flex; flex-direction: column; gap: 10px; padding: 0 12px; }
.mk-pet { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(60, 40, 90, 0.55), rgba(16, 10, 30, 0.85)); box-shadow: inset 0 0 0 1.5px var(--rcol, rgba(255, 210, 130, 0.35)); }
.mk-pet-art { width: 84px; height: 84px; border-radius: 14px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--rcol, #8a7ab0) 40%, #2a1a40), #120a1c 75%); }
.mk-pet-art img { width: 92%; height: 92%; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.6)); }
.mk-pet-text { min-width: 0; }
.mk-pet-text b, .mk-good b { display: block; font: 700 16px 'Cinzel', serif; color: var(--gold2); }
.mk-pet .rar, .mk-good .rar { display: block; font: 700 11px 'Cinzel', serif; font-style: normal; letter-spacing: 0.04em; margin: 1px 0 3px; }
.mk-pet-text p, .mk-good p { margin: 0; font: 700 13px/1.25 'Spectral', serif; color: #e8dcc0; }
.mk-pet-text p span { font-family: 'Cinzel', serif; font-size: 12px; color: var(--gold2); }
.mk-good p small { font: 700 11px 'Cinzel', serif; color: var(--muted); }
.mk-buy { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mk-price { display: inline-flex; align-items: center; gap: 4px; font: 700 17px 'Cinzel', serif; color: #cfe6ff; }
.mk-price.short { color: #ff8a9a; }
.mk-goods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 12px; }
.mk-good { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 12px 10px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(60, 40, 90, 0.5), rgba(16, 10, 30, 0.85)); box-shadow: inset 0 0 0 1.5px var(--rcol, rgba(255, 210, 130, 0.35)); }
.mk-good-art { width: 76px; height: 76px; margin-bottom: 4px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, color-mix(in srgb, var(--rcol, #8a7ab0) 45%, #2a1a40), transparent 70%); }
.mk-good-art img { width: 86%; height: 86%; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6)); }
.mk-good .mk-buy { margin-top: auto; padding-top: 8px; }
.mk-good.sold { opacity: 0.5; }
.mk-sold { margin-top: auto; padding-top: 8px; font: 700 14px 'Cinzel', serif; color: var(--muted); }
.mk-note { text-align: center; margin: 16px 16px 0; font: 700 12.5px 'Spectral', serif; }
.mk-pet.r-uncommon, .mk-good.r-uncommon { --rcol: #5fe08a; } .mk-pet.r-rare, .mk-good.r-rare { --rcol: #4aa8ff; }
.mk-pet.r-epic, .mk-good.r-epic { --rcol: #c07bff; } .mk-pet.r-legendary, .mk-good.r-legendary { --rcol: #ffb340; box-shadow: inset 0 0 0 1.5px #ffb340, 0 0 18px rgba(255, 179, 64, 0.35); }

/* ---------- the living camp: your pet by the fire ---------- */
.camp-spots > i { position: absolute; pointer-events: none; font-style: normal; }
.camp-glow { left: 51%; top: 57%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; mix-blend-mode: screen;
  background: radial-gradient(circle, rgba(255, 170, 60, 0.45), rgba(255, 120, 30, 0.12) 45%, transparent 70%); animation: campFlicker 2.3s ease-in-out infinite; }
@keyframes campFlicker { 0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); } 23% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  41% { opacity: 0.7; } 67% { opacity: 0.95; transform: translate(-50%, -50%) scale(1.02); } }
.camp-ember { left: 51%; top: 56%; width: 4px; height: 4px; border-radius: 50%; background: #ffcf6a; box-shadow: 0 0 6px 2px rgba(255, 140, 40, 0.8);
  opacity: 0; animation: campEmber 3.2s ease-out infinite; }
.camp-ember:nth-of-type(2) { animation-delay: 0.5s; --dx: -18px; } .camp-ember:nth-of-type(3) { animation-delay: 1.1s; --dx: 14px; }
.camp-ember:nth-of-type(4) { animation-delay: 1.7s; --dx: -8px; } .camp-ember:nth-of-type(5) { animation-delay: 2.2s; --dx: 22px; }
.camp-ember:nth-of-type(6) { animation-delay: 2.8s; --dx: -24px; } .camp-ember:nth-of-type(7) { animation-delay: 0.2s; --dx: 6px; }
@keyframes campEmber { 0% { opacity: 0; transform: translate(0, 0); } 10% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx, 10px), -130px) scale(0.4); } }
.camp-fly { width: 5px; height: 5px; border-radius: 50%; background: #fff6a8; box-shadow: 0 0 8px 3px rgba(240, 255, 140, 0.55); animation: campFly 7s ease-in-out infinite; }
.camp-fly:nth-of-type(8) { left: 12%; top: 22%; } .camp-fly:nth-of-type(9) { left: 68%; top: 12%; animation-delay: -2s; animation-duration: 9s; }
.camp-fly:nth-of-type(10) { left: 88%; top: 48%; animation-delay: -4s; } .camp-fly:nth-of-type(11) { left: 40%; top: 38%; animation-delay: -1s; animation-duration: 8s; }
.camp-fly:nth-of-type(12) { left: 8%; top: 60%; animation-delay: -5s; } .camp-fly:nth-of-type(13) { left: 62%; top: 88%; animation-delay: -3s; animation-duration: 10s; }
.camp-fly:nth-of-type(14) { left: 33%; top: 8%; animation-delay: -6s; }
@keyframes campFly { 0%, 100% { opacity: 0; transform: translate(0, 0); } 20% { opacity: 1; } 50% { transform: translate(18px, -14px); opacity: 0.6; }
  75% { opacity: 1; transform: translate(-10px, -26px); } }
.camp-pet { position: absolute; width: 30%; aspect-ratio: 1; transform: translate(-50%, -100%); border: 0; padding: 0; background: none; cursor: pointer; }
.camp-pet img { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; transform-origin: 50% 100%;
  filter: drop-shadow(5px 0 8px rgba(255, 150, 50, 0.45)) drop-shadow(0 6px 6px rgba(0, 0, 0, 0.5)); animation: denBreathe 3.2s ease-in-out infinite, campPetLook 9s ease-in-out infinite; }
.camp-pet img.joy { animation: denJoy 0.6s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes campPetLook { 0%, 86%, 100% { translate: 0 0; } 90% { translate: 0 -6%; } 94% { translate: 0 0; } }
.camp-pet .cp-shadow { position: absolute; left: 22%; right: 22%; bottom: -3%; height: 10%; border-radius: 50%; background: radial-gradient(rgba(0, 0, 0, 0.5), transparent 70%); }
.camp-pet .cp-label { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 6px); font: 900 12px 'Cinzel', serif; color: #fff4dc; padding: 2px 8px; border-radius: 8px;
  background: rgba(10, 5, 20, 0.75); text-shadow: 0 1px 2px #000; white-space: nowrap; }
.camp-pet > b { position: absolute; top: 8%; right: 8%; 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; }
/* the plaque buttons stack their text: Set Out keeps its label, gem and stage number on one line */
#camp-go { flex-direction: row !important; padding: 0 16px !important; height: 56px; gap: 10px; }
#camp-go b { margin-left: -4px; }

/* ---------- the Perks page: level, deck slots, what the deck does, the collection ---------- */
.pk-head { margin: 6px 4px 14px; text-align: center; }
.pk-level { display: block; font: 900 26px 'Cinzel', serif; color: var(--gold2); text-shadow: 0 2px 0 #000; }
.pk-xp { height: 10px; margin: 8px auto 6px; max-width: 320px; border-radius: 5px; background: rgba(0, 0, 0, 0.5); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.35); overflow: hidden; }
.pk-xp i { display: block; height: 100%; background: linear-gradient(90deg, #8a5cff, #c9a0ff); }
.pk-head small { font-weight: 800; color: var(--muted); }
.pk-pick { display: block; margin: 0 auto 16px; }
.pk-h { margin: 18px 4px 8px; font: 900 16px 'Cinzel', serif; color: #f3e6c8; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pk-h small { font: 800 12px 'Spectral', serif; color: var(--muted); }
.pk-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pk-slots.pk-legend { grid-template-columns: repeat(4, 1fr); }
.pk-slot.empty, .pk-slot.locked { aspect-ratio: 742 / 1131; border-radius: 12px; display: grid; place-items: center; text-align: center;
  font: 800 12px 'Spectral', serif; color: var(--muted); background: rgba(10, 6, 20, 0.55); box-shadow: inset 0 0 0 1.5px rgba(255, 210, 130, 0.35); }
.pk-slot.locked { background: rgba(0, 0, 0, 0.45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); opacity: 0.8; }
.pk-slot.locked b { display: block; font: 900 20px 'Cinzel', serif; color: #cbbfa4; }
.pk-sum { margin-top: 4px; padding: 2px 12px 8px; border-radius: 14px; background: rgba(10, 6, 20, 0.55); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.25); }
.pk-sum .pk-h { margin: 12px 0 6px; }
.pk-sum p { margin: 0 0 8px; font-weight: 700; font-size: 14px; line-height: 1.35; color: #e8dcc0; }
.pk-sum p b { color: var(--gold2); margin-right: 4px; }
.pk-own { position: relative; }
.pk-own.on .pcard { filter: drop-shadow(0 0 10px rgba(255, 215, 130, 0.75)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)); }
.pk-own em { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); padding: 2px 8px; border-radius: 9px; white-space: nowrap; pointer-events: none;
  font: 900 10px 'Spectral', serif; font-style: normal; color: #2a1600; background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 1px #3a1d00; }
#modal .perk-deal .perk-grid { max-height: 60vh; overflow-y: auto; padding: 6px 2px; }
.pk-slot span { display: block; text-align: center; }

/* ---------- the Campfire: level and power by the fire, kit, stats, records ---------- */
#hero { background: #120a1c; }
.hero-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 24px; }
.hs-fire { position: relative; height: 230px; overflow: hidden; display: flex; align-items: flex-end; justify-content: center;
  background: url(../assets/scenes/camp-living.jpg) 51% 62% / 260% auto no-repeat; box-shadow: inset 0 -60px 40px -20px #120a1c, inset 0 30px 30px -20px #120a1c; }
.hs-glow { position: absolute; left: 50%; top: 52%; width: 70%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(rgba(255, 170, 60, 0.35), transparent 65%); mix-blend-mode: screen; animation: campFlicker 2.4s ease-in-out infinite; }
@keyframes campFlicker { 30% { opacity: 0.75; } 55% { opacity: 1; } 80% { opacity: 0.85; } }
.hs-title { position: relative; width: min(320px, 86%); margin-bottom: 8px; padding: 10px 16px; border-radius: 16px; text-align: center;
  background: rgba(14, 8, 26, 0.72); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.35); backdrop-filter: blur(3px); }
.hs-title > b { display: block; font: 900 26px 'Cinzel', serif; color: var(--gold2); text-shadow: 0 2px 0 #000; }
.hs-xp { height: 8px; margin: 6px 0; border-radius: 4px; background: rgba(0, 0, 0, 0.55); overflow: hidden; }
.hs-xp i { display: block; height: 100%; background: linear-gradient(90deg, #8a5cff, #c9a0ff); }
.hs-title small { font-weight: 800; color: #e8dcc0; } .hs-title small b { color: var(--gold2); }
.hs-body { padding: 4px 12px 0; max-width: 560px; margin: 0 auto; }
.hs-kit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.hs-kit-i { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 0; border-radius: 14px; cursor: pointer; text-align: center;
  background: rgba(10, 6, 20, 0.6); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.3); color: #f3e6c8; min-width: 0; }
.hs-kit-i:active { transform: scale(0.97); }
.hs-kit-i img { width: 60px; height: 60px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)); }
.hs-kit-i img.card { width: 42px; border-radius: 6px; object-fit: cover; }
.hs-kit-i small { font: 800 11px 'Spectral', serif; color: var(--muted); margin-top: 2px; }
.hs-kit-i b { font: 900 13px 'Spectral', serif; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.hs-stat { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(10, 6, 20, 0.55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.hs-gem { width: 30px; height: 30px; object-fit: contain; flex: none; }
.hs-stat span { display: flex; flex-direction: column; min-width: 0; }
.hs-stat small { font: 800 11px 'Spectral', serif; color: var(--muted); }
.hs-stat b { font: 900 18px 'Cinzel', serif; color: #f3e6c8; }
.hs-recs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hs-rec { padding: 10px 6px; border-radius: 12px; text-align: center; background: rgba(10, 6, 20, 0.55); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.22); }
.hs-rec b { display: block; font: 900 20px 'Cinzel', serif; color: var(--gold2); }
.hs-rec small { font: 800 11px/1.2 'Spectral', serif; color: var(--muted); }
.hs-kit-i { justify-content: center; }
.hs-kit-i b { white-space: normal; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------- badges: an emblem inside a ring of bronze, silver or gold (dim and plain until earned) ---------- */
.bmedal { position: relative; display: inline-grid; place-items: center; width: 56px; aspect-ratio: 1; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 50% 40%, #2c1d44, #120a1c 70%); box-shadow: 0 0 0 3px #3a3248, 0 0 0 5px #1b1526, 0 4px 8px rgba(0, 0, 0, 0.6); }
.bmedal img { width: 66%; height: 66%; object-fit: contain; border-radius: 0; filter: grayscale(1) brightness(0.55); opacity: 0.7; }
.bmedal img[src$=".jpg"] { border-radius: 50%; object-fit: cover; }
.bmedal.t1, .bmedal.t2, .bmedal.t3 { box-shadow: 0 0 0 3px var(--m1), 0 0 0 5px var(--m2), 0 0 12px var(--glow), 0 4px 8px rgba(0, 0, 0, 0.6); }
.bmedal.t1 img, .bmedal.t2 img, .bmedal.t3 img { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); opacity: 1; }
.bmedal.t1 { --m1: #d08a4a; --m2: #6e3a14; --glow: rgba(208, 138, 74, 0.35); }
.bmedal.t2 { --m1: #e6ecf5; --m2: #7d8798; --glow: rgba(220, 230, 245, 0.4); }
.bmedal.t3 { --m1: #ffd96a; --m2: #a8701a; --glow: rgba(255, 210, 100, 0.55); }
.hs-badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 6px; }
.hs-badge { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: none; cursor: pointer; color: #f3e6c8; min-width: 0; }
.hs-badge:active { transform: scale(0.96); }
.hs-badge > b { font: 800 11px/1.15 'Spectral', serif; text-align: center; }
.hs-badge > small { font: 700 10px/1.15 'Spectral', serif; color: var(--muted); text-align: center; padding: 0 2px; }
.hb-bar { display: block; width: 70%; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
.hb-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a5cff, #c9a0ff); }
.badge-zoom { text-align: center; }
.badge-zoom .bmedal { width: 110px; margin: 6px auto 10px; animation: cardZoom 0.35s cubic-bezier(.2, 1.3, .4, 1) both; }
.badge-zoom h2 { margin: 0 !important; }
.bz-tiers { margin: 12px 0 4px; text-align: left; }
.bz-tiers p { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 8px 10px; border-radius: 10px; background: rgba(10, 6, 20, 0.5); font-weight: 700; color: #c9bfae; }
.bz-tiers p b { width: 52px; flex: none; font: 900 12px 'Cinzel', serif; }
.bz-tiers p span { flex: 1; font-size: 13px; line-height: 1.25; }
.bz-tiers p em { font-style: normal; font-weight: 900; color: var(--gold2); white-space: nowrap; }
.bz-tiers p.done { color: #f3e6c8; box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.45); }
.bz-tiers p.done b { color: var(--gold2); }
.v-badge { display: flex; align-items: center; gap: 10px; margin: 8px auto; max-width: 300px; padding: 6px 12px 6px 6px; border-radius: 40px; text-align: left;
  background: rgba(10, 6, 20, 0.7); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.4); animation: cardZoom 0.4s 0.4s cubic-bezier(.2, 1.3, .4, 1) both; }
.v-badge .bmedal { width: 40px; }
.v-badge > span:not(.bmedal) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.v-badge small { font: 800 10px 'Spectral', serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.v-badge b { font: 900 14px 'Cinzel', serif; color: #f3e6c8; }
.v-badge em { font-style: normal; font-weight: 900; color: var(--gold2); white-space: nowrap; }
.badge-toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 64px); z-index: 300; width: min(92vw, 320px); transform: translateX(-50%); pointer-events: none;
  animation: badgeToast 3.2s ease-in-out both; }
.badge-toast .v-badge { margin: 0; max-width: none; animation: none; background: rgba(14, 8, 26, 0.95); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.55), 0 8px 20px rgba(0, 0, 0, 0.6); }
@keyframes badgeToast { 0% { opacity: 0; transform: translate(-50%, -20px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -10px); } }
.bmedal { height: 56px; }
.badge-zoom .bmedal { display: grid; height: 110px; }
.v-badge .bmedal { height: 40px; }

/* ---------- camp, polished: the painting runs edge to edge, the header floats over it, and each
   place is a gold-rimmed medallion with an engraved plaque ---------- */
#camp { padding-top: 0; }
.topbar.camp-top { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 26px; margin-bottom: -16px;
  background: linear-gradient(180deg, rgba(8, 4, 20, 0.92) 0%, rgba(8, 4, 20, 0.7) 55%, rgba(8, 4, 20, 0) 100%); }
.topbar.camp-top h2 { text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9); }
.camp-bottom { background: linear-gradient(0deg, rgba(8, 4, 20, 0.9), rgba(8, 4, 20, 0.5) 60%, transparent); }
.spot { gap: 5px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55)); }
.spot i { width: 54px; height: 54px; border: 2.5px solid transparent;
  background: radial-gradient(circle at 42% 30%, #5a3a9a, #22113f 58%, #120826 100%) padding-box,
    linear-gradient(160deg, #fff3c4, #e8b84a 30%, #9a6414 62%, #f6d27a 100%) border-box;
  box-shadow: 0 0 0 1.5px rgba(26, 14, 48, 0.9), inset 0 2px 6px rgba(255, 255, 255, 0.18), inset 0 -4px 8px rgba(0, 0, 0, 0.45); }
.spot i .ic { width: 36px; height: 36px; }
.spot i::after { inset: -3px; box-shadow: 0 0 0 2px rgba(255, 240, 176, 0.9), 0 0 22px rgba(255, 210, 120, 0.75); }
.spot span { font-size: 12.5px; letter-spacing: 0.04em; padding: 3px 10px 4px; border-radius: 7px; color: #fff1d0;
  background: linear-gradient(180deg, rgba(40, 22, 70, 0.92), rgba(14, 7, 30, 0.92));
  box-shadow: inset 0 0 0 1px rgba(232, 184, 74, 0.55), 0 0 0 1px rgba(10, 5, 20, 0.8); text-shadow: 0 1px 0 #000; }
.spot b { top: -3px; right: -5px; box-shadow: 0 0 0 2px #1a0e30, 0 2px 4px rgba(0, 0, 0, 0.5); }
.spot:hover i { filter: brightness(1.12); }
/* tablets: the whole painting shows, so the places grow with it */
@media (min-width: 700px) {
  .spot i { width: 74px; height: 74px; border-width: 3px; }
  .spot i .ic { width: 50px; height: 50px; }
  .spot span { font-size: 16px; padding: 4px 14px 5px; border-radius: 9px; }
  .spot b { min-width: 24px; height: 24px; line-height: 24px; font-size: 14px; border-radius: 12px; }
  .camp-pet .cp-label { font-size: 16px; }
}

/* ---------- Moonstone respecs and the Den backdrop picker ---------- */
button.den-trait { border: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
button.den-trait:active { transform: scale(0.97); }
.collar-btns { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.collar-btns .btn { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; min-width: 116px; }
.collar-btns .btn .ic { width: 16px; height: 16px; }
.den-bds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.den-bd { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border-radius: 14px; background: rgba(10, 6, 20, 0.55); box-shadow: inset 0 0 0 1px var(--line); }
.den-bd.on { box-shadow: inset 0 0 0 2px var(--gold2), 0 0 14px rgba(255, 210, 120, 0.35); }
.den-bd .db-art { width: 100%; aspect-ratio: 3 / 4; border-radius: 10px; background: center 70% / cover no-repeat; }
.den-bd b { font: 900 13px 'Cinzel', serif; color: #f3e6c8; text-align: center; }
.den-bd small { font-weight: 800; color: var(--gold2); padding: 6px 0; }
/* the longer Pet titles stay on one line on small phones */
#market .topbar h2, #den .topbar h2 { white-space: nowrap; font-size: clamp(15px, 4.4vw, 20px); }
/* a picture's own size boost (artScale), from the feet */
.den-hero img, .camp-pet img { scale: var(--ps, 1); }
/* the Moonstone balance in the corner of any window where Moonstones can be spent */
.moon-purse { position: absolute; top: 12px; right: 14px; z-index: 2; display: flex; align-items: center; gap: 5px; padding: 4px 10px 4px 6px; border-radius: 14px;
  background: rgba(10, 6, 20, 0.75); box-shadow: inset 0 0 0 1px rgba(190, 200, 255, 0.45); font: 900 14px 'Spectral', serif; color: #e6ecff; pointer-events: none; }
.moon-purse .ic { width: 20px; height: 20px; }
.modal-card { position: relative; }
/* the pet by the fire: sized to sit on its cushion, not tower over the camp */
.camp-pet { width: 21%; }
@media (min-width: 700px) { .camp-pet { width: 19%; } }

/* ---------- floating text, polished: every line is a thick dark outline (the line itself) with its colour
   or gold laid on top (its ::after), so letters stay crisp over gems, art and effects ---------- */
.ftext { text-shadow: none; --ink: #1c0b02; --fill: #fff; letter-spacing: 0.02em; line-height: 1.02; }
.ftext .ln { position: relative; display: block; text-align: center; color: var(--ink) !important; -webkit-text-stroke: 0.2em var(--ink); }
.ftext .ln::after { content: attr(data-t); position: absolute; left: 0; right: 0; top: 0; -webkit-text-stroke: 0; color: var(--fill); }
.ftext .ln.sub { font-size: 0.46em; letter-spacing: 0.16em; text-transform: uppercase; margin-top: 0.12em; }
/* gilded: a gold fill with a light sweeping across it once */
.ftext.banner, .ftext.combo, .ftext.crit-banner { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: inherit; }
.banner, .combo, .crit-banner, .num.dmg.crit { --ink: #2a1000;
  --grad: linear-gradient(180deg, #fffbe8 0%, #ffe48e 36%, #f4b63e 52%, #c9781a 74%, #ffd978 100%); }
.banner .ln::after, .combo .ln::after, .crit-banner .ln::after, .num.dmg.crit .ln::after {
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.95) 50%, transparent 58%) no-repeat, var(--grad);
  background-size: 260% 100%, 100% 100%; background-position: 160% 0, 0 0;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: textShine 1.1s 0.25s ease-in-out both; }
@keyframes textShine { from { background-position: 160% 0, 0 0; } to { background-position: -60% 0, 0 0; } }
.banner { font-size: 50px; letter-spacing: 0.04em; filter: drop-shadow(0 4px 0 rgba(20, 6, 0, 0.9)) drop-shadow(0 0 24px rgba(255, 180, 70, 0.7)); }
.banner.small { font-size: 34px; }
.banner .ln.sub { --grad: linear-gradient(180deg, #fffdf3, #ffe9b0 60%, #e8b860); }
.banner.defeat { --ink: #2a0008; --grad: linear-gradient(180deg, #ffe6e6 0%, #ff8a9a 40%, #e0203c 60%, #7a0018 100%);
  filter: drop-shadow(0 4px 0 rgba(30, 0, 6, 0.9)) drop-shadow(0 0 24px rgba(255, 40, 70, 0.6)); }
.combo { filter: drop-shadow(0 3px 0 rgba(20, 6, 0, 0.9)) drop-shadow(0 0 18px rgba(255, 170, 60, 0.7)); }
.combo.c4, .combo.c5 { --ink: #2a0040; --grad: linear-gradient(180deg, #fff 0%, #ffc8f4 40%, #c056ff 70%, #f0b0ff 100%);
  filter: drop-shadow(0 3px 0 rgba(20, 0, 30, 0.9)) drop-shadow(0 0 22px rgba(200, 80, 255, 0.8)); }
.combo.c6, .combo.c7, .combo.c8 { --ink: #10061e; --grad: linear-gradient(90deg, #ff7a7a, #ffe066, #7aff9e, #7ac0ff, #d47aff);
  filter: drop-shadow(0 3px 0 #000) drop-shadow(0 0 26px rgba(255, 255, 255, 0.75)); }
.crit-banner { filter: drop-shadow(0 3px 0 rgba(30, 8, 0, 0.9)) drop-shadow(0 0 14px rgba(255, 170, 30, 0.85)); }
.combo-sub, .skill-name { --fill: #f2ecff; --ink: #120a24; }
.skill-name { --fill: #d6ecff; --ink: #06162e; text-shadow: none; filter: drop-shadow(0 0 16px rgba(74, 163, 255, 0.8)); }
.skill-name.perk-name { --fill: #ffe9a0; --ink: #2a1000; text-shadow: none; filter: drop-shadow(0 0 16px rgba(255, 179, 64, 0.85)); }
/* numbers: the old thin outline gives way to the thick ink layer */
.num.dmg, .num.dmg.crit, .num.hurt { -webkit-text-stroke: 0; }
.num.dmg { --fill: #fff; --ink: #4a0410; }
.num.dmg.crit { text-shadow: none; filter: drop-shadow(0 0 14px rgba(255, 160, 30, 0.85)); }
.num.hurt { --fill: #ff6a82; --ink: #34000e; }
.num.heal { --fill: #ffb0dc; --ink: #3e0626; }
.num.mana { --fill: #a8d6ff; --ink: #06244a; }
.num.shield { --fill: #9effd4; --ink: #003424; }
.num.gold { --fill: #ffdc5a; --ink: #3a2200; }
.num.burn, .num.burn > span, .ftext.burn { --fill: #ffb070; --ink: #3a1200; }
.num.poison, .ftext.poison { --fill: #b8ff7a; --ink: #143000; }
.crit-label { --fill: #ffe066; --ink: #2e1600; }
.crit-label.weak { --fill: #b8ff7a; --ink: #143000; }
.crit-label.chill { --fill: #a8e4ff; --ink: #062a44; }
.crit-label.block { --fill: #9effd4; --ink: #003424; }
.crit-label.burn { --fill: #ffb070; --ink: #3a1200; }

/* counters: Cinzel numbers with a crisp dark outline (stacked drop-shadows keep the gold gradient) */
.moves b { filter: drop-shadow(1.5px 0 0 #1c0a00) drop-shadow(-1.5px 0 0 #1c0a00) drop-shadow(0 1.5px 0 #1c0a00) drop-shadow(0 -1.5px 0 #1c0a00) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.6)); }
.moves small { font-family: 'Cinzel'; font-weight: 800; color: #e8d8b0; }
.medal b { font-family: 'Cinzel'; font-weight: 900; font-size: 15px; line-height: 1;
  background: linear-gradient(180deg, #fffbe8, #ffe48e 40%, #f0a830 75%, #c97a14); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(1px 0 0 #1c0a00) drop-shadow(-1px 0 0 #1c0a00) drop-shadow(0 1px 0 #1c0a00) drop-shadow(0 -1px 0 #1c0a00) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.medal.shield b { background-image: linear-gradient(180deg, #f0fff8, #9effd4 55%, #2fbf86); }
.bar span { font-family: 'Cinzel'; font-weight: 800; letter-spacing: 0.03em; color: #fff7ea; text-shadow: none;
  filter: drop-shadow(1px 0 0 #200608) drop-shadow(-1px 0 0 #200608) drop-shadow(0 1px 0 #200608) drop-shadow(0 -1px 0 #200608); }

/* ---------- Den v3: the room fills the screen. The pet's details float over it as glass chips, and
   cards, traits and buttons wait in a drawer that pulls up from the bottom ---------- */
#den { padding-top: 0; padding-bottom: 0; --hh: calc(84px + env(safe-area-inset-bottom)); }
#den .topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 28px;
  background: linear-gradient(180deg, rgba(8, 4, 20, 0.85), rgba(8, 4, 20, 0.4) 60%, transparent); border-image: none; transition: opacity 0.4s; }
#den .topbar::after { display: none; }
#den .topbar h2 { text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9); }
#den .den-scroll { position: absolute; inset: 0; overflow: hidden; padding: 0; }
#den .den-stage { position: absolute; inset: 0; width: auto; height: auto; max-height: none; aspect-ratio: auto; margin: 0;
  background-size: cover; background-repeat: no-repeat; box-shadow: inset 0 140px 90px -70px rgba(8, 4, 20, 0.55), inset 0 -200px 120px -80px rgba(8, 4, 20, 0.7); }
#den .den-hero { width: auto; height: min(44vh, 84vw); aspect-ratio: 1; bottom: auto; }
/* the room's own lights flicker, and a few motes drift through the air */
.den-glows i { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(rgba(var(--c), 0.5), rgba(var(--c), 0.18) 35%, rgba(var(--c), 0) 68%); animation: denFlicker 3.4s ease-in-out infinite; animation-delay: calc(var(--d) * -0.7s); }
@keyframes denFlicker { 0%, 100% { opacity: 0.75; } 22% { opacity: 1; } 41% { opacity: 0.6; } 63% { opacity: 0.95; } 80% { opacity: 0.7; } }
.den-motes i { position: absolute; bottom: 18%; width: 4px; height: 4px; border-radius: 50%; opacity: 0; pointer-events: none;
  background: rgba(255, 240, 200, 0.9); box-shadow: 0 0 8px rgba(255, 220, 150, 0.95); animation: denMote 11s linear infinite; }
.den-motes i:nth-child(1) { left: 12%; animation-delay: 0s; } .den-motes i:nth-child(2) { left: 27%; animation-delay: -3s; animation-duration: 13s; }
.den-motes i:nth-child(3) { left: 41%; animation-delay: -7s; } .den-motes i:nth-child(4) { left: 58%; animation-delay: -1.5s; animation-duration: 14s; }
.den-motes i:nth-child(5) { left: 71%; animation-delay: -9s; } .den-motes i:nth-child(6) { left: 86%; animation-delay: -5s; animation-duration: 12s; }
.den-motes i:nth-child(7) { left: 20%; animation-delay: -10s; width: 3px; height: 3px; } .den-motes i:nth-child(8) { left: 64%; animation-delay: -4s; width: 3px; height: 3px; }
.den-motes i:nth-child(9) { left: 93%; animation-delay: -8s; width: 3px; height: 3px; }
@keyframes denMote { 0% { opacity: 0; transform: translate(0, 0); } 12% { opacity: 0.9; } 50% { transform: translate(14px, -30vh); } 85% { opacity: 0.6; } 100% { opacity: 0; transform: translate(-8px, -62vh); } }
/* glass chips over the room */
.den-ui { position: absolute; left: 0; right: 0; top: calc(66px + env(safe-area-inset-top)); z-index: 4; pointer-events: none; transition: opacity 0.4s; }
.den-ui > * { pointer-events: auto; }
#den .den-plate, #den .den-pets, #den .den-collar.r-none, .den-view { background: rgba(14, 8, 28, 0.42); -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: inset 0 0 0 1px rgba(255, 220, 160, 0.38), 0 6px 18px rgba(0, 0, 0, 0.35); }
#den .den-plate { left: 12px; top: 0; max-width: 62%; }
#den .den-pets { left: 12px; top: 86px; }
#den .den-collar { right: 12px; top: 0; width: 72px; }
.den-view { position: absolute; right: 12px; top: 84px; width: 72px; padding: 7px 0; border: 0; border-radius: 12px; cursor: pointer;
  font: 900 12px 'Cinzel', serif; letter-spacing: 0.06em; color: #f3e6c8; }
/* the drawer */
.den-drawer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; max-height: 74%; display: flex; flex-direction: column;
  transform: translateY(calc(100% - var(--hh))); transition: transform 0.38s cubic-bezier(.2, 1, .3, 1), opacity 0.4s;
  border-radius: 22px 22px 0 0; background: linear-gradient(180deg, rgba(18, 10, 36, 0.62), rgba(12, 6, 24, 0.94) 120px);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.4), 0 -10px 30px rgba(0, 0, 0, 0.35); }
.den-drawer.open { transform: none; }
.dd-handle { flex: none; padding: 8px 10px 10px; cursor: pointer; touch-action: none; }
.dd-grip { display: block; width: 44px; height: 5px; margin: 0 auto 8px; border-radius: 3px; background: rgba(255, 230, 180, 0.6); }
.den-drawer .den-basket { position: static; margin: 0; padding: 6px 8px; display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x;
  border-radius: 14px; background: rgba(0, 0, 0, 0.28); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.32); }
.den-drawer .den-basket::-webkit-scrollbar { display: none; }
.den-drawer .den-treat { flex: none; width: 48px; height: 48px; padding: 5px; }
.dd-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 calc(18px + env(safe-area-inset-bottom)); }
.den-drawer .den-acts { position: static; margin: 6px 0 12px; flex-wrap: wrap; }
/* View: just the room and your pet */
#den.viewing .topbar, #den.viewing .den-ui, #den.viewing .den-drawer, #den.viewing .den-preview { opacity: 0; pointer-events: none; }
#den.viewing .den-drawer { transform: translateY(100%); }
/* trying a backdrop before buying it */
.den-preview { position: absolute; left: 12px; right: 12px; bottom: calc(var(--hh) + 12px); z-index: 4; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px;
  border-radius: 16px; background: rgba(14, 8, 28, 0.7); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1.5px rgba(255, 210, 130, 0.6), 0 8px 20px rgba(0, 0, 0, 0.45); }
.den-preview span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.den-preview small { font: 800 10px 'Spectral', serif; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.den-preview b { font: 900 15px 'Cinzel', serif; color: var(--gold2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.den-preview .btn { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.den-preview .btn .ic { width: 16px; height: 16px; }
/* no pets yet: the room alone, with the way to the Market */
#den .den-stage.empty { display: grid; place-items: center; }
#den .den-foot { position: absolute; left: 0; right: 0; bottom: calc(34px + env(safe-area-inset-bottom)); margin: 0; z-index: 4; }
@media (min-width: 700px) {
  #den .den-plate { max-width: 340px; } #den .den-collar, .den-view { width: 92px; } .den-view { top: 108px; } #den .den-pets { top: 104px; }
  .den-drawer { left: 50%; right: auto; width: min(720px, 100%); transform: translate(-50%, calc(100% - var(--hh))); }
  .den-drawer.open { transform: translate(-50%, 0); }
  #den.viewing .den-drawer { transform: translate(-50%, 100%); }
}
#den { max-width: none; }

/* daily training: three difficulties side by side */
.train-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px; }
.train-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 0; border-radius: 14px; cursor: pointer; color: #f3e6c8;
  background: rgba(10, 6, 20, 0.6); box-shadow: inset 0 0 0 1.5px var(--tc); }
.train-opt:active { transform: scale(0.96); }
.train-opt b { font: 900 15px 'Cinzel', serif; color: var(--tc); }
.train-opt span { font: 800 11.5px 'Spectral', serif; color: var(--muted); }
.train-opt em { font: 900 14px 'Spectral', serif; font-style: normal; color: #9effa8; }
.train-opt.t-gentle { --tc: #7fe0a0; } .train-opt.t-tough { --tc: #ffc36a; }
.train-opt.t-heroic { --tc: #ff8a9a; box-shadow: inset 0 0 0 1.5px var(--tc), 0 0 14px rgba(255, 110, 140, 0.35); }

/* ---------- Den v4: no drawer. Small glass chips in the corners, the main action (Train) and three
   medallions at the bottom that open Treats, Powers and Traits ---------- */
/* the two round buttons under the name plate and the collar, the same style as the row at the bottom */
.spot.den-side { position: absolute; top: 104px; transform: none; cursor: pointer; }
.spot.den-side.left { left: 18px; }
.spot.den-side.right { right: 18px; }
.spot.den-side i { width: 48px; height: 48px; overflow: hidden; }
.spot.den-side i img { width: 32px; height: 32px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7)); }
.spot.den-side i.art img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; filter: none; }
.spot.den-side span { font-size: 10.5px; padding: 2px 7px; }
.spot.den-side b.soft { right: -4px; background: rgba(10, 5, 20, 0.85); color: #f3e6c8; box-shadow: 0 0 0 1.5px rgba(255, 210, 130, 0.6); }
#den .den-plate { cursor: pointer; }
.den-bottom { position: absolute; left: 0; right: 0; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: opacity 0.4s; pointer-events: none; }
.den-bottom > * { pointer-events: auto; }
.den-main { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 0 12px; }
.den-main .btn { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; min-width: 116px; justify-content: center; }
.den-tiles { display: flex; justify-content: center; gap: clamp(18px, 7vw, 40px); }
.spot.den-tile { position: relative; left: auto; top: auto; transform: none; cursor: pointer; }
.spot.den-tile i { width: 58px; height: 58px; overflow: hidden; }
.spot.den-tile i img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7)); }
.spot.den-tile i.art img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; filter: none; }
.spot.den-tile b.soft { background: rgba(10, 5, 20, 0.85); color: #f3e6c8; box-shadow: 0 0 0 1.5px rgba(255, 210, 130, 0.6); }
#den.viewing .den-bottom { opacity: 0; pointer-events: none; }
#den.viewing .den-bottom > * { pointer-events: none; }
.den-preview { bottom: calc(150px + env(safe-area-inset-bottom)); }
/* the Treats window */
.treat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 4px; }
.treat-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border: 0; border-radius: 12px; cursor: pointer; color: #f3e6c8;
  background: rgba(10, 6, 20, 0.55); box-shadow: inset 0 0 0 1.5px var(--tc, rgba(255, 255, 255, 0.2)); }
.treat-tile img { width: 48px; height: 48px; object-fit: contain; }
.treat-tile b { font: 800 11.5px/1.15 'Spectral', serif; text-align: center; }
.treat-tile small { font: 700 10.5px/1.2 'Spectral', serif; color: var(--muted); text-align: center; }
.treat-tile.r-uncommon { --tc: #5fe08a; } .treat-tile.r-rare { --tc: #4aa8ff; } .treat-tile.r-epic { --tc: #c07bff; } .treat-tile.r-legendary { --tc: #ffb340; }
#modal .den-cards { grid-template-columns: repeat(2, 1fr); padding: 6px 4px; gap: 10px; }
#modal .den-traits { padding: 6px 0; }
@media (min-width: 700px) { .spot.den-tile i { width: 76px; height: 76px; } .spot.den-tile i img { width: 52px; height: 52px; } .spot.den-side { top: 124px; } }

/* ---------- camp v3: the forest camp painting; each object is its own button with an engraved plaque ---------- */
.camp-art { background-image: url(../assets/scenes/camp-forest.jpg); }
.camp-glow { left: 48%; top: 46%; width: 38%; }
.camp-ember { left: 48%; top: 45%; }
.place { position: absolute; transform: translate(-50%, -50%); padding: 0; border: 0; border-radius: 40%; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* pressing a place lights it up */
.place::before { content: ''; position: absolute; inset: -6%; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity 0.2s;
  background: radial-gradient(ellipse at 50% 55%, rgba(255, 220, 140, 0.45), rgba(255, 200, 100, 0.12) 45%, transparent 70%); mix-blend-mode: screen; }
.place:hover::before, .place:active::before { opacity: 1; }
.pl-label, .camp-pet .cp-label { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -4px); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; pointer-events: none;
  padding: 6px 4px 7px; border: 0 solid transparent; border-width: 0 15px; border-radius: 0; background: none;
  border-image: url(../assets/ui/plaque-dark.png) 0 100 fill / 0 15px stretch;
  font: 900 12.5px/1 'Cinzel', serif; letter-spacing: 0.05em; color: #f6e2b0; text-shadow: 0 1px 0 #000, 0 0 6px rgba(0, 0, 0, 0.8);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)); animation: plGlow 3.6s ease-in-out infinite; }
.camp-pet .cp-label { top: 100%; transform: translate(-50%, 4px); }
@keyframes plGlow { 50% { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 8px rgba(255, 210, 120, 0.45)); } }
.pl-label b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; margin-right: -4px;
  font: 900 11px 'Spectral', serif; color: #fff; background: #ff4d6d; box-shadow: 0 0 0 1.5px #1a0e30; text-shadow: none; }
@media (min-width: 700px) { .pl-label, .camp-pet .cp-label { font-size: 16px; padding: 8px 6px 9px; border-width: 0 19px; border-image-width: 0 19px; } }
.camp-pet { width: 25%; } @media (min-width: 700px) { .camp-pet { width: 22%; } }
/* the backdrop preview bar: the name on top, Back and Buy side by side underneath, nothing squeezed */
.den-preview { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
.den-preview span { flex: 1 1 100%; }
.den-preview .btn { flex: 1 1 0; flex-direction: row !important; justify-content: center; align-items: center; gap: 6px; min-height: 44px; padding-top: 0 !important; padding-bottom: 0 !important; }
.den-preview .btn .ic { width: 18px; height: 18px; }
.den-preview { bottom: calc(160px + env(safe-area-inset-bottom)); }
.place.up .pl-label { top: auto; bottom: 100%; transform: translate(-50%, 4px); }
/* every screen closes with the same × in its top-right corner as the camp's windows */
.topbar .close-x { width: 40px; height: 40px; flex: none; }
.topbar .close-x svg { width: 20px; height: 20px; }
/* the corner × on every window: stays in view while the window scrolls */
.modal-x { position: sticky; top: 0; float: right; z-index: 4; width: 36px; height: 36px; margin: -4px -4px -36px 0; }
.modal-x svg { width: 18px; height: 18px; }
.moon-purse { right: auto; left: 14px; }

/* ---------- battle art: the moves and gold medallions and the HP frame (the board frame, rings and slots wait for redraws) ---------- */
/* moves: the hourglass medallion, the number on its glass */
#battle .moves { width: 70px; height: 75px; padding: 12px 0 0; border: 0 !important; border-image: none !important; border-radius: 0 !important; box-shadow: none !important;
  background: url(../assets/ui/battle/medallion-moves.png) center / contain no-repeat !important; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55)); }
#battle .moves b { font-size: 26px; }
#battle .moves small { font-size: 7.5px; margin-top: 0; color: #f0e2ff; }
#battle .moves.low { filter: drop-shadow(0 0 10px rgba(255, 60, 90, 0.85)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55)); }
/* gold: the crown medallion */
#battle #p-gold { width: 58px; height: 62px; border-radius: 0; box-shadow: none; padding-top: 10px;
  background: url(../assets/ui/battle/medallion-gold.png) center / contain no-repeat; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
#battle #p-gold i { display: none; }
#battle #p-gold b { font-size: 16px; background-image: linear-gradient(180deg, #ffffff, #fff4d6 60%, #ffe2a0); }
/* HP: the bar runs in the frame's channel, the heart sits in its socket */
#battle .hp-wrap { padding: 0; height: auto; aspect-ratio: 1200 / 177; align-self: center; min-width: 0;
  background: url(../assets/ui/battle/hp-frame.png) center / 100% 100% no-repeat; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5)); }
#battle .hp-wrap .heart-medal { position: absolute; left: 7.4%; top: 50%; width: 9%; height: auto; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: none; box-shadow: none; border: 0; display: grid; place-items: center; z-index: 2; }
#battle .hp-wrap .heart-medal .ic { width: 100%; height: 100%; }
#battle .hp-wrap .bar { position: absolute; left: 14.3%; right: 5.2%; top: 36%; bottom: 34%; height: auto; border-radius: 2px; padding: 0;
  border: 0 !important; border-image: none !important; background: rgba(10, 4, 16, 0.85) !important; box-shadow: none !important; overflow: visible; }
#battle .hp-wrap .bar .fill, #battle .hp-wrap .bar .ghost { border-radius: 1px; }
#battle .hp-wrap .bar span { padding: 0; font-size: 12px; line-height: 1; }
/* the big messages ride on a velvet ribbon */
.ftext.banner { background: url(../assets/ui/battle/banner-ribbon.png) center / 100% 100% no-repeat; padding: 0.42em 1.5em 0.5em; }
.ftext.banner { font-size: min(44px, 10.5vw); padding: 0.42em 1.25em 0.5em; }
.ftext.banner.small { font-size: min(32px, 7.6vw); }
/* the numbers on the medallions: centred on the glass (which sits below the crown and hourglass), gilded
   numerals with a crisp outline, a readable label, and gold that shrinks as the total grows */
#battle .moves { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 15px 0 0; gap: 1px; }
#battle .moves b { font-size: 30px; line-height: 0.9;
  background-image: linear-gradient(180deg, #ffffff 0%, #fff3cf 45%, #ffd36a 75%, #e8a23a 100%);
  filter: drop-shadow(1.5px 0 0 #1a0628) drop-shadow(-1.5px 0 0 #1a0628) drop-shadow(0 1.5px 0 #1a0628) drop-shadow(0 -1.5px 0 #1a0628) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
#battle .moves small { font: 900 8.5px/1 'Cinzel', serif; letter-spacing: 0.14em; margin: 0; color: #fff4d8;
  text-shadow: 1px 0 0 #1a0628, -1px 0 0 #1a0628, 0 1px 0 #1a0628, 0 -1px 0 #1a0628, 0 0 4px rgba(26, 6, 40, 0.9); }
#battle #p-gold { display: flex; align-items: center; justify-content: center; padding: 13px 0 0; }
#battle #p-gold b { margin: 0; font-size: 20px; line-height: 1; text-align: center; letter-spacing: -0.02em;
  background-image: linear-gradient(180deg, #ffffff 0%, #fff8e6 50%, #ffe7b0 100%);
  filter: drop-shadow(1.2px 0 0 #3a1800) drop-shadow(-1.2px 0 0 #3a1800) drop-shadow(0 1.2px 0 #3a1800) drop-shadow(0 -1.2px 0 #3a1800) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.55)); }
#battle #p-gold b[data-len="3"] { font-size: 17px; }
#battle #p-gold b[data-len="4"] { font-size: 14px; }
#battle #p-gold b[data-len="5"] { font-size: 11.5px; }
/* the board's slim gold frame with prism-gem corners (drawn around the board, not over it) */
#battle .board-zone { padding: 0; }
#battle #board-wrap { padding: 0; border-radius: 3px; background: rgba(8, 4, 20, 0.5); box-shadow: 0 0 40px var(--halo), 0 22px 50px rgba(0, 0, 0, 0.7); }
#battle #board-wrap::before { display: none; }
#battle #board-wrap::after { inset: -2.4%; border-radius: 0; background: url(../assets/ui/battle/board-frame.png) center / 100% 100% no-repeat; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); }
#battle #board-cv { border-radius: 2px; }
/* the weapon and the pet each sit in a slim gold ring, just outside their charge glow */
#battle .weapon-slot, #battle .pet-slot { overflow: visible; }
#battle .weapon-slot::before, #battle .pet-slot::before { content: ''; position: absolute; inset: -9px; z-index: 3; pointer-events: none;
  background: url(../assets/ui/battle/ring.png) center / 100% 100% no-repeat; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55)); }
#battle .pet-slot::before { inset: -8px; }
#battle .weapon-slot::before, #battle .pet-slot::before { inset: -7px; }
#battle .gear-row { gap: 16px; padding-left: 10px; }
/* items sit in slim gold slots, matching the board frame and rings */
#battle .item-slot { border-radius: 10px; box-shadow: none; }
#battle .item-slot::after { content: ''; position: absolute; inset: -2px; z-index: 2; pointer-events: none;
  background: url(../assets/ui/battle/item-slot.png) center / 100% 100% no-repeat; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
#battle .item-slot .cnt { z-index: 3; }
/* the painted badge emblems fill more of their medal */
.bmedal img { width: 74%; height: 74%; }
#battle .item-slot.sel { box-shadow: 0 0 18px var(--rc), inset 0 0 0 2px rgba(255, 255, 255, 0.8); }

/* ---------- map v4: painted rings round every stage, the zone colour in the glass, gilded numbers ---------- */
.node, .node.boss, .node.big, .node.final, .node.tier-legend, .node:not(.boss), .node:not(.boss).current, .node.big.current {
  box-shadow: none; animation: none; filter: drop-shadow(0 6px 7px rgba(0, 0, 0, 0.6)); }
/* the ring sits round the node: its opening is 70% of the picture, a touch above centre */
.node::before, .node:not(.boss)::before, .node:not(.boss).current::before { content: ''; position: absolute; inset: -23.2% -21.5% -19.8%; z-index: 2; pointer-events: none;
  clip-path: none; -webkit-mask: none; mask: none; border-radius: 0; background: url(../assets/ui/map/ring-stage.png) center / contain no-repeat; }
.node::after, .node:not(.boss)::after { display: none; }
.node.boss::before { background-image: url(../assets/ui/map/ring-elite.png); }
.node.big::before { background-image: url(../assets/ui/map/ring-boss.png); }
.node.tier-legend::before { background-image: url(../assets/ui/map/ring-legend.png); }
.node.final::before { background-image: url(../assets/ui/map/ring-final.png); }
.node:not(.boss) { width: 46px; height: 46px; }
.node:not(.boss).current { width: 52px; height: 52px; }
.node.boss { width: 56px; height: 56px; }
.node.big { width: 62px; height: 62px; }
.node.tier-legend { width: 66px; height: 66px; }
.node.final { width: 72px; height: 72px; }
/* the glass: the zone's colour once beaten, deep violet ahead, gold where you are */
.node:not(.boss) { background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--za) 40%, #3a2a58), #160b28 74%); }
.node:not(.boss).done { background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--za) 75%, #fff), color-mix(in srgb, var(--za) 55%, #1a0c30) 58%, color-mix(in srgb, var(--za) 20%, #0c0618)); }
.node:not(.boss).current { background: radial-gradient(circle at 50% 28%, #fff1a8, #e89a20 58%, #7a3a00);
  filter: drop-shadow(0 0 12px rgba(255, 200, 80, 0.95)) drop-shadow(0 6px 7px rgba(0, 0, 0, 0.6)); }
.node.boss.current { filter: drop-shadow(0 0 14px rgba(255, 200, 80, 0.95)) drop-shadow(0 6px 7px rgba(0, 0, 0, 0.6)); }
.node.locked, .node:not(.boss).locked { filter: grayscale(1) brightness(0.68) drop-shadow(0 6px 7px rgba(0, 0, 0, 0.6)); }
.node.final.locked, .node.tier-legend.locked { filter: grayscale(0.4) brightness(0.8) drop-shadow(0 6px 7px rgba(0, 0, 0, 0.6)); }
/* gilded numerals with a dark outline, like the battle medallions */
.node:not(.boss) .num, .node:not(.boss).current .num, .node:not(.boss).locked .num { position: relative; z-index: 1; font: 900 21px/1 'Cinzel', serif; letter-spacing: -0.02em;
  color: transparent; -webkit-text-stroke: 0; text-shadow: none;
  background-image: linear-gradient(180deg, #ffffff 0%, #fff3cf 45%, #ffd36a 75%, #e8a23a 100%); -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(1.2px 0 0 #1a0628) drop-shadow(-1.2px 0 0 #1a0628) drop-shadow(0 1.2px 0 #1a0628) drop-shadow(0 -1.2px 0 #1a0628) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.node:not(.boss) .num.n3 { font-size: 16px; }
/* stars below the ring, tags above it */
.node .stars { bottom: calc(-20% - 10px); z-index: 3; }
.node .stars .ic { width: 16px; height: 16px; }
.node .tag { top: calc(-23% - 9px); z-index: 3; }
.node .you { z-index: 4; bottom: calc(100% + 2px); }
.node.boss.current .you { bottom: calc(100% + 10px); }
/* the camp: a painted campfire medallion, its name on the dark band */
.camp-node, .camp-node:active { width: 64px; height: 64px; padding: 0; border-radius: 0; box-shadow: none; top: 76px; right: 10px;
  background: url(../assets/ui/map/camp-button.png) center / contain no-repeat; filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.6)); }
.camp-node small { position: absolute; left: 0; right: 0; top: 66%; height: 15%; margin: 0; display: grid; place-items: center;
  font: 700 8.5px/1 'Cinzel', serif; letter-spacing: 0.08em; color: #ffe9a8; text-shadow: 0 1px 1px #000; }
/* each zone's name on its painted banner */
.zbanner { position: relative; z-index: 0; padding: 9px 46px 11px; }
/* the banner's shadow lives on its own layer so it never blurs the lettering */
.zbanner::before { content: ''; position: absolute; inset: 0; z-index: -1; background: url(../assets/ui/map/title-banner.png) center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6)); }
/* plain, crisp lettering: solid warm gold, a thin dark edge, no glow */
.zbanner h3 { padding: 0; font: 700 clamp(17px, 5.6vw, 22px)/1.1 'Cinzel', serif; letter-spacing: 0.04em; white-space: nowrap;
  color: #ffe6a6; background: none; -webkit-background-clip: border-box; background-clip: border-box; filter: none;
  text-shadow: 0 1px 0 #1a0628, 0 -1px 0 #1a0628, 1px 0 0 #1a0628, -1px 0 0 #1a0628; }
.node.boss .tag { top: calc(-23% - 16px); }

/* ---------- the pouch: the items you take into a fight ---------- */
.pre-pouch { display: flex; align-items: center; gap: 10px; width: 100%; margin: 8px 0 0; padding: 6px 12px; border: 0; border-radius: 10px; cursor: pointer; text-align: left;
  background: rgba(10, 6, 20, 0.55); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.35); color: #f3e6c8; }
.pre-pouch small { font: 700 11px 'Cinzel', serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold2); }
.pre-pouch .pp-slots { flex: 1; display: flex; gap: 6px; }
.pre-pouch .pp-slots i { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: rgba(40, 22, 70, 0.7); }
.pre-pouch .pp-slots i::after { content: ''; position: absolute; inset: -2px; background: url(../assets/ui/battle/item-slot.png) center / 100% 100% no-repeat; pointer-events: none; }
.pre-pouch .pp-slots i.empty { opacity: 0.45; }
.pre-pouch .pp-slots img { width: 74%; height: 74%; object-fit: contain; }
.pre-pouch em { font: 800 12px 'Spectral', serif; font-style: normal; color: var(--gold2); }
.pouch-count { margin: 4px 0 8px; font: 700 13px 'Cinzel', serif; color: var(--gold2); }
.pouch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; text-align: left; }
.pouch-tile { display: grid; grid-template-columns: 44px 1fr; column-gap: 8px; align-items: start; padding: 8px; border: 0; border-radius: 12px; cursor: pointer; color: #f3e6c8;
  background: rgba(10, 6, 20, 0.55); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.14); }
.pouch-tile img { grid-row: span 3; width: 44px; height: 44px; object-fit: contain; }
.pouch-tile b { font: 800 12px/1.15 'Spectral', serif; }
.pouch-tile small { font: 600 10.5px/1.25 'Spectral', serif; color: var(--muted); }
.pouch-tile em { font: 700 10px 'Spectral', serif; font-style: normal; color: var(--muted); margin-top: 2px; }
.pouch-tile.on { background: rgba(80, 50, 10, 0.55); box-shadow: inset 0 0 0 2px var(--gold2), 0 0 12px rgba(255, 200, 90, 0.35); }

/* ---------- pre-battle v3: framed tablets, gilded numbers, book-face text, a painted pouch ---------- */
.pre2 { --tab-bg: linear-gradient(180deg, rgba(46, 26, 78, 0.7), rgba(14, 8, 28, 0.88));
  --tab-edge: inset 0 0 0 1px rgba(255, 214, 140, 0.5), inset 0 0 0 2px rgba(20, 8, 30, 0.9), inset 0 10px 18px rgba(255, 255, 255, 0.04), 0 4px 10px rgba(0, 0, 0, 0.45);
  --gild: linear-gradient(180deg, #ffffff 0%, #fff3cf 45%, #ffd36a 75%, #e8a23a 100%);
  --gild-edge: drop-shadow(1.2px 0 0 #1a0628) drop-shadow(-1.2px 0 0 #1a0628) drop-shadow(0 1.2px 0 #1a0628) drop-shadow(0 -1.2px 0 #1a0628) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.pre2 .pre-strip, .pre2 .mu, .pre2 .power-cmp, .pre2 .pre-pouch {
  border: 0 !important; border-image: none !important; border-radius: 12px; background: var(--tab-bg) !important; box-shadow: var(--tab-edge) !important; }
.pre2 small { font: 700 9.5px/1.2 'Cinzel', serif !important; letter-spacing: 0.12em !important; text-transform: uppercase; color: #e9c98a !important; }
/* the three stats: separate tablets, an icon beside a gilded number */
.pre2 .pre-strip { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 6px; background: none !important; box-shadow: none !important; margin-bottom: 8px; }
.pre2 .pre-strip > div { border: 0 !important; padding: 8px 4px 9px; border-radius: 12px; background: var(--tab-bg); box-shadow: var(--tab-edge); gap: 3px; justify-content: center; }
.pre2 .pre-strip span { display: flex; align-items: center; gap: 5px; }
.pre2 .pre-strip .ic { width: 22px; height: 22px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.pre2 .pre-strip b, .pre2 .power-cmp b { font: 900 22px/1 'Cinzel', serif; color: transparent; background-image: var(--gild);
  -webkit-background-clip: text; background-clip: text; filter: var(--gild-edge); }
.pre2 .pre-strip em { font: italic 700 11.5px/1.1 'Spectral', serif; color: #ffb0b8; }
/* weakness, resistances and traits */
.pre2 .matchup { gap: 6px; }
.pre2 .mu { padding: 7px 10px !important; gap: 8px; }
.pre2 .mu b { font: 700 15px/1.1 'Spectral', serif; color: #f6ead0; }
.pre2 .mu.weak { box-shadow: inset 0 0 0 1px rgba(120, 255, 160, 0.65), inset 0 0 0 2px rgba(20, 8, 30, 0.9), 0 0 12px rgba(90, 255, 140, 0.2), 0 4px 10px rgba(0, 0, 0, 0.45) !important; }
.pre2 .mu.weak b { color: #9dffbe; }
.pre2 .mu.resist b { color: #ffb8c0; }
.pre2 .matchup:has(.mu:nth-child(3)) .mu b { font-size: 15px; }
.pre2 .matchup:has(.mu:nth-child(4)) .mu b { font-size: 13px; }
.pre2 .pre-note { font: italic 700 13px/1.25 'Spectral', serif; color: #ffe2b8; }
/* the pouch: a satchel, the items in their gold slots, and a plaque to change them */
.pre2 .pre-pouch { gap: 10px; padding: 8px 10px; margin: 8px 0 0; }
.pre2 .pp-bag { display: flex; flex-direction: column; align-items: center; gap: 1px; flex: none; }
.pre2 .pp-bag .ic { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.pre2 .pp-bag small { font-size: 8.5px !important; }
.pre2 .pre-pouch .pp-slots { gap: 7px; }
.pre2 .pre-pouch .pp-slots i { width: 44px; height: 44px; border-radius: 9px; background: radial-gradient(circle at 50% 35%, #4a2a7a, #1a0c30); }
.pre2 .pre-pouch .pp-slots i.r-rare { box-shadow: 0 0 10px rgba(74, 168, 255, 0.35); }
.pre2 .pre-pouch .pp-slots i.r-epic { box-shadow: 0 0 10px rgba(192, 123, 255, 0.45); }
.pre2 .pre-pouch .pp-slots i.r-legendary { box-shadow: 0 0 12px rgba(255, 179, 64, 0.55); }
.pre2 .pre-pouch em.btn { flex: none; font-style: normal; pointer-events: none; padding-left: 14px; padding-right: 14px; }
/* power: two gilded numbers and a verdict badge */
.pre2 .power-cmp { margin-top: 8px; padding: 8px 12px !important; }
.pre2 .power-cmp b { font-size: 21px; }
.pre2 .power-cmp .verdict { font: 700 12px 'Cinzel', serif; letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 12px; border-radius: 20px;
  background: color-mix(in srgb, var(--pc) 18%, rgba(10, 5, 20, 0.8)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 70%, transparent), 0 0 12px color-mix(in srgb, var(--pc) 30%, transparent); }
.pre2 .pre-strip img.ic[src*="items/"] { width: 32px; height: 32px; margin: -5px -3px -5px -6px; }

/* ---------- victory v2: the same framed tablets and gilded numbers as the fight screen ---------- */
.modal-card .result { --tab-bg: linear-gradient(180deg, rgba(46, 26, 78, 0.7), rgba(14, 8, 28, 0.88));
  --tab-edge: inset 0 0 0 1px rgba(255, 214, 140, 0.5), inset 0 0 0 2px rgba(20, 8, 30, 0.9), inset 0 10px 18px rgba(255, 255, 255, 0.04), 0 4px 10px rgba(0, 0, 0, 0.45);
  --gild: linear-gradient(180deg, #ffffff 0%, #fff3cf 45%, #ffd36a 75%, #e8a23a 100%);
  --gild-edge: drop-shadow(1.3px 0 0 #1a0628) drop-shadow(-1.3px 0 0 #1a0628) drop-shadow(0 1.3px 0 #1a0628) drop-shadow(0 -1.3px 0 #1a0628) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
/* XP and gold: two tablets, a big icon over a gilded number */
.modal-card .result .rewards { gap: 8px; margin: 6px 0 4px; }
.modal-card .result .rewards > div { flex-direction: column !important; gap: 2px !important; padding: 9px 6px 8px !important; border-radius: 12px;
  background: var(--tab-bg) !important; box-shadow: var(--tab-edge) !important; border: 0 !important; border-image: none !important; }
.modal-card .result .rewards .ic { width: 34px; height: 34px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); }
.modal-card .result .rewards b { font: 900 30px/1 'Cinzel', serif; color: transparent; background-image: var(--gild); -webkit-background-clip: text; background-clip: text; filter: var(--gild-edge); }
.modal-card .result .rewards small { font: 700 10px/1.2 'Cinzel', serif; letter-spacing: 0.16em; color: #e9c98a; }
.modal-card .result .v-bonus, .modal-card .result .v-moon, .modal-card .result .v-pet { font: italic 700 14px/1.25 'Spectral', serif; color: #ffe2a8; }
/* the meters: each on its tablet, its icon in a gold ring, a gold-rimmed bar with a moving shine */
.modal-card .result .meter { gap: 12px; margin: 0 0 8px !important; padding: 9px 12px 10px 9px !important; border-radius: 12px;
  background: var(--tab-bg) !important; box-shadow: var(--tab-edge) !important; border: 0 !important; border-image: none !important; }
.modal-card .result #xp-meter { margin-top: 10px !important; }
.modal-card .result #xp-meter::before { display: none; }
.modal-card .result .meter-ic { position: relative; width: 42px; height: 42px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #4a2a7a, #160b28 75%); }
.modal-card .result .meter-ic::after { content: ''; position: absolute; inset: -6px; background: url(../assets/ui/battle/ring.png) center / contain no-repeat; pointer-events: none; }
.modal-card .result .meter-ic .ic, .modal-card .result .meter-ic img { width: 30px; height: 30px; object-fit: contain; }
.modal-card .result .pet-meter .meter-ic img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; }
.modal-card .result .meter-label { margin-bottom: 7px; }
.modal-card .result .meter-label b { font: 700 15px/1.1 'Cinzel', serif; letter-spacing: 0.03em; color: #ffe6a6; text-shadow: 0 1px 0 #1a0628, 0 -1px 0 #1a0628, 1px 0 0 #1a0628, -1px 0 0 #1a0628; }
.modal-card .result .meter-label small { font: italic 700 12.5px/1.1 'Spectral', serif; color: #e2d2f0; }
.modal-card .result .meter-bar { height: 13px; border-radius: 8px; background: #0c0618 !important; overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.85), 0 0 0 1px #2a1400, 0 0 0 2.5px #d8a440, 0 0 0 3.5px #2a1400 !important; }
.modal-card .result .meter-bar .fill { border-radius: 8px; overflow: hidden; }
.modal-card .result .meter-bar .fill::before { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  background-size: 250% 100%; animation: barSheen 2.6s ease-in-out infinite; }
@keyframes barSheen { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.modal-card .result .levelup { border-radius: 12px; background: var(--tab-bg); box-shadow: var(--tab-edge), 0 0 16px rgba(255, 200, 90, 0.25); }
.modal-card .result .levelup span { font: italic 700 13px/1.25 'Spectral', serif; color: #f6ead0; }
/* the Den's bottom row: five buttons in a gentle arc that follows the front of the bed, the outer two raised */
#den .den-tiles { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 560px; gap: 0; padding: 0 4px; box-sizing: border-box; }
#den .spot.den-tile { justify-self: center; }
#den .spot.den-tile.side { transform: translateY(-30px); }
#den .spot.den-tile.side i { width: 50px; height: 50px; }
#den .spot.den-tile.side i img { width: 32px; height: 32px; }
#den .spot.den-tile span { font-size: 11px; padding: 2px 7px; }
#den .spot.den-tile.side span { font-size: 9.5px; padding: 2px 6px; }
#den .spot.den-tile.side i.art img { width: 100%; height: 100%; }
#den .den-tiles > .spot.den-tile:nth-child(2), #den .den-tiles > .spot.den-tile:nth-child(4) { transform: translateY(-7px); }
/* the Den's action buttons sit clear above the raised ends of the arc and their badges */
#den .den-main { margin-bottom: 34px; }
/* a long rarity like "Uncommon" fits inside the collar slot */
#den .den-collar small { font-size: 8px; letter-spacing: 0.03em; white-space: nowrap; }
/* the marker: the floating amethyst from the title screen, hovering above your next stage */
.node .you { width: 30px; height: 70px; bottom: calc(100% + 4px);
  filter: drop-shadow(0 0 10px rgba(255, 190, 120, 0.8)) drop-shadow(0 0 18px rgba(170, 110, 255, 0.6)); animation: youFloat 2.4s ease-in-out infinite; }
.node .you img { object-position: 50% 50%; }
.node.boss.current .you { bottom: calc(100% + 12px); }
@keyframes youFloat { 50% { transform: translate(-50%, -7px); } }
/* the camp, one tap from the fight screen: the painted medallion in the corner of the monster's portrait */
.pre-hero .ph-camp { position: absolute; z-index: 2; right: 8px; bottom: 8px; width: 54px; height: 54px; padding: 0; border: 0; cursor: pointer;
  background: url(../assets/ui/map/camp-button.png) center / contain no-repeat; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)); }
.pre-hero .ph-camp small { position: absolute; left: 0; right: 0; top: 66%; height: 15%; display: grid; place-items: center;
  font: 700 7.5px/1 'Cinzel', serif !important; letter-spacing: 0.06em !important; color: #ffe9a8 !important; text-shadow: 0 1px 1px #000; }
.pre-hero .ph-camp:active { transform: scale(0.94); }
.pre2 .ph-bot { right: 70px; }
/* the pouch: its own section, item pictures big enough to read, each with its name */
.pre2 .pre-pouch { display: block; padding: 10px 12px 12px; margin: 10px 0 0; cursor: pointer; text-align: left; }
.pre2 .pp-head { display: flex; align-items: center; gap: 10px; }
.pre2 .pp-head > .ic { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.pre2 .pp-head span { flex: 1; display: flex; flex-direction: column; }
.pre2 .pp-head b { font: 700 16px/1.1 'Cinzel', serif; color: #ffe6a6; text-shadow: 0 1px 0 #1a0628, 0 -1px 0 #1a0628, 1px 0 0 #1a0628, -1px 0 0 #1a0628; }
.pre2 .pp-head em { font: italic 700 12px/1.2 'Spectral', serif; color: #d8c8ee; }
.pre2 .pp-head .btn { font-style: normal; pointer-events: none; }
.pre2 .pre-pouch .pp-slots { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
.pre2 .pp-slot { flex: 1; max-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pre2 .pre-pouch .pp-slot i { position: relative; width: 62px; height: 62px; display: grid; place-items: center; border-radius: 11px; background: radial-gradient(circle at 50% 35%, #4a2a7a, #1a0c30); }
.pre2 .pre-pouch .pp-slot i::after { content: ''; position: absolute; inset: -3px; background: url(../assets/ui/battle/item-slot.png) center / 100% 100% no-repeat; pointer-events: none; }
.pre2 .pre-pouch .pp-slot i img { width: 76%; height: 76%; object-fit: contain; }
.pre2 .pre-pouch .pp-slot.r-rare i { box-shadow: 0 0 12px rgba(74, 168, 255, 0.4); }
.pre2 .pre-pouch .pp-slot.r-epic i { box-shadow: 0 0 12px rgba(192, 123, 255, 0.5); }
.pre2 .pre-pouch .pp-slot.r-legendary i { box-shadow: 0 0 14px rgba(255, 179, 64, 0.6); }
.pre2 .pre-pouch .pp-slot.empty i { opacity: 0.45; }
.pre2 .pp-slot small { font: 700 11.5px/1.1 'Spectral', serif !important; letter-spacing: 0 !important; text-transform: none; color: #f0e2c8 !important; text-align: center; }
.pre-warn { margin: 8px 0 0; padding: 7px 10px; border-radius: 10px; font: italic 700 13px/1.25 'Spectral', serif; color: #ffc0c8;
  background: rgba(255, 60, 90, 0.12); box-shadow: inset 3px 0 0 #ff5a6a; text-align: left; }

/* ---------- victory v3: a gilded title instead of the big crest, no boxes, fits without scrolling ---------- */
.modal-card .result .v-title { position: relative; margin: 2px 0 0; text-align: center; }
.modal-card .result .v-title h2 { position: relative; z-index: 1; margin: 0; font: 900 40px/1 'Cinzel', serif !important; letter-spacing: 0.06em;
  color: transparent; background-image: var(--gild); -webkit-background-clip: text; background-clip: text; filter: var(--gild-edge) drop-shadow(0 0 16px rgba(255, 190, 90, 0.45)); }
.modal-card .result .v-title h2::after { display: none !important; }
.modal-card .result .v-rule { position: relative; z-index: 1; display: block; width: 62%; margin: 6px auto 0; opacity: 0.9; }
.modal-card .result .v-title .v-rays { top: 40%; width: 120%; opacity: 0.35; }
.modal-card .result.win .big-stars { margin: 4px 0 2px; }
.modal-card .result.win .big-stars .ic { width: 46px; height: 46px; }
.modal-card .result.win .big-stars span:nth-child(2) .ic { width: 56px; height: 56px; }
/* XP and gold: one open strip between two gold rules */
.modal-card .result .rewards { margin: 4px 0 0; padding: 8px 0; gap: 0; border-top: 1px solid transparent; border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(247, 218, 134, 0.6), transparent) 1; }
.modal-card .result .rewards > div { flex-direction: row !important; align-items: center; justify-content: center; gap: 8px !important; padding: 0 6px !important;
  background: none !important; box-shadow: none !important; }
.modal-card .result .rewards > div + div { border-left: 1px solid transparent !important; border-image: linear-gradient(transparent, rgba(247, 218, 134, 0.55), transparent) 1 !important; }
.modal-card .result .rewards .ic { width: 30px; height: 30px; }
.modal-card .result .rewards b { font-size: 28px; }
.modal-card .result .v-bonus, .modal-card .result .v-moon, .modal-card .result .v-pet { margin: 6px 0 0; font: 700 11.5px/1.3 'Cinzel', serif; letter-spacing: 0.03em; color: #f2d28a; }
/* the meters: open rows, no boxes, tight enough to all fit */
.modal-card .result .meter { margin: 0 !important; padding: 7px 4px 7px 2px !important; background: none !important; box-shadow: none !important; border-radius: 0; }
.modal-card .result .meter + .meter { border-top: 1px solid rgba(247, 218, 134, 0.14) !important; }
.modal-card .result #xp-meter { margin-top: 8px !important; }
.modal-card .result .meter-ic { width: 36px; height: 36px; }
.modal-card .result .meter-ic .ic, .modal-card .result .meter-ic img { width: 26px; height: 26px; }
.modal-card .result .pet-meter .meter-ic img { width: 34px; height: 34px; }
.modal-card .result .meter-label { margin-bottom: 5px; }
.modal-card .result .meter-label b { font-size: 13.5px; }
.modal-card .result .meter-label small { font: 700 11px/1.1 'Cinzel', serif; letter-spacing: 0.02em; color: #cdbbe6; }
.modal-card .result .meter-bar { height: 11px; }
.modal-card .result .levelup span { font: 700 12.5px/1.3 'Cinzel', serif; }
/* the book face uses lining numbers, so figures sit straight */
.pre2, .modal-card .result { font-variant-numeric: lining-nums; }
.pre2 em, .pre2 .mu b, .pre2 .pp-slot small { font-variant-numeric: lining-nums; }

/* ---------- Victory Hall and Treasure Chamber: full-screen painted scenes ---------- */
.modal:has(.scene) { padding: 0; background: #07040f; }
.modal-card:has(.scene) {
  --sw: min(max(100vw, 66.667dvh), 100dvh); --sh: calc(var(--sw) * 1.5);
  position: relative; width: 100%; max-width: none; height: 100%; max-height: none; overflow: hidden; border-radius: 0;
  border: 0 !important; border-image: none !important; background: none !important; box-shadow: none !important; filter: none;
  padding: calc(env(safe-area-inset-top) + 10px) 14px calc(env(safe-area-inset-bottom) + 14px);
  display: flex; flex-direction: column; align-items: center; animation: fade 0.4s; font-variant-numeric: lining-nums;
}
.modal-card:has(.scene) > :not(.scene) { position: relative; z-index: 1; }
.modal-card:has(.scene) .modal-btns { flex: none; width: 100%; max-width: 440px; margin-top: 10px; z-index: 3; }
.scene { position: absolute !important; inset: 0; z-index: 0 !important; overflow: hidden; pointer-events: none; }
.scene-bg { position: absolute; inset: 0; transition: opacity 0.6s; }
.scene-bg.hall { background: linear-gradient(180deg, rgba(8, 4, 18, 0.1), rgba(8, 4, 18, 0.35) 35%, rgba(8, 4, 18, 0.72)), url(../assets/scenes/victory-hall.jpg) center top / cover;
  animation: hallIn 1.6s ease-out both; }
@keyframes hallIn { from { transform: scale(1.08); filter: brightness(0.4); } }
.scene-bg.vault { inset: auto; left: 50%; top: 50%; width: var(--sw); height: var(--sh); translate: -50% -50%; opacity: 0;
  background: url(../assets/scenes/treasure-vault.jpg) center / 100% 100%; }
.scene.vault .scene-bg.hall { opacity: 0; }
.scene.vault .scene-bg.vault { opacity: 1; }

/* the hall: title plaque, star sockets, reward plaques, then the ledger of bars */
.vh { flex: 1; width: 100%; max-width: 440px; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; gap: 6px;
  overflow-y: auto; scrollbar-width: none; transition: opacity 0.35s; }
.vh::-webkit-scrollbar { display: none; }
.vh.gone { opacity: 0; pointer-events: none; }
.vh-title { position: relative; flex: none; width: min(94%, 370px); animation: crestIn 0.7s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes crestIn { from { transform: translateY(-30px) scale(0.85); opacity: 0; } }
.vh-title img { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.7)); }
.modal-card .vh-title h2 { position: absolute; left: 14%; right: 14%; top: 41%; translate: 0 -50%; margin: 0; font-size: clamp(22px, 7.4vw, 31px); line-height: 1; letter-spacing: 3px; white-space: nowrap; }
.modal-card .vh-title h2::after { display: none; }
.vh .v-sub { margin: -4px 0 0; }
.vh-stars { flex: none; display: flex; align-items: flex-end; gap: clamp(6px, 3vw, 14px); }
.vh-socket { position: relative; width: clamp(58px, 9.5dvh, 80px); aspect-ratio: 306 / 320; background: url(../assets/ui/victory/star-socket.png) center / contain no-repeat;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)); }
.vh-socket.mid { width: clamp(70px, 11.5dvh, 98px); margin-bottom: 12px; }
.vh-star { position: absolute; left: 15%; top: 13%; width: 70%; filter: drop-shadow(0 0 10px rgba(255, 200, 80, 0.85)); animation: starDrop 0.55s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes starDrop { from { transform: translateY(-90px) scale(1.9) rotate(-40deg); opacity: 0; } }
.vh-rewards { flex: none; display: flex; gap: 8px; width: 100%; }
.vh-plaque { position: relative; flex: 1; aspect-ratio: 768 / 262; background: url(../assets/ui/victory/reward-plaque.png) center / 100% 100% no-repeat;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55)); animation: cardIn 0.5s 0.9s both; }
.vh-plaque + .vh-plaque { animation-delay: 1.05s; }
.vh-plaque .ic { position: absolute; left: 15.2%; top: 50%; width: 18%; height: auto; aspect-ratio: 1; translate: -50% -50%; object-fit: contain; }
.vh-plaque span { position: absolute; left: 30%; right: 13%; top: 18%; bottom: 20%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.vh-plaque b { font: 900 clamp(16px, 5vw, 22px)/1 'Cinzel', serif; letter-spacing: 0.5px;
  background: linear-gradient(180deg, #fffbe6 10%, #ffd977 50%, #d98e2b 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1.5px 0 rgba(30, 6, 40, 0.95)); }
.vh-plaque small { margin-top: 2px; font: 700 9px 'Cinzel', serif; letter-spacing: 0.14em; text-transform: uppercase; color: #cdb88a; }
.vh-notes { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vh-notes:empty { display: none; }
.vh .v-bonus, .vh .v-moon, .vh .v-pet, .vh .v-unlock { margin: 0; font: italic 600 13.5px/1.3 'Spectral', serif; color: #ffe2a8; text-shadow: 0 1px 3px #000, 0 0 10px rgba(0, 0, 0, 0.8); }
.vh .v-badge { margin: 2px auto; }
.vh .v-prize { margin: 2px auto; background: rgba(20, 10, 40, 0.75); }
.vh-ledger { flex: none; width: 100%; display: flex; flex-direction: column; gap: 9px; padding: 6px 8px; text-align: left;
  border: 20px solid transparent; border-image: url(../assets/ui/victory/ledger-panel.png) 112 fill / 38px round;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.65)); animation: cardIn 0.5s 1.2s both; }
.vrow { display: flex; align-items: center; gap: 10px; }
.vrow .meter-ic { width: 38px; height: 38px; }
.vrow .meter-ic .ic { width: 100%; height: 100%; }
.vrow .meter-label { margin-bottom: 1px; }
.vrow .meter-label b { font: 700 13.5px 'Cinzel', serif; color: #ffe6a6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow .meter-label small { font: 600 12.5px 'Spectral', serif; color: #cdbbe6; }
.vbar { position: relative; height: 22px; border: 0 solid transparent; border-width: 0 22px; border-image: url(../assets/ui/victory/bar-frame.png) 0 62 fill / 0 22px stretch; }
.vbar > i { position: absolute; inset: 6px -7px; border-radius: 4px; overflow: hidden; }
.vbar .fill { position: absolute; inset: 0 auto 0 0; transition: width 0.7s cubic-bezier(.3, .8, .3, 1); }
.vbar .fill::after { content: ''; position: absolute; inset: 1px 0 55%; background: rgba(255, 255, 255, 0.35); border-radius: 3px; }
.vrow.full { animation: vrowFull 0.45s; }
@keyframes vrowFull { 50% { transform: scale(1.03); filter: drop-shadow(0 0 12px rgba(255, 210, 120, 0.95)); } }
.vh-ledger .v-pet { justify-content: flex-start; font-size: 12.5px; }
.vh-ledger .levelup { margin: 0; padding: 7px 12px; }
.vh-ledger .levelup span { font: 700 12.5px/1.3 'Cinzel', serif; }

/* the chamber: the chest on the vault's pedestal; everything placed against the painting's own size */
.tc { position: absolute !important; inset: 0; z-index: 1; }
.tc:not([hidden]) { animation: fade 0.5s; }
.tc-box { position: absolute; inset: 0; }
.tc-head { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 14px); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tc-head .vh-title { width: min(88%, 340px); }
.tc .meter-note { font-size: 15px; color: #ffe08a; text-shadow: 0 1px 3px #000, 0 0 12px rgba(255, 190, 80, 0.7); }
.tc-burst { position: absolute; left: 50%; top: calc(50% - var(--sh) * 0.01 - var(--sw) * 0.2); width: calc(var(--sw) * 0.95); translate: -50% -50%; pointer-events: none;
  opacity: 0.3; animation: burstSpin 40s linear infinite; transition: opacity 0.5s, scale 0.5s; }
@keyframes burstSpin { to { rotate: 360deg; } }
.tc-box.open .tc-burst { opacity: 0.95; scale: 1.25; }
.tc-chest { position: absolute; left: 50%; bottom: calc(50% + var(--sh) * 0.008); width: calc(var(--sw) * 0.4); aspect-ratio: 1 / 1.26; translate: -50% 0; border: 0; padding: 0; background: none; cursor: pointer; }
.tc-chest img { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.6)); }
.tc-chest .shut { transform-origin: 50% 100%; animation: chestShake 1.6s ease-in-out infinite; }
.tc-chest .open { opacity: 0; }
.tc-box.open .tc-chest .shut { opacity: 0; animation: none; }
.tc-box.open .tc-chest .open { opacity: 1; animation: chestBurst 0.5s cubic-bezier(.2, 1.6, .4, 1); filter: drop-shadow(0 0 24px rgba(255, 210, 110, 0.8)) drop-shadow(0 10px 12px rgba(0, 0, 0, 0.6)); }
@keyframes chestBurst { from { transform: scale(0.85); } 50% { transform: scale(1.12); } }
.tc-tap { position: absolute; left: 50%; top: 100%; translate: -50% calc(var(--sh) * 0.035); white-space: nowrap; animation: tapPulse 1.2s ease-in-out infinite;
  height: 40px; display: inline-flex; align-items: center; padding: 0 4px; border: 0 solid transparent; border-width: 0 20px;
  border-image: url(../assets/ui/plaque-primary.png) 0 100 fill / 0 20px stretch; font: 700 14px 'Cinzel', serif; letter-spacing: 1px; color: #fff1cf; text-shadow: 0 1px 0 rgba(20, 6, 40, 0.95); }
.tc-box.open .tc-tap { display: none; }
.tc-loot { position: absolute; left: 10px; right: 10px; top: calc(50% + var(--sh) * 0.07); bottom: calc(env(safe-area-inset-bottom) + 108px); display: none; justify-content: center; align-items: center; gap: 8px; }
.tc-box.open .tc-loot { display: flex; }
.tloot { flex: none; width: min(112px, calc((100% - (var(--n) - 1) * 8px) / var(--n))); display: flex; flex-direction: column; align-items: center; text-align: center;
  animation: lootFly 0.6s var(--d) cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes lootFly { from { transform: translateY(calc(var(--sh) * -0.14)) scale(0.15) rotate(-12deg); opacity: 0; } }
.tloot.gold { --rc: #ffd84a; }
.tl-frame { position: relative; width: 100%; aspect-ratio: 288 / 400; background: url(../assets/ui/victory/loot-frame.png) center / 100% 100% no-repeat;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--rc) 75%, transparent)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.6)); }
.tl-frame::before { content: ''; position: absolute; inset: 14% 9% 18%; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rc) 55%, transparent), transparent 70%); }
.tl-frame > img, .tl-frame > .ic { position: absolute; left: 13%; top: 18%; width: 74%; height: 58%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)); }
.tl-frame .rib { position: absolute; left: 22%; right: 22%; top: 88.5%; height: 8%; display: grid; place-items: center; overflow: hidden; white-space: nowrap;
  font: 700 clamp(6.5px, 2.1vw, 8.5px)/1 'Cinzel', serif; letter-spacing: 0.06em; text-transform: uppercase; color: #3a1d00; }
.tl-frame em { position: absolute; left: 50%; top: -6px; translate: -50% 0; padding: 2px 7px; border-radius: 8px; white-space: nowrap; font: normal 800 10px 'Spectral', serif;
  background: rgba(10, 6, 20, 0.9); box-shadow: inset 0 0 0 1px currentColor; }
.tl-frame em.up { color: #5fe08a; }
.tl-frame em.need { color: #ff9a9a; }
.tloot b { margin-top: 5px; font: 700 12px/1.15 'Cinzel', serif; color: #fff0d0; text-shadow: 0 1px 3px #000, 0 0 8px rgba(0, 0, 0, 0.9); }
.tloot small { margin-top: 2px; font: 600 11.5px/1.2 'Spectral', serif; color: var(--rc); text-shadow: 0 1px 3px #000; }
.tloot.gold b { font-size: 14px; color: #ffe08a; }
.tloot.r-legendary .tl-frame, .tloot.r-unique .tl-frame { animation: lootGlow 1.8s 1.2s ease-in-out infinite; }
@keyframes lootGlow { 50% { filter: drop-shadow(0 0 22px var(--rc)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.6)); } }
.tc-hint { position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 80px); margin: 0; display: none; text-align: center;
  font: italic 600 13px 'Spectral', serif; color: #f0dfbc; text-shadow: 0 1px 3px #000, 0 0 10px #000; animation: fade 0.5s 1.4s both; }
.tc-box.open .tc-hint { display: block; }
.modal-card:has(.scene) .modal-btns { margin-top: auto; }
.tc-head { gap: 8px; }
.modal-card .tc-head .vh-title h2 { font-size: clamp(17px, 5.4vw, 23px); letter-spacing: 1.5px; }
.tl-frame .rib { font-size: clamp(6px, 1.75vw, 7.5px); letter-spacing: 0.02em; }
.tc-head { z-index: 2; }
.modal-card:has(.scene) .moon-purse { display: none; }
.tloot { width: min(clamp(100px, calc(var(--sw) * 0.2), 160px), calc((100% - (var(--n) - 1) * 8px) / var(--n))); }
.tc-head .vh-title { width: min(88%, calc(var(--sw) * 0.62)); }
.tc-loot { bottom: calc(env(safe-area-inset-bottom) + 112px); }
.tloot b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- the fight screen as a full-screen scene: zone arena, the foe, the difficulty at the top ---------- */
.scene-bg.arena { background: var(--art) center 30% / cover no-repeat, radial-gradient(ellipse at 50% 40%, var(--z1), var(--z2) 75%); animation: hallIn 1.2s ease-out both; }
.scene-bg.arena.splash { background-position: center 18%, center; }
/* zone light: the stand-in until each zone has its painting, and a glow on the floor under the foe after */
.scene-bg.pb-glow { background: radial-gradient(ellipse 70% 30% at 50% 44%, color-mix(in srgb, var(--za) 22%, transparent), transparent 70%),
  linear-gradient(180deg, rgba(8, 4, 18, 0.35), transparent 22%, transparent 38%, rgba(8, 4, 18, 0.55) 52%, rgba(8, 4, 18, 0.9)); }
/* harder difficulties tint the whole scene in their colour */
.pb-scene.hard::after { content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(ellipse 90% 35% at 50% 0%, color-mix(in srgb, var(--dc) 40%, transparent), transparent 70%),
    radial-gradient(ellipse 120% 30% at 50% 100%, color-mix(in srgb, var(--dc) 22%, transparent), transparent 70%); }
.pb-scene.hard { box-shadow: inset 0 0 60px color-mix(in srgb, var(--dc) 45%, transparent); }

.pb { flex: 1; width: 100%; max-width: 440px; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  overflow-y: auto; scrollbar-width: none; font-variant-numeric: lining-nums; }
.pb::-webkit-scrollbar { display: none; }
.modal-card:has(.pb) .modal-x { position: absolute; z-index: 4; top: calc(env(safe-area-inset-top) + 12px); right: 12px; margin: 0; float: none; }
.pb-top { position: relative; flex: none; width: 100%; min-height: 58px; display: flex; justify-content: center; align-items: center; }
.pb-camp { position: absolute; left: 0; top: 0; width: 58px; height: 58px; padding: 0; border: 0; cursor: pointer;
  background: url(../assets/ui/map/camp-button.png) center / contain no-repeat; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)); }
.pb-camp small { position: absolute; left: 0; right: 0; top: 66%; height: 15%; display: grid; place-items: center; font: 700 8px/1 'Cinzel', serif; letter-spacing: 0.06em; color: #ffe9a8; text-shadow: 0 1px 1px #000; }
.pb-camp:active { transform: scale(0.94); }
.pb-diff { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 64px; }
.pb-diff b { display: flex; align-items: center; gap: 9px; font: 900 21px/1.1 'Cinzel', serif; letter-spacing: 2.5px; text-transform: uppercase; color: var(--dc);
  text-shadow: 0 2px 0 rgba(20, 6, 30, 0.95), 0 0 16px color-mix(in srgb, var(--dc) 70%, transparent); }
.pb-diff b i { width: 9px; height: 9px; rotate: 45deg; background: var(--dc); box-shadow: 0 0 8px var(--dc); }
.pb-diff small { font: 700 11px 'Cinzel', serif; letter-spacing: 0.12em; text-transform: uppercase; color: var(--za); text-shadow: 0 1px 3px #000, 0 0 8px #000; }
.pb-foe { position: relative; flex: 1 1 0; width: 100%; min-height: 110px; }
.pb-foe::before { content: ''; position: absolute; left: 22%; right: 22%; bottom: 2%; height: 12%; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.65), transparent); }
.pb-art { position: absolute; left: 50%; bottom: 0; height: 100%; max-width: 100%; translate: -50% 0; object-fit: contain; object-position: 50% 100%;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 22px color-mix(in srgb, var(--za) 25%, transparent)); animation: foeIn 0.6s cubic-bezier(.2, 1.3, .4, 1) both; }
canvas.pb-art { width: 100%; }
@keyframes foeIn { from { opacity: 0; transform: translateY(20px) scale(0.92); } }
.pb-name { flex: none; position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; margin-top: -14px; }
.pb-name .vh-title { width: min(92%, 350px); }
.modal-card .pb-name h2 { font-size: clamp(16px, 5.4vw, 23px); letter-spacing: 1px; }
.pb-tag { position: relative; z-index: 2; margin-bottom: -10px; padding: 3px 12px; border-radius: 8px; font: 700 11px 'Cinzel', serif; letter-spacing: 0.14em; text-transform: uppercase;
  color: #3a1d00; background: linear-gradient(180deg, #ffe58a, #e9a33b); box-shadow: 0 0 0 1px #6a3a00, 0 3px 6px rgba(0, 0, 0, 0.5); }
.pb.challenge .pb-tag, .pb.tier-legend .pb-tag { color: #fff; background: linear-gradient(180deg, #ff4a6a, #7a0020); box-shadow: 0 0 0 1px #ffb0c0, 0 3px 6px rgba(0, 0, 0, 0.5); }
.pb-panel { flex: none; width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 4px 6px;
  border: 18px solid transparent; border-image: url(../assets/ui/victory/ledger-panel.png) 112 fill / 34px round; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6)); }
.pb-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.pb-stats > div { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: center; column-gap: 6px; }
.pb-stats > div + div { border-left: 1px solid transparent; border-image: linear-gradient(transparent, rgba(247, 218, 134, 0.5), transparent) 1; }
.pb-stats .ic { width: 26px; height: 26px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.pb-stats b { font: 900 22px/1 'Cinzel', serif; background: linear-gradient(180deg, #fffbe6 10%, #ffd977 50%, #d98e2b 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1.5px 0 rgba(30, 6, 40, 0.95)); }
.pb-stats small { grid-column: 1 / -1; margin-top: 3px; font: 700 9px 'Cinzel', serif; letter-spacing: 0.1em; text-transform: uppercase; color: #cdb88a; white-space: nowrap; }
.pb-hit { margin: 0; font: italic 600 12.5px 'Spectral', serif; color: #ffb8c0; }
.pb-match { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding-top: 7px; border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(247, 218, 134, 0.5), transparent) 1; }
.pb-match > div { flex: 1 1 40%; display: flex; align-items: center; gap: 7px; padding: 4px 9px 4px 5px; border-radius: 10px; text-align: left; background: rgba(8, 4, 18, 0.45);
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.22); }
.pb-match .gem-ic, .pb-match .ic { width: 26px; height: 26px; flex: none; object-fit: contain; }
.pb-match .gem-ic + .gem-ic { margin-left: -12px; }
.pb-match span { display: flex; flex-direction: column; min-width: 0; }
.pb-match small { font: 700 8.5px 'Cinzel', serif; letter-spacing: 0.1em; text-transform: uppercase; color: #cdb88a; }
.pb-match b { font: 700 13.5px/1.15 'Spectral', serif; color: #f6ead0; }
.pb-match .weak { box-shadow: inset 0 0 0 1px rgba(120, 255, 160, 0.6), 0 0 10px rgba(90, 255, 140, 0.18); }
.pb-match .weak b { color: #9dffbe; }
.pb-match .resist b { color: #ffb8c0; }
.pb-note { margin: 0; font: italic 600 12.5px/1.3 'Spectral', serif; color: #ffe2b8; }
.pb-note b { font-style: normal; color: #fff; }
.pb-note.curse { color: #ffc4ce; }
.pb-note.curse b { color: #ff8aa0; }
.pb-note.warn { color: #ffb0b8; }
.pb .pre-sig { margin: 0; background: rgba(8, 4, 18, 0.45); }
.pb-pouch { cursor: pointer; gap: 8px; }
.pbp-head { display: flex; align-items: center; gap: 9px; text-align: left; }
.pbp-head .ic { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.pbp-head span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pbp-head b { font: 700 15px 'Cinzel', serif; color: #ffe6a6; }
.pbp-head small { font: italic 600 12px 'Spectral', serif; color: #cdbbe6; }
.pbp-head .btn { flex: none; }
.pbp-slots { display: flex; justify-content: space-around; gap: 6px; }
.pbp-slots > span { flex: 1; max-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pbp-slots i { width: 50px; height: 50px; display: grid; place-items: center; background: url(../assets/ui/battle/item-slot.png) center / contain no-repeat; }
.pbp-slots .r-rare i, .pbp-slots .r-epic i, .pbp-slots .r-legendary i { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--rc) 60%, transparent)); }
.pbp-slots i img { width: 64%; height: 64%; object-fit: contain; }
.pbp-slots small { font: 600 11.5px/1.15 'Spectral', serif; color: #f0e2c8; }
.pbp-slots .empty small { color: #8f82a8; font-style: italic; }
.pbp-slots .empty i { opacity: 0.55; }
.pb-tag { margin-bottom: -2px; }
.pb-panel { padding: 4px 12px; }
.modal-card .pb-name h2.mid { font-size: clamp(14px, 4.5vw, 19px); letter-spacing: 0.5px; }
.modal-card .pb-name h2.long { font-size: clamp(12px, 3.7vw, 16px); letter-spacing: 0; }
.pb-scene:has(.splash) + .pb .pb-foe { min-height: 60px; }
/* short phones: tighter plaque, panels and pouch so everything still fits */
@media (max-height: 800px) {
  .pb { gap: 4px; }
  .pb-top { min-height: 50px; }
  .pb-camp { width: 50px; height: 50px; }
  .pb-name .vh-title { width: min(80%, 300px); }
  .pb-foe { min-height: 90px; }
  .pb-panel { gap: 4px; padding: 0 10px; border-width: 14px; }
  .pb-stats b { font-size: 19px; }
  .pb-match > div { padding: 2px 8px 2px 4px; }
  .pbp-head small { display: none; }
  .pbp-head .ic { width: 28px; height: 28px; }
  .pbp-slots i { width: 42px; height: 42px; }
  .pbp-slots small { font-size: 10.5px; }
}
.modal-card .pb-name h2.long { white-space: normal; font-size: clamp(12px, 3.6vw, 15px); line-height: 1.05; }
.pbp-slots { padding: 0 14px; }
/* legendary foes: their square painting stands where a monster would, over a blurred copy of itself */
.scene-bg.arena.splash { filter: blur(16px) brightness(0.55) saturate(1.2); scale: 1.15; }
.pb-scene:has(.splash) + .pb .pb-foe { min-height: 120px; }
.pb-art.pb-splash { aspect-ratio: 1; height: 100%; max-height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 20%;
  -webkit-mask: radial-gradient(closest-side, #000 72%, transparent); mask: radial-gradient(closest-side, #000 72%, transparent); }

/* ---------- calm panels: dark glass and one fine gold line, no corner gems. Only the Victory plaque and stars stay ornate ---------- */
.vh-rewards, .vh-ledger, .pb-panel {
  border: 0 !important; border-image: none !important; border-radius: 14px; filter: none;
  background: linear-gradient(180deg, rgba(36, 20, 62, 0.86), rgba(14, 8, 28, 0.92));
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.42), inset 0 1px 0 rgba(255, 240, 200, 0.12), 0 12px 28px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.vh-ledger, .pb-panel { padding: 12px 14px; }
.vh-ledger { gap: 12px; }
/* XP and gold: one panel split down the middle, icon beside a big number */
.vh-rewards { gap: 0; padding: 10px 6px; animation: cardIn 0.5s 0.9s both; }
.vh-plaque { aspect-ratio: auto; background: none; filter: none; animation: none; display: flex; align-items: center; justify-content: center; gap: 10px; }
.vh-plaque + .vh-plaque { border-left: 1px solid transparent; border-image: linear-gradient(transparent, rgba(247, 218, 134, 0.5), transparent) 1; }
.vh-plaque .ic { position: static; translate: none; width: 34px; height: 34px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); }
.vh-plaque span { position: static; align-items: flex-start; }
.vh-plaque b { font-size: clamp(20px, 6vw, 26px); }
.vh-plaque small { margin-top: 3px; }
/* bars: a slim dark channel with a fine gold rim */
.vbar { height: 12px; border: 0; border-image: none; border-radius: 7px; background: #0b0617;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(247, 218, 134, 0.4); }
.vbar > i { inset: 2px; border-radius: 5px; }
.vrow .meter-label { margin-bottom: 4px; }
.vrow .meter-ic { width: 36px; height: 36px; }
@media (max-height: 800px) { .pb-panel { padding: 8px 12px; } }
/* a bigger Camp medallion, and breathing room between the pouch and the buttons */
.pb-top { min-height: 72px; }
.pb-camp { width: 72px; height: 72px; top: -4px; }
.pb-camp small { font-size: 10px; }
.pb-diff { padding: 0 80px; }
.modal-card:has(.pb) .modal-btns { margin-top: 18px; }
@media (max-height: 800px) {
  .pb-top { min-height: 64px; }
  .pb-camp { width: 64px; height: 64px; }
  .modal-card:has(.pb) .modal-btns { margin-top: 12px; }
}
/* legendary foes stand in the scene like everyone else, their painting blurred behind; cut-out edges fade into the floor */
.modal-card .pb-name h2 { overflow: hidden; }
.pb-art.pb-legend { -webkit-mask: linear-gradient(180deg, #000 82%, transparent); mask: linear-gradient(180deg, #000 82%, transparent); }
.pb-diff { padding: 0 76px; }
.pb-diff small { white-space: nowrap; font-size: clamp(9px, 2.7vw, 11px); letter-spacing: 0.08em; }
/* the pouch in two columns: its name and Change on the left, the slots beside them */
.pb-pouch { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
.pbp-head { flex-direction: column; gap: 4px; text-align: center; }
.pbp-head span { align-items: center; }
.pbp-head small { display: none; }
.pbp-head b { font-size: 14px; white-space: nowrap; }
.pbp-slots { padding: 0; }
.pbp-slots > span { max-width: 84px; }
.pbp-slots small { font-size: 11px; }
.pb-name { margin-top: -22px; }
.pb .pre-sig { padding: 4px 10px 4px 4px; }
.pb .pre-sig img { width: 30px; height: 30px; }
.pb-match .sig { box-shadow: inset 0 0 0 1px rgba(255, 95, 162, 0.55), 0 0 10px rgba(255, 70, 150, 0.18); }
.pb-match .sig img { width: 28px; height: 28px; flex: none; object-fit: contain; filter: drop-shadow(0 0 6px rgba(255, 70, 150, 0.7)); }
.pb-match .sig small { color: #ff9ac8; }
.pb-match .sig b { color: #ffe0f0; }
@media (max-height: 800px) { .pb-scene:has(.splash) + .pb .pb-foe { min-height: 100px; } }
/* the plaque's dark panel is centred 44.7% down the art; Cinzel's capitals sit 0.055em above the middle of
   their line, so nudge them down by that much to centre the letters themselves */
.modal-card .vh-title h2, .modal-card .pb-name h2, .modal-card .tc-head .vh-title h2 { top: 44.7%; line-height: 1; translate: 0 calc(-50% + 0.055em); }
/* the same capital-letter centring for the Cinzel labels on plaque buttons, tags and the chest's Tap to open */
.modal-btns .btn, .pb-tag, .tc-tap { padding-top: 0.11em; }
.pb-tag { padding-bottom: 3px; }
/* a big Camp medallion in the top-left; the difficulty centres in the room between it and the X */
.pb-top { min-height: 100px; justify-content: flex-start; }
.pb-camp { position: relative; flex: none; width: 100px; height: 100px; top: 0; margin-left: -6px; }
.pb-camp small { font-size: 13px; }
.pb-diff { flex: 1; min-width: 0; padding: 0 40px 0 4px; }
@media (max-height: 800px) {
  .pb-top { min-height: 84px; }
  .pb-camp { width: 84px; height: 84px; }
  .pb-camp small { font-size: 11px; }
}
@media (max-height: 800px) { .pb-top { min-height: 78px; } .pb-camp { width: 80px; height: 80px; } }
/* the foe fills its area and the picture centres inside it, so it never starts off to one side while loading */
.pb-art { left: 0; right: 0; width: 100%; max-width: none; translate: none; }
.pb-art.pb-splash { left: 50%; right: auto; width: auto; translate: -50% 0; }
/* the arena paintings are brightest at the top: shade behind the difficulty banner so it stays crisp */
.scene-bg.pb-glow { background: radial-gradient(ellipse 70% 30% at 50% 44%, color-mix(in srgb, var(--za) 14%, transparent), transparent 70%),
  linear-gradient(180deg, rgba(8, 4, 18, 0.72), rgba(8, 4, 18, 0.25) 13%, transparent 24%, transparent 38%, rgba(8, 4, 18, 0.55) 52%, rgba(8, 4, 18, 0.9)); }
.pb-diff b, .pb-diff small { text-shadow: 0 2px 0 rgba(20, 6, 30, 0.95), 0 0 10px rgba(0, 0, 0, 0.9), 0 0 16px color-mix(in srgb, var(--dc) 50%, transparent); }

/* ---------- polished walnut under the panels on the fight screen and in the Victory Hall ---------- */
.pb-panel, .vh-rewards, .vh-ledger { -webkit-backdrop-filter: none; backdrop-filter: none;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.25)), url(../assets/ui/panels/walnut.jpg) center / cover !important;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.55), inset 0 0 0 3px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.14), inset 0 -10px 24px rgba(0, 0, 0, 0.45), 0 12px 28px rgba(0, 0, 0, 0.6); }
/* text and chips read clearly on the wood */
.pb-match > div { background: rgba(6, 3, 12, 0.55); }
.pb-stats small, .pb-match small, .vh-plaque small { color: #e6cf98; }
.pb-hit, .pb-note, .pbp-head b, .pbp-slots small, .vrow .meter-label b, .vrow .meter-label small, .vh-ledger .v-pet { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); }
.vrow .meter-label small { color: #e2d3f0; }
.pb-stats > div + div, .vh-plaque + .vh-plaque { border-image: linear-gradient(transparent, rgba(247, 218, 134, 0.65), transparent) 1; }

/* ---------- camp places as full screens: a painting across the top, Pet Market cards below ---------- */
#camp-sheet .sheet-card { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0 !important; border-radius: 0 !important;
  border: 0 !important; border-image: none !important; box-shadow: none !important; background: #120a1c !important; padding: 0 0 env(safe-area-inset-bottom) !important; }
#camp-sheet.open { background: #120a1c; }
.sheet-scene { flex: none; position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 34dvh;
  background: var(--place-art, none) center 60% / cover no-repeat, url(../assets/scenes/camp-forest.jpg) var(--place-crop, 50% 50%) / 260% auto no-repeat;
  box-shadow: inset 0 -60px 40px -20px #120a1c, inset 0 70px 50px -30px rgba(18, 10, 28, 0.85); }
#camp-sheet[data-place="merchant"] { --place-art: url(../assets/scenes/place-merchant.jpg); --place-crop: 19% 21%; }
#camp-sheet[data-place="smith"] { --place-art: url(../assets/scenes/place-blacksmith.jpg); --place-crop: 80% 76%; }
#camp-sheet[data-place="satchel"] { --place-art: url(../assets/scenes/place-satchel.jpg); --place-crop: 12% 47%; }
/* the title, purse and X sit over the top of the painting */
#camp-sheet .sheet-head { position: absolute; z-index: 2; top: 0; left: 0; right: 0; padding: calc(env(safe-area-inset-top) + 10px) 56px 0; }
#camp-sheet .sheet-head h2 { margin: 0; font-size: 24px; filter: drop-shadow(0 2px 0 rgba(20, 6, 30, 0.95)) drop-shadow(0 0 10px rgba(0, 0, 0, 0.9)); }
#camp-sheet .sheet-head h2::after { display: none; }
#camp-sheet .sheet-head .purse { position: static; margin: 6px auto 0; background: rgba(10, 5, 22, 0.78); }
#camp-sheet .sheet-x { top: calc(env(safe-area-inset-top) + 8px) !important; right: 12px !important; }
#sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 24px; }
#sheet-body > .muted { margin: 4px 4px 10px; text-align: center; }
#sheet-body .den-h { margin: 14px 2px 8px; }
#sheet-body .den-h:first-child { margin-top: 4px; }
/* every row is a card, like the market's */
#sheet-body .shop-item, #sheet-body .arm-item, #sheet-body .wcard { --rcol: color-mix(in srgb, var(--rc, #d8b46a) 60%, transparent); margin: 0 0 10px; padding: 10px 12px 10px 10px; border: 0; border-radius: 16px;
  background: linear-gradient(135deg, rgba(60, 40, 90, 0.55), rgba(16, 10, 30, 0.85)); box-shadow: inset 0 0 0 1.5px var(--rcol, rgba(255, 210, 130, 0.35)); }
#sheet-body .arm-item { padding: 0; }
#sheet-body .shop-item.restock-row { --rcol: rgba(255, 210, 130, 0.3); }
#sheet-body .si-art { width: 64px; height: 64px; border-radius: 14px; flex: none; display: grid; place-items: center; border: 0; box-shadow: none;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--rc, #8a7ab0) 40%, #2a1a40), #120a1c 75%); }
#sheet-body .si-art img { width: 86%; height: 86%; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6)); }
#sheet-body .si-text b { font: 700 16px 'Cinzel', serif; color: var(--gold2); }
#sheet-body .si-text small { font: 600 13px/1.25 'Spectral', serif; color: #e8dcc0; }
#sheet-body .merch-weapon { margin: 0 0 4px; }
#sheet-body .merch-weapon .wcard { margin-bottom: 0; }
#sheet-body .forge-row { margin: 4px 0 6px; }
#sheet-body .armory-h { margin: 16px 2px 8px; font: 900 15px 'Cinzel', serif; color: var(--gold2); }
#camp-sheet .sheet-head h2 { white-space: nowrap; font-size: clamp(18px, 5.6vw, 24px); }

/* ---------- every pop-up window on polished walnut with one fine gold rim, no corner gems ---------- */
:root { --panel-bg: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.3)), url(../assets/ui/panels/walnut.jpg) center / cover; }
.modal-card { background: var(--panel-bg) !important; border-radius: 16px !important;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.6), inset 0 0 0 4px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.12), 0 22px 50px rgba(0, 0, 0, 0.7); }
.tree-detail { background: var(--panel-bg) !important; }
.modal-card .muted, .modal-card p { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }

/* ---------- the map's pinned cards on walnut: their colour lives in the text and a thin edge, not a bright fill ---------- */
.map-pin .diff-chip, .map-pin .trial-card, .map-pin .boss-ahead, .map-pin .trial-card.done {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.3)), url(../assets/ui/panels/walnut.jpg) center / cover !important; animation: none !important;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.55), inset 0 0 0 3px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.1), 0 6px 14px rgba(0, 0, 0, 0.55) !important;
  border-radius: 14px !important; }
.map-pin .trial-card::after { display: none; }
.map-pin .diff-chip { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dc) 70%, transparent), inset 0 0 0 3px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.1), 0 6px 14px rgba(0, 0, 0, 0.55) !important; }
.map-pin .diff-chip small, .map-pin .trial-card small, .map-pin .boss-ahead small { font: 700 9.5px 'Cinzel', serif; letter-spacing: 0.14em; color: #e6cf98; }
.map-pin .diff-chip b { color: var(--dc); text-shadow: 0 1px 2px #000, 0 0 10px color-mix(in srgb, var(--dc) 60%, transparent); }
.map-pin .trial-card b, .map-pin .boss-ahead b { color: #fff0d0; text-shadow: 0 1px 2px #000; }
.map-pin .boss-ahead { color: #fff0d0; }
.map-pin .boss-ahead small { color: #ff9aac; }
.map-pin .boss-ahead em { color: #ffd76a; text-shadow: 0 1px 2px #000; }
.map-pin .boss-ahead img { border-radius: 50%; box-shadow: 0 0 0 1.5px #ff8aa0, 0 0 10px rgba(255, 90, 120, 0.4); background: #1a0c14; object-fit: cover; object-position: 50% 15%; }

/* ---------- Perks: the tent painted across the top, the deck on the market's dark ground ---------- */
#tree { background: #120a1c; }
#tree .tree-scroll { padding: 0; }
#tree .tree { border: 0 !important; border-image: none !important; border-radius: 0; background: #120a1c !important; min-height: 0; }
#tree .tree::before, #tree .tree::after { display: none !important; }
#tree .perk-page { padding: 0 12px 24px; }
#tree .perk-page::before { content: ''; display: block; margin: 0 -12px 4px; aspect-ratio: 16 / 10; max-height: 30dvh;
  background: url(../assets/scenes/place-perks.jpg) center 60% / cover no-repeat, url(../assets/scenes/camp-forest.jpg) 80% 21% / 260% auto no-repeat;
  box-shadow: inset 0 -60px 40px -20px #120a1c, inset 0 30px 30px -20px #120a1c; }
#tree .pk-head { position: relative; margin-top: -54px; }

/* ---------- Campfire: the place painting when it's in, and market-style cards ---------- */
.hs-fire { background: url(../assets/scenes/place-campfire.jpg) center 60% / cover no-repeat, url(../assets/scenes/camp-living.jpg) 51% 62% / 260% auto no-repeat; }
.hs-kit-i, .hs-stat, .hs-rec { background: linear-gradient(135deg, rgba(60, 40, 90, 0.55), rgba(16, 10, 30, 0.85)); box-shadow: inset 0 0 0 1.5px rgba(255, 210, 130, 0.3); border-radius: 16px; }
.hs-title { background: rgba(14, 8, 26, 0.78); box-shadow: inset 0 0 0 1.5px rgba(255, 210, 130, 0.45); }

/* ---------- the Guide: a full-screen book of the rules ---------- */
.gd-scene { background: #120a1c; }
.scene-bg.gd-art { inset: 0 0 auto; height: 34dvh;
  background: url(../assets/scenes/place-guide.jpg) center 60% / cover no-repeat, url(../assets/scenes/title.jpg) center 35% / cover no-repeat;
  -webkit-mask: linear-gradient(180deg, #000 55%, transparent); mask: linear-gradient(180deg, #000 55%, transparent); }
.guide { flex: 1; min-height: 0; width: 100%; max-width: 480px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 0 2px 8px; text-align: left; }
.guide::-webkit-scrollbar { display: none; }
.modal-card .guide .gd-title { margin: 0 0 calc(34dvh - 110px); text-align: center; font-size: 30px; filter: drop-shadow(0 2px 0 rgba(20, 6, 30, 0.95)) drop-shadow(0 0 12px rgba(0, 0, 0, 0.9)); }
.modal-card .guide .gd-title::after { display: none; }
.gd-card { margin: 0 0 12px; padding: 12px 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(60, 40, 90, 0.55), rgba(16, 10, 30, 0.85)); box-shadow: inset 0 0 0 1.5px rgba(255, 210, 130, 0.3); }
.modal-card .gd-card h3 { margin: 0 0 6px; font: 900 17px 'Cinzel', serif; color: var(--gold2); }
.gd-card p { margin: 0 0 8px; font: 500 14px/1.4 'Spectral', serif; color: #eadfc6; text-shadow: none; }
.gd-card p:last-child { margin-bottom: 0; }
.gd-gems, .gd-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px; }
.gd-card > div:last-child { margin-bottom: 0; }
.gd-row { display: flex; align-items: center; gap: 10px; }
.gd-row > img, .gd-row > .ic, .gd-row > .gd-n { flex: none; }
.gd-gem { width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.gd-gem + .gd-gem { margin-left: -18px; }
.gd-row .ic { width: 30px; height: 30px; object-fit: contain; }
.gd-n { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; font: 900 15px 'Cinzel', serif; font-style: normal; color: #3a1d00;
  background: linear-gradient(180deg, #ffe58a, #e9a33b); box-shadow: 0 0 0 1px #6a3a00; }
.gd-row span { display: flex; flex-direction: column; min-width: 0; }
.gd-row b { font: 700 14px 'Cinzel', serif; color: #ffe6a6; }
.gd-row small { font: 500 13.5px/1.35 'Spectral', serif; color: #e2d6bd; }
.modal-card:has(.scene) .modal-x { position: absolute; z-index: 4; top: calc(env(safe-area-inset-top) + 12px); right: 12px; margin: 0; float: none; }
/* the campfire painting is taller and the level card drops below the flames */
.hs-fire { height: 290px; overflow: visible; background-position: center 70%, 51% 62%; }
.hs-fire .hs-title { margin-bottom: -44px; z-index: 2; }
.hs-body { padding-top: 54px; }

/* ======================================================================================================
   One pattern for every full-screen shop and menu (Pet Market, Merchant, Blacksmith, Satchel,
   Perks, Campfire, Guide): a top bar with the title, your balance and the X; a painting below it that
   fades into a dark walnut ground; restocks on a sign at the foot of the painting; dark glass cards.
   ====================================================================================================== */
:root {
  --ground: linear-gradient(rgba(12, 6, 20, 0.8), rgba(12, 6, 20, 0.86)), url(../assets/ui/panels/walnut.jpg) center top / 100% auto repeat-y;
  --glass: linear-gradient(160deg, rgba(40, 24, 62, 0.72), rgba(10, 5, 18, 0.84));
  --glass-edge: rgba(255, 210, 130, 0.32);
}
#market, #tree, #hero, #den-shop-dummy { background: var(--ground) !important; }
#camp-sheet .sheet-card { background: var(--ground) !important; }
.gd-scene { background: var(--ground) !important; }
#tree .tree { background: none !important; }

/* the top bar: the camp pages use the very same bar as the Pet Market */
#camp-sheet .sheet-head { position: relative !important; order: -1; top: auto; left: auto; right: auto; flex: none; padding: calc(12px + env(safe-area-inset-top)) 14px 12px !important;
  display: flex; align-items: center; gap: 10px; text-align: left; }
#sheet-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
#camp-sheet .sheet-head h2 { flex: 1; min-width: 0; margin: 0; text-align: center; font-size: clamp(15px, 4.4vw, 20px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; filter: none; }
#camp-sheet .sheet-head .purse { position: static; display: flex; gap: 6px; margin: 0; padding: 0; width: auto; background: none !important; box-shadow: none !important; border: 0; }
#camp-sheet .sheet-head .purse span { display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px; border: 8px solid transparent; border-image: var(--kit-inset) 70 fill / 18px stretch; }
#camp-sheet .sheet-head .purse small { display: none; }
#camp-sheet .sheet-head .purse b { font: 900 15px 'Cinzel', serif; color: var(--gold); }
#camp-sheet .sheet-head .purse .ic { width: 18px; height: 18px; }
#camp-sheet .sheet-x { position: static !important; flex: none; width: 40px !important; height: 40px !important; }

/* paintings fade into the ground instead of a flat colour */
.mk-stall, .sheet-scene, #tree .perk-page::before, .hs-fire { box-shadow: none !important;
  -webkit-mask: linear-gradient(180deg, #000 72%, transparent); mask: linear-gradient(180deg, #000 72%, transparent); }
.sheet-scene { position: relative; aspect-ratio: auto; height: min(62.5vw, 34dvh); max-height: none; }
#tree .perk-page::before { width: calc(100% + 24px); aspect-ratio: auto; height: min(62.5vw, 30dvh); max-height: none; }
.hs-fire { -webkit-mask: none; mask: none; }
.hs-fire::after { content: ''; position: absolute; inset: auto 0 0; height: 90px; background: linear-gradient(transparent, rgba(12, 6, 20, 0.85)); pointer-events: none; }
/* the restock sign sits on the painting, the same in the Merchant and the Pet Market */
.sheet-scene .mk-sign { -webkit-mask: none; mask: none; flex-direction: column; gap: 6px; padding: 8px 10px; }
.sheet-scene { -webkit-mask: none; mask: none; }
.sheet-scene::before { content: ''; position: absolute; inset: 0; background: inherit; -webkit-mask: linear-gradient(180deg, #000 72%, transparent); mask: linear-gradient(180deg, #000 72%, transparent); }
#camp-sheet .sheet-scene { background: none; }
#camp-sheet .sheet-scene::before { background: var(--place-art, none) center 60% / cover no-repeat, url(../assets/scenes/camp-forest.jpg) var(--place-crop, 50% 50%) / 260% auto no-repeat; }
.mk-sign span { display: flex; gap: 6px; }
.mk-sign .btn .ic { width: 16px; height: 16px; }

/* cards: dark glass with a rarity edge, everywhere */
.mk-pet, .mk-good, #sheet-body .shop-item, #sheet-body .arm-item, #sheet-body .wcard, .hs-kit-i, .hs-stat, .hs-rec, .gd-card, .pk-slot.empty, .pk-slot.locked {
  background: var(--glass) !important; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.hs-kit-i, .hs-stat, .hs-rec, .gd-card, .pk-slot.empty, .pk-slot.locked, #sheet-body .shop-item:not([class*="r-"]) { box-shadow: inset 0 0 0 1.5px var(--glass-edge) !important; }
#camp-sheet .sheet-head { gap: 6px; padding-left: 12px !important; padding-right: 12px !important; }
#sheet-head { gap: 6px; }
#camp-sheet .sheet-head .purse { gap: 4px; }
#camp-sheet .sheet-head .purse span { gap: 4px; padding: 2px 3px; border-width: 6px; border-image-width: 14px; }
/* the Guide follows the same pattern: top bar, then the painting, then cards */
.modal-card:has(.gd-scene) { padding: 0 0 calc(env(safe-area-inset-bottom) + 14px) !important; }
.gd-top { flex: none; width: 100%; padding: calc(12px + env(safe-area-inset-top)) 60px 12px !important; }
.modal-card .gd-top h2 { margin: 0; font-size: 20px; filter: none; }
.modal-card .gd-top h2::after { display: none; }
.guide { padding: 0 12px 8px; max-width: none; }
.gd-paint { margin: 0 -12px 8px; height: min(62.5vw, 30dvh); background: url(../assets/scenes/place-guide.jpg) center 60% / cover no-repeat;
  -webkit-mask: linear-gradient(180deg, #000 72%, transparent); mask: linear-gradient(180deg, #000 72%, transparent); }
.modal-card:has(.gd-scene) .modal-btns { padding: 0 12px; }
.modal-card:has(.gd-scene) .modal-x { top: calc(env(safe-area-inset-top) + 9px); }
/* restock signs read the same everywhere: the line on top, the buttons beneath */
.mk-sign { flex-direction: column; gap: 6px; padding: 8px 10px; }

/* balance chips everywhere: a slim dark pill with one fine gold line, no ornate frame */
.gold-chip, .sp-chip, #camp-sheet .sheet-head .purse span {
  border: 0 !important; border-image: none !important; border-radius: 20px !important; padding: 5px 11px 5px 7px !important; gap: 6px !important;
  background: rgba(10, 5, 20, 0.75) !important; box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4) !important; }
.gold-chip b, .sp-chip b, #camp-sheet .sheet-head .purse b { font: 900 15px/1 'Cinzel', serif !important; color: #ffe7a8 !important; padding-top: 0.1em; }
.gold-chip .ic, .sp-chip .ic, #camp-sheet .sheet-head .purse .ic { width: 20px !important; height: 20px !important; }

/* restock: just the button on the painting, no box around it */
.mk-sign { background: none !important; box-shadow: none !important; padding: 0 !important; }
.mk-sign .btn { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55); }

/* a polished steel ground, every item on its own walnut panel */
body { --ground: linear-gradient(rgba(8, 8, 14, 0.45), rgba(8, 8, 14, 0.6)), url(../assets/ui/panels/steel.jpg) center top / 100% auto repeat-y; }
:is(.mk-pet, .mk-good, #sheet-body .shop-item, #sheet-body .arm-item, #sheet-body .wcard) {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.32)), url(../assets/ui/panels/walnut.jpg) center / cover !important;
  -webkit-backdrop-filter: none; backdrop-filter: none; }
:is(.mk-pet-art, .mk-good-art, #sheet-body .si-art, #sheet-body .wcard .wc-art) { background: radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--rcol, #8a7ab0) 35%, #1a0e08), rgba(10, 5, 2, 0.85) 78%) !important; }
:is(.mk-pet-text p, .mk-good p, #sheet-body .si-text small, .den-h, .mk-note) { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); }
/* pictures sit straight on the wood, no dark well behind them */
:is(.mk-pet-art, .mk-good-art, #sheet-body .si-art, #sheet-body .wcard .wc-art) { background: none !important; box-shadow: none !important; border: 0 !important; }
:is(.mk-pet-art, .mk-good-art, #sheet-body .si-art, #sheet-body .wcard .wc-art) img { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7)) !important; }
/* the steel ground tiles seamlessly down long pages */
body { --ground: linear-gradient(rgba(8, 8, 14, 0.25), rgba(8, 8, 14, 0.4)), url(../assets/ui/panels/steel-tall.jpg) center top / 100% auto repeat-y; }
/* the painted tall steel is evenly lit and already dark: only a light shade on top */
body { --ground: linear-gradient(rgba(8, 8, 14, 0.1), rgba(8, 8, 14, 0.25)), url(../assets/ui/panels/steel-tall.jpg) center top / 100% auto repeat-y; }
/* walnut cards on the steel ground in the Guide, Campfire and Perks too */
:is(.gd-card, .hs-kit-i, .hs-stat, .hs-rec, .hs-title, .pk-slot.empty, .pk-slot.locked) {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.32)), url(../assets/ui/panels/walnut.jpg) center / cover !important;
  -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.5), inset 0 0 0 3px rgba(0, 0, 0, 0.25), 0 6px 14px rgba(0, 0, 0, 0.5) !important; }
:is(.gd-card p, .gd-row small, .hs-stat small, .hs-rec small) { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); }

/* ---------- the map's bottom buttons: painted medallions in the stage ring, on a walnut bar ---------- */
.bottomnav { background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)), url(../assets/ui/panels/walnut.jpg) center / cover !important;
  box-shadow: inset 0 1px 0 rgba(247, 218, 134, 0.55), 0 -6px 16px rgba(0, 0, 0, 0.5); padding-top: 10px; }
.navbtn { gap: 5px; font-size: 12.5px; text-shadow: 0 1px 2px #000, 0 0 6px rgba(0, 0, 0, 0.8); }
.navbtn span { width: 58px !important; height: 58px !important; border-radius: 50% !important; overflow: visible; display: grid; place-items: center;
  background: var(--nav-art, radial-gradient(circle at 50% 40%, #3a2350, #120a1c 75%)) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 0 12px rgba(0, 0, 0, 0.55) !important; }
.navbtn span::before { content: ''; position: absolute; inset: -6px; pointer-events: none; background: url(../assets/ui/map/ring-stage.png) center / contain no-repeat; }
#nav-tree span { --nav-art: url(../assets/scenes/place-perks.jpg) 50% 66% / 260% auto; }
#nav-camp span { --nav-art: url(../assets/scenes/place-campfire.jpg) 48% 72% / 250% auto; }
#nav-help span { --nav-art: url(../assets/scenes/place-guide.jpg) 52% 50% / 230% auto; }
#nav-tree span .ic, #nav-camp span .ic, #nav-help span .ic { display: none; }
#nav-sound span .ic { width: 36px; height: 36px; }
.navbtn .dot { top: 0; right: calc(50% - 30px); z-index: 2; }
#nav-tree span { --nav-art: url(../assets/scenes/place-perks.jpg) 50% 74% / 280% auto; }
.guide canvas.gd-live { width: 40px !important; height: 40px !important; min-width: 0; max-width: none; flex: none; margin: -5px; }
.guide .gd-pair { display: flex !important; flex-direction: row !important; align-items: center; width: 40px; flex: none; margin: 0 -5px; }
.guide .gd-pair canvas.gd-live { width: 30px !important; height: 30px !important; margin: 0 -5px !important; }
/* pouch items nearly fill their slot (the item art has its own margin) */
.pbp-slots i img { width: 100%; height: 100%; transform: scale(1.12); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }

/* ---------- performance: glows pulse by fading a ready-made glow layer (cheap for the GPU) instead of
   animating shadows and filters, which repaints every frame; no blur-behind panels ---------- */
.pet-slot.ready { animation: none; }
.pet-slot.ready::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none; opacity: 0; z-index: 3;
  box-shadow: 0 0 24px rgba(255, 210, 90, 0.95); animation: glowFade 1.1s ease-in-out infinite; }
#battle .item-slot.r-legendary, #battle .item-slot.r-epic { animation: none; }
#battle .item-slot.r-legendary::before, #battle .item-slot.r-epic::before { content: ''; position: absolute; inset: 0; border-radius: 10px; pointer-events: none; opacity: 0; z-index: 1;
  box-shadow: inset 0 0 14px var(--rc), 0 0 12px color-mix(in srgb, var(--rc) 70%, transparent); animation: glowFade 2.4s ease-in-out infinite; }
.pl-label, .camp-pet .cp-label { animation: none; }
.wcard.r-legendary, .item-slot.r-legendary, .item-slot.r-epic, .loot-card.r-legendary { animation-name: none; }
* { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
#den .den-plate, #den .den-pets, #den .den-collar.r-none, .den-view { background: rgba(14, 8, 28, 0.62); }
/* without the blur behind them, the Den's drawer and preview get a touch more body so text stays clear */
.den-drawer { background: linear-gradient(180deg, rgba(18, 10, 36, 0.8), rgba(12, 6, 24, 0.96) 120px) !important; }
.den-preview { background: rgba(14, 8, 28, 0.86) !important; }
.hs-title { background: rgba(14, 8, 26, 0.85); }
/* the ribbon label sits on the ribbon's flat band (87-93.5% down the frame art) and grows with the card */
.tl-frame { container-type: inline-size; }
.tl-frame .rib { top: 87%; height: 6.5%; left: 27%; right: 27%; font-size: max(6px, 5.6cqw) !important; letter-spacing: 0.03em; line-height: 1; padding-top: 0.12em; }

/* fight screen title: centred on the screen (Camp tucks into the corner), ivory on a soft dark halo so it
   reads over every zone; the difficulty's colour lives in the tint, the diamonds and the glow */
.pb-top { justify-content: center; }
.pb-camp { position: absolute !important; left: -10px; top: -12px; width: 92px !important; height: 92px !important; z-index: 2; }
.pb-diff { flex: none; padding: 8px 22px 10px; max-width: calc(100% - 170px); box-sizing: content-box;
  background: radial-gradient(ellipse closest-side, rgba(8, 4, 18, 0.62), rgba(8, 4, 18, 0.35) 60%, transparent); }
.pb-diff b { color: color-mix(in srgb, var(--dc) 30%, #fff6e2); text-shadow: 0 2px 2px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.85), 0 0 22px color-mix(in srgb, var(--dc) 60%, transparent); }
.pb-diff small { color: #f3e9d2; white-space: normal; text-align: center; text-shadow: 0 1px 2px #000, 0 0 8px rgba(0, 0, 0, 0.95); }
@media (max-height: 800px) { .pb-camp { width: 78px !important; height: 78px !important; } }
.pb-diff small { white-space: nowrap; font-size: clamp(9px, 2.55vw, 11px); letter-spacing: 0.06em; }
.pb-diff { max-width: none; }
/* victory stars stand on their own: no medallion sockets; a missed star is a dim grey star */
.vh-socket { background: none !important; filter: none; aspect-ratio: 320 / 305; }
.vh-star { left: 0; top: 0; width: 100%; filter: drop-shadow(0 0 12px rgba(255, 200, 80, 0.75)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5)); }
.vh-socket:empty { background: url(../assets/ui/victory/star-big.png) center / contain no-repeat !important; filter: grayscale(1) brightness(0.32); opacity: 0.75; }
/* Camp sits fully on screen at the left of the top panel, level with the title */
.pb-camp { left: 2px; top: 50%; translate: 0 -50%; width: 84px !important; height: 84px !important; }
@media (max-height: 800px) { .pb-camp { width: 74px !important; height: 74px !important; } }

/* ---------- side-by-side weapon compare at the Merchant and Blacksmith: a walnut card, the other weapon's numbers green or red ---------- */
#sheet-body .wcmp { margin: 0 0 10px; padding: 10px 12px; border-radius: 16px; text-align: left;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.32)), url(../assets/ui/panels/walnut.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.5), inset 0 0 0 3px rgba(0, 0, 0, 0.25), 0 6px 14px rgba(0, 0, 0, 0.5); }
.merch-weapon .wcmp { width: 100%; }
.wcmp-grid { display: grid; grid-template-columns: minmax(64px, auto) 1fr 1fr; gap: 6px 10px; align-items: baseline; }
.wcmp-grid > * { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); }
.wcmp-h { font: 700 13px 'Cinzel', serif; color: var(--gold2); padding-bottom: 4px; border-bottom: 1px solid rgba(247, 218, 134, 0.35); }
.wcmp-l { font: 600 12px 'Spectral', serif; color: #e6cf98; }
.wcmp-grid > b:not(.wcmp-h) { font: 700 14px 'Spectral', serif; color: #f3ead6; }
.wcmp-bon { display: flex; flex-direction: column; gap: 2px; }
.wcmp-bon i { font: 600 12px/1.25 'Spectral', serif; font-style: normal; color: #e8dcc0; }
.wcmp .up { color: #5fe08a !important; } .wcmp .down { color: #ff8a9a !important; }
.wcmp-pow { display: grid; grid-template-columns: minmax(64px, auto) 1fr 1fr; gap: 10px; margin-top: 6px; }
.wcmp-pow::before { content: 'Power'; font: 600 12px 'Spectral', serif; color: #e6cf98; }
.wcmp-pow small { font: 600 12px/1.25 'Spectral', serif; color: #ffc7de; }
.wcmp-note { margin: 8px 0 0; font: 500 12px/1.3 'Spectral', serif; color: #cbbfa6; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); }
/* sound toggle on the fight screen: top right, just left of the X */
.pb-snd { position: absolute; right: 52px; top: 50%; translate: 0 -50%; width: 36px; height: 36px; z-index: 2; }
.pb-snd svg { width: 19px; height: 19px; }
.pb-snd { right: 2px; top: auto; bottom: 2px; translate: none; }

/* ---------- first-time tips: a slim walnut bubble pointing at what it explains ---------- */
.coach { position: fixed; z-index: 90; max-width: min(300px, calc(100vw - 24px)); padding: 10px 14px; border-radius: 14px; cursor: pointer;
  font: 600 14px/1.35 'Spectral', serif; color: #f6ead0; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35)), url(../assets/ui/panels/walnut.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.75), 0 8px 22px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(247, 218, 134, 0.12);
  opacity: 0; transform: translateY(6px) scale(0.96); transition: opacity 0.28s, transform 0.28s cubic-bezier(.2, 1.4, .4, 1); }
.coach.below { transform: translateY(-6px) scale(0.96); }
.coach.show { opacity: 1; transform: none; }
.coach b { font-family: 'Cinzel', serif; color: #ffe6a6; }
.coach-arrow { position: absolute; left: var(--ax, 50%); bottom: -7px; width: 14px; height: 14px; translate: -50% 0; rotate: 45deg;
  background: #3a2414; box-shadow: inset -1px -1px 0 rgba(247, 218, 134, 0.75); }
.coach.below .coach-arrow { bottom: auto; top: -7px; box-shadow: inset 1px 1px 0 rgba(247, 218, 134, 0.75); }
.coach.free .coach-arrow { display: none; }
.coach-target { animation: coachPing 1.4s ease-in-out infinite; }
@keyframes coachPing { 50% { filter: drop-shadow(0 0 10px rgba(255, 220, 140, 0.9)); } }
/* the Settings medallion: the whole golden cog inside the ring */
#nav-sound span .ic { display: none; }
#nav-sound span { --nav-art: url(../assets/scenes/place-settings.jpg) 50% 24% / 205% auto; }

/* the timed-rules card shown before your first taming and first training */
.rules-card { text-align: left; }
.rules-card h2 { text-align: center; }
.rc-lead { margin: -2px 0 12px; text-align: center; font: italic 600 15px 'Spectral', serif; color: #ffe2a8; }
.rc-rows { display: flex; flex-direction: column; gap: 10px; }
.rc-rows > div { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 14px; background: rgba(8, 4, 18, 0.45); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.3); }
.rc-rows .ic { width: 32px; height: 32px; flex: none; object-fit: contain; }
.rc-rows span { display: flex; flex-direction: column; min-width: 0; }
.rc-rows b { font: 700 15px 'Cinzel', serif; color: #ffe6a6; }
.rc-rows small { font: 500 13.5px/1.3 'Spectral', serif; color: #eadfc6; }
/* the clock you'll watch, shown on the rules card exactly as it looks in the fight */
.rc-clock { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: rgba(8, 4, 18, 0.45); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.3); }
.rc-clock .moves { position: relative; flex: none; margin: 0; animation: none; }
.rc-clock span { font: 600 13.5px/1.3 'Spectral', serif; color: #ffe2a8; }

/* tap a loot card to read what it does */
.tloot { cursor: pointer; }
.tloot.picked .tl-frame { transform: translateY(-6px) scale(1.04); transition: transform 0.2s; filter: drop-shadow(0 0 16px var(--rc)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.6)); }
.tc-info { position: absolute; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 76px); z-index: 4; display: flex; flex-direction: column; gap: 3px; padding: 11px 14px; border-radius: 14px; cursor: pointer;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35)), url(../assets/ui/panels/walnut.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.7), 0 10px 24px rgba(0, 0, 0, 0.6); animation: fade 0.2s; }
.tc-info[hidden] { display: none; }
.tc-info b { font: 700 15px 'Cinzel', serif; color: #ffe6a6; }
.tc-info span { font: 500 14px/1.35 'Spectral', serif; color: #f1e5cb; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.tc-box:has(.tc-info:not([hidden])) .tc-hint { visibility: hidden; }
.tc-info { bottom: calc(env(safe-area-inset-bottom) + 68px); padding: 9px 14px; }
.tc .meter-note { max-width: 92%; text-align: center; line-height: 1.25; }

/* locked deck slots: a padlock above an embossed gold seal with the unlock level */
.pk-slot.locked { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 8%; opacity: 1 !important; }
.pk-slot.locked .pk-lock { width: 40%; height: auto; aspect-ratio: 1; object-fit: contain; opacity: 0.9; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.7)); }
.pk-seal { width: 62%; aspect-ratio: 1; border-radius: 50%; display: flex !important; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  background: radial-gradient(circle at 35% 30%, #fbe3a0, #d9a441 45%, #8a5a14 100%);
  box-shadow: inset 0 2px 2px rgba(255, 245, 210, 0.75), inset 0 -3px 4px rgba(70, 35, 0, 0.7), 0 0 0 2px #6a420c, 0 0 0 4px rgba(247, 218, 134, 0.35), 0 4px 8px rgba(0, 0, 0, 0.6); }
.pk-seal small { font: 700 clamp(7px, 2vw, 9px) 'Cinzel', serif !important; letter-spacing: 0.08em !important; text-transform: uppercase; color: #5a3608 !important; text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6); }
.pk-seal b { display: block; margin-top: 1px; font: 900 clamp(15px, 4.6vw, 21px) 'Cinzel', serif !important; color: #4a2a04 !important;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.7), 0 -1px 0 rgba(60, 30, 0, 0.5); }
/* the unlock seal as a brushed-steel badge: cool, embossed, a fine gold rim */
.pk-seal { background: linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 45%, rgba(0, 0, 0, 0.35)), url(../assets/ui/panels/steel-tall.jpg) center / 300% auto !important;
  box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.35), inset 0 -2px 3px rgba(0, 0, 0, 0.6), 0 0 0 1.5px rgba(247, 218, 134, 0.55), 0 0 0 3px rgba(10, 8, 16, 0.6), 0 4px 8px rgba(0, 0, 0, 0.55) !important; }
.pk-seal small { color: #c9ccd6 !important; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 255, 255, 0.15) !important; }
.pk-seal b { color: #e9ebf0 !important; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.25) !important; }

/* ---------- the unlock card (App Store version): the road ahead painted behind, the counts on walnut ---------- */
.modal-card:has(.pw-scene) { padding: calc(env(safe-area-inset-top) + 14px) 14px calc(env(safe-area-inset-bottom) + 14px) !important; }
.scene-bg.pw-art { background: linear-gradient(180deg, rgba(8, 4, 18, 0.15), rgba(8, 4, 18, 0.25) 40%, rgba(8, 4, 18, 0.85) 62%, #0c0716),
  url(../assets/scenes/paywall.jpg) center top / cover no-repeat, url(../assets/scenes/title.jpg) center 30% / cover no-repeat; }
.pw { flex: 1; min-height: 0; width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; justify-content: safe flex-end; gap: 8px; overflow-y: auto; scrollbar-width: none; }
.pw .vh-title { width: min(96%, 380px); }
.modal-card .pw .vh-title h2 { font-size: clamp(15px, 4.8vw, 21px); letter-spacing: 1px; }
.pw-lead { margin: 0; text-align: center; font: italic 600 15px/1.3 'Spectral', serif; color: #ffe2a8; text-shadow: 0 1px 3px #000, 0 0 10px #000; }
.pw-list { width: 100%; margin: 0; padding: 10px 14px; list-style: none; display: grid; grid-template-columns: 1fr; gap: 5px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35)), url(../assets/ui/panels/walnut.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.55), 0 10px 24px rgba(0, 0, 0, 0.6); }
.pw-list li { display: flex; align-items: baseline; gap: 8px; font: 500 14px/1.3 'Spectral', serif; color: #eadfc6; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.pw-list li::before { content: ''; flex: none; width: 7px; height: 7px; rotate: 45deg; translate: 0 -2px; background: #e8b84a; box-shadow: 0 0 6px rgba(232, 184, 74, 0.7); }
.pw-list b { flex: none; font: 700 14.5px 'Cinzel', serif; color: #ffe6a6; }
.pw-price { margin: 2px 0 0; font: 700 15px 'Cinzel', serif; color: #fff0d0; text-shadow: 0 1px 3px #000; }
.pw-restore { border: 0; background: none; padding: 2px 8px; font: 600 13px 'Spectral', serif; color: #c9bfe0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.modal-card:has(.pw-scene) .modal-btns { margin-top: 10px; }
.pw-list li { display: block; padding-left: 16px; position: relative; }
.pw-list li::before { position: absolute; left: 0; top: 0.55em; translate: none; }
.pw-list b { margin-right: 6px; }

/* unlock card: the painted road ahead fills the screen; three sample layouts (a rows, b tiles, c headline) */
.scene-bg.pw-art { background: linear-gradient(180deg, transparent 30%, rgba(8, 4, 18, 0.45) 48%, rgba(8, 4, 18, 0.88) 66%, #0b0715),
  url(../assets/scenes/paywall.jpg) center top / cover no-repeat !important; }
.pw { justify-content: flex-end; justify-content: safe flex-end; gap: 10px; }
.pw .vh-title { margin-top: auto; }
.pw-lead { font: italic 600 15.5px/1.3 'Spectral', serif !important; }
.pw-price { font: 700 13px 'Cinzel', serif !important; letter-spacing: 0.12em; color: #e6cf98 !important; }
.pw-panel, .pw-rows, .pw-tiles, .pw-list { border-radius: 14px; background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35)), url(../assets/ui/panels/walnut.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.55), 0 10px 24px rgba(0, 0, 0, 0.6); }
/* gilded words for the headlines and numbers */
.pw-rows b, .pw-tiles b, .pw-hero, .pw-list b { background: linear-gradient(180deg, #fffbe6 10%, #ffd977 50%, #d98e2b 95%); -webkit-background-clip: text; background-clip: text; color: transparent !important;
  filter: drop-shadow(0 1.5px 0 rgba(30, 6, 40, 0.95)); }
/* a: feature rows */
.pw-rows { width: 100%; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.pw-rows > div { display: flex; align-items: center; gap: 11px; }
.pw-rows .ic { width: 30px; height: 30px; flex: none; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.pw-rows span { display: flex; flex-direction: column; min-width: 0; }
.pw-rows b { font: 900 15px/1.15 'Cinzel', serif; }
.pw-rows small { font: 500 13px/1.3 'Spectral', serif; color: #eadfc6; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
/* b: big numbers */
.pw-tiles { width: 100%; padding: 12px 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 4px; }
.pw-tiles > div { display: flex; flex-direction: column; align-items: center; text-align: center; }
.pw-tiles b { font: 900 clamp(26px, 8vw, 34px)/1 'Cinzel', serif; }
.pw-tiles small { margin-top: 3px; font: 700 10px 'Cinzel', serif; letter-spacing: 0.1em; text-transform: uppercase; color: #e6cf98; }
.pw-sub { margin: 0; text-align: center; font: 500 14px/1.35 'Spectral', serif; color: #f1e5cb; text-shadow: 0 1px 3px #000, 0 0 10px #000; }
/* c: a headline, then the rest */
.pw-hero { margin: 0; text-align: center; font: 900 clamp(19px, 5.6vw, 24px)/1.25 'Cinzel', serif; }
.pw-c .pw-list b { display: block; font: 900 14.5px 'Cinzel', serif; }
.pw-c .pw-list { padding: 10px 14px; gap: 7px; }
.pw-rows, .pw-list { text-align: left; }
/* the headline over the painting: bright ivory with a dark outline, so it reads on any part of the art */
.pw-hero { background: none !important; -webkit-background-clip: border-box !important; background-clip: border-box !important; filter: none !important;
  color: #fff6e2 !important; font: 900 clamp(18px, 5.4vw, 23px)/1.25 'Cinzel', serif !important; letter-spacing: 0.5px; padding: 0 6px;
  -webkit-text-stroke: 3px rgba(20, 8, 30, 0.9); paint-order: stroke fill;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 18px rgba(0, 0, 0, 0.7); }
.pw-c .pw-list { gap: 9px; }
.pw-c .pw-list b { font-size: 15px; letter-spacing: 0.04em; }
.pw-c .pw-list span { display: block; margin-top: 1px; font-size: 13.5px; }
/* the unlock card's box: brushed steel, gold headings, short bullet points */
.pw-box { width: 100%; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; text-align: left; border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 40%, rgba(0, 0, 0, 0.3)), url(../assets/ui/panels/steel-tall.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 24px rgba(0, 0, 0, 0.6); }
.pw-box b { display: block; font: 900 15.5px 'Cinzel', serif; letter-spacing: 0.05em; color: #ffd977;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9), 0 0 10px rgba(255, 200, 90, 0.25); }
.pw-box ul { margin: 3px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 1px; }
.pw-box li { position: relative; padding-left: 14px; font: 500 14px/1.3 'Spectral', serif; color: #eef0f4; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85); }
.pw-box li::before { content: ''; position: absolute; left: 1px; top: 0.55em; width: 5px; height: 5px; rotate: 45deg; background: #e8b84a; }
.rules-card .pw-box { padding: 12px 14px; }
.rules-card .pw-box ul { gap: 6px; margin: 0; }
.rules-card .rc-clock span { font-size: 14.5px; }
/* an opened armory row already shows the weapon's picture, name and type: the detail below skips them */
.arm-detail .wcard .wc-art, .arm-detail .wcard .wc-name, .arm-detail .wcard > .wc-body > .rar { display: none; }
.arm-detail .wcard { padding: 10px 14px !important; }
.arm-detail .wcard .wc-power, .arm-detail .wcard .wc-aff { display: none; }
/* an update reload goes straight back to the map: don't flash the title screen on the way */
html.resuming #title { visibility: hidden; }
/* the App Store version moves saves with the iPhone or iPad itself, not with transfer codes */
html.native #btn-device { display: none; }
/* Fight! waits while first-time tips are showing */
.modal-btns .btn.waiting { filter: grayscale(0.6) brightness(0.65); pointer-events: none; transition: filter 0.3s; }
/* the moves and gold numbers sit on the middle of their rings (they read a touch low) */
#battle .moves b { translate: 0 -2px; }
#battle #p-gold b { translate: 0 -4px; }
/* a slim tip for tight spots (the gap between the board and the health bar) */
.coach.compact { padding: 5px 12px; font-size: 13px; line-height: 1.2; white-space: nowrap; border-radius: 10px; }
.coach.compact .coach-arrow { width: 10px; height: 10px; bottom: -5px; }
/* the ability name and pet level sit on top of the gold ring */
#battle .weapon-slot .wready, #battle .pet-slot .plv { z-index: 4; }
/* a fresh install waits a moment for an iCloud save before showing the menu */
#title.icloud-wait .title-menu { visibility: hidden; }
/* a charged weapon tapped mid-cascade: pressed in until it fires */
#battle .weapon-slot.queued img { transform: scale(0.92); filter: drop-shadow(0 0 14px #ffd84a) brightness(1.3); }
.icloud-check { display: none; font: 600 15px 'Spectral'; color: #fff; text-shadow: 0 1px 3px #000; margin: 0; }
#title.icloud-wait .icloud-check { display: block; }
#title.icloud-wait .title-menu { display: none; }

/* ---------- the Daily Trial stands out on the map: a prism border running round it, a warm glow and a few twinkles ---------- */
@property --trial-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
#map .map-pin .trial-card:not(.done) { overflow: visible; animation: trial-pulse 2.4s ease-in-out infinite !important;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.3), 0 0 16px rgba(255, 200, 90, 0.45), 0 6px 14px rgba(0, 0, 0, 0.55) !important; }
#map .map-pin .trial-card:not(.done)::before { content: ''; position: absolute; inset: -1px; border-radius: 15px; padding: 3px; pointer-events: none;
  background: conic-gradient(from var(--trial-a), #ffd76a, #fff6d0, #ff8ad8, #b07bff, #6ac8ff, #7dffb0, #ffd76a);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: trial-spin 3.5s linear infinite; }
#map .map-pin .trial-card:not(.done)::after { display: block !important; content: ''; position: absolute; inset: -4px; pointer-events: none; border-radius: 16px;
  background: radial-gradient(circle at 12% 0%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 63% 100%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 100% 30%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 38% 0%, #ffe9a0 0 1px, transparent 2px);
  animation: trial-twinkle 1.8s ease-in-out infinite; }
#map .map-pin .trial-card:not(.done) small { color: #ffd76a; }
#map .map-pin .trial-card:not(.done) em { padding: 6px 12px; border-radius: 10px; color: #2a1600; background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 1.5px #3a1d00, 0 2px 0 #7a4a10; }
@keyframes trial-spin { to { --trial-a: 360deg; } }
@keyframes trial-pulse { 50% { box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.3), 0 0 26px rgba(255, 200, 90, 0.75), 0 6px 14px rgba(0, 0, 0, 0.55); } }
@keyframes trial-twinkle { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
/* a full pouch (4 items) fits beside the weapon and pet without scrolling: the slots share the space */
#battle .belt { gap: 6px; padding: 6px; }
#battle .belt .item-slot { flex: 1 1 0; min-width: 0; max-width: 60px; height: auto; aspect-ratio: 1; }
#battle .gear-row:has(.belt .item-slot:nth-child(4)) { gap: 12px; }

/* ---------- Moonstone packs: a quiet link under the Market, and a plain list of packs ---------- */
.mk-getmoons { display: block; margin: 4px auto 18px; padding: 6px 12px; border: 0; background: none; cursor: pointer;
  font: 600 14px 'Spectral', serif; color: #d9c8ff; text-decoration: underline; text-underline-offset: 3px; text-shadow: 0 1px 2px #000; }
.moon-packs { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 8px; }
.moon-pack { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 0; border-radius: 12px; cursor: pointer; color: #fff0d0; text-align: left;
  background: rgba(8, 4, 20, 0.55); box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.45); }
.moon-pack .ic { width: 26px; height: 26px; }
.moon-pack b { flex: 1; font: 700 16px 'Cinzel', serif; }
.moon-pack span { font: 700 15px 'Spectral', serif; color: #ffd76a; }
.moon-pack:active { transform: scale(0.98); }
/* XP and gold: two separate walnut panels, the icon beside a big number (XP's label sits on the number's line) */
.modal-card .vh-rewards { gap: 12px; padding: 0; background: none !important; box-shadow: none !important; }
.modal-card .vh-plaque { padding: 12px 10px; border-radius: 14px; gap: 12px;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.25)), url(../assets/ui/panels/walnut.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.55), inset 0 0 0 3px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.14), inset 0 -10px 24px rgba(0, 0, 0, 0.45), 0 12px 28px rgba(0, 0, 0, 0.6); }
.modal-card .vh-plaque + .vh-plaque { border-left: 0; border-image: none !important; }
.modal-card .vh-plaque .ic { width: 42px; height: 42px; }
.modal-card .vh-plaque span { flex-direction: row; align-items: baseline; gap: 6px; }
.modal-card .vh-plaque small { margin: 0; font-size: 13px; }

/* ---------- the Moonstone Store: a painted scene, the packs and how Moonstones are earned ---------- */
.modal-card:has(.ms-scene) { padding: calc(env(safe-area-inset-top) + 14px) 14px calc(env(safe-area-inset-bottom) + 14px) !important; }
.scene-bg.ms-art { background: linear-gradient(180deg, transparent 42%, rgba(8, 4, 18, 0.45) 56%, rgba(8, 4, 18, 0.85) 72%, #0b0715),
  url(../assets/scenes/moon-store.jpg) center top / cover no-repeat, url(../assets/scenes/place-merchant.jpg) center top / cover no-repeat; }
.modal-card:has(.ms-scene) .modal-btns { margin-top: 10px; }
.ms .pw-lead .ic { width: 20px; height: 20px; vertical-align: -4px; }
.ms .moon-packs { width: 100%; margin: 0; }
.moon-earn { width: 100%; padding: 10px 14px; border-radius: 14px; text-align: left;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35)), url(../assets/ui/panels/walnut.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.55), 0 10px 24px rgba(0, 0, 0, 0.6); }
.moon-earn b { display: block; margin-bottom: 4px; font: 700 13px 'Cinzel', serif; letter-spacing: 0.08em; color: #ffe6a6; }
.moon-earn ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.moon-earn li { position: relative; padding-left: 16px; font: 500 14px/1.3 'Spectral', serif; color: #eadfc6; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.moon-earn li::before { content: ''; position: absolute; left: 0; top: 0.5em; width: 7px; height: 7px; rotate: 45deg; background: #b9a6ff; box-shadow: 0 0 6px rgba(185, 166, 255, 0.7); }
.modal-card > .moon-earn { margin: 8px 0 4px; }
/* a Moonstone price you can't afford stays tappable: it explains how to get more */
.btn.off.moon-short { pointer-events: auto; }
button.moon-purse { border: 0; cursor: pointer; font: inherit; }
.gold-chip:has(#mk-moon), .gold-chip:has(#den-moon) { cursor: pointer; }
/* packs on walnut, the price in a gold pill like the other buy buttons */
.moon-pack { padding: 10px 12px 10px 14px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35)), url(../assets/ui/panels/walnut.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.12), 0 8px 18px rgba(0, 0, 0, 0.55); }
.moon-pack .ic { width: 32px; height: 32px; filter: drop-shadow(0 0 6px rgba(160, 150, 255, 0.6)); }
.moon-pack b { color: #fff0d0; text-shadow: 0 1px 2px #000; }
.moon-pack span { padding: 6px 12px; border-radius: 10px; font: 700 15px 'Cinzel', serif; color: #2a1600;
  background: linear-gradient(180deg, #ffe58a, #f2a93b); box-shadow: 0 0 0 1.5px #3a1d00, 0 2px 0 #7a4a10; }
/* the pet's name stays on one line (long names shrink to fit); "With you" sits after the kind, not over the name */
.den-plate .den-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.den-plate .den-badge { position: static; display: inline-block; margin-left: 8px; vertical-align: 1px; }
/* a long pet name in a meter row (victory screen) trims with … instead of pushing the row wider */
.meter-label b { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter-label small { flex: none; }
/* what the enemy does (Heals, Drains, Enrages…) sits in its own small chip, apart from its weakness */
#battle .trait.act { padding: 2px 9px; border-radius: 9px; font-size: 0.82em; letter-spacing: 0.04em; color: #ffd9a0;
  background: rgba(40, 14, 6, 0.65) !important; box-shadow: inset 0 0 0 1px rgba(255, 180, 100, 0.65), 0 0 8px rgba(255, 140, 60, 0.25) !important; }
/* the weapon of the day: Compare beside its price and Buy */
.merch-weapon .mw-actions { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
/* the first-time window for a bonus gem: the gem itself, cut from the board */
.gem-tip { text-align: center; }
.gem-tip img { display: block; width: 84px; height: 84px; margin: 4px auto 6px; border-radius: 16px; background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.5), 0 0 22px rgba(255, 230, 160, 0.35); }
/* iPhone won't reliably focus a text box that inherits "no selection" (it took many taps to name a pet) */
input, textarea { user-select: text; -webkit-user-select: text; }
/* the Legendary Boss / Challenge ribbon sits under the name plaque, over its hanging pennants, to give the foe more room */
.pb-name .pb-tag { order: 2; margin: -30px 0 0; }
/* Legends and the Queen: a head-and-shoulders portrait, its shoulders tucked behind the name plaque so the face fills the space */
.pb-art.pb-legend { height: calc(100% + 34px); bottom: -34px; -webkit-mask: linear-gradient(180deg, #000 78%, transparent 96%); mask: linear-gradient(180deg, #000 78%, transparent 96%);
  filter: drop-shadow(0 0 14px rgba(0, 0, 0, 0.6)); }
.pb-foe:has(.pb-legend)::before { display: none; }
#battle .trait.act { cursor: pointer; pointer-events: auto; }
#battle .trait.act:active { transform: scale(0.95); }
#battle .trait.weak, #battle .trait.resist, #battle #intent { cursor: pointer; pointer-events: auto; }
/* "charges from" shows the gem itself, not a coloured dot */
img.gemdot { width: 16px; height: 16px; border-radius: 0; background: none; box-shadow: none; object-fit: contain; vertical-align: -3px; margin: 0 3px 0 2px; }
/* treats this pet can't eat yet: greyed, with the reason (they can still be tapped, to sell) */
.treat-tile { position: relative; }
.treat-tile.no img { filter: grayscale(1) brightness(0.6); }
.treat-tile.no b, .treat-tile.no small { opacity: 0.55; }
.treat-tile .tt-why { display: block; margin-top: 2px; font: italic 700 11px 'Spectral', serif; color: #ffb0ba; }
/* the web demo's last card: the player's code and how to bring their progress into the app */
.pw-code { width: 100%; padding: 10px 14px; border-radius: 14px; text-align: left;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35)), url(../assets/ui/panels/walnut.jpg) center / cover;
  box-shadow: inset 0 0 0 1px rgba(247, 218, 134, 0.55), 0 10px 24px rgba(0, 0, 0, 0.6); }
.pw-code > b { display: block; font: 700 14px 'Cinzel', serif; color: #ffe6a6; }
.pw-code ol { margin: 4px 0 0; padding-left: 20px; font: 500 14px/1.4 'Spectral', serif; color: #eadfc6; }
.pw-code .xfer-code { margin: 6px auto 2px; font-size: 24px; text-align: center; }
.pw-code .pw-note { margin: 6px 0 0; font: italic 13px 'Spectral', serif; color: #cdbfa0; text-align: center; }
/* windows you type into sit near the top, so the on-screen keyboard never covers them */
.modal:has(.xfer-in, .name-field input) { align-items: flex-start; padding-top: max(calc(env(safe-area-inset-top) + 40px), 14vh); }
/* the road to the full game: a prism floating over the path out of camp, glowing and catching the eye */
.place[data-spot="road"] .place-art { position: absolute; left: 50%; top: 42%; width: 78%; translate: -50% -50%; pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255, 230, 160, 0.9)) drop-shadow(0 0 24px rgba(200, 140, 255, 0.7)); animation: road-float 3s ease-in-out infinite; }
.place[data-spot="road"] .place-rays { position: absolute; left: 50%; top: 42%; width: 190%; aspect-ratio: 1; translate: -50% -50%; pointer-events: none; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 236, 180, 0.32) 0 8deg, transparent 8deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%); mask: radial-gradient(circle, #000 18%, transparent 68%); animation: road-spin 14s linear infinite; }
.place[data-spot="road"] .pl-label { box-shadow: 0 0 14px rgba(255, 210, 110, 0.55); animation: road-glow 2.2s ease-in-out infinite; }
@keyframes road-float { 50% { translate: -50% calc(-50% - 6px); } }
@keyframes road-spin { to { rotate: 360deg; } }
@keyframes road-glow { 50% { box-shadow: 0 0 22px rgba(255, 210, 110, 0.85); } }
/* the painted signpost carries its own words: no plaque, just the sign with a soft glow at its crystal */
.place[data-spot="road"] .pl-label { display: none; }
.place[data-spot="road"] .place-art { top: 50%; width: auto; height: 100%; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 12px rgba(255, 220, 150, 0.45)); }
.place[data-spot="road"] .place-rays { top: 18%; width: 120%; opacity: 0.8; }
/* an empty deck slot is a button: tap it to choose a card */
.pk-slot.empty { border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: inherit; color: inherit; }
.pk-slot.empty small { font: italic 11px 'Spectral', serif; color: #cdbfa0; opacity: 0.8; text-align: center; padding: 0 4px; }

/* on a computer the game sits in an iPad-shaped frame in the middle of the window (see index.html) */
html.host-frame, html.host-frame body { background: #05030b url(../assets/scenes/title.jpg) center / cover no-repeat; }
html.host-frame body::before { content: ''; position: fixed; inset: 0; background: rgba(5, 3, 11, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
#game-frame { position: fixed; left: 50%; top: 50%; width: 615px; height: 820px; border: 0; transform-origin: center;
  box-shadow: 0 0 0 1px rgba(247, 218, 134, 0.35), 0 20px 60px rgba(0, 0, 0, 0.8); background: #07040f; }
/* the camp pet's feet sit in the middle of the cushion; its name stays down on the cushion's front edge
   (4% of the painting's height lower, the painting being as tall as .camp-spots) */
.camp-pet .cp-label { top: calc(100% + 0.04 * min(max(150vw, 100vh), 1350px)); }

/* ---------- how tough the quest is: three cards, and the Campfire row ---------- */
.tough-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 6px; }
.tough-row.one { grid-template-columns: minmax(0, 150px); justify-content: center; }
.tough-card { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 6px 10px; border: 0; border-radius: 14px; cursor: pointer;
  background: rgba(10, 6, 20, 0.65); box-shadow: inset 0 0 0 1.5px rgba(255, 210, 130, 0.35); color: #f3e6c8; text-align: center; min-width: 0; }
.tough-card:active { transform: scale(0.97); }
.tough-card.on { box-shadow: inset 0 0 0 2.5px #ffd76a, 0 0 16px rgba(255, 200, 90, 0.45); }
.tough-card .tc-art { width: 100%; aspect-ratio: 3 / 4; border-radius: 10px; background-size: cover; background-position: center; }
.tough-card b { font: 900 clamp(10px, 3vw, 13px)/1.15 'Cinzel', serif; margin-top: 4px; white-space: nowrap; letter-spacing: -0.01em; }
.tough-card small { font: 600 12px/1.25 'Spectral', serif; color: var(--muted); }
.tough-card em { font: 800 11px/1.2 'Spectral', serif; font-style: normal; color: #ffd76a; }
/* the colour each card shows until its picture is in assets/tough/ */
.t-gentle .tc-art { background-color: #2f6b3a; background-image: linear-gradient(160deg, #7fd38a, #2f6b3a); }
.t-fair .tc-art { background-color: #7a5a1a; background-image: linear-gradient(160deg, #ffd76a, #7a5a1a); }
.t-mercy .tc-art { background-color: #6b1020; background-image: linear-gradient(160deg, #ff5a6a, #4a0612); }
.hs-tough { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 10px; padding: 8px 12px 8px 8px; border: 0; border-radius: 14px; cursor: pointer;
  background: rgba(10, 6, 20, 0.6); box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.3); color: #f3e6c8; text-align: left; }
.hs-tough:active { transform: scale(0.98); }
.hs-tough .tc-art { flex: none; width: 46px; height: 46px; border-radius: 10px; background-size: cover; background-position: center; }
.hs-tough > span:not(.tc-art) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.hs-tough small { font: 800 11px 'Spectral', serif; color: var(--muted); }
.hs-tough b { font: 900 15px 'Cinzel', serif; }
.hs-tough em { font: 800 12px 'Spectral', serif; font-style: normal; color: #2a1600; padding: 5px 10px; border-radius: 9px; background: linear-gradient(180deg, #ffe58a, #f2a93b); }
/* the challenge level, a small pill under the stage on the pre-battle card */
.pb-diff .pb-tough { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: 8px; font: 800 10px 'Cinzel', serif; font-style: normal;
  letter-spacing: 0.08em; text-transform: uppercase; background: rgba(10, 6, 20, 0.7); text-shadow: 0 1px 2px #000; }
.pb-tough.t-gentle { color: #8fe39b; box-shadow: inset 0 0 0 1px rgba(143, 227, 155, 0.5); }
.pb-tough.t-fair { color: #ffd76a; box-shadow: inset 0 0 0 1px rgba(255, 215, 106, 0.5); }
.pb-tough.t-mercy { color: #ff7a86; box-shadow: inset 0 0 0 1px rgba(255, 122, 134, 0.55); }
.modal-btns .btn .now-tag { font: 700 11px 'Spectral', serif; letter-spacing: 0; text-transform: none; opacity: 0.85; margin-left: 4px; }

/* ---------- daily streak ---------- */
.streak-chip { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font: 800 13px 'Spectral', serif; color: #ffb45a; }
.streak-chip .ic { width: 18px; height: 18px; }
.v-first { margin: 6px 0 0; font: 700 13px 'Spectral', serif; color: #ffb45a; }
.streak-toast img { width: 46px; height: 46px; object-fit: contain; }
.streak-reward { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.streak-reward small { font: 800 12px 'Cinzel', serif; letter-spacing: 0.12em; text-transform: uppercase; color: #ffb45a; }
.streak-reward img { width: 150px; height: 150px; object-fit: contain; border-radius: 14px; filter: drop-shadow(0 6px 14px rgba(255, 140, 40, 0.45)); }
/* the camp fire by streak stage: 1 brighter, 2 bigger with more sparks, 3 blue flames, 4 prism flames */
.camp-ember:nth-of-type(8) { animation-delay: 0.8s; --dx: -12px; } .camp-ember:nth-of-type(9) { animation-delay: 1.4s; --dx: 18px; }
.camp-ember:nth-of-type(10) { animation-delay: 2s; --dx: -20px; } .camp-ember:nth-of-type(11) { animation-delay: 2.5s; --dx: 10px; }
.camp-ember:nth-of-type(12) { animation-delay: 0.35s; --dx: 26px; } .camp-ember:nth-of-type(13) { animation-delay: 0.95s; --dx: -28px; }
.camp-ember:nth-of-type(14) { animation-delay: 1.6s; --dx: 2px; } .camp-ember:nth-of-type(15) { animation-delay: 2.35s; --dx: -4px; }
.camp-ember:nth-of-type(16) { animation-delay: 2.9s; --dx: 16px; } .camp-ember:nth-of-type(17) { animation-delay: 1.2s; --dx: -16px; }
.camp-ember:nth-of-type(18) { animation-delay: 0.6s; --dx: 30px; }
#camp-spots[data-fire="1"] .camp-glow { background: radial-gradient(circle, rgba(255, 180, 70, 0.6), rgba(255, 120, 30, 0.18) 45%, transparent 70%); }
#camp-spots[data-fire="2"] .camp-glow { width: 46%; background: radial-gradient(circle, rgba(255, 190, 80, 0.7), rgba(255, 120, 30, 0.22) 48%, transparent 72%); }
#camp-spots[data-fire="3"] .camp-glow { width: 48%; background: radial-gradient(circle, rgba(120, 200, 255, 0.7), rgba(60, 120, 255, 0.24) 48%, transparent 72%); }
#camp-spots[data-fire="3"] .camp-ember { background: #bfe6ff; box-shadow: 0 0 6px 2px rgba(80, 160, 255, 0.85); }
#camp-spots[data-fire="4"] .camp-glow { width: 52%; background: radial-gradient(circle, rgba(220, 150, 255, 0.75), rgba(120, 90, 255, 0.26) 45%, rgba(80, 220, 255, 0.1) 62%, transparent 74%);
  animation: campFlicker 2.3s ease-in-out infinite, prismHue 6s linear infinite; }
#camp-spots[data-fire="4"] .camp-ember { background: #f0d0ff; box-shadow: 0 0 7px 3px rgba(190, 110, 255, 0.85); animation: campEmber 3.2s ease-out infinite, prismHue 6s linear infinite; }
@keyframes prismHue { 0%, 100% { filter: hue-rotate(-45deg); } 50% { filter: hue-rotate(40deg); } }
.hs-streak { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(10, 6, 20, 0.6); box-shadow: inset 0 0 0 1px rgba(255, 180, 90, 0.35); color: #f3e6c8; }
.st-head { display: flex; align-items: center; gap: 10px; }
.st-head img { width: 40px; height: 40px; object-fit: contain; }
.st-head > span:not(.st-embers) { flex: 1; display: flex; flex-direction: column; }
.st-head small { font: 800 11px 'Spectral', serif; color: var(--muted); }
.st-head b { font: 900 17px 'Cinzel', serif; color: #ffb45a; }
.st-head em { font: 700 12px 'Spectral', serif; font-style: normal; color: var(--muted); }
.st-embers { display: flex; gap: 4px; }
.st-ember { width: 24px; height: 24px; object-fit: contain; opacity: 0.25; filter: grayscale(1); }
.st-ember.on { opacity: 1; filter: drop-shadow(0 0 6px rgba(255, 140, 40, 0.8)); }
.st-miles { display: grid; gap: 4px; margin: 10px 0 4px; }
.st-miles p { display: flex; align-items: center; gap: 10px; margin: 0; font: 600 13px 'Spectral', serif; color: var(--muted); }
.st-miles b { flex: none; width: 38px; text-align: center; padding: 2px 0; border-radius: 8px; font: 900 13px 'Cinzel', serif; color: #f3e6c8; background: rgba(255, 255, 255, 0.06); }
.st-miles p.done { color: #8fe39b; } .st-miles p.done b { background: rgba(80, 180, 100, 0.3); }
.st-miles p.next { color: #fff0d0; } .st-miles p.next b { color: #2a1600; background: linear-gradient(180deg, #ffe58a, #f2a93b); }
/* the armory's what's-different line: damage up in green, down in red */
.arm-row small .dd { font-weight: 800; } .arm-row small .dd.up { color: #8fe39b; } .arm-row small .dd.down { color: #ff8a8a; }

/* Windows always fit the part of the screen you can see, and their buttons stay in reach. On the web, Safari's
   floating address bar covers the bottom of the page (100vh and inset: 0 reach under it), so a tall window, like
   a new pet with two badges earned, hid its buttons behind it. svh is the height with the browser's bars shown. */
.modal { padding-bottom: max(12px, calc(100lvh - 100svh + 12px), env(safe-area-inset-bottom)); }
.modal-card { box-sizing: border-box; max-height: min(100%, 88svh); } /* the overlay's own space (it pads from the top), frame included */
/* a long window scrolls under its buttons rather than pushing them off the bottom */
.modal-card:not(:has(.result)):not(:has(.scene)) > .modal-btns { position: sticky; bottom: 0; z-index: 2; padding: 14px 0 4px; background: none; }
/* only a window that actually scrolls gets a backing behind its buttons, in the panel's own dark wood */
.modal-card.scrolls:not(:has(.result)):not(:has(.scene)) > .modal-btns { background: linear-gradient(to bottom, transparent, rgba(28, 16, 8, 0.9) 45%); }

/* A pet joining you takes the whole screen (it was a window pushed 14% down for its name box, so with a badge or
   two you had to scroll); the picture shrinks on shorter screens so it all fits. */
/* .po-art makes this outrank the name-box rule that starts windows 14% down */
.modal:has(.pet-offer .name-field) { align-items: stretch; padding: max(env(safe-area-inset-top), 8px) 8px max(8px, calc(100lvh - 100svh + 8px), env(safe-area-inset-bottom)); }
.modal-card:has(.pet-offer .name-field) { max-width: 460px; max-height: none; height: 100%; }
.pet-offer .po-art { width: clamp(110px, 22svh, 190px); height: clamp(110px, 22svh, 190px); }
/* the paywall's lead line sits on a bright part of the painting: give it the same dark outline as the headline */
.pw-lead { -webkit-text-stroke: 2.5px rgba(20, 8, 30, 0.9); paint-order: stroke fill; }
