:root {
  color-scheme: dark;
  --bg-top: #241a26;
  --bg-bottom: #0f0c16;
  --attack-1: #6b1d23;
  --attack-2: #a33b3f;
  --skill-1: #264e69;
  --skill-2: #4f7b94;
  --power-1: #4c3277;
  --power-2: #7950a7;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #17111b 0%, #0b0910 100%);
  overflow: hidden;
  font-family: sans-serif;
}

#app {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
}

.game-shell {
  --scene-width: min(calc(100vw - 24px), calc((100vh - 24px) * 16 / 9));
  --scene-height: calc(var(--scene-width) * 9 / 16);
  width: 100%;
  min-height: 100vh;
  position: relative;
  display: grid;
  place-items: center;
}

.background-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  height: var(--scene-height);
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.background-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(19, 14, 22, 0.5), rgba(10, 8, 14, 0.8));
}

.background-image {
  display: block;
  height: 100%;
  width: auto;
}

.scene-layer {
  position: relative;
  width: var(--scene-width);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: transparent;
  z-index: 1;
}

.particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.energy-orb {
  position: absolute;
  left: 12%;
  bottom: 19%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 3px solid rgba(255, 200, 120, 0.5);
  background: radial-gradient(circle at 40% 36%, #c87830, #7a3e10 72%);
  z-index: 30;
  box-shadow:
    inset 0 0 18px rgba(255, 160, 50, 0.3),
    0 0 16px rgba(255, 150, 50, 0.35),
    0 0 32px rgba(220, 120, 30, 0.18),
    0 6px 14px rgba(0, 0, 0, 0.5);
  animation: orb-pulse 2.4s ease-in-out infinite;
}

.energy-orb::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 170, 60, 0.3), transparent 70%);
  animation: orb-glow-spin 4s linear infinite;
  z-index: -1;
}

.energy-orb::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(255, 180, 80, 0.25) 15%,
    transparent 30%,
    rgba(255, 140, 40, 0.2) 50%,
    transparent 65%,
    rgba(255, 200, 100, 0.18) 80%,
    transparent 100%
  );
  animation: orb-glow-spin 3s linear infinite reverse;
  z-index: -1;
}

@keyframes orb-pulse {
  0%, 100% {
    box-shadow:
      inset 0 0 18px rgba(255, 160, 50, 0.3),
      0 0 16px rgba(255, 150, 50, 0.35),
      0 0 32px rgba(220, 120, 30, 0.18),
      0 6px 14px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow:
      inset 0 0 22px rgba(255, 170, 60, 0.45),
      0 0 24px rgba(255, 160, 50, 0.5),
      0 0 48px rgba(230, 130, 30, 0.3),
      0 6px 14px rgba(0, 0, 0, 0.5);
  }
}

@keyframes orb-glow-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.energy-orb-value {
  color: #fff4e0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  -webkit-text-stroke: 2px rgba(0, 0, 0, 0.7);
  paint-order: stroke fill;
  text-shadow: 0 0 8px rgba(255, 200, 100, 0.4);
}

.end-turn-button {
  position: absolute;
  right: 8%;
  bottom: 19%;
  padding: 16px 28px;
  border: 2px solid rgba(255, 234, 200, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 194, 113, 0.22), rgba(115, 62, 24, 0.35)),
    rgba(27, 18, 12, 0.85);
  color: #fff2d9;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 30;
  overflow: visible;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.end-turn-button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.end-turn-button.disabled,
.end-turn-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  animation: none;
  border-color: rgba(150, 130, 110, 0.2);
}

.energy-orb.empty {
  animation: none;
  border-color: rgba(150, 130, 110, 0.3);
  background: radial-gradient(circle at 40% 36%, #5a4a38, #3a2a1a 72%);
  box-shadow:
    inset 0 0 10px rgba(100, 80, 50, 0.2),
    0 0 8px rgba(100, 80, 50, 0.15),
    0 6px 14px rgba(0, 0, 0, 0.5);
}

.energy-orb.empty::before,
.energy-orb.empty::after {
  display: none;
}

.end-turn-button.glow {
  animation: btn-pulse 2s ease-in-out infinite;
  border-color: rgba(255, 210, 140, 0.5);
}

@keyframes btn-pulse {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      0 0 16px rgba(255, 160, 50, 0.35),
      0 0 32px rgba(220, 120, 30, 0.18),
      0 12px 24px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      0 0 24px rgba(255, 170, 60, 0.5),
      0 0 48px rgba(230, 130, 30, 0.3),
      0 12px 24px rgba(0, 0, 0, 0.35);
  }
}

.discard-button {
  position: absolute;
  left: 1.5%;
  bottom: 1.5%;
  width: 110px;
  height: 146px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  cursor: pointer;
  z-index: 30;
  transition: transform 0.12s ease, filter 0.12s ease;
  overflow: visible;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.discard-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.discard-button-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.85;
  pointer-events: none;
}

