/* =================================================================
   BLOCK SIEGE — STYLES
   ================================================================= */

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

:root {
  --gold: #E8A33D;
  --gold-deep: #9e691f;
  --green: #4A7C3D;
  --green-deep: #33582a;
  --slate: #1E2530;
  --slate-light: #2a3340;
  --danger: #B84A3E;
  --danger-deep: #82332a;
  --wood: #d68a3e;
  --wood-deep: #7a4818;
  --stone: #7c8794;
  --stone-deep: #404a55;
  --metal: #5a6470;
  --metal-deep: #23272e;
  --hp-green: #4A7C3D;
  --hp-red: #B84A3E;
  --hp-bg: rgba(0, 0, 0, 0.35);
  --bg-deep: #0e1a2b;
  --bg-warm: #2c1810;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.25);
  --radius: 14px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0d12;
  color: #fff;
  font-family: 'Outfit', 'Trebuchet MS', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top, #1d2c46 0%, #07090f 70%);
}

#game {
  display: block;
  background: #87CEEB;
  border-radius: 8px;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: default;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  /* Scale canvas down to fit viewport while keeping internal 1280x720 resolution */
  width: 1280px;
  max-width: calc(100vw - 40px);
  height: auto;
  aspect-ratio: 16 / 9;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

#game.grabbing { cursor: grabbing; }
#game.placing { cursor: crosshair; }
#game.selling { cursor: pointer; }

/* =================================================================
   HUD (top bar)
   ================================================================= */
.hud-top {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 5;
  pointer-events: none;
}

.hud-card {
  background: linear-gradient(180deg, rgba(28, 32, 42, 0.92), rgba(16, 20, 28, 0.92));
  border: 1.5px solid rgba(232, 163, 61, 0.25);
  border-radius: var(--radius);
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 90px;
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(232, 163, 61, 0.06),
    0 0 8px rgba(232, 163, 61, 0.06);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  transition: transform 0.15s, box-shadow 0.2s;
}

.hud-card.flash {
  animation: flash-pulse 0.4s;
}

@keyframes flash-pulse {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: 0 0 0 4px rgba(232, 163, 61, 0.5), var(--shadow); }
}

.hud-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.hud-value {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 22px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hud-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.hud-sub.combat { color: var(--danger); }
.hud-sub.build { color: var(--gold); }

#card-castle { min-width: 200px; }
.hp-bar {
  position: relative;
  height: 22px;
  background: var(--hp-bg);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

.hp-fill {
  height: 100%;
  background: linear-gradient(180deg, #5eb84a, #3d7a30);
  border-right: 1px solid rgba(0, 0, 0, 0.2);
  transition: width 0.3s ease, background 0.3s;
  width: 100%;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.hp-fill.low {
  background: linear-gradient(180deg, var(--gold), #c87020);
}

.hp-fill.critical {
  background: linear-gradient(180deg, #d44a40, #a0302a);
  animation: hp-blink 0.7s infinite;
}

@keyframes hp-blink {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.4); }
}

.hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

#card-gold .hud-value { display: inline-flex; align-items: center; gap: 6px; }
.hud-coin-icon { vertical-align: middle; }
.hud-coin-icon svg { display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); }

#card-gold.flash .hud-value {
  animation: gold-pop 0.5s;
}

@keyframes gold-pop {
  0% { transform: scale(1); color: #fff; }
  40% { transform: scale(1.18); color: var(--gold); }
  100% { transform: scale(1); color: #fff; }
}

/* =================================================================
   BLOCK TRAY
   ================================================================= */
.tray {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
}

.tray.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(40px);
  pointer-events: none !important;
}

.tray-inner {
  background: linear-gradient(180deg, rgba(38, 44, 56, 0.92), rgba(20, 24, 32, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 12px 16px 14px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.tray-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--gold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sell-toggle {
  font-size: 14px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.sell-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.08);
}

.sell-toggle.active {
  background: rgba(184, 74, 62, 0.25);
  border-color: rgba(184, 74, 62, 0.4);
  box-shadow: 0 0 12px rgba(184, 74, 62, 0.2);
}

.tray-items {
  display: flex;
  gap: 10px;
}

.tray-item {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.18));
  border: 2px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.tray-item:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 6px 18px rgba(232, 163, 61, 0.2);
}

.tray-item:active {
  cursor: grabbing;
  transform: translateY(-2px) scale(0.96);
}

.tray-item.disabled {
  opacity: 0.4;
  filter: grayscale(0.7);
  cursor: not-allowed;
}

.tray-item.disabled:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.tray-item.selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(232, 163, 61, 0.18), rgba(232, 163, 61, 0.04));
  box-shadow: 0 0 16px rgba(232, 163, 61, 0.4), inset 0 0 0 2px var(--gold);
}

.tray-item.selected::after {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--gold);
  filter: drop-shadow(0 0 4px rgba(232, 163, 61, 0.6));
  animation: select-bounce 1.4s infinite ease-in-out;
}

@keyframes select-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}

.tray-item.dragging-source {
  opacity: 0.4;
  transform: scale(0.95);
}

.tray-item .item-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.tray-item .item-cost {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 6px;
  border-radius: 4px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
}

.tray-item .item-name {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tray-shortcut {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 700;
}

/* =================================================================
   ACTION BUTTON
   ================================================================= */
#action-area {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 4;
  transition: opacity 0.3s, transform 0.3s;
}

#action-area.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.action-btn {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 18px;
  padding: 14px 26px;
  color: #fff;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 14px;
  cursor: pointer;
  letter-spacing: 0.05em;
  box-shadow:
    0 8px 22px rgba(158, 105, 31, 0.5),
    inset 0 -4px 0 rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 28px rgba(158, 105, 31, 0.65),
    inset 0 -4px 0 rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.action-btn:active {
  transform: translateY(1px);
}

