/* ────────────────────────────────────────────────────────────────
   PULL : SAGA — meta-progression redesign
   ──────────────────────────────────────────────────────────────── */

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

:root {
  --bg-deep:   #140626;
  --bg-mid:    #3a0a4a;
  --bg-glow:   #ff4d97;

  /* Orb tiers — same palette as original game */
  --c-pink:    #ff4d97;
  --c-violet:  #a06bff;
  --c-emerald: #00d672;
  --c-gold:    #ffd75e;
  --c-orange:  #ff6a1f;
  --c-coral:   #ff7a59;
  --c-ruby:    var(--c-orange);
  --c-cyan:    var(--c-emerald);
  --c-magenta: var(--c-pink);
  --c-yellow:  var(--c-gold);
  --c-blue:    #3aa0ff;

  --text: #fff5e6;
  --text-dim: rgba(255,245,230,0.55);
  --text-soft: rgba(255,245,230,0.78);
}

html, body {
  height: 100%; width: 100%; overflow: hidden;
  background: var(--bg-deep); color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; overscroll-behavior: none;
}

body::before {
  content: ''; position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse at 20% 0%,   var(--zone-a, rgba(255,45,79,0.36)),  transparent 55%),
    radial-gradient(ellipse at 90% 30%,  var(--zone-b, rgba(255,77,151,0.36)), transparent 55%),
    radial-gradient(ellipse at 50% 110%, var(--zone-c, rgba(255,215,94,0.30)), transparent 60%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 55%, var(--zone-floor, #5a0e3a) 100%);
  animation: bgShift 22s ease-in-out infinite alternate;
  transition: background 1.2s ease;
}
/* Per-zone tints — shift the whole ambient wash as you progress */
body[data-zone="0"] { --zone-a: rgba(255,77,151,0.42); --zone-b: rgba(255,45,128,0.40); --zone-c: rgba(255,215,94,0.30); --zone-floor: #5a0e3a; }
body[data-zone="1"] { --zone-a: rgba(160,107,255,0.46); --zone-b: rgba(120,60,220,0.42); --zone-c: rgba(255,77,151,0.28); --zone-floor: #2a0a5a; }
body[data-zone="2"] { --zone-a: rgba(0,214,114,0.42); --zone-b: rgba(58,160,255,0.34); --zone-c: rgba(160,107,255,0.30); --zone-floor: #062a3a; }
body[data-zone="3"] { --zone-a: rgba(255,215,94,0.48); --zone-b: rgba(255,106,31,0.38); --zone-c: rgba(255,77,151,0.30); --zone-floor: #4a2a06; }
body[data-zone="4"] { --zone-a: rgba(255,106,31,0.50); --zone-b: rgba(255,77,151,0.42); --zone-c: rgba(160,107,255,0.30); --zone-floor: #4a0e1a; }
body[data-zone="5"] { --zone-a: rgba(255,255,255,0.30); --zone-b: rgba(160,107,255,0.50); --zone-c: rgba(255,77,151,0.40); --zone-floor: #1a0628; }
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%,  rgba(255,215,94,0.9), transparent 60%),
    radial-gradient(1px 1px at 78% 22%,  rgba(255,77,151,0.85), transparent 60%),
    radial-gradient(1px 1px at 35% 70%,  rgba(255,215,94,0.85), transparent 60%),
    radial-gradient(1px 1px at 64% 88%,  rgba(255,45,79,0.8),  transparent 60%),
    radial-gradient(1px 1px at 88% 60%,  rgba(255,215,94,0.8), transparent 60%),
    radial-gradient(1px 1px at 22% 42%,  rgba(255,77,151,0.85), transparent 60%),
    radial-gradient(1px 1px at 50% 12%,  rgba(255,215,94,0.85), transparent 60%),
    radial-gradient(1px 1px at 8%  82%,  rgba(255,77,151,0.8),  transparent 60%);
  animation: twinkle 3.2s ease-in-out infinite;
}
@keyframes twinkle { 0%,100%{opacity:.55}50%{opacity:1} }
@keyframes bgShift { 0%{transform:scale(1) rotate(0)}100%{transform:scale(1.15) rotate(3deg)} }

#root {
  width: 100%; height: 100%;
  max-width: 460px; margin: 0 auto;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}

/* Numeric */
.tab-num { font-variant-numeric: tabular-nums; }

/* ────────────────────────────────────────────────────────────────
   TOP HUD — persistent across screens
   ──────────────────────────────────────────────────────────────── */
.hud {
  position: relative; z-index: 5;
  padding: max(env(safe-area-inset-top), 12px) 12px 8px;
  display: flex; align-items: center; gap: 10px;
}
.hud-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-gold), var(--c-pink) 55%, var(--c-orange));
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: #2a0810;
  border: 2px solid rgba(255,215,94,0.85);
  box-shadow: 0 4px 14px rgba(255,77,151,0.5), inset 0 1px 0 rgba(255,255,255,0.45);
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}
.hud-avatar-lvl {
  position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  background: var(--bg-deep);
  color: var(--c-gold);
  font-size: 9px; font-weight: 900; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 999px;
  border: 1px solid rgba(255,215,94,0.6);
}
.hud-xp-stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hud-xp-top {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em;
  color: var(--text-soft);
}
.hud-xp-top .lvl { color: var(--c-gold); }
.hud-xp-top .num { color: var(--text-dim); letter-spacing: 0.05em; font-weight: 700; }
.hud-xp-bar {
  height: 10px; border-radius: 999px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden; position: relative;
}
.hud-xp-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--c-emerald), var(--c-gold) 60%, var(--c-orange));
  box-shadow: 0 0 12px rgba(255,215,94,0.5), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hud-xp-fill.gain { animation: xpGain 0.6s ease-out; }