.discard-button-count {
  position: absolute;
  left: 2px;
  top: 16px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: #c87830;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 24px;
  text-align: center;
  pointer-events: none;
}

.deck-button {
  position: absolute;
  right: 1.5%;
  bottom: 1.5%;
  width: 110px;
  height: 146px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  cursor: pointer;
  z-index: 30;
  transition: transform 0.12s ease, filter 0.12s ease;
  overflow: visible;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.deck-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.deck-button-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.85;
  pointer-events: none;
  transform: scaleX(-1);
}

.deck-button-count {
  position: absolute;
  right: 2px;
  top: 16px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: #c87830;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 24px;
  text-align: center;
  pointer-events: none;
}

.pile-button-label {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 16px;
  font-weight: 700;
  color: rgba(255, 220, 170, 0.75);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  letter-spacing: 0.3px;
}

.pile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 50;
  overflow-y: auto;
}

.pile-overlay-title {
  margin: 0;
  padding: 28px 0 16px;
  color: #f0e4d0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  flex-shrink: 0;
}

.pile-overlay-close {
  flex-shrink: 0;
  margin: 20px 0 32px;
  padding: 14px 48px;
  border: 2px solid rgba(255, 234, 200, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 194, 113, 0.22), rgba(115, 62, 24, 0.35)),
    rgba(27, 18, 12, 0.85);
  color: #fff2d9;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.pile-overlay-close:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.pile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 20px 12% 40px;
  justify-items: center;
  width: 100%;
}

.pile-card {
  position: relative;
  overflow: visible;
  width: 220px;
}

.pile-card .card-image {
  display: block;
  width: 100%;
  height: auto;
}

.pile-card .card-cost {
  left: 6px;
  top: -2px;
  width: 42px;
  height: 42px;
  font-size: 20px;
}

.pile-card .card-name {
  font-size: 14px;
}

.pile-empty {
  padding: 60px 24px;
  text-align: center;
  color: rgba(200, 190, 175, 0.5);
  font-size: 18px;
  font-weight: 600;
}

.targeting-arrow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  overflow: visible;
  z-index: 35;
  transition: opacity 0.08s linear;
}

.targeting-arrow.active {
  opacity: 1;
}

.targeting-arrow-path {
  fill: none;
  stroke: rgba(210, 236, 255, 0.92);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 18;
  filter: drop-shadow(0 0 10px rgba(114, 191, 255, 0.34));
}

.targeting-arrow-head {
  fill: rgba(210, 236, 255, 0.98);
  filter: drop-shadow(0 0 10px rgba(114, 191, 255, 0.34));
}

.character-slot {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.player-slot {
  left: 8%;
  bottom: 24%;
  width: 28%;
}

.enemy-slot {
  right: 4%;
  bottom: 32%;
  width: 34%;
}

.armor-bar {
  position: relative;
  width: 70%;
  height: 24px;
  border: 2px solid rgba(80, 150, 255, 0.7);
  border-radius: 4px;
  background: rgba(10, 20, 40, 0.7);
  overflow: visible;
  margin-bottom: 2px;
  z-index: 25;
  animation:
    armor-bar-appear 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    armor-bob 2s ease-in-out 0.35s infinite,
    armor-glow-pulse 1.8s ease-in-out infinite;
  box-shadow:
    0 0 8px rgba(80, 160, 255, 0.4),
    0 0 20px rgba(60, 130, 255, 0.2),
    inset 0 0 6px rgba(100, 180, 255, 0.15);
}

@keyframes armor-bar-appear {
  0% {
    opacity: 0;
    transform: translateY(10px) scaleY(0.2) scaleX(0.8);
  }
  60% {
    opacity: 1;
    transform: translateY(-4px) scaleY(1.1) scaleX(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scaleY(1) scaleX(1);
  }
}

@keyframes armor-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes armor-glow-pulse {
  0%, 100% {
    border-color: rgba(80, 150, 255, 0.6);
    box-shadow:
      0 0 8px rgba(80, 160, 255, 0.35),
      0 0 20px rgba(60, 130, 255, 0.15),
      inset 0 0 6px rgba(100, 180, 255, 0.1);
  }
  50% {
    border-color: rgba(100, 180, 255, 0.9);
    box-shadow:
      0 0 12px rgba(80, 170, 255, 0.55),
      0 0 30px rgba(60, 140, 255, 0.3),
      inset 0 0 10px rgba(120, 200, 255, 0.25);
  }
}

.armor-bar-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #5aadff 0%, #3080dd 50%, #1a5aaa 100%);
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(180, 220, 255, 0.4);
  animation: armor-fill-shimmer 2s linear infinite;
  background-size: 200% 100%;
}

@keyframes armor-fill-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.armor-bar-icon {
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(80, 170, 255, 0.7));
  z-index: 1;
  animation: armor-icon-pulse 1.8s ease-in-out infinite;
}

@keyframes armor-icon-pulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(80, 160, 255, 0.5)); transform: translateY(-50%) scale(1); }
  50% { filter: drop-shadow(0 0 10px rgba(100, 180, 255, 0.8)); transform: translateY(-50%) scale(1.1); }
}

