/* ========================================
   K◆M CARD GAME — MASTER STYLESHEET
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Rajdhani:wght@400;500;600;700&family=Orbitron:wght@400;600;700;900&display=swap');

/* CSS Custom Properties */
:root {
  --gold: #f5c842;
  --gold-dark: #c9902a;
  --crimson: #e63946;
  --teal: #00b4d8;
  --violet: #7b2d8b;
  --dark-bg: #0a0a1a;
  --card-shadow: 0 8px 32px rgba(0,0,0,0.6);
  --glow-gold: 0 0 20px rgba(245, 200, 66, 0.6);
  --glow-blue: 0 0 20px rgba(0, 180, 216, 0.6);
  --glow-red: 0 0 20px rgba(230, 57, 70, 0.6);
  --font-title: 'Cinzel', serif;
  --font-body: 'Rajdhani', sans-serif;
  --font-mono: 'Orbitron', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }

body {
  font-family: var(--font-body);
  background: var(--dark-bg);
  color: #fff;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.screen { width: 100vw; height: 100vh; overflow: hidden; position: absolute; top: 0; left: 0; }

/* ========================================
   SPLASH SCREEN
   ======================================== */

.splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}

.splash-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, #1a0033 0%, #0a0a1a 40%, #000510 100%);
  overflow: hidden;
}
.splash-bg::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.8) 0%, transparent 50%),
    radial-gradient(2px 2px at 60% 15%, rgba(255,255,255,0.5) 0%, transparent 50%),
    radial-gradient(1px 1px at 80% 50%, rgba(255,255,255,0.6) 0%, transparent 50%),
    radial-gradient(3px 3px at 40% 70%, rgba(245,200,66,0.4) 0%, transparent 50%),
    radial-gradient(2px 2px at 10% 80%, rgba(0,180,216,0.4) 0%, transparent 50%),
    radial-gradient(2px 2px at 90% 80%, rgba(255,255,255,0.3) 0%, transparent 50%),
    radial-gradient(1px 1px at 50% 90%, rgba(255,255,255,0.5) 0%, transparent 50%);
  animation: twinkle 4s infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.splash-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
  text-align: center; padding: 2rem;
}

.splash-logo {
  font-family: var(--font-title);
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  display: flex; align-items: center; gap: 0.1em;
  filter: drop-shadow(0 0 40px rgba(245, 200, 66, 0.8));
  animation: logo-pulse 3s ease-in-out infinite;
}

