:root {
  --bg-outer: #05070e;
  --bg-top: #090e1c;
  --bg-bottom: #141d33;
  --glass: rgba(13, 20, 38, 0.72);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #eef3ff;
  --text-muted: #8fa1c7;
  --accent-silk: #d7ecff;
  --accent-elastic: #f6c453;
  --accent-cut: #ff6b7a;
  --accent-firefly: #c8ff62;
  --accent-beetle: #c084fc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #10172b 0%, var(--bg-outer) 75%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

.app-shell {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-frame {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 460px;
  max-height: 920px;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@media (min-width: 500px) {
  .game-frame {
    height: min(94vh, 860px);
    width: min(440px, 52vh);
    border-radius: 26px;
  }
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* Top HUD */
.hud-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: 1fr 1.45fr 0.85fr;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  pointer-events: none;
  z-index: 5;
}

.wave-label {
  color: #b7d3ff;
}

.hearts-row {
  font-size: 16px;
  letter-spacing: 2px;
  color: #ff6b7a;
  text-shadow: 0 0 10px rgba(255, 107, 122, 0.55);
  line-height: 1.2;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-stat.right {
  align-items: flex-end;
}

.hud-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.hud-value {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.combo-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f6c453, #ff8a4c);
  color: #16110a;
  transform: scale(1);
  transition: transform 0.15s ease;
}

.combo-badge.hidden {
  display: none;
}

.hud-silk {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.silk-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.silk-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-silk);
  font-variant-numeric: tabular-nums;
}

.silk-bar-bg {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.silk-bar-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #9ad1ff, #ffffff);
  box-shadow: 0 0 10px rgba(180, 224, 255, 0.65);
  transition: width 0.08s linear;
}

/* Hint pill */
.hint-pill {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 88%;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(12, 19, 36, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #cbd8f5;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0.92;
  transition: opacity 0.35s ease;
  z-index: 4;
}

.hint-pill.fade {
  opacity: 0;
}

.hint-pill.with-boss {
  top: 128px;
}

/* Bottom HUD */
.hud-bottom {
  position: absolute;
  bottom: 14px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  z-index: 5;
}

.tool-group {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  flex: 1;
}

.tool-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  color: var(--text-main);
}

.tool-btn.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.tool-btn[data-tool="elastic"].active {
  border-color: rgba(246, 196, 83, 0.55);
  color: #ffe29a;
}

.tool-btn[data-tool="cut"].active {
  border-color: rgba(255, 107, 122, 0.6);
  color: #ff9ea8;
}

.tool-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.sticky-dot {
  background: #e6f4ff;
  box-shadow: 0 0 8px #bce0ff;
}

.elastic-dot {
  background: var(--accent-elastic);
  box-shadow: 0 0 8px rgba(246, 196, 83, 0.8);
}

.tool-icon {
  font-size: 14px;
  line-height: 1;
}

.action-group {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-main);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

/* Start Overlay */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 20, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 24px 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(22, 32, 58, 0.95), rgba(11, 16, 31, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}

/* Language Switcher Button & Modal Grid */
.lang-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(160, 205, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.lang-btn:hover {
  background: rgba(124, 196, 255, 0.16);
  border-color: rgba(124, 196, 255, 0.55);
}

.lang-btn:active {
  transform: scale(0.94);
}

.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 16px;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.lang-option:hover {
  background: rgba(124, 196, 255, 0.12);
  border-color: rgba(124, 196, 255, 0.4);
}

.lang-option.active {
  background: rgba(126, 245, 196, 0.13);
  border-color: rgba(126, 245, 196, 0.65);
  box-shadow: 0 0 12px rgba(126, 245, 196, 0.2);
}

.lang-option-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.lang-flag {
  font-size: 18px;
  line-height: 1;
}

.lang-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-check {
  font-size: 12px;
  font-weight: 800;
  color: #7ef5c4;
}

.logo-spider {
  font-size: 42px;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 16px rgba(215, 236, 255, 0.4));
}

.logo-spider img {
  display: block;
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 22px;
}

.overlay-card h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.rules-list {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
  font-size: 13px;
  line-height: 1.45;
  color: #d7e2fa;
}

.rules-list li {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.c-firefly { color: var(--accent-firefly); font-weight: 600; }
.c-beetle { color: var(--accent-beetle); font-weight: 600; }
.c-wasp { color: #ffd166; font-weight: 600; }

.primary-btn {
  width: 100%;
  padding: 13px 18px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #7cc4ff, #c5e6ff);
  color: #081224;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(124, 196, 255, 0.35);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.primary-btn:hover {
  filter: brightness(1.06);
}

.primary-btn:active {
  transform: scale(0.97);
}

.secondary-btn {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.secondary-btn:active {
  transform: scale(0.97);
}

.best-pill {
  display: inline-block;
  margin-bottom: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(246, 196, 83, 0.14);
  border: 1px solid rgba(246, 196, 83, 0.35);
  color: #ffe29a;
  font-size: 12px;
}

.best-pill.hidden {
  display: none;
}

.wave-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(124, 196, 255, 0.16);
  border: 1px solid rgba(124, 196, 255, 0.4);
  color: #a8dcff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.overlay-card h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.upgrade-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.upgrade-card:hover {
  background: rgba(124, 196, 255, 0.12);
  border-color: rgba(124, 196, 255, 0.45);
}

.upgrade-card:active {
  transform: scale(0.98);
}

.upgrade-icon {
  font-size: 24px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upgrade-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upgrade-title {
  font-size: 14px;
  font-weight: 700;
}

.upgrade-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0 18px;
}

.stat-box {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-box strong {
  font-size: 20px;
  font-weight: 800;
}

.gameover-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Spider Species Picker */
.spider-picker-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.spider-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 10px;
}

.start-card {
  max-width: 360px;
  padding: 20px 16px;
}

.spider-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 5px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.spider-card.locked {
  opacity: 0.52;
  border-style: dashed;
  cursor: pointer;
}

.spider-card.locked:hover {
  opacity: 0.72;
}

.sp-lock {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 10px;
}

.species-detail {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  font-size: 12px;
  line-height: 1.4;
  color: #d7e2fa;
  margin-bottom: 14px;
  min-height: 62px;
}

.species-detail strong {
  color: #ffffff;
}

.species-req {
  display: block;
  margin-top: 4px;
  color: #ffd166;
  font-size: 11px;
  font-weight: 600;
}

.sp-jumper {
  background: radial-gradient(circle at 35% 35%, #7ef5c4, #144d3c);
  box-shadow: 0 0 8px rgba(126, 245, 196, 0.55);
}

.sp-volt {
  background: radial-gradient(circle at 35% 35%, #6ee7ff, #11346b);
  box-shadow: 0 0 10px rgba(110, 231, 255, 0.7);
}

.sp-tarantula {
  background: radial-gradient(circle at 35% 35%, #ff8a4c, #4a1c12);
  box-shadow: 0 0 8px rgba(255, 138, 76, 0.6);
}

.spider-card[data-species="jumper"].active {
  background: rgba(126, 245, 196, 0.15);
  border-color: rgba(126, 245, 196, 0.65);
}

.spider-card[data-species="volt"].active {
  background: rgba(110, 231, 255, 0.16);
  border-color: rgba(110, 231, 255, 0.7);
}

.spider-card[data-species="tarantula"].active {
  background: rgba(255, 138, 76, 0.16);
  border-color: rgba(255, 138, 76, 0.7);
}

/* Achievement Toast */
.achieve-toast {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(32, 46, 78, 0.96), rgba(16, 24, 44, 0.96));
  border: 1px solid rgba(246, 196, 83, 0.65);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 16px rgba(246, 196, 83, 0.25);
  z-index: 25;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.achieve-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-14px);
}

.achieve-icon {
  font-size: 20px;
}

.achieve-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.achieve-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #f6c453;
}

.achieve-name {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

/* Leaderboard Modal */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  margin: 10px 0 16px;
  text-align: left;
}

.lb-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
}

.lb-row.top-1 {
  background: rgba(246, 196, 83, 0.14);
  border-color: rgba(246, 196, 83, 0.4);
}

.lb-rank {
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
}

.lb-row.top-1 .lb-rank {
  color: #ffe29a;
}

.lb-player {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lb-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-meta {
  font-size: 10.5px;
  color: var(--text-muted);
}

.lb-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #a8dcff;
}

/* Daily Challenge Button */
.start-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.daily-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(246, 196, 83, 0.5);
  background: linear-gradient(135deg, rgba(246, 196, 83, 0.16), rgba(255, 138, 76, 0.12));
  color: #ffe8ad;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.12s ease, background 0.15s ease;
}

.daily-btn:hover {
  background: linear-gradient(135deg, rgba(246, 196, 83, 0.24), rgba(255, 138, 76, 0.2));
}

.daily-btn:active {
  transform: scale(0.98);
}

.daily-title {
  font-size: 13.5px;
  font-weight: 800;
}

.daily-meta {
  font-size: 11px;
  color: #e2c98e;
}

/* Leaderboard Tabs */
.lb-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0 8px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-tab {
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lb-tab.active {
  background: rgba(124, 196, 255, 0.16);
  border-color: rgba(124, 196, 255, 0.45);
  color: #ffffff;
}

/* Meta pills, Offline Banner & Nest Upgrade */
.meta-pills-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.meta-pills-row .best-pill {
  margin-bottom: 0;
}

.chitin-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(200, 255, 98, 0.12);
  border: 1px solid rgba(200, 255, 98, 0.32);
  color: #d7ff8c;
  font-size: 12px;
}

.offline-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  margin-bottom: 10px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(126, 245, 196, 0.16), rgba(110, 231, 255, 0.12));
  border: 1px solid rgba(126, 245, 196, 0.45);
  text-align: left;
}

.offline-banner.hidden {
  display: none;
}

.offline-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
}