.armor-bar-text {
  position: relative;
  display: block;
  width: 100%;
  text-align: center;
  color: #d0e8ff;
  font-size: 18px;
  font-weight: 800;
  line-height: 20px;
  z-index: 1;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.6);
  paint-order: stroke fill;
  text-shadow: 0 0 10px rgba(80, 170, 255, 0.6);
}

.health-bar {
  position: relative;
  width: 74%;
  height: 30px;
  border: 3px solid rgba(66, 41, 22, 0.95);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(74, 50, 28, 0.95) 0%, rgba(40, 23, 12, 0.98) 100%);
  overflow: hidden;
  margin-bottom: 8px;
  z-index: 25;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 221, 176, 0.18),
    inset 0 -2px 8px rgba(0, 0, 0, 0.35);
}

.health-bar::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025) 0 12px,
      rgba(0, 0, 0, 0.07) 12px 13px
    ),
    linear-gradient(180deg, rgba(20, 8, 8, 0.82), rgba(50, 16, 16, 0.88));
  pointer-events: none;
}

.health-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 240, 205, 0.14), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.2));
  pointer-events: none;
}

.health-bar-fill {
  position: absolute;
  left: 3px;
  top: 3px;
  bottom: 3px;
  width: calc(100% - 6px);
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.06) 0 10px,
      rgba(0, 0, 0, 0.04) 10px 11px
    ),
    linear-gradient(180deg, #cf4b40 0%, #a32724 52%, #6c1116 100%);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 210, 210, 0.24),
    inset 0 -2px 6px rgba(45, 0, 0, 0.42);
  transition: width 0.28s ease, background 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.health-bar-fill::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 230, 230, 0.16), transparent 38%);
  opacity: 1;
}

.health-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.14) 100%);
  opacity: 0.8;
}

.health-bar.is-low .health-bar-fill {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.06) 0 10px,
      rgba(0, 0, 0, 0.04) 10px 11px
    ),
    linear-gradient(180deg, #d89b46 0%, #b76d26 52%, #7c3f10 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 200, 0.2),
    inset 0 -2px 6px rgba(70, 30, 0, 0.35);
}

.health-bar.is-critical {
  animation: health-bar-critical-pulse 0.95s ease-in-out infinite;
}

.health-bar.is-critical .health-bar-fill {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.08) 0 10px,
      rgba(0, 0, 0, 0.06) 10px 11px
    ),
    linear-gradient(180deg, #d6574d 0%, #b12428 52%, #760d18 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 225, 225, 0.26),
    inset 0 -2px 6px rgba(50, 0, 0, 0.45);
}

@keyframes health-bar-critical-pulse {
  0%, 100% {
    box-shadow:
      0 6px 14px rgba(0, 0, 0, 0.28),
      inset 0 1px 0 rgba(255, 221, 176, 0.18),
      inset 0 -2px 8px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 7px 16px rgba(0, 0, 0, 0.32),
      0 0 10px rgba(174, 40, 40, 0.22),
      inset 0 1px 0 rgba(255, 221, 176, 0.2),
      inset 0 -2px 8px rgba(0, 0, 0, 0.38);
  }
}

.health-bar-text {
  position: relative;
  display: block;
  width: 100%;
  text-align: center;
  color: #f7e6d0;
  font-size: 20px;
  font-weight: 800;
  line-height: 24px;
  letter-spacing: 0.03em;
  z-index: 1;
  padding-top: 1px;
  -webkit-text-stroke: 1px rgba(22, 10, 4, 0.88);
  paint-order: stroke fill;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.82),
    0 2px 4px rgba(0, 0, 0, 0.34);
}

.health-bar.is-critical .health-bar-text {
  color: #fff0ea;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.85),
    0 0 6px rgba(150, 28, 28, 0.18);
}

.enemy-intent {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px 8px 12px;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 12px;
  z-index: 25;
  animation: intent-appear 0.3s ease;
  backdrop-filter: blur(4px);
  cursor: default;
}

.enemy-intent.intent-attack {
  border-color: rgba(220, 80, 60, 0.5);
  box-shadow: 0 0 16px rgba(220, 80, 60, 0.25);
}

.enemy-intent.intent-block {
  border-color: rgba(60, 130, 220, 0.5);
  box-shadow: 0 0 16px rgba(60, 130, 220, 0.25);
}

.enemy-intent .intent-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(10, 8, 16, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e8dcc8;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.enemy-intent:hover .intent-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes intent-appear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.intent-icon {
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
}

.intent-attack-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(220, 80, 60, 0.5));
}

.intent-armor-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(60, 130, 220, 0.5));
}

.intent-value {
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.5);
  paint-order: stroke fill;
}

.player-character,
.enemy-character {
  display: block;
  width: 100%;
  max-height: 65%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42));
  transition: filter 0.12s ease;
}

.enemy-character.enemy-strike {
  animation: enemy-strike 0.3s ease !important;
}