.logo-k { color: #fff; text-shadow: 0 0 30px rgba(255,255,255,0.8); }
.logo-diamond {
  color: var(--gold);
  font-size: 0.7em;
  text-shadow: 0 0 30px var(--gold), 0 0 60px var(--gold);
  animation: diamond-spin 6s linear infinite;
  display: inline-block;
}
.logo-m { color: #fff; text-shadow: 0 0 30px rgba(255,255,255,0.8); }

@keyframes logo-pulse {
  0%, 100% { filter: drop-shadow(0 0 40px rgba(245, 200, 66, 0.8)); }
  50% { filter: drop-shadow(0 0 60px rgba(245, 200, 66, 1)) drop-shadow(0 0 80px rgba(0, 180, 216, 0.5)); }
}

@keyframes diamond-spin {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(1); }
  75% { transform: rotate(270deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

.splash-tagline {
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 2vw, 1.2rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--teal);
  text-shadow: 0 0 20px var(--teal);
}

.splash-cards-preview {
  display: flex; gap: 0.5rem; margin: 1rem 0;
  height: 120px; align-items: center;
}

.preview-card {
  width: 70px; height: 110px;
  background: linear-gradient(135deg, #1a1a3e 0%, #2d1b4e 50%, #0a1a2e 100%);
  border: 2px solid rgba(245, 200, 66, 0.4);
  border-radius: 8px;
  transform: rotate(var(--rot));
  animation: preview-float var(--delay, 0s) 2s ease-in-out infinite alternate;
  position: relative;
  overflow: hidden;
}

.preview-card::before {
  content: 'K◆M';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title);
  font-size: 0.7rem;
  color: rgba(245, 200, 66, 0.5);
  letter-spacing: 0.1em;
}

@keyframes preview-float {
  0% { transform: rotate(var(--rot)) translateY(0); }
  100% { transform: rotate(var(--rot)) translateY(-10px); }
}

/* ========================================
   BUTTONS
   ======================================== */

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #000;
  border: none;
  padding: 0.9rem 2.5rem;
  border-radius: 50px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(245, 200, 66, 0.4);
}
.btn-primary:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: var(--glow-gold), 0 8px 30px rgba(245, 200, 66, 0.5);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-huge {
  font-size: 1.3rem;
  padding: 1.1rem 3.5rem;
  box-shadow: 0 6px 30px rgba(245, 200, 66, 0.5);
}

.btn-secondary {
  background: transparent;
  color: var(--teal);
  border: 2px solid var(--teal);
  padding: 0.8rem 2rem;
  border-radius: 50px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover {
  background: rgba(0, 180, 216, 0.1);
  box-shadow: var(--glow-blue);
  transform: translateY(-2px);
}

/* ========================================
   GAME HEADER
   ======================================== */

.game-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(245, 200, 66, 0.2);
}
.header-logo {
  font-family: var(--font-title);
  font-size: 1.8rem; font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold);
}
.game-header h1 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  letter-spacing: 0.1em;
}
.btn-back {
  background: transparent; color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.5rem 1.2rem; border-radius: 20px;
  font-family: var(--font-body); font-size: 0.9rem;
  cursor: pointer; transition: var(--transition);
}
.btn-back:hover { color: #fff; border-color: rgba(255,255,255,0.6); }

/* ========================================
   COLLECTION SCREEN
   ======================================== */

#collection-screen {
  background: radial-gradient(ellipse at top, #0d0d2b 0%, #0a0a1a 100%);
  overflow-y: auto;
}

.filter-bar {
  display: flex; gap: 0.8rem; padding: 1rem 2rem;
  background: rgba(0,0,0,0.3);
  overflow-x: auto;
}
.filter-btn {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.5rem 1.3rem;
  border-radius: 20px;
  font-family: var(--font-body); font-size: 0.9rem;
  cursor: pointer; transition: var(--transition);
  white-space: nowrap;
}
.filter-btn.active, .filter-btn:hover {
  background: rgba(245, 200, 66, 0.15);
  color: var(--gold);
  border-color: rgba(245, 200, 66, 0.4);
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
}

/* ========================================
   CARD DESIGN — THE HEART OF THE GAME
   ======================================== */

.game-card {
  width: 180px;
  aspect-ratio: 5/7;
  border-radius: 14px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  flex-shrink: 0;
  transform-origin: bottom center;
}

.game-card:hover {
  transform: translateY(-15px) scale(1.05) rotate(2deg);
  z-index: 100;
}
.game-card:hover .card-inner {
  box-shadow: 0 20px 50px rgba(0,0,0,0.7), 0 0 30px rgba(245, 200, 66, 0.5);
}

.card-inner {
  width: 100%; height: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(160deg, #1a1a3e 0%, #0d1b2e 100%);
  border: 2px solid rgba(245, 200, 66, 0.3);
  box-shadow: var(--card-shadow);
  display: flex; flex-direction: column;
  position: relative;
  transition: var(--transition);
}

/* Card type color coding */
.card-inner.type-creature { border-color: rgba(230, 57, 70, 0.5); }
.card-inner.type-spell { border-color: rgba(0, 180, 216, 0.5); }
.card-inner.type-legendary { border-color: rgba(245, 200, 66, 0.8); }
.card-inner.type-ability { border-color: rgba(138, 43, 226, 0.5); }

.card-inner.type-legendary::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(135deg,
    transparent 0%, rgba(245,200,66,0.05) 25%,
    transparent 50%, rgba(245,200,66,0.05) 75%, transparent 100%);
  background-size: 400% 400%;
  animation: holographic 3s linear infinite;
}

@keyframes holographic {
  0% { background-position: 0% 0%; }
  100% { background-position: 400% 400%; }
}

/* Card Header */
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0.5rem 0.3rem;
  position: relative; z-index: 1;
}
.card-name {
  font-family: var(--font-title);
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  max-width: 75%;
}
.card-type-badge {
  font-family: var(--font-mono);
  font-size: 0.38rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.type-creature .card-type-badge { background: rgba(230,57,70,0.3); color: #ff8a8a; border: 1px solid rgba(230,57,70,0.5); }
.type-spell .card-type-badge { background: rgba(0,180,216,0.3); color: #7dd7f0; border: 1px solid rgba(0,180,216,0.5); }
.type-legendary .card-type-badge { background: rgba(245,200,66,0.3); color: var(--gold); border: 1px solid rgba(245,200,66,0.6); }
.type-ability .card-type-badge { background: rgba(138,43,226,0.3); color: #c77dff; border: 1px solid rgba(138,43,226,0.5); }

/* Card Art Area */
.card-art {
  width: 100%;
  height: 52%;
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.card-art img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: var(--transition);
}
.game-card:hover .card-art img { transform: scale(1.08); }

/* CSS-drawn art fallbacks */
.card-art-css {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  position: relative;
  overflow: hidden;
}

/* Card Stats */
.card-stats {
  display: flex; justify-content: space-around; align-items: center;
  padding: 0.25rem 0.4rem;
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.stat-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.05rem;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.3rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
}
.stat-item.atk .stat-value { color: #ff8a8a; }
.stat-item.def .stat-value { color: #7dd7f0; }
.stat-item.hp .stat-value { color: #5eff87; }

/* Card Description */
.card-desc {
  padding: 0.3rem 0.5rem;
  font-family: var(--font-body);
  font-size: 0.42rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
  flex: 1;
  overflow: hidden;
}

/* Card Ability */
.card-ability {
  padding: 0.25rem 0.5rem;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.ability-name {
  font-family: var(--font-title);
  font-size: 0.4rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.ability-effect {
  font-family: var(--font-body);
  font-size: 0.38rem;
  color: rgba(255,255,255,0.6);
  margin-top: 0.1rem;
  line-height: 1.3;
}

/* Card Power Number (corner) */
.card-power-corner {
  position: absolute;
  bottom: 0.3rem; right: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(245,200,66,0.8);
  line-height: 1;
}

/* HP Bar on active cards */
.card-hp-bar {
  height: 4px;
  background: rgba(0,0,0,0.5);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 0.5rem 0.3rem;
  flex-shrink: 0;
}
.card-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #ffaa00, #44ff88);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Card back */
.card-back {
  background: linear-gradient(135deg, #0d0d2e, #1a1040);
  border: 2px solid rgba(245,200,66,0.3);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: rgba(245,200,66,0.5);
  width: 180px; aspect-ratio: 5/7;
  flex-shrink: 0;
}

/* Status effects */
.card-status {
  position: absolute; top: 0.3rem; right: 0.3rem;
  font-size: 0.7rem; z-index: 10;
}

/* ========================================
   DECK SELECT SCREEN
   ======================================== */

#deck-select-screen {
  background: radial-gradient(ellipse at 50% 0%, #0d0d2b 0%, #0a0a1a 100%);
  overflow-y: auto;
}

.deck-select-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.deck-option {
  background: linear-gradient(160deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.3) 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
}
.deck-option:hover {
  border-color: rgba(245,200,66,0.4);
  transform: translateY(-5px);
  background: linear-gradient(160deg, rgba(245,200,66,0.08) 0%, rgba(0,0,0,0.3) 100%);
  box-shadow: 0 15px 40px rgba(0,0,0,0.4);
}
.deck-option.featured {
  border-color: rgba(245,200,66,0.6);
  background: linear-gradient(160deg, rgba(245,200,66,0.1) 0%, rgba(0,0,0,0.3) 100%);
}
.deck-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #000; font-weight: 700;
  padding: 0.2rem 1rem; border-radius: 20px;
  font-family: var(--font-mono); font-size: 0.65rem;
  letter-spacing: 0.1em;
}
.deck-icon { font-size: 3rem; margin-bottom: 0.8rem; }
.deck-option h2 {
  font-family: var(--font-title);
  font-size: 1.2rem; margin-bottom: 0.5rem;
  color: var(--gold);
}
.deck-option p {
  font-size: 0.85rem; color: rgba(255,255,255,0.6);
  margin-bottom: 1rem; line-height: 1.5;
}
.deck-preview-cards {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  justify-content: center; margin-bottom: 1.5rem;
}
.mini-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.2rem 0.6rem; border-radius: 10px;
  font-size: 0.7rem; color: rgba(255,255,255,0.7);
}

/* ========================================
   BATTLE SCREEN
   ======================================== */

#battle-screen {
  background: #050510;
  overflow: hidden;
  display: flex; flex-direction: column;
}

.battle-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(100, 0, 150, 0.2) 0%, transparent 60%),
    radial-gradient(ellipse at 0% 100%, rgba(0, 80, 150, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(150, 0, 50, 0.15) 0%, transparent 50%),
    linear-gradient(180deg, #050510 0%, #0a0a1a 100%);
  z-index: 0;
}
.battle-bg::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0, 180, 216, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 180, 216, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* HUD */
.battle-hud {
  position: relative; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 1.5rem;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.player-hud {
  display: flex; flex-direction: column; gap: 0.25rem;
  min-width: 160px;
}
.hud-name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}
.hud-hp-bar {
  height: 8px;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
.hud-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4444 0%, #ffaa00 50%, #44ff88 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 100%;
}
.player-fill { background: linear-gradient(90deg, #44ff88, #00b4d8); }
.hud-hp-text {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
}
.hud-deck-count {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: rgba(255,255,255,0.4);
}

.opponent-hud .hud-hp-bar {
  background: rgba(0,0,0,0.5);
}
.opponent-hud .hud-hp-fill {
  background: linear-gradient(90deg, #ff4444 0%, #ffaa00 100%);
}

.turn-indicator {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  background: rgba(0, 180, 216, 0.15);
  border: 1px solid rgba(0, 180, 216, 0.4);
  color: var(--teal);
  text-shadow: 0 0 10px var(--teal);
  animation: pulse-indicator 2s ease-in-out infinite;
}
@keyframes pulse-indicator {
  0%, 100% { box-shadow: 0 0 10px rgba(0,180,216,0.2); }
  50% { box-shadow: 0 0 25px rgba(0,180,216,0.5); }
}
.turn-indicator.opponent-turn {
  background: rgba(230, 57, 70, 0.15);
  border-color: rgba(230, 57, 70, 0.4);
  color: #ff8a8a;
  text-shadow: 0 0 10px #ff4444;
  animation: pulse-indicator-red 2s ease-in-out infinite;
}
@keyframes pulse-indicator-red {
  0%, 100% { box-shadow: 0 0 10px rgba(230,57,70,0.2); }
  50% { box-shadow: 0 0 25px rgba(230,57,70,0.5); }
}

/* Battle Field */
.battle-field {
  position: relative; z-index: 5;
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 0;
}

.opponent-zone, .player-zone {
  display: flex; flex-direction: column; align-items: center;
  padding: 0.4rem 1rem;
  flex: 1; min-height: 0;
}
.opponent-zone { justify-content: flex-start; }
.player-zone { justify-content: flex-end; }

.bench-label, .active-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  margin-bottom: 0.3rem;
}

.bench-area {
  display: flex; gap: 0.5rem; align-items: center;
  min-height: 80px;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  background: rgba(0,0,0,0.15);
  border: 1px dashed rgba(255,255,255,0.05);
  overflow-x: auto;
  max-width: 100%;
}
.bench-area .game-card {
  width: 80px;
  transform: none;
}
.bench-area .game-card:hover {
  transform: translateY(-8px) scale(1.05);
}

.active-slot {
  width: 140px;
  aspect-ratio: 5/7;
  border: 2px dashed rgba(245,200,66,0.2);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}
.active-slot.has-card { border-color: transparent; }
.active-slot.pulse {
  border-color: rgba(245,200,66,0.6);
  animation: slot-pulse 1s ease-in-out infinite;
}
@keyframes slot-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(245,200,66,0); }
  50% { box-shadow: 0 0 20px rgba(245,200,66,0.3); }
}
.empty-slot-hint {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.1em;
  text-align: center;
}

/* Active card sizing */
.active-slot .game-card {
  width: 130px;
  cursor: default;
}
.active-slot .game-card:hover {
  transform: none;
}

/* Center Zone */
.center-zone {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  gap: 1.5rem;
  padding: 0.5rem 1rem;
  flex-shrink: 0;
}

.battle-effect {
  position: absolute; pointer-events: none;
  font-size: 3rem; z-index: 20;
  opacity: 0;
  transition: opacity 0.3s;
}
.battle-effect.show {
  opacity: 1;
  animation: battle-impact 0.5s ease-out;
}
@keyframes battle-impact {
  0% { transform: scale(0.5); opacity: 1; }
  50% { transform: scale(1.5); }
  100% { transform: scale(1); opacity: 0; }
}

.action-log {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  width: 280px;
  max-height: 80px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.log-entry {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.7);
  padding: 0.1rem 0;
  line-height: 1.4;
}
.log-entry.important { color: var(--gold); font-weight: 700; }
.log-entry.damage { color: #ff8a8a; }
.log-entry.heal { color: #5eff87; }
.log-entry.spell { color: var(--teal); }

/* ========================================
   HAND
   ======================================== */

.hand-container {
  position: relative; z-index: 10;
  padding: 0.4rem 1rem 0.6rem;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.hand-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  margin-bottom: 0.4rem;
}
.hand-area {
  display: flex; gap: 0.4rem;
  overflow-x: auto;
  padding: 0.3rem 0 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.hand-area .game-card {
  width: 100px;
  flex-shrink: 0;
}
.hand-area .game-card.selected {
  border: 2px solid var(--gold) !important;
  box-shadow: var(--glow-gold) !important;
  transform: translateY(-12px) scale(1.05) !important;
  z-index: 50;
}
.hand-area .game-card.playable {
  animation: playable-glow 1.5s ease-in-out infinite;
}
@keyframes playable-glow {
  0%, 100% { box-shadow: var(--card-shadow); }
  50% { box-shadow: 0 8px 30px rgba(245,200,66,0.4); }
}

/* ========================================
   ACTION BUTTONS
   ======================================== */

.action-buttons {
  position: relative; z-index: 10;
  display: flex; gap: 0.6rem; justify-content: center;
  padding: 0.5rem 1rem 0.8rem;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.btn-action {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  padding: 0.55rem 1.2rem;
  border-radius: 30px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-action:not(:disabled):hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}
.btn-action:disabled {
  opacity: 0.3; cursor: not-allowed;
}
#btn-attack:not(:disabled) {
  background: rgba(230,57,70,0.15);
  border-color: rgba(230,57,70,0.4);
  color: #ff8a8a;
}
#btn-attack:not(:disabled):hover {
  background: rgba(230,57,70,0.25);
  box-shadow: var(--glow-red);
}
.btn-spell:not(:disabled) {
  background: rgba(0,180,216,0.15);
  border-color: rgba(0,180,216,0.4);
  color: var(--teal);
}
.btn-spell:not(:disabled):hover {
  background: rgba(0,180,216,0.25);
  box-shadow: var(--glow-blue);
}
.btn-end:not(:disabled) {
  background: rgba(245,200,66,0.15);
  border-color: rgba(245,200,66,0.4);
  color: var(--gold);
}
.btn-end:not(:disabled):hover {
  background: rgba(245,200,66,0.25);
  box-shadow: var(--glow-gold);
}

/* ========================================
   CARD MODAL
   ======================================== */

.card-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
}
.modal-content {
  position: relative; z-index: 1;
  animation: modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-content .game-card {
  width: 280px;
  cursor: default;
}
.modal-content .game-card:hover {
  transform: none;
}
.modal-actions {
  position: absolute; bottom: -60px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 0.8rem; white-space: nowrap;
}

@keyframes modal-in {
  from { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ========================================
   RESULT SCREEN
   ======================================== */

.result-screen {
  position: absolute; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
}
.result-content {
  text-align: center;
  animation: result-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes result-in {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.result-icon { font-size: 5rem; margin-bottom: 1rem; animation: bounce 1s ease infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}
.result-title {
  font-family: var(--font-title);
  font-size: 3rem; font-weight: 900;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.result-msg {
  font-size: 1.1rem; color: rgba(255,255,255,0.7);
  margin-bottom: 2rem;
}
.result-buttons { display: flex; gap: 1rem; justify-content: center; }

/* ========================================
   DAMAGE NUMBER ANIMATION
   ======================================== */

.damage-float {
  position: fixed;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 900;
  pointer-events: none;
  z-index: 999;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  animation: float-up 1.2s ease-out forwards;
}
.damage-float.dmg { color: #ff4444; }
.damage-float.heal { color: #5eff87; }
.damage-float.block { color: var(--teal); }

@keyframes float-up {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-80px) scale(1.3); opacity: 0; }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .deck-select-container { grid-template-columns: 1fr 1fr; }
  .battle-hud { padding: 0.5rem 0.8rem; }
  .action-buttons { gap: 0.4rem; }
  .btn-action { padding: 0.45rem 0.8rem; font-size: 0.6rem; }
  .hand-area .game-card { width: 85px; }
  .collection-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .game-card { width: 140px; }
}

@media (max-width: 480px) {
  .splash-logo { font-size: 4rem; }
  .deck-select-container { grid-template-columns: 1fr; padding: 1rem; }
  .collection-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1rem; padding: 1rem; }
  .game-card { width: 120px; }
}

/* ========================================
   SCROLLBAR
   ======================================== */

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb { background: rgba(245,200,66,0.3); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(245,200,66,0.6); }

/* ========================================
   ANIMATIONS
   ======================================== */

.card-shake {
  animation: card-shake 0.4s ease-in-out;
}
@keyframes card-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-2deg); }
  40% { transform: translateX(8px) rotate(2deg); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.card-flash-red {
  animation: card-flash-red 0.3s ease-in-out;
}
@keyframes card-flash-red {
  0%, 100% { filter: none; }
  50% { filter: brightness(2) saturate(0) sepia(1) hue-rotate(300deg); }
}

.card-glow-gold {
  animation: card-glow-gold 0.5s ease-in-out;
}
@keyframes card-glow-gold {
  0%, 100% { box-shadow: var(--card-shadow); }
  50% { box-shadow: 0 0 40px rgba(245,200,66,0.8), 0 0 60px rgba(245,200,66,0.4); }
}
