:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #120526;
  color: #f8fbff;
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(95, 41, 214, 0.32), transparent 35%),
    linear-gradient(225deg, rgba(0, 190, 255, 0.22), transparent 38%),
    #120526;
  overflow-x: hidden;
}

canvas {
  display: none;
  width: 100vw;
  height: 100vh;
  background: #9ed8ff;
}

body.game-active {
  overflow: hidden;
}

body.game-active .app-shell {
  display: none;
}

body.game-active canvas {
  display: block;
}

.fire-vfx {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--fire-size, 136px);
  height: calc(var(--fire-size, 136px) * 0.95);
  transform: translate(-50%, -72%);
  pointer-events: none;
  z-index: 8;
  mix-blend-mode: screen;
  filter: saturate(1.28) contrast(1.08);
}

.player-face {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--face-size, 52px);
  height: var(--face-size, 52px);
  transform: translate(-50%, -50%) rotate(var(--face-tilt, 0deg));
  pointer-events: none;
  z-index: 7;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.25),
    0 0 0 3px rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.7);
}

.player-face img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.fire-vfx span {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  display: block;
}

.fire-glow {
  width: 108%;
  height: 66%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 235, 120, 0.62), rgba(255, 94, 8, 0.3) 38%, rgba(255, 20, 0, 0) 72%);
  filter: blur(12px);
  animation: fireGlow 680ms ease-in-out infinite alternate;
}

.fire-core {
  width: 82%;
  height: 44%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 220, 0.94), rgba(255, 190, 38, 0.72) 28%, rgba(255, 65, 4, 0.42) 55%, transparent 78%);
  filter: blur(3px);
  animation: fireCore 520ms ease-in-out infinite alternate;
}

.fire-flame {
  width: 42%;
  height: 82%;
  bottom: 15%;
  border-radius: 54% 46% 50% 50%;
  clip-path: polygon(50% 0%, 68% 25%, 86% 52%, 74% 82%, 50% 100%, 24% 82%, 12% 52%, 32% 25%);
  background:
    radial-gradient(circle at 52% 72%, rgba(255, 255, 210, 0.95), rgba(255, 214, 55, 0.88) 21%, rgba(255, 92, 7, 0.7) 48%, rgba(220, 16, 0, 0.12) 74%, transparent 100%);
  filter: blur(1.4px);
  transform-origin: 50% 88%;
  animation: flameFlicker 560ms ease-in-out infinite alternate;
}

.flame-a {
  margin-left: -28%;
  height: 72%;
  animation-delay: -120ms;
}

.flame-b {
  height: 94%;
  width: 50%;
  animation-delay: -280ms;
}

.flame-c {
  margin-left: 29%;
  height: 68%;
  animation-delay: -410ms;
}

.fire-spark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 235, 92, 0.92);
  box-shadow: 0 0 12px rgba(255, 154, 18, 0.92);
  animation: sparkRise 980ms linear infinite;
}

.spark-a {
  margin-left: -38%;
  animation-delay: -120ms;
}

.spark-b {
  margin-left: 8%;
  animation-delay: -520ms;
}

.spark-c {
  margin-left: 42%;
  animation-delay: -760ms;
}

@keyframes flameFlicker {
  from {
    transform: translateX(-50%) rotate(-7deg) scale(0.9, 0.92);
    opacity: 0.72;
  }
  to {
    transform: translateX(-50%) rotate(6deg) scale(1.08, 1.12);
    opacity: 0.96;
  }
}

@keyframes fireGlow {
  from {
    transform: translateX(-50%) scale(0.9);
    opacity: 0.72;
  }
  to {
    transform: translateX(-50%) scale(1.1);
    opacity: 0.98;
  }
}

@keyframes fireCore {
  from {
    transform: translateX(-50%) scale(0.96, 0.92);
  }
  to {
    transform: translateX(-50%) scale(1.08, 1.04);
  }
}