@keyframes xpGain {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.7) saturate(1.4); }
  100% { filter: brightness(1); }
}
.hud-chips { display: flex; gap: 6px; flex-shrink: 0; }
.hud-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px 5px 7px; border-radius: 999px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px; font-weight: 800; letter-spacing: 0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.hud-chip-ic {
  width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
}
.hud-chip.streak { border-color: rgba(255,106,31,0.5); }
.hud-chip.streak .hud-chip-ic { filter: drop-shadow(0 0 6px rgba(255,106,31,0.7)); }
.hud-chip.coins .hud-chip-ic { color: var(--c-gold); filter: drop-shadow(0 0 6px rgba(255,215,94,0.55)); }
.hud-chip.gems  .hud-chip-ic { color: var(--c-pink); filter: drop-shadow(0 0 6px rgba(255,77,151,0.55)); }
.hud-chip.stars .hud-chip-ic { color: var(--c-gold); filter: drop-shadow(0 0 6px rgba(255,215,94,0.6)); }
.hud-chip.hearts {
  border-color: rgba(255,77,77,0.5);
  gap: 5px;
  padding-right: 9px;
}
.hud-chip.hearts .hud-chip-ic { filter: drop-shadow(0 0 6px rgba(255,77,77,0.7)); }
.hud-chip.hearts.empty {
  border-color: rgba(255,77,77,0.7);
  background: rgba(120,15,30,0.4);
  animation: heartEmptyPulse 1.4s ease-in-out infinite;
}
@keyframes heartEmptyPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,77,77,0); }
  50%     { box-shadow: 0 0 0 4px rgba(255,77,77,0.18); }
}
.hud-chip-timer {
  font-size: 10px; font-weight: 800; letter-spacing: 0.02em;
  color: var(--text-soft);
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.4);
  margin-left: -2px;
}
.hud-chip.hearts.empty .hud-chip-timer { color: var(--c-gold); }

/* ────────────────────────────────────────────────────────────────
   OUT-OF-HEARTS MODAL
   ──────────────────────────────────────────────────────────────── */
.ooh-card { text-align: center; padding: 26px 22px 20px; }
.ooh-heart {
  font-size: 64px; line-height: 1;
  filter: drop-shadow(0 4px 22px rgba(255,77,77,0.6));
  animation: oohHeartBeat 1.4s ease-in-out infinite;
  margin-bottom: 4px;
}
@keyframes oohHeartBeat {
  0%, 60%, 100% { transform: scale(1) rotate(-6deg); }
  20% { transform: scale(1.12) rotate(-4deg); }
  35% { transform: scale(0.96) rotate(-7deg); }
}
.ooh-title {
  font-size: 26px; font-weight: 900; letter-spacing: 0.16em;
  background: linear-gradient(180deg, #fff, #ff4d4d 60%, var(--c-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 14px rgba(255,77,77,0.45));
  line-height: 1.1;
}
.ooh-sub {
  font-size: 11px; color: var(--text-soft); margin-top: 6px;
  letter-spacing: 0.04em; line-height: 1.5;
}

.ooh-timer-wrap {
  margin: 16px auto 14px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,77,77,0.3);
  border-radius: 14px;
  padding: 10px 16px;
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 160px;
}
.ooh-timer-lbl { font-size: 9px; letter-spacing: 0.28em; color: var(--text-dim); font-weight: 800; }
.ooh-timer {
  font-size: 32px; font-weight: 900; letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff, var(--c-gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1;
}

.ooh-btn {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  transition: transform 0.12s;
}
.ooh-btn:active { transform: scale(0.97); }
.ooh-btn.primary {
  background: linear-gradient(135deg, #00d672 0%, var(--c-gold) 100%);
  color: #003317; border: none;
  box-shadow: 0 4px 18px rgba(0,214,114,0.45), inset 0 2px 0 rgba(255,255,255,0.45);
}
.ooh-btn.disabled { opacity: 0.45; cursor: not-allowed; }
.ooh-btn.ghost {
  background: transparent; border-color: rgba(255,255,255,0.08);
  color: var(--text-dim);
  justify-content: center;
  font-size: 10px; letter-spacing: 0.28em; font-weight: 800;
  padding: 10px;
}
.ooh-btn-ic {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900;
  flex-shrink: 0;
}
.ooh-btn.primary .ooh-btn-ic { background: rgba(0,0,0,0.18); }
.ooh-btn-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.1; }
.ooh-btn-top { font-size: 13px; font-weight: 900; letter-spacing: 0.14em; }
.ooh-btn-sub { font-size: 10px; letter-spacing: 0.1em; opacity: 0.75; font-weight: 800; }

.hud-chip.bump { animation: chipBump 0.45s ease; }
@keyframes chipBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.22); filter: brightness(1.5); }
  100% { transform: scale(1); }
}

/* ────────────────────────────────────────────────────────────────
   LOGO MARK
   ──────────────────────────────────────────────────────────────── */