@keyframes enemy-strike {
  0% { transform: translateX(0); }
  30% { transform: translateX(-30px) scale(1.08); }
  60% { transform: translateX(10px); }
  100% { transform: translateX(0); }
}

.player-character.player-hit {
  animation: player-hit 0.3s ease !important;
}

@keyframes player-hit {
  0% { transform: translateX(0); filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42)); }
  20% { transform: translateX(12px); filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42)) brightness(2); }
  50% { transform: translateX(-8px); filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42)) brightness(1.5); }
  100% { transform: translateX(0); filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42)); }
}

.enemy-character.enemy-hit {
  animation: enemy-hit 0.35s ease !important;
}

@keyframes enemy-hit {
  0% {
    transform: translateX(0) scale(1);
    filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42));
  }
  15% {
    transform: translateX(18px) scale(1.06);
    filter:
      drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
      drop-shadow(0 0 35px rgba(255, 40, 20, 0.9))
      drop-shadow(0 0 70px rgba(255, 60, 30, 0.6))
      brightness(2.5);
  }
  35% {
    transform: translateX(-10px) scale(0.97);
    filter:
      drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
      drop-shadow(0 0 25px rgba(255, 50, 30, 0.7))
      drop-shadow(0 0 50px rgba(255, 30, 10, 0.4))
      brightness(1.8);
  }
  55% {
    transform: translateX(5px) scale(1.02);
    filter:
      drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
      drop-shadow(0 0 15px rgba(255, 60, 40, 0.5))
      drop-shadow(0 0 30px rgba(255, 40, 20, 0.25))
      brightness(1.3);
  }
  100% {
    transform: translateX(0) scale(1);
    filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42));
  }
}

.damage-number {
  position: absolute;
  pointer-events: none;
  z-index: 40;
  color: #ff1a1a;
  font-size: 52px;
  font-weight: 900;
  font-family: 'Impact', 'Arial Black', sans-serif;
  letter-spacing: 0.02em;
  -webkit-text-stroke: 3px rgba(0, 0, 0, 0.9);
  paint-order: stroke fill;
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.7);
  will-change: transform, left, top, opacity;
  white-space: nowrap;
}

.scene-layer.screen-shake {
  animation: screen-shake 0.2s ease;
}

@keyframes screen-shake {
  0% { transform: translate(0, 0); }
  15% { transform: translate(-5px, 3px); }
  30% { transform: translate(5px, -2px); }
  45% { transform: translate(-3px, 2px); }
  60% { transform: translate(3px, -1px); }
  75% { transform: translate(-1px, 1px); }
  100% { transform: translate(0, 0); }
}

.player-character.shield-up,
.enemy-character.shield-up {
  animation: shield-up-flash 0.5s ease !important;
}

@keyframes shield-up-flash {
  0% {
    filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42));
    transform: translateY(0) scale(1);
  }
  25% {
    filter:
      drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
      drop-shadow(0 0 25px rgba(80, 170, 255, 0.9))
      drop-shadow(0 0 50px rgba(60, 140, 255, 0.5));
    transform: translateY(-5px) scale(1.04);
  }
  50% {
    filter:
      drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
      drop-shadow(0 0 18px rgba(80, 170, 255, 0.6))
      drop-shadow(0 0 35px rgba(60, 140, 255, 0.3));
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42));
    transform: translateY(0) scale(1);
  }
}

.player-character {
  animation: idle-bob 3s ease-in-out infinite;
}

.enemy-character {
  animation: idle-bob-enemy 2.6s ease-in-out infinite;
}

@keyframes idle-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes idle-bob-enemy {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30% { transform: translateY(-5px) rotate(0.8deg); }
  70% { transform: translateY(-3px) rotate(-0.6deg); }
}

.player-character.targetable,
.enemy-character.targetable {
  pointer-events: auto;
  cursor: crosshair;
}

.player-character.targetable {
  filter:
    drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 30px rgba(151, 214, 255, 0.5))
    drop-shadow(0 0 60px rgba(120, 190, 255, 0.25));
}

.player-character.targetable.is-targeted {
  animation: none;
  transform: scale(1.05);
  filter:
    drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 40px rgba(151, 214, 255, 0.7))
    drop-shadow(0 0 80px rgba(120, 190, 255, 0.35));
}

.enemy-character.targetable {
  filter:
    drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 30px rgba(255, 120, 80, 0.5))
    drop-shadow(0 0 60px rgba(255, 90, 50, 0.25));
}

.enemy-character.targetable.is-targeted {
  animation: none;
  transform: scale(1.05);
  filter:
    drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 40px rgba(255, 120, 80, 0.7))
    drop-shadow(0 0 80px rgba(255, 90, 50, 0.35));
}

.hand-zone {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 42%;
  pointer-events: none;
  z-index: 20;
}