@keyframes sparkRise {
  from {
    transform: translate(-50%, 0) scale(0.6);
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  to {
    transform: translate(-50%, -92px) scale(0.08);
    opacity: 0;
  }
}

.app-shell {
  min-height: 100vh;
}

.hero {
  min-height: 92vh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 20px clamp(18px, 4vw, 56px) 48px;
  background:
    linear-gradient(180deg, rgba(18, 5, 38, 0.1), rgba(18, 5, 38, 0.72)),
    linear-gradient(120deg, rgba(134, 56, 255, 0.44), transparent 44%),
    linear-gradient(300deg, rgba(52, 209, 255, 0.34), transparent 46%),
    url("assets/avalancha-de-pinchos-splash.png") center / cover no-repeat;
}

.topbar {
  width: min(1120px, 100%);
  margin: 0 auto;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand,
.top-actions a {
  color: #f8fbff;
  text-decoration: none;
  font-weight: 900;
}

.brand {
  font-size: 1.22rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-content {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  align-items: center;
  gap: clamp(22px, 5vw, 64px);
}

.hero-copy {
  max-width: 700px;
}

.hero-copy h1 {
  margin: 0 0 16px;
  color: #fff9ff;
  text-shadow: 0 18px 42px rgba(18, 5, 38, 0.42);
}

.hero-copy p:not(.kicker) {
  max-width: 46ch;
  margin: 0;
  color: #e6f8ff;
  font-size: clamp(1.02rem, 2.4vw, 1.3rem);
  line-height: 1.55;
}

.catalog-cta {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.18), transparent 42%),
    rgba(28, 8, 55, 0.74);
  box-shadow:
    0 24px 80px rgba(18, 5, 38, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(22px) saturate(1.2);
}

.catalog-cta h2 {
  margin: 0 0 2px;
  font-size: 1.45rem;
}

.catalog-cta p:not(.kicker) {
  margin: 0;
  color: #dcecff;
  line-height: 1.45;
}

.games-section {
  min-height: 100vh;
  padding: 72px clamp(18px, 4vw, 56px);
  background:
    linear-gradient(180deg, #120526, #241057 44%, #09263d);
}

.section-heading,
.game-grid {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4rem);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.game-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 22px 70px rgba(4, 3, 16, 0.28);
}

.game-card img,
.placeholder-art {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  object-fit: cover;
  background:
    linear-gradient(135deg, rgba(227, 68, 255, 0.55), rgba(63, 204, 255, 0.36)),
    #2a0c4a;
  color: #ffe08a;
  font-size: 5rem;
  font-weight: 900;
}

.game-card-body {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.game-card h3,
.game-card p {
  margin: 0;
}

.game-card h3 {
  font-size: 1.35rem;
}

.game-card p:not(.game-tag) {
  color: #dcecff;
  line-height: 1.48;
}

.game-tag {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 224, 138, 0.15);
  color: #ffe08a;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(7, 19, 28, 0.16), rgba(7, 19, 28, 0.68));
  backdrop-filter: blur(10px) saturate(1.1);
}

.splash {
  place-items: end center;
  background:
    linear-gradient(180deg, rgba(5, 16, 24, 0.08), rgba(5, 16, 24, 0.24) 42%, rgba(5, 16, 24, 0.78)),
    url("assets/avalancha-de-pinchos-splash.png") center / cover no-repeat;
}

.result-screen {
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 135, 26, 0.34), transparent 30%),
    linear-gradient(180deg, rgba(7, 19, 28, 0.34), rgba(7, 19, 28, 0.88)),
    url("assets/avalancha-de-pinchos-splash.png") center / cover no-repeat;
}

.panel {
  position: relative;
  overflow: hidden;
  width: min(760px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), transparent 34%),
    rgba(36, 16, 78, 0.72);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(24px) saturate(1.2);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: translateX(-74%);
  pointer-events: none;
}

.splash .panel {
  margin-bottom: min(7vh, 60px);
}

.compact {
  width: min(440px, 100%);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 204, 92, 0.22), transparent 42%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 36%),
    rgba(36, 16, 78, 0.76);
}

.loser-portrait {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 8px auto 16px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 15%, rgba(255, 255, 255, 0.9), transparent 40%),
    rgba(255, 255, 255, 0.12);
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.34),
    0 0 0 8px rgba(99, 220, 255, 0.12);
}