.action-btn.combat {
  background: linear-gradient(180deg, var(--danger), var(--danger-deep));
  box-shadow:
    0 8px 22px rgba(130, 51, 42, 0.5),
    inset 0 -4px 0 rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.action-btn.combat:hover {
  box-shadow:
    0 12px 28px rgba(130, 51, 42, 0.65),
    inset 0 -4px 0 rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.action-btn.pulse {
  animation: pulse-glow 1.8s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow:
      0 8px 22px rgba(158, 105, 31, 0.5),
      inset 0 -4px 0 rgba(0, 0, 0, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  50% {
    box-shadow:
      0 8px 36px rgba(232, 163, 61, 0.8),
      inset 0 -4px 0 rgba(0, 0, 0, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
}

/* =================================================================
   FLOATING TIP (in-world hint)
   ================================================================= */
.floating-tip {
  position: absolute;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  transform: translate(-50%, -100%);
  transition: opacity 0.2s;
  z-index: 6;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-soft);
}

.floating-tip.hidden {
  opacity: 0;
}

/* =================================================================
   LOADING SCREEN
   ================================================================= */
.loading-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top, #1d2c46 0%, #07090f 70%);
  transition: opacity 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-card {
  text-align: center;
  animation: loading-fade 0.6s ease-out;
}

@keyframes loading-fade {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.loading-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 32px;
}

/* Animated shield icon — subtle pulse + glow */
.loading-icon {
  display: inline-block;
  animation: shield-pulse 2.2s ease-in-out infinite;
}

.loading-icon svg {
  filter: drop-shadow(0 4px 0 #0a0d12) drop-shadow(0 8px 24px rgba(0,0,0,0.6)) drop-shadow(0 0 16px rgba(232,163,61,0.3));
}

@keyframes shield-pulse {
  0%, 100% { transform: scale(1);   filter: drop-shadow(0 4px 0 #0a0d12) drop-shadow(0 8px 24px rgba(0,0,0,0.6)) drop-shadow(0 0 16px rgba(232,163,61,0.3)); }
  50%      { transform: scale(1.06); filter: drop-shadow(0 4px 0 #0a0d12) drop-shadow(0 8px 24px rgba(0,0,0,0.6)) drop-shadow(0 0 28px rgba(232,163,61,0.55)); }
}

/* Carved-stone title for loading screen */
.loading-title {
  font-family: 'Bungee', 'Russo One', sans-serif;
  font-size: 52px;
  letter-spacing: 0.04em;
  line-height: 1;
  background: linear-gradient(
    180deg,
    #c4c9d0 0%,
    #9ea4ad 30%,
    #8a9099 50%,
    #6e747d 70%,
    #5a6068 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow:
    0 -1px 1px rgba(255, 255, 255, 0.3),
    0 2px 1px rgba(0, 0, 0, 0.5),
    0 5px 0 rgba(0, 0, 0, 0.3),
    0 10px 20px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(232, 163, 61, 0.2);
}

.loading-accent {
  background: linear-gradient(
    180deg,
    #f5d078 0%,
    var(--gold) 25%,
    #c88528 55%,
    var(--gold-deep) 80%,
    #7a4a14 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow:
    0 -1px 1px rgba(255, 255, 255, 0.45),
    0 3px 0 #5a3f0a,
    0 6px 12px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(232, 163, 61, 0.45);
}

.loading-bar-track {
  width: 240px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin: 0 auto 16px;
  overflow: hidden;
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #c87020);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(232, 163, 61, 0.4);
  animation: loading-progress 1.8s ease-in-out forwards, bar-glow 1.2s ease-in-out infinite;
}

@keyframes loading-progress {
  0% { width: 0%; }
  60% { width: 65%; }
  100% { width: 100%; }
}

@keyframes bar-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(232, 163, 61, 0.3); }
  50%      { box-shadow: 0 0 18px rgba(232, 163, 61, 0.7), 0 0 40px rgba(232, 163, 61, 0.15); }
}

.loading-text {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* =================================================================
   OVERLAY SCREENS
   ================================================================= */
.overlay-screen {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(20, 30, 50, 0.85), rgba(0, 0, 0, 0.92));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(6px);
  transition: opacity 0.4s;
}

.overlay-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.title-card {
  text-align: center;
  padding: 36px 48px;
  background: linear-gradient(180deg, rgba(30, 37, 48, 0.95), rgba(20, 25, 35, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  position: relative;
  max-width: 880px;
  width: 92vw;
  animation: card-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes card-in {
  0% { transform: scale(0.8) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.title-sun {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0%, #c87020 70%, transparent 100%);
  filter: blur(8px);
  animation: sun-pulse 3s infinite ease-in-out;
}

@keyframes sun-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.7; }
  50% { transform: translateX(-50%) scale(1.15); opacity: 1; }
}

/* Carved-stone title with bevel, depth, and warm glow */
.title {
  font-family: 'Bungee', 'Russo One', sans-serif;
  font-size: 64px;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-bottom: 8px;
  /* Stone base color with subtle gradient */
  background: linear-gradient(
    180deg,
    #c4c9d0 0%,
    #9ea4ad 30%,
    #8a9099 50%,
    #6e747d 70%,
    #5a6068 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Inner bevel: light top shadow, dark bottom shadow */
  text-shadow:
    /* top lit edge */ 0 -1px 1px rgba(255, 255, 255, 0.3),
    /* bottom dark edge */ 0 2px 1px rgba(0, 0, 0, 0.5),
    /* deep inset bottom */ 0 5px 0 rgba(0, 0, 0, 0.3),
    /* outer drop */ 0 10px 20px rgba(0, 0, 0, 0.6),
    /* warm glow */ 0 0 40px rgba(232, 163, 61, 0.2);
}

/* Gold-forged accent for "SIEGE" — stands out from the stone */
.title-accent {
  background: linear-gradient(
    180deg,
    #f5d078 0%,
    var(--gold) 25%,
    #c88528 55%,
    var(--gold-deep) 80%,
    #7a4a14 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Metallic bevel via text-shadow (avoids GPU layer / anti-alias loss) */
  text-shadow:
    0 -1px 1px rgba(255, 255, 255, 0.45),
    0 3px 0 #5a3f0a,
    0 6px 12px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(232, 163, 61, 0.45);
}

.subtitle {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 22px;
}

.title-gold {
  font-size: 28px;
  font-family: 'Russo One', sans-serif;
  color: var(--gold);
  margin-bottom: 24px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.3);
}

.how-to {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0 20px;
  text-align: left;
}

.how-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.how-icon {
  font-size: 32px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  flex-shrink: 0;
}

.how-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}

.how-text b {
  color: var(--gold);
  font-weight: 800;
}

/* Primary button: gold/amber */
.big-btn {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 22px;
  letter-spacing: 0.05em;
  padding: 16px 40px;
  border-radius: 14px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  border: 2px solid rgba(255,255,255,0.3);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  box-shadow:
    0 10px 32px rgba(158, 105, 31, 0.55),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s, box-shadow 0.2s;
  margin-top: 12px;
}

.big-btn:hover {
  transform: translateY(-3px);
  box-shadow:
    0 16px 40px rgba(158, 105, 31, 0.75),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.big-btn:active {
  transform: translateY(1px);
}

/* Secondary button: forest green */
.big-btn.green-btn {
  background: linear-gradient(180deg, var(--green), var(--green-deep));
  box-shadow:
    0 10px 32px rgba(51, 88, 42, 0.55),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.big-btn.green-btn:hover {
  box-shadow:
    0 16px 40px rgba(51, 88, 42, 0.75),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Tertiary button: neutral slate outline */
.big-btn.outline-btn {
  background: linear-gradient(180deg, rgba(42, 51, 64, 0.8), rgba(30, 37, 48, 0.9));
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.35),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.big-btn.outline-btn:hover {
  background: linear-gradient(180deg, rgba(50, 60, 75, 0.8), rgba(35, 44, 56, 0.9));
  border-color: rgba(232, 163, 61, 0.4);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.45),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.credit {
  margin-top: 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.1em;
}

.title-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.title-buttons .big-btn {
  min-width: 0;
  margin-top: 0;
}

/* Campaign & Survival: both gold primary */
.survival-btn {
  /* inherits gold from .big-btn — nothing to override */
}

/* Shop: green secondary */
.shop-btn {
  background: linear-gradient(180deg, var(--green), var(--green-deep)) !important;
  box-shadow:
    0 10px 32px rgba(51, 88, 42, 0.55),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

.shop-btn:hover {
  box-shadow:
    0 16px 40px rgba(51, 88, 42, 0.75),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

/* Settings, How to Play, About: neutral slate outline */
.settings-btn,
.howto-btn,
.about-btn {
  background: linear-gradient(180deg, rgba(42, 51, 64, 0.85), rgba(30, 37, 48, 0.92)) !important;
  border: 2px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.35),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.settings-btn:hover,
.howto-btn:hover,
.about-btn:hover {
  background: linear-gradient(180deg, rgba(50, 60, 75, 0.85), rgba(35, 44, 56, 0.92)) !important;
  border-color: rgba(232, 163, 61, 0.4) !important;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.45),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.secondary-btn {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 18px;
  letter-spacing: 0.05em;
  padding: 14px 28px;
  border-radius: 14px;
  cursor: pointer;
  color: #ccd;
  background: linear-gradient(180deg, var(--slate-light), var(--slate));
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.35),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  white-space: nowrap;
}

.secondary-btn:hover {
  transform: translateY(-3px);
  background: linear-gradient(180deg, #374458, #28303e);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.45),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.secondary-btn:active {
  transform: translateY(1px);
}

/* Settings card */
.settings-card {
  text-align: center;
  padding: 40px 48px;
  background: linear-gradient(180deg, rgba(30, 37, 48, 0.95), rgba(20, 25, 35, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  min-width: 400px;
  animation: card-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settings-title {
  font-family: 'Bungee', 'Russo One', sans-serif;
  font-size: 32px;
  letter-spacing: 0.04em;
  margin-bottom: 28px;
  text-shadow: 0 4px 0 #0a0d12, 0 8px 16px rgba(0, 0, 0, 0.6);
  color: #fff;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 32px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  user-select: none;
}

.setting-label {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.02em;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: #3a3f4a;
  border-radius: 14px;
  transition: background 0.25s;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #888;
  transition: transform 0.25s, background 0.25s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.toggle input:checked + .toggle-track {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  border-color: rgba(232, 163, 61, 0.3);
}

.toggle input:checked + .toggle-track .toggle-knob {
  transform: translateX(24px);
  background: #fff;
}

/* =================================================================
   TUTORIAL OVERLAY
   ================================================================= */
.tutorial-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 140px;
  transition: opacity 0.3s;
  pointer-events: none;
}

.tutorial-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.tutorial-card {
  position: relative;
  text-align: center;
  padding: 28px 36px 24px;
  background: linear-gradient(180deg, rgba(30, 37, 48, 0.97), rgba(18, 24, 32, 0.97));
  border: 1px solid rgba(232, 163, 61, 0.25);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  max-width: 520px;
  width: 90%;
  animation: card-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

.tutorial-step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.25s, transform 0.25s;
}

.tutorial-dot.active {
  background: var(--gold);
  transform: scale(1.3);
}

.tutorial-dot.done {
  background: rgba(232, 163, 61, 0.4);
}

.tutorial-title {
  font-family: 'Bungee', 'Russo One', sans-serif;
  font-size: 22px;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
  color: #fff;
  text-shadow: 0 2px 0 #0a0d12;
}

.tutorial-text {
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 20px;
}

.tutorial-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.tutorial-actions .big-btn {
  font-size: 16px;
  padding: 12px 28px;
  margin-top: 0;
}

.tutorial-skip {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  transition: color 0.2s;
}

.tutorial-skip:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* Highlight rings for targeted elements */
.tutorial-highlight {
  animation: tut-pulse 1.2s ease-in-out infinite;
  z-index: 31 !important;
}

@keyframes tut-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(232, 163, 61, 0), 0 0 0 0 rgba(232, 163, 61, 0.3);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(232, 163, 61, 0.15), 0 0 0 14px rgba(232, 163, 61, 0.05);
  }
}

/* Pause card */
.pause-card {
  text-align: center;
  padding: 44px 56px 36px;
  background: linear-gradient(180deg, rgba(30, 37, 48, 0.96), rgba(18, 24, 32, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  min-width: 340px;
  animation: card-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pause-title {
  font-family: 'Bungee', 'Russo One', sans-serif;
  font-size: 42px;
  letter-spacing: 0.06em;
  margin-bottom: 32px;
  text-shadow: 0 4px 0 #0a0d12, 0 8px 24px rgba(0, 0, 0, 0.6);
  color: #fff;
}

.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.pause-buttons .big-btn {
  min-width: 220px;
  margin-top: 0;
}

.pause-buttons .secondary-btn {
  min-width: 220px;
}

.quit-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.4);
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 16px;
  margin-top: 4px;
  transition: color 0.2s;
  letter-spacing: 0.05em;
}

.quit-btn:hover {
  color: rgba(184, 74, 62, 0.8);
}

/* Shop card */
.shop-card {
  text-align: center;
  padding: 32px 36px 28px;
  background: linear-gradient(180deg, rgba(30, 37, 48, 0.97), rgba(18, 24, 32, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  min-width: 520px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  animation: card-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.shop-title {
  font-family: 'Bungee', 'Russo One', sans-serif;
  font-size: 28px;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 3px 0 #0a0d12;
}

.shop-gold {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 22px;
  color: var(--gold);
  text-shadow: 0 2px 0 #5a3f0a;
}

.shop-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.shop-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}

.shop-item.maxed {
  border-color: rgba(232, 163, 61, 0.2);
  opacity: 0.7;
}

.shop-item-icon {
  font-size: 36px;
  margin-bottom: 4px;
}

.shop-item-name {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 16px;
  color: #fff;
  margin-bottom: 2px;
}

.shop-item-level {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.shop-item-stats {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin-bottom: 12px;
}

.shop-item-stat {
  display: flex;
  justify-content: space-between;
  padding: 1px 4px;
}

.shop-item-stat-label { color: rgba(255, 255, 255, 0.5); }

.shop-item-stat-value { color: #fff; font-weight: 600; }

.shop-item-stat-value.next {
  color: #6abf5a;
}

.shop-upgrade-btn {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, var(--green), var(--green-deep));
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, box-shadow 0.2s;
  min-width: 120px;
}

.shop-upgrade-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(51, 88, 42, 0.4);
}

.shop-upgrade-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.shop-upgrade-btn.maxed-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(232, 163, 61, 0.2);
  cursor: default;
}

.shop-card .big-btn {
  margin-top: 0;
}

/* Shop tabs */
.shop-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}

.shop-tab {
  font-family: 'Outfit', 'Russo One', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.shop-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.shop-tab.active {
  background: rgba(232, 163, 61, 0.12);
  border-color: rgba(232, 163, 61, 0.25);
  color: var(--gold);
}

/* Ability bar (in-game) */
.ability-bar {
  position: absolute;
  left: 22px;
  bottom: 22px;
  display: flex;
  gap: 8px;
  z-index: 5;
  transition: opacity 0.3s;
}

.ability-bar.hidden {
  opacity: 0;
  pointer-events: none;
}

.ability-btn {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(42, 51, 64, 0.9), rgba(30, 37, 48, 0.9));
  border: 1px solid rgba(232, 163, 61, 0.2);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ability-btn:hover {
  transform: translateY(-3px);
  border-color: rgba(232, 163, 61, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.ability-btn:active {
  transform: translateY(1px);
}

.ability-btn .ability-key {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0;
  font-family: 'Outfit', sans-serif;
}

.ability-btn .ability-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--green);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.ability-btn.used {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* Shop ability items */
.shop-ability-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(232, 163, 61, 0.12);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  transition: border-color 0.2s;
}

.shop-ability-item .shop-item-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.shop-ability-item .shop-item-name {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 15px;
  color: #fff;
  margin-bottom: 4px;
}

.shop-ability-item .shop-item-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.4;
  margin-bottom: 10px;
  min-height: 32px;
}

/* Wave clear card */
.wave-clear-card {
  background: linear-gradient(180deg, rgba(40, 34, 22, 0.95), rgba(22, 18, 12, 0.95));
  border: 1px solid rgba(232, 163, 61, 0.3);
  border-radius: 22px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: banner-unfurl 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 460px;
  position: relative;
  overflow: hidden;
}

/* Gold particle burst behind the title */
.wc-particle-burst {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 0;
}

/* Each particle is a pseudo-element clone via box-shadow — 12 particles */
.wc-particle-burst::before,
.wc-particle-burst::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: wc-particle-burst 1.2s cubic-bezier(0, 0.7, 0.3, 1) forwards;
}

.wc-particle-burst::before {
  box-shadow:
    0 0 0 0 var(--gold),
    -28px -22px 0 0 #f5d078,
    34px -18px 0 0 #e8a33d,
    -40px 8px 0 0 #f5d078,
    42px 6px 0 0 #e8a33d,
    -22px -36px 0 0 #f0c060,
    14px -34px 0 0 #e8a33d,
    -8px 28px 0 0 #f5d078,
    24px 22px 0 0 #f0c060,
    -36px 30px 0 0 #e8a33d,
    38px -30px 0 0 #f5d078,
    0 -40px 0 0 #e8a33d;
}

.wc-particle-burst::after {
  width: 4px;
  height: 4px;
  animation-delay: 0.05s;
  box-shadow:
    0 0 0 0 var(--gold),
    18px -28px 0 0 #f0c060,
    -32px -12px 0 0 #e8a33d,
    28px 16px 0 0 #f5d078,
    -16px 32px 0 0 #f0c060,
    44px -8px 0 0 #e8a33d,
    -44px -28px 0 0 #f5d078,
    8px 36px 0 0 #e8a33d,
    -24px -44px 0 0 #f0c060,
    32px 30px 0 0 #e8a33d,
    -10px -16px 0 0 #f5d078,
    10px -44px 0 0 #f0c060;
}

@keyframes wc-particle-burst {
  0% {
    transform: translate(0, 0) scale(0);
    opacity: 1;
  }
  30% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(0, 0) scale(0);
    opacity: 0;
  }
}

@keyframes banner-unfurl {
  0% {
    clip-path: inset(0 50% 0 50%);
    opacity: 0;
    transform: translateY(30px);
  }
  60% {
    clip-path: inset(0 0 0 0);
    opacity: 1;
    transform: translateY(0);
  }
  70% {
    transform: translateY(-4px);
  }
  100% {
    clip-path: inset(0 0 0 0);
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes title-glow-in {
  0% { text-shadow: 0 3px 0 #5a3f0a, 0 0 0 rgba(232, 163, 61, 0); }
  60% { text-shadow: 0 3px 0 #5a3f0a, 0 0 0 rgba(232, 163, 61, 0); }
  100% { text-shadow: 0 3px 0 #5a3f0a, 0 0 24px rgba(232, 163, 61, 0.5); }
}

@keyframes wc-row-in {
  0%   { opacity: 0; transform: translateY(24px); }
  100% { opacity: 1; transform: translateY(0); }
}

.wave-clear-card h2 {
  font-family: 'Bungee', sans-serif;
  font-size: 38px;
  color: var(--gold);
  text-shadow: 0 3px 0 #5a3f0a, 0 0 24px rgba(232, 163, 61, 0.5);
  margin-bottom: 18px;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 1;
  animation: title-glow-in 0.8s 0.15s both;
}

.wc-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}

/* Stat rows slide up from below with staggered delays */
.wc-stat {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: left;
  border: 1px solid rgba(232, 163, 61, 0.15);
  opacity: 0;
  transform: translateY(24px);
  animation: wc-row-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.wc-stat:nth-child(1) { animation-delay: 0.3s; }
.wc-stat:nth-child(2) { animation-delay: 0.35s; }
.wc-stat:nth-child(3) { animation-delay: 0.40s; }
.wc-stat:nth-child(4) { animation-delay: 0.45s; }
.wc-stat:nth-child(5) { animation-delay: 0.50s; }

.wc-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.wc-value {
  display: block;
  font-family: 'Russo One', sans-serif;
  font-size: 22px;
  color: var(--gold);
  margin-top: 2px;
}

.wc-enemy-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 8px 0 16px;
  opacity: 0;
  transform: translateY(20px);
  animation: wc-row-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.55s forwards;
}

#wc-next-btn {
  opacity: 0;
  transform: translateY(20px);
  animation: wc-row-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards;
}

.wc-enemy-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 5px 12px;
  border: 1px solid rgba(232, 163, 61, 0.08);
}

.wc-enemy-icon { font-size: 16px; }
.wc-enemy-name { font-size: 12px; color: rgba(255,255,255,0.7); }
.wc-enemy-count { font-family: 'Russo One', sans-serif; font-size: 16px; color: var(--gold); margin-left: 4px; }

/* Game over */
.game-over-card {
  background: linear-gradient(180deg, rgba(48, 24, 24, 0.95), rgba(24, 12, 12, 0.95));
  border: 1px solid rgba(184, 74, 62, 0.3);
  border-radius: 22px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(184, 74, 62, 0.1);
  animation: banner-unfurl 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 460px;
  position: relative;
  overflow: hidden;
}

/* Ember rain behind the game-over title */
.go-ember-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.go-ember-burst::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  width: 6px;
  height: 10px;
  border-radius: 2px;
  background: #d44a40;
  animation: go-ember-fall-1 3s linear infinite;
  box-shadow:
    40px -15px 0 #b84a3e,
    -55px -40px 0 #e87040,
    90px -8px 0 #d44a40,
    -105px -30px 0 #b84a3e,
    140px -25px 0 #e87040,
    -150px -10px 0 #d44a40,
    190px -45px 0 #b84a3e,
    -205px -20px 0 #e87040,
    240px -35px 0 #d44a40,
    -260px -12px 0 #b84a3e,
    290px -42px 0 #e87040,
    -310px -28px 0 #d44a40,
    340px -5px 0 #b84a3e,
    -355px -38px 0 #e87040,
    130px 0 0 #d44a40,
    -80px 0 0 #b84a3e;
}

.go-ember-burst::after {
  content: '';
  position: absolute;
  top: -35px;
  left: 50%;
  width: 4px;
  height: 7px;
  border-radius: 1.5px;
  background: #e87040;
  animation: go-ember-fall-2 4s linear 0.8s infinite;
  box-shadow:
    25px -20px 0 #f09060,
    -70px -8px 0 #d44a40,
    80px -35px 0 #e87040,
    -115px -28px 0 #f09060,
    120px -12px 0 #d44a40,
    -170px -42px 0 #e87040,
    175px -30px 0 #f09060,
    -225px -6px 0 #d44a40,
    230px -45px 0 #e87040,
    -280px -22px 0 #f09060,
    285px -18px 0 #d44a40,
    -330px -36px 0 #e87040,
    340px -5px 0 #f09060,
    -375px -15px 0 #d44a40,
    100px 0 0 #e87040,
    -185px 0 0 #f09060;
}

@keyframes go-ember-fall-1 {
  0%   { transform: translateY(-120px) translateX(0) rotate(0deg);   opacity: 1; }
  20%  { transform: translateY(18vh) translateX(15px) rotate(45deg); opacity: 0.9; }
  45%  { transform: translateY(45vh) translateX(-10px) rotate(130deg);opacity: 0.75; }
  70%  { transform: translateY(72vh) translateX(18px) rotate(220deg); opacity: 0.4; }
  100% { transform: translateY(115vh) translateX(-8px) rotate(350deg);opacity: 0; }
}

@keyframes go-ember-fall-2 {
  0%   { transform: translateY(-140px) translateX(0) rotate(0deg);   opacity: 0.9; }
  25%  { transform: translateY(25vh) translateX(-18px) rotate(70deg); opacity: 0.8; }
  50%  { transform: translateY(55vh) translateX(12px) rotate(180deg); opacity: 0.5; }
  75%  { transform: translateY(80vh) translateX(-22px) rotate(280deg);opacity: 0.25; }
  100% { transform: translateY(115vh) translateX(8px) rotate(400deg); opacity: 0; }
}

.go-title {
  font-family: 'Bungee', sans-serif;
  font-size: 36px;
  color: var(--danger);
  text-shadow: 0 3px 0 #4a0c0c, 0 0 24px rgba(184, 74, 62, 0.4);
  margin-bottom: 12px;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 1;
}

.go-sub {
  font-size: 18px;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.85);
}

.go-score {
  font-size: 18px;
  margin-bottom: 22px;
  color: var(--gold);
  font-family: 'Russo One', sans-serif;
}

/* Victory */
.victory-card {
  background: linear-gradient(180deg, rgba(28, 44, 32, 0.96), rgba(14, 26, 18, 0.96));
  border: 1px solid rgba(74, 124, 61, 0.35);
  border-radius: 22px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(74, 124, 61, 0.15);
  animation: card-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 460px;
  position: relative;
  overflow: hidden;
}

.v-title {
  font-family: 'Bungee', sans-serif;
  font-size: 48px;
  color: var(--green);
  text-shadow: 0 3px 0 #1a3a18, 0 0 30px rgba(74, 124, 61, 0.5);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.v-sub {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 6px;
}

.v-score {
  font-size: 18px;
  margin-bottom: 22px;
  color: var(--gold);
  font-family: 'Russo One', sans-serif;
}

.confetti-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/* Gold confetti stream — faster fall */
.confetti-burst::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  width: 7px;
  height: 12px;
  border-radius: 1.5px;
  background: #E8A33D;
  animation: confetti-fall-1 3.4s linear infinite;
  box-shadow:
    45px -18px 0 #f5d078,
    -50px -45px 0 #E8A33D,
    95px -8px 0 #f0c060,
    -110px -35px 0 #f5d078,
    150px -28px 0 #E8A33D,
    -160px -12px 0 #f0c060,
    200px -50px 0 #f5d078,
    -220px -22px 0 #E8A33D,
    260px -38px 0 #f0c060,
    -280px -15px 0 #f5d078,
    320px -44px 0 #E8A33D,
    -340px -30px 0 #f0c060,
    380px -5px 0 #f5d078,
    -400px -48px 0 #E8A33D,
    140px 0 0 #f0c060,
    -70px 0 0 #f5d078;
}

/* Green & white confetti stream — slower, offset */
.confetti-burst::after {
  content: '';
  position: absolute;
  top: -40px;
  left: 50%;
  width: 5px;
  height: 9px;
  border-radius: 1px;
  background: #4A7C3D;
  animation: confetti-fall-2 4.5s linear 1.2s infinite;
  box-shadow:
    30px -25px 0 #6db85e,
    -65px -10px 0 #fff,
    75px -40px 0 #4A7C3D,
    -120px -32px 0 #6db85e,
    125px -15px 0 #fff,
    -175px -48px 0 #4A7C3D,
    180px -35px 0 #6db85e,
    -230px -8px 0 #fff,
    235px -50px 0 #4A7C3D,
    -290px -28px 0 #6db85e,
    295px -20px 0 #fff,
    -355px -42px 0 #4A7C3D,
    360px -5px 0 #6db85e,
    -410px -18px 0 #fff,
    105px 0 0 #4A7C3D,
    -195px 0 0 #6db85e;
}

@keyframes confetti-fall-1 {
  0%   { transform: translateY(-120px) translateX(0) rotate(0deg);   opacity: 1; }
  15%  { transform: translateY(12vh) translateX(18px) rotate(60deg);  opacity: 1; }
  30%  { transform: translateY(30vh) translateX(-12px) rotate(140deg);opacity: 0.95; }
  50%  { transform: translateY(52vh) translateX(22px) rotate(210deg); opacity: 0.85; }
  70%  { transform: translateY(72vh) translateX(-16px) rotate(300deg);opacity: 0.6; }
  85%  { transform: translateY(90vh) translateX(8px) rotate(350deg);  opacity: 0.3; }
  100% { transform: translateY(115vh) translateX(-6px) rotate(420deg);opacity: 0; }
}

@keyframes confetti-fall-2 {
  0%   { transform: translateY(-140px) translateX(0) rotate(0deg);   opacity: 1; }
  20%  { transform: translateY(18vh) translateX(-20px) rotate(80deg); opacity: 1; }
  40%  { transform: translateY(40vh) translateX(14px) rotate(160deg); opacity: 0.9; }
  60%  { transform: translateY(64vh) translateX(-24px) rotate(250deg);opacity: 0.7; }
  80%  { transform: translateY(85vh) translateX(10px) rotate(330deg); opacity: 0.4; }
  100% { transform: translateY(115vh) translateX(-10px) rotate(430deg);opacity: 0; }
}

/* =================================================================
   INLINE SVG ICONS & LOGO
   ================================================================= */
.svg-icon,
.inline-icon,
.sell-toggle > span,
.corner-btn > span,
.big-btn > span,
.action-btn > span,
.ability-btn > span,
.tutorial-icon > span,
.shop-gold > span,
.title-gold > span,
.title-card .logo-icon,
.about-logo > span,
.end-stat-row .stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
}

.svg-icon svg,
.inline-icon svg,
.sell-toggle > span svg,
.corner-btn > span svg,
.big-btn > span svg,
.action-btn > span svg,
.ability-btn > span svg,
.tutorial-icon span svg,
.shop-gold > span svg,
.title-gold > span svg,
.title-card .logo-icon svg,
.about-logo > span svg {
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.title-card .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 4px;
}

.title-card .logo-icon svg {
  filter: drop-shadow(0 4px 0 #0a0d12) drop-shadow(0 8px 16px rgba(0,0,0,0.5));
}

.title-card .logo + .title {
  margin-bottom: 8px;
}

.brand-name {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.title-card .title {
  margin-top: 4px;
}

.title-card .title-gold .inline-icon {
  vertical-align: -4px;
  margin-right: 4px;
}

/* =================================================================
   HOW TO PLAY OVERLAY (visual panels)
   ================================================================= */
.howto-card {
  text-align: center;
  padding: 32px 36px 28px;
  background: linear-gradient(180deg, rgba(30, 37, 48, 0.96), rgba(20, 25, 35, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  max-width: 980px;
  width: 95vw;
  max-height: 88vh;
  overflow-y: auto;
  animation: card-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.howto-title {
  font-family: 'Bungee', 'Russo One', sans-serif;
  font-size: 34px;
  letter-spacing: 0.04em;
  margin-bottom: 28px;
  text-shadow: 0 4px 0 #0a0d12, 0 8px 16px rgba(0, 0, 0, 0.6);
  color: #fff;
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.howto-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px 16px 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.howto-h {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 17px;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin: 0;
}

.howto-p {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

/* Stylized visual dioramas in each How to Play panel */
.howto-visual {
  height: 100px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(232, 163, 61, 0.15);
  background: linear-gradient(180deg, #5BB6E8 0%, #FFD9A8 100%);
}

.howto-visual-build {
  background:
    linear-gradient(180deg, #5BB6E8 0%, #A3D6F1 60%, #5da858 60%, #3e7a40 100%);
}
.howto-visual-build::before {
  content: '';
  position: absolute;
  left: 50%; top: 30%;
  transform: translateX(-50%);
  width: 30px; height: 30px;
  background: #d68a3e;
  border: 2px solid #4a2a08;
  border-radius: 3px;
  box-shadow:
    -22px -8px 0 -6px #a8b1bc,
    22px -8px 0 -6px #a8b1bc,
    -10px 8px 0 -2px #bcc4cf;
}
.howto-visual-build::after {
  content: '\203A BUILD AREA';
  position: absolute;
  top: 6px; left: 8px;
  font-family: 'Russo One', sans-serif;
  font-size: 11px; font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.howto-visual-fight {
  background:
    linear-gradient(180deg, #5BB6E8 0%, #A3D6F1 60%, #5da858 60%, #3e7a40 100%);
}
.howto-visual-fight::before {
  content: '';
  position: absolute;
  left: 12%; bottom: 22%;
  width: 16px; height: 16px;
  background: #7ec850;
  border-radius: 50%;
  border: 2px solid #2c5a14;
  box-shadow:
    24px 2px 0 0 #7ec850 inset,
    24px 2px 0 2px #2c5a14;
  animation: howto-charge 2.4s infinite linear;
}
.howto-visual-fight::after {
  content: '';
  position: absolute;
  right: 8%; bottom: 18%;
  width: 28px; height: 28px;
  background: #7c8794;
  border-radius: 2px;
  border: 2px solid #1f2730;
  box-shadow: 0 -36px 0 -14px #7c8794, 0 -36px 0 -12px #1f2730;
}

@keyframes howto-charge {
  0% { left: 12%; }
  50% { left: 60%; }
  100% { left: 12%; }
}

.howto-visual-survive {
  /* gold coin + castle visualized */
}
.howto-visual-survive::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  background: radial-gradient(circle, var(--gold) 0%, var(--gold-deep) 100%);
  border: 2px solid #6a4d10;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(232, 163, 61, 0.3);
  animation: howto-coin 1.4s ease-in-out infinite;
}
@keyframes howto-coin {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.15); }
}

.howto-visual-tips {
  background:
    linear-gradient(180deg, #5BB6E8 0%, #A3D6F1 60%, #5da858 60%, #3e7a40 100%);
}
.howto-visual-tips::before {
  content: '';
  position: absolute;
  left: 28%; top: 36%;
  width: 40px; height: 10px;
  background: #d24a3c;
  border-radius: 1px;
  border: 1px solid #561410;
  box-shadow:
    0 -8px 0 -3px #d24a3c inset,
    0 -8px 0 -2px #561410 inset,
    -2px -10px 0 -1px #c63030;
}
.howto-visual-tips::after {
  content: '';
  position: absolute;
  right: 30%; bottom: 24%;
  width: 16px; height: 16px;
  background: #7c8794;
  border: 2px solid #1f2730;
  border-radius: 2px;
  box-shadow: -22px 0 0 0 #7c8794, -22px 0 0 2px #1f2730;
}

/* =================================================================
   ABOUT / CREDITS
   ================================================================= */
.about-card {
  text-align: left;
  padding: 32px 44px 28px;
  background: linear-gradient(180deg, rgba(30, 37, 48, 0.97), rgba(20, 25, 35, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  max-width: 580px;
  width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  animation: card-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.about-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 4px;
}

.about-title {
  font-family: 'Bungee', 'Russo One', sans-serif;
  font-size: 32px;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 3px 0 #0a0d12;
  margin: 0;
}

.about-version {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  letter-spacing: 0.12em;
  margin-bottom: 24px;
}

.about-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 12px;
}

.about-h {
  font-family: 'Russo One', sans-serif;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}

.about-section p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
}

.about-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-list li {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
}
.about-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

.about-section code {
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--gold);
  font-family: 'SFMono-Regular', Menlo, monospace;
}

.about-credit {
  text-align: center;
  font-size: 14px;
  margin: 0;
}

/* =================================================================
   SETTINGS EXTRAS (slider, segmented control, danger button)
   ================================================================= */
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  border: 2px solid rgba(255,255,255,0.3);
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
.slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.15); }

.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  border: 2px solid rgba(255,255,255,0.3);
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.slider-value {
  font-family: 'Russo One', sans-serif;
  font-size: 14px;
  color: var(--gold);
  min-width: 40px;
  text-align: right;
}

.seg-control {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.seg-btn {
  font-family: 'Russo One', 'Outfit', sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 6px 14px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.seg-btn:hover {
  color: rgba(255, 255, 255, 0.85);
}
.seg-btn.active {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: #2a1a04;
  font-weight: 800;
}

.danger-row {
  border-color: rgba(255, 80, 80, 0.18);
  background: rgba(255, 80, 80, 0.06);
}

.danger-btn {
  font-family: 'Russo One', sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(184, 74, 62, 0.4);
  background: linear-gradient(180deg, var(--danger), var(--danger-deep));
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}

.danger-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(184, 74, 62, 0.5);
}

.danger-btn:active {
  transform: translateY(1px);
}

/* =================================================================
   CONFIRM DIALOG
   ================================================================= */
.confirm-card {
  text-align: center;
  padding: 28px 32px 24px;
  background: linear-gradient(180deg, rgba(40, 24, 24, 0.97), rgba(22, 12, 12, 0.97));
  border: 1px solid rgba(184, 74, 62, 0.3);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  max-width: 380px;
  width: 92vw;
  animation: card-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-title {
  font-family: 'Bungee', 'Russo One', sans-serif;
  font-size: 22px;
  color: var(--danger);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.confirm-body {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* =================================================================
   TUTORIAL ICON (large illustration on each tutorial card)
   ================================================================= */
.tutorial-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(232, 163, 61, 0.18);
}

.tutorial-icon span svg {
  filter: drop-shadow(0 4px 0 #0a0d12) drop-shadow(0 8px 16px rgba(0,0,0,0.4));
}

/* =================================================================
   MUTE BUTTON
   ================================================================= */
.corner-btn {
  position: absolute;
  top: 14px;
  z-index: 6;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(28, 32, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s, background 0.2s;
}

.corner-btn:hover {
  background: rgba(50, 56, 70, 0.95);
  transform: scale(1.06);
}

#mute-btn { right: 60px; }
.pause-btn { right: 106px; font-size: 16px; font-weight: 700; letter-spacing: 2px; }
.fs-btn { right: 14px; font-size: 22px; font-weight: 700; }


/* =================================================================
   MOBILE / SMALL VIEWPORT ADJUSTMENTS
   ================================================================= */
@media (max-width: 920px), (pointer: coarse) {
  .hud-top { gap: 6px; top: 8px; }
  .hud-card { padding: 6px 10px; min-width: 60px; }
  .hud-value { font-size: 17px; }
  .hud-label { font-size: 9px; letter-spacing: 0.1em; }
  .hud-sub { font-size: 9px; }
  #card-castle { min-width: 150px; }
  .hp-bar { height: 16px; }
  .hp-text { font-size: 10px; }
  .tray-item { width: 60px; height: 60px; }
  .tray-inner { padding: 8px 12px 10px; border-radius: 14px; }
  .tray-items { gap: 6px; }
  .tray-title { font-size: 10px; letter-spacing: 0.12em; }
  .tray-bottom-pad { display: block; width: 1px; height: 88px; }

  .action-btn {
    font-size: 14px;
    padding: 11px 18px;
    border-radius: 12px;
  }
  .corner-btn { width: 36px; height: 36px; font-size: 16px; }
  #mute-btn { right: 52px; }
  .pause-btn { right: 94px; font-size: 14px; }
  .pause-card {
    min-width: auto;
    max-width: calc(100vw - 24px);
    padding: 30px 24px;
    box-sizing: border-box;
  }
  .fs-btn { right: 10px; }

.big-btn { font-size: 16px; padding: 10px 22px; }
.secondary-btn { font-size: 14px; padding: 9px 18px; }
.title { font-size: 46px; }
  .title-buttons .big-btn { font-size: 14px; padding: 9px 14px; }
.title-buttons { grid-template-columns: repeat(2, 1fr); }
  .title-card { padding: 28px 24px; max-width: 95vw; }
  .how-to { grid-template-columns: 1fr; gap: 8px; margin: 14px 0; }
  .how-step { flex-direction: row; padding: 10px 12px; text-align: left; gap: 10px; }
  .how-icon { font-size: 26px; }
  .how-text { font-size: 13px; }
  .settings-card { min-width: auto; padding: 30px 24px; }
  .setting-label { font-size: 15px; }
  .shop-card { min-width: auto; padding: 24px 16px; max-height: 80vh; }
  .shop-title { font-size: 22px; }
  .shop-items { grid-template-columns: 1fr 1fr; gap: 8px; }
  .shop-item { padding: 12px; }
  .shop-item-icon { font-size: 28px; }
  .ability-bar { left: 10px; bottom: 10px; gap: 6px; }
  .ability-btn { width: 40px; height: 40px; font-size: 16px; }
  .wave-clear-card,
  .game-over-card,
  .victory-card {
    min-width: 0;
    max-width: calc(100vw - 24px);
    padding: 24px 20px;
    box-sizing: border-box;
  }
  .shop-card { box-sizing: border-box; }
}

@media (max-width: 560px) {
  .hud-top { gap: 4px; }
  .hud-card { padding: 5px 8px; min-width: 50px; }
  .hud-value { font-size: 14px; }
  .title { font-size: 36px; }
  .subtitle { font-size: 13px; }
  .how-to { gap: 8px; }
  .how-step { padding: 9px 12px; }
  .how-icon { font-size: 22px; }
  .how-text { font-size: 12px; }
  .tutorial-card { padding: 20px 20px 18px; max-width: 95%; }
  .tutorial-title { font-size: 18px; }
  .tutorial-text { font-size: 13px; }
  .title-buttons { grid-template-columns: 1fr; gap: 8px; }
  .title-buttons .big-btn { font-size: 15px; padding: 11px 18px; }
  .tutorial-overlay { padding-bottom: 100px; }
}

/* =================================================================
   SMALL UTILITY
   ================================================================= */
.hidden { display: none !important; }

body.dragging,
body.dragging #game,
body.dragging * {
  cursor: grabbing !important;
}

body.dragging {
  user-select: none;
  -webkit-user-select: none;
}

html, body, #app {
  touch-action: none;
  overscroll-behavior: none;
}

#app {
  /* Prevent iOS rubber-band scroll on the whole game shell */
  overflow: hidden;
}

/* End-game stats breakdown */
.end-stats {
  margin: 14px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Staggered entrance for game-over stat rows */
#game-over .end-stat-row {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(16px);
  animation: wc-row-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#game-over .end-stat-row:nth-child(1) { animation-delay: 0.35s; }
#game-over .end-stat-row:nth-child(2) { animation-delay: 0.40s; }
#game-over .end-stat-row:nth-child(3) { animation-delay: 0.45s; }
#game-over .end-stat-row:nth-child(4) { animation-delay: 0.50s; }
#game-over .end-stat-row:nth-child(5) { animation-delay: 0.55s; }
#game-over .end-stat-row:nth-child(6) { animation-delay: 0.60s; }

/* Staggered entrance for game-over breakdown chip */
#game-over .end-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
  opacity: 0;
  transform: translateY(16px);
  animation: wc-row-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.65s forwards;
}

/* Staggered entrance for TRY AGAIN button */
#game-over #restart-btn {
  opacity: 0;
  transform: translateY(16px);
  animation: wc-row-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.7s forwards;
}

.end-val {
  font-family: 'Russo One', sans-serif;
  color: var(--gold);
  font-size: 16px;
}

.end-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

.end-enemy-chip {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  padding: 3px 10px;
  border: 1px solid rgba(232, 163, 61, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stat-time {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Russo One', sans-serif;
  letter-spacing: 0.1em;
}

/* =================================================================
   HOW-TO & ABOUT BUTTON VARIANTS (title screen)
   ================================================================= */
.howto-btn {
  background: linear-gradient(180deg, #b89aff, #6a4c9a) !important;
  box-shadow:
    0 10px 32px rgba(106, 76, 154, 0.55),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  white-space: nowrap;
}
.howto-btn:hover {
  box-shadow:
    0 16px 40px rgba(106, 76, 154, 0.75),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

.about-btn {
  background: linear-gradient(180deg, #88a8c8, #466a8a) !important;
  box-shadow:
    0 10px 32px rgba(70, 106, 138, 0.55),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}
.about-btn:hover {
  box-shadow:
    0 16px 40px rgba(70, 106, 138, 0.75),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}