.hand-fan {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.empty-hand {
  width: 100%;
}

.hand-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 330px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center bottom;
  overflow: visible;
  transform: translateX(calc(-50% + var(--offset))) translateY(var(--rise)) rotate(var(--angle)) scale(1);
  transition:
    transform 0.22s cubic-bezier(0.23, 1.2, 0.32, 1),
    filter 0.2s ease,
    z-index 0s;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.34));
}

.hand-card:hover {
  transform: translateX(calc(-50% + var(--offset))) translateY(calc(var(--rise) - var(--hover-lift))) rotate(0deg) scale(1.18);
  z-index: 100 !important;
  filter:
    drop-shadow(0 0 1px rgba(255, 215, 100, 0.95))
    drop-shadow(0 0 2px rgba(255, 200, 80, 0.9))
    drop-shadow(0 0 10px rgba(255, 190, 60, 0.6))
    drop-shadow(0 0 24px rgba(255, 170, 40, 0.35))
    drop-shadow(0 0 48px rgba(255, 150, 30, 0.18))
    drop-shadow(0 32px 44px rgba(0, 0, 0, 0.5));
}

.hand-card.dragging,
.hand-card.dragging:hover {
  z-index: 120 !important;
  filter:
    drop-shadow(0 0 1px rgba(255, 215, 100, 0.95))
    drop-shadow(0 0 2px rgba(255, 200, 80, 0.9))
    drop-shadow(0 0 12px rgba(255, 190, 60, 0.55))
    drop-shadow(0 0 28px rgba(255, 170, 40, 0.3))
    drop-shadow(0 0 52px rgba(255, 150, 30, 0.15))
    drop-shadow(0 36px 48px rgba(0, 0, 0, 0.5));
}

.hand-fan.is-dragging .hand-card:not(.dragging) {
  pointer-events: none;
}

.hand-card.is-unplayable {
  cursor: not-allowed;
  filter:
    saturate(0.72)
    brightness(0.84)
    drop-shadow(0 14px 18px rgba(0, 0, 0, 0.28));
}

.hand-card.is-unplayable .card-cost {
  background: radial-gradient(circle at 40% 38%, #5a2a2a, #2e1212 72%);
  box-shadow:
    inset 0 0 10px rgba(180, 60, 60, 0.3),
    0 0 8px rgba(120, 40, 40, 0.3),
    0 4px 10px rgba(0, 0, 0, 0.5);
  -webkit-text-stroke: 2px #3a1515;
}

.card-cost,
.card-name,
.card-desc,
.card-art {
  position: absolute;
  pointer-events: none;
}

.card-art {
  top: 8%;
  left: 50%;
  width: 88%;
  height: 42%;
  transform: translateX(-50%);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.pile-card .card-art {
  width: 88%;
  height: 42%;
}

.card-cost {
  left: 6px;
  top: -2px;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 210, 140, 0.5);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #c87830, #7a3e10 72%);
  color: #fff4e0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  -webkit-text-stroke: 2px rgba(0, 0, 0, 0.7);
  paint-order: stroke fill;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 160, 0.2),
    inset 0 0 14px rgba(255, 160, 50, 0.25),
    0 0 12px rgba(255, 150, 50, 0.3),
    0 0 24px rgba(220, 120, 30, 0.15),
    0 4px 10px rgba(0, 0, 0, 0.5);
}

.card-name {
  left: 50%;
  top: 55%;
  max-width: calc(100% - 16px);
  color: #3b2010;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.card-desc {
  left: 50%;
  top: 70%;
  max-width: calc(100% - 48px);
  color: #f5ecd4;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  transform: translate(-50%, -50%);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.card-desc .desc-value {
  color: #eeddb8;
}

.card-desc .boosted-value {
  color: #ffd45a;
  text-shadow:
    0 0 4px rgba(255, 230, 150, 0.55),
    0 1px 3px rgba(70, 42, 0, 0.75);
}

.pile-card .card-desc {
  font-size: 11px;
}

.card-frame {
  position: relative;
  display: block;
  min-height: 268px;
  padding: 16px;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 16%),
    linear-gradient(180deg, #f2e2bf 0%, #ddc294 68%, #c9a771 100%);
  border: 3px solid rgba(93, 57, 25, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 230, 0.7),
    inset 0 -10px 16px rgba(117, 72, 28, 0.16);
}

.card-frame::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 12px;
  border: 1px solid rgba(88, 56, 28, 0.28);
  pointer-events: none;
}

.card-portrait {
  position: relative;
  display: block;
  height: 100%;
  min-height: 232px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(72, 44, 22, 0.22);
  background: rgba(43, 27, 15, 0.18);
}

.hand-card.attack .card-frame {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 16%),
    linear-gradient(180deg, #ddb19b 0%, #c97d67 62%, #a9524c 100%);
}

.hand-card.skill .card-frame {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 16%),
    linear-gradient(180deg, #c1d6de 0%, #8db0bc 62%, #5c7f8f 100%);
}

.hand-card.power .card-frame {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 16%),
    linear-gradient(180deg, #d7c7e5 0%, #a98ac8 62%, #705796 100%);
}