.offline-info strong {
  color: #b5ffe0;
  font-size: 12.5px;
}

.offline-info span {
  color: var(--text-muted);
  font-size: 10.5px;
}

.claim-btn {
  padding: 7px 11px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #7ef5c4, #6ee7ff);
  color: #071915;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.start-row-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 7px;
}

.campaign-btn {
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid rgba(192, 132, 252, 0.55);
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.22), rgba(124, 196, 255, 0.15));
  color: #f2e2ff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.campaign-btn:active {
  transform: scale(0.97);
}

.nest-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid rgba(200, 255, 98, 0.28);
  background: rgba(200, 255, 98, 0.07);
  color: #d9ff96;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nest-btn:hover {
  background: rgba(200, 255, 98, 0.14);
}

.nest-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Campaign Spider-Web Progression Map */
.campaign-map-card {
  padding: 16px 14px 14px;
}

.campaign-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.campaign-header-row .wave-badge {
  margin-bottom: 0;
}

.campaign-progress-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(126, 245, 196, 0.12);
  border: 1px solid rgba(126, 245, 196, 0.35);
  color: #9fffe0;
}

.campaign-web-map {
  position: relative;
  width: 100%;
  aspect-ratio: 340 / 300;
  margin: 8px 0 10px;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 77, 166, 0.14) 0%, rgba(18, 28, 52, 0.72) 48%, rgba(7, 11, 22, 0.96) 100%);
  border: 1px solid rgba(170, 210, 255, 0.18);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.65);
}

