:root {
  --ink: #141414;
  --paper: #fff6e0;
  --yellow: #ffe14a;
  --cyan: #19c5ff;
  --pink: #ff4d8d;
  --white: #fffdf7;
}

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

html,
body {
  min-height: 100%;
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 10px;
  color: var(--ink);
  font-family: Nunito, "Trebuchet MS", sans-serif;
  background-color: var(--cyan);
  background-image:
    radial-gradient(#111 1.15px, transparent 1.2px),
    linear-gradient(180deg, #7ae7ff 0%, #19c5ff 55%, #ffce4a 100%);
  background-size: 12px 12px, 100% 100%;
}

.shell {
  width: min(1600px, calc(100vw - 16px), calc((100vh - 20px) * 16 / 9));
}

.stage {
  position: relative;
  border: 6px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 12px 12px 0 var(--ink);
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #7ad7ff;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px 20px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 225, 74, 0.85), transparent 32%),
    radial-gradient(circle at 90% 80%, rgba(255, 77, 141, 0.35), transparent 36%),
    rgba(255, 246, 224, 0.72);
}

.overlay.hidden {
  display: none;
}

.pow {
  position: absolute;
  top: 18px;
  left: 22px;
  font-family: Bangers, Impact, sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.08em;
  color: var(--pink);
  transform: rotate(-12deg);
  text-shadow: 3px 3px 0 #fff, 5px 5px 0 var(--ink);
}

h1 {
  font-family: Bangers, Impact, sans-serif;
  font-size: clamp(3.4rem, 8vw, 6rem);
  letter-spacing: 0.06em;
  line-height: 0.9;
  text-shadow: 4px 4px 0 #fff, 8px 8px 0 var(--ink);
}

.sub,
.hint {
  text-align: center;
  max-width: 720px;
}

.sub {
  font-size: 1.25rem;
  font-weight: 800;
}

.hint {
  color: #333;
  font-size: 1rem;
}

.heroes {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 72px;
  min-height: 320px;
  margin: 8px 0 6px;
  padding: 12px 24px 0;
}

.hero-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.hero-orb {
  position: relative;
  width: 250px;
  height: 280px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform: scale(1);
  transition: transform 0.28s cubic-bezier(0.2, 1.4, 0.3, 1);
}

.hero-orb::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 48%;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #fff6c2 0%, #ffe14a 58%, #ffb703 100%);
  border: 6px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  transition:
    opacity 0.25s ease,
    transform 0.28s cubic-bezier(0.2, 1.4, 0.3, 1);
}

.hero-pop {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  transform: scale(0);
  animation: head-in 0.55s cubic-bezier(0.2, 1.45, 0.32, 1) forwards;
}

.hero-head[data-id="miri"] .hero-pop {
  animation-delay: 0.14s;
}

.hero-pop img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  filter: drop-shadow(5px 7px 0 rgba(20, 20, 20, 0.35));
}

.hero-head:hover .hero-orb,
.hero-head.is-selected .hero-orb,
.hero-head:focus-visible .hero-orb {
  transform: scale(1.28);
}

.hero-head.is-selected .hero-orb::before,
.hero-head:focus-visible .hero-orb::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.hero-name {
  font-family: Bangers, Impact, sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.06em;
}

.hero-head .hero-name {
  font-size: 2rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hero-head:hover .hero-name,
.hero-head.is-selected .hero-name,
.hero-head:focus-visible .hero-name {
  opacity: 1;
  transform: translateY(0);
}

@keyframes head-in {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  70% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.comic-btn {
  margin-top: 4px;
  padding: 12px 34px 14px;
  border: 4px solid var(--ink);
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-family: Bangers, Impact, sans-serif;
  font-size: 2rem;
  letter-spacing: 0.06em;
  box-shadow: 5px 5px 0 var(--ink);
  cursor: pointer;
}

.comic-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--ink);
}

.board-rows {
  display: grid;
  gap: 16px;
  width: min(720px, 100%);
}

.board-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 8px 22px 8px 8px;
  border: 4px solid var(--ink);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 5px 5px 0 var(--ink);
}

.board-row.is-player {
  background: var(--yellow);
}

.board-row img {
  width: 140px;
  height: 160px;
  object-fit: contain;
  object-position: center bottom;
  background: transparent;
}

.board-meta {
  min-width: 0;
}

.board-rank {
  min-height: 1.1em;
  font-family: Bangers, Impact, sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 0.95;
  text-shadow: 3px 3px 0 #fff, 6px 6px 0 var(--ink);
}

.board-rank.is-winner {
  color: var(--pink);
}

.board-rank.is-loser {
  color: #3a3a3a;
}

.hero-score {
  font-family: Bangers, Impact, sans-serif;
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: right;
  justify-self: end;
}

@media (max-width: 800px) {
  .heroes {
    gap: 36px;
    min-height: 210px;
  }

  .hero-orb {
    width: 160px;
    height: 180px;
  }
}