.hand-card.attack .card-portrait {
  background: linear-gradient(180deg, var(--attack-2), var(--attack-1));
}

.hand-card.skill .card-portrait {
  background: linear-gradient(180deg, var(--skill-2), var(--skill-1));
}

.hand-card.power .card-portrait {
  background: linear-gradient(180deg, var(--power-2), var(--power-1));
}

.card-glyph {
  position: absolute;
  inset: 0;
}

.hand-card.attack .card-glyph::before,
.hand-card.attack .card-glyph::after,
.hand-card.skill .card-glyph::before,
.hand-card.skill .card-glyph::after,
.hand-card.power .card-glyph::before,
.hand-card.power .card-glyph::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
}

.hand-card.attack .card-glyph::before {
  width: 90px;
  height: 18px;
  background: linear-gradient(90deg, #fff4d6, #ffd16f);
  border-radius: 10px;
  transform: translate(-50%, -50%) rotate(-28deg);
}

.hand-card.attack .card-glyph::after {
  width: 26px;
  height: 26px;
  background: #7a1118;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  transform: translate(24px, -36px) rotate(-14deg);
}

.hand-card.skill .card-glyph::before {
  width: 78px;
  height: 86px;
  background: linear-gradient(180deg, #e9f7fd, #90d6ea);
  clip-path: polygon(50% 0, 100% 18%, 92% 100%, 8% 100%, 0 18%);
  transform: translate(-50%, -50%);
}

.hand-card.skill .card-glyph::after {
  width: 24px;
  height: 46px;
  background: rgba(42, 91, 122, 0.82);
  border-radius: 999px;
  transform: translate(-50%, -16%);
}

.hand-card.power .card-glyph::before {
  width: 82px;
  height: 82px;
  background: radial-gradient(circle at 35% 35%, #fff4ff, #dfb8ff 42%, #9b6bda 76%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.hand-card.power .card-glyph::after {
  width: 120px;
  height: 120px;
  border: 2px solid rgba(246, 231, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.card-image {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Reward Overlay ──────────────────────────────────────────────── */

.reward-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
  animation: reward-fade-in 0.4s ease;
}

@keyframes reward-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reward-title {
  margin: 0 0 32px;
  color: #f0e4d0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  text-shadow: 0 0 20px rgba(255, 200, 100, 0.4);
}

.reward-cards {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 24px;
}

.reward-card {
  position: relative;
  width: 320px;
  padding: 0;
  border: 3px solid rgba(255, 200, 120, 0.25);
  border-radius: 16px;
  background: none;
  cursor: pointer;
  overflow: visible;
  transition: transform 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5));
  animation: reward-card-in 0.5s ease backwards;
}

.reward-card:nth-child(1) { animation-delay: 0.1s; }
.reward-card:nth-child(2) { animation-delay: 0.25s; }
.reward-card:nth-child(3) { animation-delay: 0.4s; }

@keyframes reward-card-in {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.reward-card:hover {
  transform: translateY(-12px) scale(1.06);
  border-color: rgba(255, 200, 120, 0.6);
  filter:
    drop-shadow(0 20px 36px rgba(0, 0, 0, 0.6))
    drop-shadow(0 0 24px rgba(255, 180, 60, 0.3));
}

.reward-card .card-image {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  border-radius: 14px;
}

.reward-card .card-art {
  width: 88%;
  height: 42%;
}

.reward-card .card-cost {
  left: 6px;
  top: -2px;
  width: 56px;
  height: 56px;
  font-size: 26px;
}

.reward-card .card-name {
  font-size: 24px;
}

.reward-card .card-desc {
  font-size: 16px;
}

/* ── Victory / Game Over Overlay ─────────────────────────────────── */

.victory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 70;
  animation: reward-fade-in 0.6s ease;
}

.victory-title {
  margin: 0 0 16px;
  color: #ffd97a;
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 30px rgba(255, 200, 80, 0.5),
    0 0 60px rgba(255, 160, 40, 0.3);
}

.victory-text {
  margin: 0 0 36px;
  color: #e8dcc8;
  font-size: 20px;
  font-weight: 600;
}

.victory-button {
  padding: 18px 56px;
  border: 2px solid rgba(255, 234, 200, 0.35);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 194, 113, 0.25), rgba(115, 62, 24, 0.4)),
    rgba(27, 18, 12, 0.9);
  color: #fff2d9;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 24px rgba(0, 0, 0, 0.4);
}

.victory-button:hover {
  transform: translateY(-3px);
  filter: brightness(1.15);
}

.gameover-title {
  color: #ff4444 !important;
  text-shadow:
    0 0 30px rgba(255, 40, 40, 0.5),
    0 0 60px rgba(255, 20, 20, 0.3) !important;
}

.card-fly-clone {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
  will-change: transform, left, top, opacity;
  overflow: visible;
  border-radius: 14px;
  background: none;
}

/* ── Main Menu ─────────────────────────────────────────────────── */

.main-menu {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.menu-bg-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.menu-bg-layer .background-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(3px) brightness(0.35);
}

.menu-bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(30, 20, 40, 0.3), rgba(8, 5, 14, 0.85) 70%);
}