.logo-mark {
  width: 32px; height: 32px; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, #ffffff 0%, transparent 28%),
    conic-gradient(from 0deg, var(--c-pink), var(--c-violet), var(--c-emerald), var(--c-gold), var(--c-orange), var(--c-pink));
  box-shadow: 0 0 14px rgba(255,77,151,0.6), 0 0 24px rgba(255,215,94,0.35), inset 0 0 8px rgba(255,255,255,0.5);
  animation: logoSpin 14s linear infinite;
  flex-shrink: 0;
}
@keyframes logoSpin { from{transform:rotate(0)} to{transform:rotate(360deg)} }

/* ────────────────────────────────────────────────────────────────
   HOME SCREEN
   ──────────────────────────────────────────────────────────────── */
.home {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  padding: 0 14px 14px;
}
.home-hero {
  flex-shrink: 0; padding: 18px 4px 12px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.home-orb {
  width: 110px; height: 110px; border-radius: 50%;
  background:
    radial-gradient(circle at 28% 22%, #ffffff 0%, rgba(255,255,255,0) 35%),
    conic-gradient(from 0deg, var(--c-pink), var(--c-violet), var(--c-emerald), var(--c-gold), var(--c-orange), var(--c-pink));
  box-shadow:
    0 0 40px rgba(255,77,151,0.65),
    0 0 80px rgba(255,215,94,0.4),
    inset 0 0 22px rgba(255,255,255,0.55);
  animation: homeOrbSpin 8s linear infinite, homeOrbFloat 3s ease-in-out infinite alternate;
  margin-bottom: 14px;
}
@keyframes homeOrbSpin { from { filter: hue-rotate(0); } to { filter: hue-rotate(360deg); } }
@keyframes homeOrbFloat {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-8px) scale(1.04); }
}
.home-title {
  font-size: 48px; font-weight: 900; letter-spacing: 0.16em;
  background: linear-gradient(180deg, #fff 0%, var(--c-gold) 35%, var(--c-pink) 75%, var(--c-orange) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(255,77,151,0.5)) drop-shadow(0 0 30px rgba(255,215,94,0.3));
  line-height: 1;
}
.home-subtitle {
  font-size: 10px; letter-spacing: 0.35em; color: var(--text-soft);
  font-weight: 700; margin-top: 8px;
}
.home-edition {
  margin-top: 4px;
  font-size: 22px; font-weight: 900; letter-spacing: 0.12em;
  color: var(--c-gold);
  text-shadow: 0 2px 12px rgba(255,215,94,0.55);
}

.home-stats {
  flex-shrink: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 14px 0;
}
.home-stat {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.home-stat-num {
  font-size: 22px; font-weight: 900; letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff, var(--c-gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.home-stat-lbl {
  font-size: 9px; letter-spacing: 0.18em; font-weight: 800;
  color: var(--text-dim);
}

/* Daily reward card */
.daily {
  background: linear-gradient(135deg, rgba(255,106,31,0.18), rgba(255,77,151,0.18));
  border: 1px solid rgba(255,215,94,0.4);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  cursor: pointer;
}
.daily.claimed {
  background: rgba(0,0,0,0.25);
  border-color: rgba(255,255,255,0.06);
}
.daily-flame {
  font-size: 32px; line-height: 1;
  filter: drop-shadow(0 0 12px rgba(255,106,31,0.7));
  position: relative;
}
.daily-flame .streak-num {
  position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%);
  background: var(--bg-deep); color: var(--c-gold);
  font-size: 10px; font-weight: 900; padding: 1px 6px; border-radius: 999px;
  border: 1px solid rgba(255,215,94,0.6);
}
.daily-text { flex: 1; min-width: 0; }
.daily-title {
  font-size: 12px; font-weight: 900; letter-spacing: 0.12em;
  background: linear-gradient(90deg, var(--c-gold), var(--c-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.daily-sub { font-size: 11px; color: var(--text-soft); margin-top: 2px; letter-spacing: 0.02em; }
.daily-btn {
  padding: 8px 14px; border-radius: 999px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--c-gold), var(--c-pink) 55%, var(--c-orange));
  color: #2a0810; font-weight: 900; font-size: 11px; letter-spacing: 0.16em;
  border: none; cursor: pointer; font-family: inherit;
  box-shadow: 0 3px 14px rgba(255,77,151,0.5), inset 0 1px 0 rgba(255,255,255,0.5);
}
.daily-btn:active { transform: scale(0.95); }
.daily.claimed .daily-btn {
  background: rgba(255,255,255,0.06); color: var(--text-dim); box-shadow: none;
}

/* Big PLAY CTA */
.play-cta {
  flex-shrink: 0; margin: auto 0 8px;
  display: flex; flex-direction: column; gap: 10px;
}
.play-btn {
  padding: 18px 22px; border-radius: 22px;
  background: linear-gradient(135deg, var(--c-gold) 0%, var(--c-pink) 50%, var(--c-orange) 100%);
  color: #2a0810; font-weight: 900; font-size: 18px; letter-spacing: 0.18em;
  border: none; cursor: pointer; font-family: inherit;
  box-shadow:
    0 6px 28px rgba(255,77,151,0.55),
    inset 0 2px 0 rgba(255,255,255,0.55),
    inset 0 -3px 0 rgba(120,30,60,0.25);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  animation: playBtnPulse 2.4s ease-in-out infinite;
}
@keyframes playBtnPulse {
  0%, 100% { box-shadow: 0 6px 28px rgba(255,77,151,0.55), inset 0 2px 0 rgba(255,255,255,0.55), inset 0 -3px 0 rgba(120,30,60,0.25); }
  50%      { box-shadow: 0 6px 36px rgba(255,77,151,0.85), 0 0 0 3px rgba(255,215,94,0.15), inset 0 2px 0 rgba(255,255,255,0.55), inset 0 -3px 0 rgba(120,30,60,0.25); }
}
.play-btn:active { transform: scale(0.97); animation: none; }
.play-btn-row { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.play-btn-row .small { font-size: 10px; letter-spacing: 0.22em; opacity: 0.75; font-weight: 800; }
.play-btn-row .big   { font-size: 22px; letter-spacing: 0.14em; font-weight: 900; }

.play-secondary { display: flex; gap: 8px; }
.btn-mini {
  flex: 1;
  padding: 12px 8px; border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text); font-family: inherit;
  font-weight: 800; font-size: 10px; letter-spacing: 0.16em;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.btn-mini-ic { font-size: 20px; line-height: 1; }
.btn-mini:active { transform: scale(0.96); }

/* Friends ticker on home */
.friends-row {
  flex-shrink: 0; padding: 8px 4px 0;
  display: flex; gap: 8px; overflow-x: auto;
  scrollbar-width: none;
}
.friends-row::-webkit-scrollbar { display: none; }
.friend-pill {
  flex-shrink: 0;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 5px 11px 5px 5px;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-soft); letter-spacing: 0.02em;
}
.friend-pill .av {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; color: #2a0810;
}
.friend-pill b { color: var(--c-gold); font-weight: 800; margin: 0 3px; }

/* ────────────────────────────────────────────────────────────────
   MAP SCREEN
   ──────────────────────────────────────────────────────────────── */
.map-screen {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  position: relative;
}
.map-zone-banner {
  flex-shrink: 0;
  margin: 6px 14px 4px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(160,107,255,0.2), rgba(255,77,151,0.18));
  border: 1px solid rgba(160,107,255,0.4);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.map-zone-name {
  font-size: 14px; font-weight: 900; letter-spacing: 0.14em;
  background: linear-gradient(90deg, var(--c-violet), var(--c-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.map-zone-progress { font-size: 10px; color: var(--text-soft); letter-spacing: 0.14em; font-weight: 800; }
.map-zone-progress b { color: var(--c-gold); }

.map-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding: 0 0 30px;
  position: relative;
}
.map-scroll::-webkit-scrollbar { display: none; }
.map-path {
  position: relative;
  margin: 0 auto;
  width: 100%; max-width: 380px;
}

/* SVG path drawn behind nodes */
.map-path-svg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}
.map-node {
  position: absolute;
  width: 70px; height: 70px;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.map-node-disc {
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 22px; letter-spacing: -0.01em;
  color: white; position: relative;
  transition: transform 0.15s;
  font-variant-numeric: tabular-nums;
}
.map-node:active .map-node-disc { transform: scale(0.94); }
.map-node.locked .map-node-disc {
  background: rgba(40,15,60,0.85);
  border: 2px solid rgba(255,255,255,0.08);
  color: var(--text-dim);
  font-size: 22px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3);
}
.map-node.done .map-node-disc {
  background: radial-gradient(circle at 30% 25%, #fff, #b8fdd9 18%, #00d672 60%, #006d3a);
  border: 2px solid rgba(0,214,114,0.7);
  color: #00301a;
  text-shadow: 0 1px 1px rgba(255,255,255,0.4);
  box-shadow: 0 3px 12px rgba(0,214,114,0.45), inset 0 -3px 6px rgba(0,55,30,0.4);
}
.map-node.current .map-node-disc {
  background: radial-gradient(circle at 30% 25%, #fff, #fff2c0 14%, #ffd75e 58%, #b07a00);
  border: 2px solid rgba(255,215,94,0.95);
  color: #3a2400;
  text-shadow: 0 1px 1px rgba(255,255,255,0.4);
  box-shadow: 0 4px 20px rgba(255,215,94,0.7), inset 0 -3px 6px rgba(110,70,0,0.4);
  animation: currentPulse 1.4s ease-in-out infinite;
}
@keyframes currentPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(255,215,94,0.7),  inset 0 -3px 6px rgba(110,70,0,0.4); transform: scale(1); }
  50%      { box-shadow: 0 6px 30px rgba(255,215,94,1), 0 0 0 6px rgba(255,215,94,0.15), inset 0 -3px 6px rgba(110,70,0,0.4); transform: scale(1.05); }
}
.map-node.boss .map-node-disc {
  background: radial-gradient(circle at 30% 25%, #fff, #ffd6c0 14%, #ff6a1f 58%, #962e00);
  border: 2px solid rgba(255,77,151,0.85);
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: 0 4px 22px rgba(255,77,151,0.6), inset 0 -3px 6px rgba(70,20,0,0.5);
}
.map-node.boss.current .map-node-disc { animation: currentPulse 1.2s ease-in-out infinite; }

/* Star arc above each completed node */
.map-node-stars {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 2px;
}
.map-node-stars .s {
  width: 12px; height: 12px;
  background: radial-gradient(circle, var(--c-gold), #b07a00);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 0 4px rgba(255,215,94,0.7));
}
.map-node-stars .s.off {
  background: rgba(255,255,255,0.08);
  filter: none;
}

.map-node-flag {
  position: absolute; top: -22px; left: calc(50% + 24px);
  font-size: 18px; line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255,215,94,0.6));
}

/* Bonus/chest nodes scattered along map */
.map-chest {
  position: absolute;
  width: 50px; height: 50px;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  filter: drop-shadow(0 2px 8px rgba(255,215,94,0.5));
  animation: chestBob 2.6s ease-in-out infinite;
}
@keyframes chestBob {
  0%, 100% { transform: translate(-50%, -50%) rotate(-4deg); }
  50%      { transform: translate(-50%, -54%) rotate(4deg); }
}

/* ────────────────────────────────────────────────────────────────
   LEVEL INTRO MODAL
   ──────────────────────────────────────────────────────────────── */
.modal-bg {
  position: absolute; inset: 0;
  background: rgba(15,5,30,0.78);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 18px;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.card {
  background: linear-gradient(180deg, #2a0e44 0%, #1a0628 100%);
  border: 1px solid rgba(255,215,94,0.3);
  border-radius: 22px;
  padding: 22px 20px 18px;
  width: 100%; max-width: 360px;
  box-shadow: 0 20px 60px rgba(255,77,151,0.4), 0 0 0 1px rgba(255,215,94,0.1);
  position: relative;
  animation: cardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cardIn {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.card-ribbon {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--c-pink), var(--c-orange));
  color: #2a0810; font-weight: 900; font-size: 10px; letter-spacing: 0.18em;
  padding: 5px 14px; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(255,77,151,0.5);
  white-space: nowrap;
}
.card-level {
  text-align: center; padding-top: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.3em;
  color: var(--text-dim);
}
.card-title {
  text-align: center;
  font-size: 30px; font-weight: 900; letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff, var(--c-gold) 60%, var(--c-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-top: 2px;
  line-height: 1.1;
}

.objective {
  margin-top: 16px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.objective-ic {
  width: 48px; height: 48px; border-radius: 14px;
  background: radial-gradient(circle at 30% 25%, #fff, var(--c-gold) 50%, #b07a00);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 900; color: #3a2400;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(255,215,94,0.4);
}
.objective-ic.score { background: radial-gradient(circle at 30% 25%, #fff, var(--c-gold) 50%, #b07a00); color: #3a2400; }
.objective-ic.chain { background: radial-gradient(circle at 30% 25%, #fff, var(--c-pink) 50%, #a31057); color: white; }
.objective-ic.value { background: radial-gradient(circle at 30% 25%, #fff, var(--c-violet) 50%, #4d20a8); color: white; }
.objective-ic.color { background: radial-gradient(circle at 30% 25%, #fff, var(--c-emerald) 50%, #006d3a); color: white; }
.objective-text { flex: 1; min-width: 0; }
.objective-lbl { font-size: 10px; letter-spacing: 0.22em; color: var(--text-dim); font-weight: 800; }
.objective-goal {
  font-size: 16px; font-weight: 900; color: var(--text); margin-top: 2px;
  letter-spacing: 0.01em;
}

.budget {
  margin-top: 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.budget-lbl { font-size: 10px; letter-spacing: 0.22em; color: var(--text-dim); font-weight: 800; }
.budget-val {
  font-size: 22px; font-weight: 900; color: var(--c-pink);
  font-variant-numeric: tabular-nums;
}

.rewards { margin-top: 14px; }
.rewards-lbl {
  font-size: 10px; letter-spacing: 0.22em; color: var(--text-dim); font-weight: 800;
  text-align: center; margin-bottom: 8px;
}
.rewards-row { display: flex; justify-content: center; gap: 10px; }
.reward-pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,215,94,0.25);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex; align-items: center; gap: 6px;
  font-weight: 800; font-size: 13px;
}
.reward-pill .ic { font-size: 16px; line-height: 1; }
.reward-pill.xp .ic   { color: var(--c-emerald); }
.reward-pill.coin .ic { color: var(--c-gold); }
.reward-pill.gem .ic  { color: var(--c-pink); }

.card-cta {
  width: 100%; margin-top: 16px;
  padding: 14px; border-radius: 16px;
  background: linear-gradient(135deg, var(--c-gold), var(--c-pink) 55%, var(--c-orange));
  color: #2a0810; font-weight: 900; font-size: 14px; letter-spacing: 0.2em;
  border: none; cursor: pointer; font-family: inherit;
  box-shadow: 0 5px 22px rgba(255,77,151,0.55), inset 0 2px 0 rgba(255,255,255,0.5);
}
.card-cta:active { transform: scale(0.97); }

.card-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-dim); font-size: 18px; cursor: pointer; font-family: inherit;
  line-height: 1;
}

/* ────────────────────────────────────────────────────────────────
   GAME SCREEN
   ──────────────────────────────────────────────────────────────── */
.game-screen {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  padding: 0 12px 12px;
}

.objective-bar {
  flex-shrink: 0; margin: 4px 0 10px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.objective-bar-ic {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900;
  flex-shrink: 0;
}
.objective-bar-text { flex: 1; min-width: 0; }
.objective-bar-goal {
  font-size: 13px; font-weight: 800; color: var(--text); letter-spacing: 0.02em;
}
.objective-bar-prog {
  margin-top: 4px;
  height: 6px; border-radius: 999px;
  background: rgba(0,0,0,0.5);
  overflow: hidden;
}
.objective-bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--c-emerald), var(--c-gold));
  transition: width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px rgba(255,215,94,0.4);
}
.objective-bar-fill.done {
  background: linear-gradient(90deg, var(--c-emerald), var(--c-emerald));
  box-shadow: 0 0 12px rgba(0,214,114,0.6);
}

.taps-left {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 6px 10px;
  min-width: 56px;
}
.taps-left .num {
  font-size: 22px; font-weight: 900; color: var(--c-pink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.taps-left .lbl { font-size: 8px; letter-spacing: 0.22em; color: var(--text-dim); font-weight: 800; margin-top: 2px; }
.taps-left.warning .num { color: var(--c-orange); animation: warnPulse 0.6s ease-in-out infinite alternate; }
@keyframes warnPulse { from{transform:scale(1)} to{transform:scale(1.08)} }

/* Score pill row */
.score-row {
  flex-shrink: 0; display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
}
.score-row .score-num {
  font-size: 30px; font-weight: 900;
  background: linear-gradient(180deg, #fff, var(--c-gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em; line-height: 1;
  transition: transform 0.2s;
}
.score-row .score-num.flash { animation: scoreFlash 0.4s ease; }
@keyframes scoreFlash {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); filter: brightness(1.5); }
}
.score-row .streak {
  font-size: 13px; font-weight: 800; letter-spacing: 0.16em;
  color: var(--text-soft);
  padding: 5px 10px; border-radius: 999px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
}
.score-row .streak.hot {
  color: var(--c-gold); border-color: rgba(255,215,94,0.5);
  text-shadow: 0 0 10px rgba(255,215,94,0.55);
  background: rgba(255,215,94,0.08);
}

/* Board */
.grid-wrap {
  flex-shrink: 0;
  width: 100%; aspect-ratio: 1; padding: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  box-shadow: inset 0 0 50px rgba(255,77,151,0.05), 0 0 60px rgba(255,77,151,0.1);
  position: relative;
}
.grid-wrap.flash-good { animation: flashGood 0.5s ease; }
.grid-wrap.flash-bad  { animation: flashBad 0.5s ease; }
@keyframes flashGood {
  0%   { box-shadow: inset 0 0 60px rgba(0,214,114,0.7), 0 0 100px rgba(0,214,114,0.5); }
  100% { box-shadow: inset 0 0 50px rgba(255,77,151,0.05), 0 0 60px rgba(255,77,151,0.1); }
}
@keyframes flashBad {
  0%   { box-shadow: inset 0 0 60px rgba(255,45,79,0.7), 0 0 100px rgba(255,45,79,0.5); transform: translateX(-5px); }
  20%  { transform: translateX(5px); }
  40%  { transform: translateX(-3px); }
  60%  { transform: translateX(3px); }
  100% { transform: translateX(0); box-shadow: inset 0 0 50px rgba(255,77,151,0.05), 0 0 60px rgba(255,77,151,0.1); }
}

.grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 5px; width: 100%; height: 100%;
}
.cell { position: relative; aspect-ratio: 1; }

.orb {
  position: absolute; inset: 4%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: clamp(10px, 2.6vw, 16px);
  color: white; cursor: pointer;
  will-change: transform, filter, opacity;
  animation: orbSpawn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  z-index: 1;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
@keyframes orbSpawn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.orb:active { filter: brightness(1.3); transform: scale(0.92); }
@media (hover: hover) { .orb:hover { filter: brightness(1.15); } }

.orb-c0 {
  background: radial-gradient(circle at 28% 22%, #ffffff 0%, #ffe0ec 16%, #ff5fa8 56%, #c1126a 100%);
  box-shadow: 0 2px 8px rgba(255,77,151,0.55), 0 0 18px rgba(255,77,151,0.35), inset 0 -3px 8px rgba(120,10,60,0.4), inset 0 2px 5px rgba(255,255,255,0.7);
}
.orb-c1 {
  background: radial-gradient(circle at 28% 22%, #ffffff 0%, #e0d0ff 14%, #a06bff 58%, #4d20a8 100%);
  box-shadow: 0 2px 6px rgba(30,10,70,0.5), inset 0 -3px 8px rgba(40,10,90,0.45), inset 0 2px 4px rgba(255,255,255,0.55);
}
.orb-c2 {
  background: radial-gradient(circle at 28% 22%, #ffffff 0%, #b8fdd9 14%, #00d672 58%, #006d3a 100%);
  box-shadow: 0 2px 6px rgba(0,40,25,0.5), inset 0 -3px 8px rgba(0,55,30,0.45), inset 0 2px 4px rgba(255,255,255,0.55);
  color: #00301a; text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}
.orb-c3 {
  background: radial-gradient(circle at 28% 22%, #ffffff 0%, #fff2c0 14%, #ffd75e 58%, #b07a00 100%);
  box-shadow: 0 2px 6px rgba(80,50,0,0.5), inset 0 -3px 8px rgba(110,70,0,0.45), inset 0 2px 4px rgba(255,255,255,0.6);
  color: #3a2400; text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}
.orb-c4 {
  background: radial-gradient(circle at 28% 22%, #ffffff 0%, #ffd6c0 14%, #ff6a1f 58%, #962e00 100%);
  box-shadow: 0 2px 6px rgba(60,15,0,0.5), inset 0 -3px 8px rgba(70,20,0,0.45), inset 0 2px 4px rgba(255,255,255,0.55);
}
.orb-rainbow {
  background:
    radial-gradient(circle at 28% 22%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 30%),
    conic-gradient(from 0deg, var(--c-pink), var(--c-violet), var(--c-emerald), var(--c-gold), var(--c-orange), var(--c-pink));
  box-shadow: 0 0 24px rgba(255,255,255,0.7), 0 0 48px rgba(255,215,94,0.35), inset 0 0 12px rgba(255,255,255,0.6);
  animation: orbSpawn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), rainbowSpin 3s linear infinite 0.3s;
}
@keyframes rainbowSpin { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }

.orb.sliding {
  transition: transform 0.34s cubic-bezier(0.45, 0, 0.55, 1.2),
              filter 0.34s linear, opacity 0.18s linear 0.18s;
  filter: brightness(1.6) drop-shadow(0 0 14px currentColor);
  z-index: 5;
}
.orb.sliding-end { opacity: 0; }
.orb.merging { animation: mergePop 0.48s ease-out forwards; z-index: 6; }
@keyframes mergePop {
  0%   { transform: scale(1); }
  18%  { transform: scale(1.32) rotate(-6deg); filter: brightness(1.7); }
  38%  { transform: scale(1.5); filter: brightness(2); }
  58%  { transform: scale(0.88); filter: brightness(1.15); }
  78%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.orb.shake { animation: orbShake 0.3s ease; }
@keyframes orbShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px) rotate(-3deg); }
  40% { transform: translateX(4px) rotate(3deg); }
  60% { transform: translateX(-3px) rotate(-2deg); }
  80% { transform: translateX(3px) rotate(2deg); }
}
.orb.preview-magnet {
  filter: brightness(1.25) drop-shadow(0 0 12px currentColor);
  animation: previewMagnetPulse 0.85s ease-in-out infinite;
  z-index: 3;
}
.orb.preview-slider {
  filter: brightness(1.2) drop-shadow(0 0 9px currentColor);
  animation: previewSliderPulse 0.85s ease-in-out infinite;
  z-index: 2;
}
@keyframes previewMagnetPulse { 0%,100%{transform:scale(1)}50%{transform:scale(1.07)} }
@keyframes previewSliderPulse { 0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.04);opacity:0.93} }

.pulse-ring {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  animation: pulseRing 0.5s ease-out forwards; z-index: 4;
}
@keyframes pulseRing {
  0% { transform: scale(1); opacity: 0.9; box-shadow: 0 0 0 0 currentColor, inset 0 0 20px currentColor; }
  100% { transform: scale(2.5); opacity: 0; box-shadow: 0 0 60px 20px transparent, inset 0 0 0 0 transparent; }
}

.floating-score {
  position: absolute; left: 50%; top: 50%; pointer-events: none;
  font-size: 18px; font-weight: 900; color: var(--c-gold);
  text-shadow: 0 0 14px var(--c-gold), 0 1px 2px rgba(60,20,0,0.7);
  animation: floatUp 0.95s ease-out forwards;
  z-index: 50; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@keyframes floatUp {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  30% { transform: translate(-50%, -90%) scale(1.4); opacity: 1; }
  100% { transform: translate(-50%, -220%) scale(1); opacity: 0; }
}

.combo-flash {
  position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%);
  font-size: clamp(40px, 12vw, 78px); font-weight: 900; letter-spacing: 0.05em;
  pointer-events: none; animation: comboFlash 0.85s ease-out forwards;
  z-index: 60;
  background: linear-gradient(180deg, #fff, var(--c-gold) 45%, var(--c-orange));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
@keyframes comboFlash {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; }
  75% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -90%) scale(0.9); opacity: 0; }
}

/* Powerup tray */
.powerups {
  flex-shrink: 0; margin-top: 10px;
  display: flex; gap: 8px; justify-content: center;
}
.pu {
  flex: 1; max-width: 110px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,215,94,0.25);
  border-radius: 14px;
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.2s;
  position: relative;
}
.pu:active { transform: scale(0.95); }
.pu.active { border-color: var(--c-gold); background: rgba(255,215,94,0.14); }
.pu.disabled { opacity: 0.5; cursor: not-allowed; }
.pu-ic { font-size: 22px; line-height: 1; }
.pu-info { flex: 1; min-width: 0; }
.pu-name { font-size: 9px; font-weight: 800; letter-spacing: 0.14em; color: var(--text-soft); }
.pu-count {
  font-size: 16px; font-weight: 900; color: var(--c-gold);
  font-variant-numeric: tabular-nums;
}
.pu-count.zero { color: var(--text-dim); }

/* Back button */
.back-btn {
  position: absolute; top: max(env(safe-area-inset-top), 12px); left: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text); font-size: 18px; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.back-btn:active { transform: scale(0.94); }

/* ────────────────────────────────────────────────────────────────
   RESULTS / WIN / LOSE
   ──────────────────────────────────────────────────────────────── */
.result-card {
  background: linear-gradient(180deg, #2a0e44 0%, #1a0628 100%);
  border: 1px solid rgba(255,215,94,0.4);
  border-radius: 22px;
  padding: 22px 20px 18px;
  width: 100%; max-width: 360px;
  box-shadow: 0 20px 60px rgba(255,77,151,0.5), 0 0 80px rgba(255,215,94,0.15);
  text-align: center;
}
.result-headline {
  font-size: 32px; font-weight: 900; letter-spacing: 0.14em;
  background: linear-gradient(180deg, #fff 0%, var(--c-gold) 50%, var(--c-pink) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 16px rgba(255,215,94,0.5));
  margin-bottom: 6px;
}
.result-headline.lose {
  background: linear-gradient(180deg, #fff 0%, var(--c-pink) 50%, var(--c-orange) 100%);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 4px 16px rgba(255,77,151,0.5));
}
.result-sub { font-size: 11px; letter-spacing: 0.2em; color: var(--text-soft); font-weight: 800; }

.stars {
  display: flex; justify-content: center; gap: 14px;
  margin: 22px 0 16px;
}
.star {
  width: 60px; height: 60px;
  background: rgba(255,255,255,0.06);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  position: relative;
  transition: transform 0.3s, background 0.3s;
}
.star.lit {
  background: radial-gradient(circle at 35% 25%, #fff, var(--c-gold) 50%, #b07a00);
  filter: drop-shadow(0 0 12px rgba(255,215,94,0.7));
  animation: starPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes starPop {
  0% { transform: scale(0.2) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.35) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.result-stat {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center;
  margin: 6px 0;
}
.result-stat-lbl { font-size: 10px; letter-spacing: 0.22em; font-weight: 800; color: var(--text-dim); }
.result-stat-val {
  font-size: 18px; font-weight: 900; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.result-stat-val.gold { color: var(--c-gold); }

.result-xp-bar {
  margin: 14px 0 8px;
  height: 14px; border-radius: 999px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden; position: relative;
}
.result-xp-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--c-emerald), var(--c-gold) 60%, var(--c-orange));
  box-shadow: 0 0 14px rgba(255,215,94,0.55);
  transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s;
}
.result-xp-lbl {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; letter-spacing: 0.18em; color: var(--text-soft); font-weight: 800;
}
.result-xp-gain {
  color: var(--c-emerald);
  font-size: 12px; font-weight: 900; letter-spacing: 0.12em;
}

.rewards-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 12px;
}
.reward-card {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  animation: rewardPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}
.reward-card:nth-child(1) { animation-delay: 0.2s; }
.reward-card:nth-child(2) { animation-delay: 0.35s; }
.reward-card:nth-child(3) { animation-delay: 0.5s; }
@keyframes rewardPop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.reward-card .ic { font-size: 28px; line-height: 1; margin-bottom: 4px; }
.reward-card .v {
  font-size: 18px; font-weight: 900; color: var(--c-gold);
  font-variant-numeric: tabular-nums;
}
.reward-card .l { font-size: 8px; letter-spacing: 0.16em; color: var(--text-dim); font-weight: 800; margin-top: 1px; }

.result-actions { margin-top: 16px; display: flex; gap: 8px; }
.result-actions .btn { flex: 1; }
.btn {
  padding: 12px 16px; border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-family: inherit; font-weight: 800; font-size: 11px; letter-spacing: 0.2em;
  cursor: pointer;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--c-gold), var(--c-pink) 55%, var(--c-orange));
  color: #2a0810; border: none;
  box-shadow: 0 4px 18px rgba(255,77,151,0.5), inset 0 2px 0 rgba(255,255,255,0.5);
}

/* Chest open animation */
.chest-stage {
  position: relative;
  height: 130px;
  margin: 8px 0 4px;
  display: flex; align-items: center; justify-content: center;
}
.chest {
  font-size: 70px; line-height: 1;
  cursor: pointer;
  animation: chestShake 0.6s ease-in-out infinite;
  filter: drop-shadow(0 4px 14px rgba(255,215,94,0.5));
}
@keyframes chestShake {
  0%, 100% { transform: rotate(-3deg) scale(1); }
  50%      { transform: rotate(3deg) scale(1.04); }
}
.chest.opening { animation: chestBurst 0.6s ease forwards; }
@keyframes chestBurst {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); filter: brightness(2) drop-shadow(0 0 30px var(--c-gold)); }
  100% { transform: scale(0); opacity: 0; }
}
.chest-hint {
  position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%);
  font-size: 10px; letter-spacing: 0.22em; font-weight: 800;
  color: var(--c-gold); white-space: nowrap;
  animation: chestHintPulse 1.4s ease-in-out infinite;
}
@keyframes chestHintPulse { 0%,100%{opacity:0.5} 50%{opacity:1} }
.chest-burst {
  position: absolute; inset: 0; pointer-events: none;
  animation: burstRing 0.8s ease-out forwards;
  border-radius: 50%;
}
@keyframes burstRing {
  0% { box-shadow: 0 0 0 0 var(--c-gold), 0 0 0 0 var(--c-pink); opacity: 1; }
  100% { box-shadow: 0 0 0 80px transparent, 0 0 0 140px transparent; opacity: 0; }
}

/* Confetti rain (CSS-only, layered absolute pieces) */
.confetti {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  z-index: 70;
}
.confetti i {
  position: absolute; top: -10px;
  width: 8px; height: 12px; border-radius: 2px;
  animation: confettiFall 2.2s ease-in forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0.7; }
}

/* Level-up flash */
.levelup {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(255,215,94,0.35), rgba(20,6,38,0.92));
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}
.levelup-content {
  text-align: center;
  animation: cardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.levelup-tag {
  font-size: 12px; letter-spacing: 0.4em; font-weight: 800; color: var(--c-gold);
}
.levelup-num {
  font-size: 90px; font-weight: 900; letter-spacing: -0.04em;
  background: linear-gradient(180deg, #fff, var(--c-gold) 50%, var(--c-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px rgba(255,215,94,0.6));
  line-height: 1;
}
.levelup-reward {
  margin-top: 12px;
  font-size: 14px; font-weight: 800; letter-spacing: 0.14em;
  color: var(--text);
}
.levelup-reward b { color: var(--c-gold); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  background: rgba(20,6,38,0.95); color: var(--c-gold);
  padding: 10px 18px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.16em;
  border: 1px solid rgba(255,215,94,0.4);
  z-index: 150; animation: toastIn 0.3s ease, toastOut 0.3s ease 2.4s forwards;
}
@keyframes toastIn  { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, 8px); } }
