:root {
  --bg: #050d18;
  --surface: #0b1d32;
  --text: #f5f8ff;
  --muted: #9cccf5;
  --accent: #42c2ff;
  --accent-rgb: 66, 194, 255;
  --danger: #ff6385;
  --good: #44d192;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(var(--accent-rgb), .22), transparent 38%),
    radial-gradient(circle at 85% 8%, rgba(255, 255, 255, .06), transparent 32%),
    radial-gradient(circle at 50% 120%, rgba(0, 0, 0, .45), transparent 60%),
    linear-gradient(180deg, #091a2f 0%, #050d18 55%, #040a12 100%);
  min-height: 100vh;
}

.container { width: min(1120px, 94vw); margin: 0 auto; padding: 24px 0 40px; }
.hero { text-align: center; margin-bottom: 26px; }
.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 4vw, 4rem);
  letter-spacing: 3px;
  background: linear-gradient(180deg, #ffffff 0%, #bbecff 55%, #7ddfff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 30px rgba(var(--accent-rgb), .28);
}
.hero p { color: #d8edff; margin-top: 10px; letter-spacing: .3px; }

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.deck-button {
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  width: 100%;
  color: inherit;
  background: linear-gradient(165deg, rgba(255,255,255,.1), rgba(255,255,255,.02));
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  box-shadow:
    0 10px 30px rgba(0,0,0,.28),
    inset 0 1px 0 rgba(255,255,255,.08);
}
.deck-button:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(var(--accent-rgb), .55);
  box-shadow:
    0 18px 38px rgba(0,0,0,.42),
    0 0 32px rgba(var(--accent-rgb), .2);
}
.deck-cover-wrap { aspect-ratio: 3/4.7; background: rgba(255,255,255,.06); }
.deck-cover { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .45s ease; }
.deck-button:hover .deck-cover { transform: scale(1.06); }
.deck-meta { padding: 12px; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.01)); }
.deck-name { margin: 0; font-size: 1.05rem; text-align: center; font-weight: 700; }

.game-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  text-align: center;
}
.game-header h1 {
  margin: 2px 0 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: 2px;
  background: linear-gradient(180deg, #ffffff 0%, #bbecff 55%, #7ddfff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 30px rgba(var(--accent-rgb), .28);
}
.game-header .link-button { align-self: flex-start; }
.link-button {
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
}

.scoreboard, .board { display: grid; gap: 12px; }
.scoreboard { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin: 8px 0 18px; }
.score-item {
  background: linear-gradient(160deg, rgba(14,33,56,.95), rgba(9,22,38,.95));
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
}
.board { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); max-width: 500px; margin: 0 auto 8px; }

.card {
  position: relative;
  background: linear-gradient(180deg, rgba(16,38,64,.95), rgba(10,24,41,.96));
  border: 1px solid rgba(var(--accent-rgb), .35);
  border-radius: 18px;
  padding: 14px;
  box-shadow:
    0 0 30px rgba(var(--accent-rgb), .13),
    0 16px 30px rgba(0,0,0,.32);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(130deg, rgba(255,255,255,.09), transparent 30%, transparent 75%, rgba(255,255,255,.05));
}
.player-title { text-align: center; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.marca { text-align: center; font-size: 1.4rem; font-weight: 800; text-transform: uppercase; }
.modelo { text-align: center; color: var(--accent); margin-bottom: 8px; }

.card-media { position: relative; margin-bottom: 8px; }
.card-media img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  background: #102338;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
.credito {
  position: absolute;
  right: 8px;
  bottom: 8px;
  color: #d5e8ff;
  font-size: .76rem;
  background: rgba(0,0,0,.38);
  border-radius: 8px;
  padding: 2px 6px;
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.12);
  padding: 8px 0;
  gap: 8px;
  font-size: .97rem;
}
.stat.player { cursor: pointer; }
.stat.player:hover {
  background: rgba(var(--accent-rgb), .16);
  border-radius: 8px;
  padding-inline: 8px;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .25);
}
.stat.selected {
  background: rgba(var(--accent-rgb), .22);
  border-radius: 8px;
  padding-inline: 8px;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .32);
}
.stat-value.positive { color: var(--good); }
.stat-value.negative { color: var(--danger); }

.card-back {
  min-height: 480px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .26), rgba(0,0,0,.18));
}
.back-badge { text-align: center; }
.back-badge strong { display:block; letter-spacing: 1.6px; font-size: 1.6rem; }

.battle-log { text-align: center; margin-top: 8px; background: linear-gradient(160deg, rgba(14,33,56,.6), rgba(9,22,38,.6)); border: 1px solid rgba(var(--accent-rgb), .2); border-radius: 12px; padding: 12px; }
.battle-log h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.12rem;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: .2px;
  color: var(--accent);
}
.battle-log p {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: .9rem;
  font-style: italic;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.5;
}
.controls { display: flex; justify-content: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.controls button {
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), var(--accent));
  color: #02111f;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0,0,0,.3);
  transition: transform .15s ease, box-shadow .15s ease;
}
.controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,.35);
}

.final-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.68);
}
.final-screen[hidden] { display: none !important; }
.final-card {
  width: min(500px, 90vw);
  background: linear-gradient(170deg, rgba(20,45,75,.95), rgba(9,22,39,.98));
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 20px 45px rgba(0,0,0,.48), 0 0 26px rgba(var(--accent-rgb), .22);
}

.theme-autos { --accent: #43c4ff; --accent-rgb: 67, 196, 255; }
.theme-animales { --accent: #86cf5a; --accent-rgb: 134, 207, 90; }
.theme-futbol { --accent: #ff7350; --accent-rgb: 255, 115, 80; }
.theme-paises { --accent: #f8f8f8; --accent-rgb: 248, 248, 248; }

@media (max-width: 680px) {
  .game-header .link-button { align-self: flex-start; }
}
.install-btn {
  margin-top: 14px;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  color: #02111f;
  background: linear-gradient(180deg, #ffffff, #7ddfff);
  box-shadow: 0 10px 22px rgba(0,0,0,.28);
  transition: transform .15s ease, box-shadow .15s ease;
}

.install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,.35);
}

.logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 0;
}
.logo-svg {
  filter: drop-shadow(0 0 10px rgba(66,194,255,.45));
  flex-shrink: 0;
}
.game-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.deck-tagline {
  margin: 5px 0 0;
  font-size: .77rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
  line-height: 1.35;
}

.streak-highlight { color: #ffa040; }

.final-detalle {
  color: var(--muted);
  font-size: .9rem;
  margin: 4px 0 18px;
  line-height: 1.5;
}

@media (max-width: 580px) {
  .board { grid-template-columns: 1fr; }
  .card-media img { height: 140px; }
}