.main-menu .menu-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.menu-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  animation: menu-fade-in 1s ease;
}

@keyframes menu-fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-logo {
  width: min(600px, 100vw);
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 0 30px rgba(255, 180, 60, 0.35))
    drop-shadow(0 0 60px rgba(200, 120, 40, 0.2));
  animation: menu-logo-float 3.5s ease-in-out infinite;
  user-select: none;
  -webkit-user-drag: none;
}

@keyframes menu-logo-float {
  0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 30px rgba(255, 180, 60, 0.35)) drop-shadow(0 0 60px rgba(200, 120, 40, 0.2)); }
  50% { transform: translateY(-10px); filter: drop-shadow(0 0 40px rgba(255, 190, 70, 0.5)) drop-shadow(0 0 80px rgba(210, 130, 50, 0.3)); }
}

.menu-play-button {
  padding: 20px 80px;
  border: 2px solid rgba(255, 210, 130, 0.4);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 200, 110, 0.25), rgba(140, 70, 20, 0.4)),
    rgba(30, 18, 10, 0.9);
  color: #fff2d9;
  font: inherit;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 20px rgba(255, 160, 50, 0.2),
    0 0 40px rgba(200, 120, 30, 0.1),
    0 14px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  animation: menu-btn-pulse 2.2s ease-in-out infinite;
}

.menu-play-button:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: rgba(255, 220, 150, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 30px rgba(255, 170, 60, 0.45),
    0 0 60px rgba(220, 130, 40, 0.25),
    0 18px 36px rgba(0, 0, 0, 0.5);
}

.menu-play-button:active {
  transform: translateY(0) scale(0.98);
}

@keyframes menu-btn-pulse {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.15),
      0 0 20px rgba(255, 160, 50, 0.2),
      0 0 40px rgba(200, 120, 30, 0.1),
      0 14px 28px rgba(0, 0, 0, 0.45);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.2),
      0 0 28px rgba(255, 175, 60, 0.4),
      0 0 56px rgba(220, 130, 40, 0.2),
      0 14px 28px rgba(0, 0, 0, 0.45);
  }
}

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

.menu-collection-button {
  padding: 14px 52px;
  border: 2px solid rgba(180, 200, 230, 0.3);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(160, 190, 230, 0.15), rgba(60, 80, 120, 0.3)),
    rgba(20, 18, 30, 0.85);
  color: #d0dced;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.menu-collection-button:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: rgba(180, 200, 230, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 20px rgba(140, 180, 240, 0.2),
    0 12px 28px rgba(0, 0, 0, 0.4);
}

.menu-collection-button:active {
  transform: translateY(0) scale(0.97);
}

/* ── Card Collection Overlay ───────────────────────────────────── */

.collection-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  animation: collection-fade-in 0.3s ease;
}

@keyframes collection-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.collection-title {
  position: sticky;
  top: 0;
  width: 100%;
  margin: 0;
  padding: 28px 0 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 60%, transparent);
  color: #f0e4d0;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-align: center;
  text-shadow: 0 0 24px rgba(255, 200, 100, 0.4);
  z-index: 5;
}

.collection-panel {
  width: 100%;
  max-width: 1100px;
  padding: 0 28px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.collection-section-title {
  width: 100%;
  margin: 28px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  color: #d4c4a6;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(200, 160, 100, 0.2);
}

.collection-section-title:first-of-type {
  margin-top: 8px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  width: 100%;
  justify-items: center;
}

.collection-card {
  position: relative;
  width: 230px;
  overflow: visible;
  transform-origin: center bottom;
  will-change: transform, filter;
  transition:
    transform 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.26s ease;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
  animation: collection-card-in 0.4s ease backwards;
}

.collection-card:nth-child(1) { animation-delay: 0.02s; }
.collection-card:nth-child(2) { animation-delay: 0.04s; }
.collection-card:nth-child(3) { animation-delay: 0.06s; }
.collection-card:nth-child(4) { animation-delay: 0.08s; }
.collection-card:nth-child(5) { animation-delay: 0.10s; }
.collection-card:nth-child(6) { animation-delay: 0.12s; }

@keyframes collection-card-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.collection-card:hover {
  transform: translateY(-8px) scale(1.06);
  filter:
    drop-shadow(0 18px 30px rgba(0, 0, 0, 0.52))
    drop-shadow(0 0 18px rgba(255, 200, 100, 0.22));
  z-index: 2;
}

.collection-card .card-image {
  display: block;
  width: 100%;
  height: auto;
}

.collection-card .card-art {
  width: 88%;
  height: 42%;
}

.collection-card .card-cost {
  left: 5px;
  top: -2px;
  width: 42px;
  height: 42px;
  font-size: 20px;
}

.collection-card .card-name {
  font-size: 18px;
}

.collection-card .card-desc {
  font-size: 12px;
}

.collection-close-button {
  flex-shrink: 0;
  margin-top: 28px;
  padding: 14px 52px;
  border: 2px solid rgba(255, 234, 200, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 194, 113, 0.22), rgba(115, 62, 24, 0.35)),
    rgba(27, 18, 12, 0.85);
  color: #fff2d9;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.collection-close-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

/* ── Story Screen ────────────────────────────────────────────────── */

.story-screen {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.story-bg-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
}

.story-bg-layer .background-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(6px) brightness(0.3);
}