.loser-portrait img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  filter: saturate(0.85) brightness(0.94);
}

.tear {
  position: absolute;
  width: 13px;
  height: 34px;
  border-radius: 999px 999px 999px 999px;
  background: linear-gradient(180deg, rgba(201, 246, 255, 0.95), rgba(70, 190, 255, 0.72));
  box-shadow: 0 0 16px rgba(133, 225, 255, 0.7);
  animation: tearDrop 1.25s ease-in-out infinite;
}

.tear-left {
  left: 38px;
  top: 58px;
}

.tear-right {
  right: 34px;
  top: 62px;
  animation-delay: -520ms;
}

@keyframes tearDrop {
  0% {
    transform: translateY(-4px) scale(0.72);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: translateY(24px) scale(1);
    opacity: 0;
  }
}

.kicker {
  margin: 0 0 8px;
  color: #9df1ff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
.intro {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 8vw, 4.8rem);
  line-height: 0.94;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 7vw, 3.7rem);
  line-height: 1;
}

.intro {
  max-width: 46ch;
  color: #d7ebf8;
  line-height: 1.55;
}

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

.character-selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 16px;
}

.selector-title {
  margin: 0 0 8px;
  color: #d7ebf8;
  font-size: 0.82rem;
  font-weight: 900;
}

.characters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.character-card {
  min-height: 0;
  padding: 7px;
  display: grid;
  gap: 5px;
  place-items: center;
  border-color: rgba(255, 255, 255, 0.22);
}

.character-card img {
  width: 100%;
  max-width: 78px;
  aspect-ratio: 1;
  display: block;
  border-radius: 7px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26);
}

.character-card span {
  font-size: 0.78rem;
  line-height: 1;
}

label {
  display: grid;
  gap: 6px;
  color: #d7ebf8;
  font-size: 0.82rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: #07131c;
  font: inherit;
  font-weight: 900;
  outline: none;
  padding: 0 12px;
}

input:focus {
  border-color: #ffe08a;
  box-shadow: 0 0 0 3px rgba(255, 224, 138, 0.22);
}

.choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 14px;
}

button {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fbff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:hover,
button.selected {
  border-color: #ffe08a;
  background: rgba(227, 68, 255, 0.22);
  transform: translateY(-1px);
}

.primary {
  width: 100%;
  border-color: transparent;
  background: linear-gradient(135deg, #ffe08a, #ff55d8 48%, #63dcff);
  color: #17051f;
  box-shadow:
    0 14px 30px rgba(227, 68, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.primary:hover {
  background: linear-gradient(135deg, #fff0b8, #ff70df 48%, #88e8ff);
}

.ghost {
  background: rgba(255, 255, 255, 0.08);
}

.back-button {
  width: fit-content;
  min-height: 38px;
  margin-bottom: 14px;
  padding: 0 12px;
}

.controls {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  color: #c3d9e7;
  font-size: 0.92rem;
}

.hud {
  position: fixed;
  top: 14px;
  left: 50%;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 18px;
  width: min(900px, calc(100vw - 28px));
  transform: translateX(-50%);
  color: #07131c;
  font-weight: 900;
}

.hud > div {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.hud span,
#timer {
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 28px rgba(21, 49, 68, 0.16);
}

.hud button {
  min-height: 40px;
  padding: 0 12px;
  color: #07131c;
  background: rgba(255, 255, 255, 0.82);
}

#timer {
  min-width: 74px;
  text-align: center;
  font-size: 1.25rem;
  color: #231407;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 221, 84, 0.92)),
    rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(96, 58, 4, 0.18);
}

[hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .hero {
    min-height: 96vh;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    gap: 8px;
  }

  .hero-content,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .hero-content {
    align-content: center;
  }

  .panel {
    padding: 20px;
  }

  .choice {
    grid-template-columns: 1fr;
  }

  .names {
    grid-template-columns: 1fr;
  }

  .character-selectors {
    grid-template-columns: 1fr;
  }

  .character-card {
    padding: 5px;
  }

  .hud {
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 0.82rem;
  }
}