.campaign-web-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.web-spoke {
  stroke: rgba(190, 220, 255, 0.14);
  stroke-width: 1;
}

.web-ring {
  fill: none;
  stroke: rgba(190, 220, 255, 0.1);
  stroke-width: 1;
}

.web-path-locked {
  fill: none;
  stroke: rgba(185, 210, 245, 0.2);
  stroke-width: 1.8;
  stroke-dasharray: 4 5;
}

.web-path-done {
  fill: none;
  stroke: rgba(126, 245, 196, 0.85);
  stroke-width: 2.6;
  filter: drop-shadow(0 0 4px rgba(126, 245, 196, 0.65));
}

.web-path-active {
  fill: none;
  stroke: #9be8ff;
  stroke-width: 2.6;
  stroke-dasharray: 7 5;
  animation: webSilkFlow 1.4s linear infinite;
  filter: drop-shadow(0 0 5px rgba(124, 196, 255, 0.85));
}

@keyframes webSilkFlow {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

.web-dew {
  fill: rgba(220, 245, 255, 0.55);
}

.campaign-web-nodes {
  position: absolute;
  inset: 0;
}

.web-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(180, 215, 255, 0.35);
  background: radial-gradient(circle at 35% 30%, rgba(36, 52, 86, 0.95), rgba(10, 16, 32, 0.96));
  color: #e9f2ff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  z-index: 2;
}