.story-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 90%;
  max-width: 900px;
  animation: story-fade-in 0.5s ease;
}

@keyframes story-fade-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.story-image-wrapper {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 40px rgba(0, 0, 0, 0.7),
    0 0 80px rgba(0, 0, 0, 0.4),
    0 4px 30px rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 200, 120, 0.2);
}

.story-image {
  display: block;
  width: 100%;
  height: auto;
}

.story-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
}

.story-dots {
  display: flex;
  gap: 10px;
  align-items: center;
}

.story-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

.story-dot.done {
  background: rgba(255, 200, 120, 0.5);
  border-color: rgba(255, 200, 120, 0.4);
}

.story-dot.active {
  background: rgba(255, 200, 120, 0.9);
  border-color: rgba(255, 220, 150, 0.8);
  box-shadow: 0 0 8px rgba(255, 180, 80, 0.5);
  transform: scale(1.25);
}

.story-continue-button {
  padding: 14px 48px;
  border: 2px solid rgba(255, 210, 130, 0.4);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 200, 110, 0.25), rgba(140, 70, 20, 0.4)),
    rgba(30, 18, 10, 0.9);
  color: #fff2d9;
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 20px rgba(255, 160, 50, 0.2),
    0 0 40px rgba(200, 120, 30, 0.1),
    0 10px 24px rgba(0, 0, 0, 0.4);
  animation: menu-btn-pulse 2.5s ease-in-out infinite;
}

.story-continue-button:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: rgba(255, 220, 150, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 30px rgba(255, 170, 60, 0.45),
    0 0 60px rgba(220, 130, 40, 0.25),
    0 14px 28px rgba(0, 0, 0, 0.5);
}

.story-continue-button:active {
  transform: translateY(0) scale(0.98);
}

/* ── Settings Gear Button ────────────────────────────────────────── */

.settings-gear-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid rgba(255, 220, 160, 0.25);
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 36%, rgba(60, 40, 25, 0.9), rgba(30, 18, 10, 0.95));
  color: rgba(255, 220, 170, 0.8);
  cursor: pointer;
  z-index: 40;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.settings-gear-button:hover {
  transform: rotate(30deg) scale(1.1);
  border-color: rgba(255, 210, 130, 0.5);
  color: rgba(255, 230, 180, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 16px rgba(255, 170, 60, 0.3),
    0 6px 16px rgba(0, 0, 0, 0.5);
}

.settings-gear-button:active {
  transform: rotate(15deg) scale(0.95);
}

.settings-gear-icon {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

/* ── Settings Overlay ────────────────────────────────────────────── */

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  animation: settings-fade-in 0.25s ease;
}

@keyframes settings-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.settings-panel {
  position: relative;
  width: 380px;
  max-width: 90vw;
  padding: 36px 32px 28px;
  border-radius: 20px;
  border: 2px solid rgba(255, 200, 120, 0.2);
  background:
    linear-gradient(180deg, rgba(50, 35, 22, 0.98), rgba(25, 16, 10, 0.99));
  box-shadow:
    0 0 60px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(255, 150, 50, 0.08),
    inset 0 1px 0 rgba(255, 240, 200, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  animation: settings-panel-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes settings-panel-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.settings-title {
  margin: 0 0 24px;
  color: #f0e4d0;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(255, 200, 100, 0.3);
  text-align: center;
}

.settings-options {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-btn {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid rgba(255, 220, 160, 0.2);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 194, 113, 0.12), rgba(115, 62, 24, 0.2)),
    rgba(40, 28, 18, 0.8);
  color: #e8dcc8;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, border-color 0.12s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.settings-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
  border-color: rgba(255, 220, 160, 0.4);
}

.settings-btn:active {
  transform: translateY(0);
}

.settings-btn-danger {
  border-color: rgba(220, 80, 60, 0.3);
  background:
    linear-gradient(180deg, rgba(220, 80, 60, 0.12), rgba(120, 30, 20, 0.2)),
    rgba(40, 18, 14, 0.8);
  color: #e8b0a0;
}

.settings-btn-danger:hover {
  border-color: rgba(220, 80, 60, 0.5);
  filter: brightness(1.2);
}

.settings-close-btn {
  margin-top: 20px;
  padding: 12px 48px;
  border: 2px solid rgba(255, 234, 200, 0.25);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 194, 113, 0.18), rgba(115, 62, 24, 0.3)),
    rgba(27, 18, 12, 0.85);
  color: #fff2d9;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.settings-close-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.settings-close-btn:active {
  transform: translateY(0);
}