.web-node:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.web-node.biome-attic { border-color: rgba(245, 166, 75, 0.55); }
.web-node.biome-garden { border-color: rgba(124, 196, 255, 0.55); }
.web-node.biome-greenhouse { border-color: rgba(126, 245, 196, 0.55); }
.web-node.biome-neon { border-color: rgba(255, 92, 178, 0.65); }

.web-node.done {
  background: radial-gradient(circle at 35% 30%, rgba(32, 118, 92, 0.95), rgba(10, 42, 36, 0.96));
  border-color: #7ef5c4;
  box-shadow: 0 0 12px rgba(126, 245, 196, 0.45);
}

.web-node.current {
  border-color: #9be8ff;
  box-shadow: 0 0 0 4px rgba(124, 196, 255, 0.22), 0 0 16px rgba(124, 196, 255, 0.7);
  animation: webNodePulse 1.8s ease-in-out infinite;
}

.web-node.locked {
  opacity: 0.58;
  background: rgba(12, 16, 28, 0.9);
  border-color: rgba(160, 180, 210, 0.24);
  color: #8b9bb8;
}

.web-node.boss {
  width: 44px;
  height: 44px;
  font-size: 16px;
  border-width: 2.5px;
  background: radial-gradient(circle at 35% 30%, rgba(122, 24, 72, 0.96), rgba(32, 8, 28, 0.98));
  border-color: #ff5ca8;
  box-shadow: 0 0 16px rgba(255, 77, 166, 0.45);
}

.web-node.selected {
  transform: translate(-50%, -50%) scale(1.18);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7), 0 0 20px rgba(140, 220, 255, 0.85);
  z-index: 4;
}

.web-node-star {
  position: absolute;
  top: -6px;
  right: -5px;
  font-size: 11px;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
}

.web-node-tag {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 9px;
  font-weight: 700;
  color: rgba(215, 232, 255, 0.82);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  pointer-events: none;
}

@keyframes webNodePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(124, 196, 255, 0.2), 0 0 12px rgba(124, 196, 255, 0.65); }
  50% { box-shadow: 0 0 0 7px rgba(124, 196, 255, 0.06), 0 0 22px rgba(124, 196, 255, 0.9); }
}

.campaign-spider-token {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1), top 0.45s cubic-bezier(0.22, 1, 0.36, 1), transform 0.35s ease;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 6px rgba(130, 230, 255, 0.55));
}

.campaign-spider-token img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.campaign-detail {
  text-align: left;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid rgba(160, 205, 255, 0.2);
  background: rgba(15, 24, 44, 0.68);
  margin-bottom: 10px;
}

.campaign-detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.campaign-detail-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
}

.campaign-detail-goal {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.campaign-detail-reward {
  font-size: 11px;
  font-weight: 800;
  color: #c8ff62;
  white-space: nowrap;
}

.campaign-detail-locked-note {
  margin-top: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: #ff9c8a;
}

.campaign-footer-actions {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 8px;
}

.campaign-footer-actions .primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lvl-biome {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ec5ff;
}

/* Web Skins Shop */
.shop-btn {
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid rgba(255, 138, 200, 0.38);
  background: rgba(255, 110, 190, 0.1);
  color: #ffc8e6;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.shop-btn:hover {
  background: rgba(255, 110, 190, 0.18);
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 320px;
  overflow-y: auto;
  margin: 12px 0 14px;
  text-align: left;
}

.skin-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-main);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.skin-card.equipped {
  border-color: rgba(126, 245, 196, 0.65);
  background: rgba(126, 245, 196, 0.1);
}

.skin-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.skin-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.skin-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.skin-name {
  font-size: 13px;
  font-weight: 800;
}

.skin-desc {
  font-size: 10.5px;
  color: var(--text-muted);
}

.skin-price {
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(200, 255, 98, 0.14);
  color: #d7ff8c;
  white-space: nowrap;
}

.skin-card.equipped .skin-price {
  background: rgba(126, 245, 196, 0.2);
  color: #9ef5d0;
}

.spider-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.spider-card.active {
  background: rgba(124, 196, 255, 0.14);
  border-color: rgba(124, 196, 255, 0.6);
  box-shadow: 0 0 14px rgba(124, 196, 255, 0.2);
}

.spider-card[data-species="widow"].active {
  background: rgba(255, 77, 109, 0.16);
  border-color: rgba(255, 77, 109, 0.65);
  box-shadow: 0 0 14px rgba(255, 77, 109, 0.25);
}

.spider-card[data-species="golden"].active {
  background: rgba(246, 196, 83, 0.16);
  border-color: rgba(246, 196, 83, 0.68);
  box-shadow: 0 0 14px rgba(246, 196, 83, 0.25);
}

.sp-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 2px;
}

/* Painted spider portraits (override the gradient dots below) */
.spider-card .sp-dot {
  width: 34px;
  height: 34px;
  border-radius: 0;
  box-shadow: none !important;
  background-color: transparent !important;
  background-position: center !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
}
.spider-card .sp-dot.sp-orb { background-image: url('assets/sprites/spider-garden-orb-weaver.webp') !important; }
.spider-card .sp-dot.sp-jumper { background-image: url('assets/sprites/spider-jumping.webp') !important; }
.spider-card .sp-dot.sp-widow { background-image: url('assets/sprites/spider-black-widow.webp') !important; }
.spider-card .sp-dot.sp-golden { background-image: url('assets/sprites/spider-golden-orb-weaver.webp') !important; }
.spider-card .sp-dot.sp-volt { background-image: url('assets/sprites/spider-volt.webp') !important; }
.spider-card .sp-dot.sp-tarantula { background-image: url('assets/sprites/spider-royal-tarantula.webp') !important; }
.spider-card.locked .sp-dot { filter: grayscale(0.85) brightness(0.6); }

.chitin-icon {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.28em;
  margin: 0 1px;
  object-fit: contain;
}

/* Beetle sprite faces up; tilt it a bit so it reads as a flying bug */
.beetle-icon {
  width: 1.45em;
  height: 1.45em;
  vertical-align: -0.38em;
  transform: rotate(-20deg);
}

.sp-orb {
  background: radial-gradient(circle at 35% 35%, #9ec5ff, #1e2d4a);
  box-shadow: 0 0 8px rgba(158, 197, 255, 0.55);
}

.sp-widow {
  background: radial-gradient(circle at 50% 50%, #ff3b5c 0%, #140c14 68%);
  box-shadow: 0 0 8px rgba(255, 59, 92, 0.6);
}

.sp-golden {
  background: radial-gradient(circle at 35% 35%, #ffe699, #b87c18);
  box-shadow: 0 0 8px rgba(246, 196, 83, 0.65);
}

.sp-title {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
}

.sp-perk {
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Boss HP Bar */
.boss-hud {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: 78%;
  max-width: 310px;
  padding: 7px 12px;
  border-radius: 13px;
  background: rgba(34, 12, 20, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 92, 114, 0.48);
  box-shadow: 0 8px 24px rgba(255, 60, 90, 0.25);
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.25s ease;
}

.boss-hud.hidden {
  display: none;
}

.boss-hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.boss-name {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #ffb8c0;
}

.boss-hp-text {
  font-size: 11px;
  font-weight: 800;
  color: #ffd166;
}

.boss-bar-bg {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.boss-bar-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff4d6d, #ffb703);
  box-shadow: 0 0 10px rgba(255, 92, 114, 0.7);
  transition: width 0.25s ease;
}
