:root {
  --ink: #071018;
  --panel: rgba(8, 16, 28, 0.86);
  --sonic: #1d7cff;
  --mario: #e4252a;
  --gold: #ffd34a;
  --paper: #f4f1e8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 0%, #16345a 0%, transparent 42%),
    linear-gradient(180deg, #081018 0%, #102033 55%, #0b1a14 100%);
  color: var(--paper);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 10px;
}

#stage {
  position: relative;
  width: min(96vw, calc(96vh * 16 / 9));
  max-width: 1280px;
  aspect-ratio: 16 / 9;
  border: 3px solid #f2e6b0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 0 0 4px #1b1208,
    0 18px 50px rgba(0, 0, 0, 0.45);
  background: #4ec4ff;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(6, 14, 28, 0.38), rgba(6, 14, 28, 0.72)),
    repeating-linear-gradient(
      90deg,
      transparent 0 18px,
      rgba(255, 255, 255, 0.03) 18px 19px
    );
}

.overlay.hidden {
  display: none;
}

.card {
  width: min(720px, 100%);
  background: var(--panel);
  border: 2px solid rgba(255, 230, 140, 0.55);
  border-radius: 16px;
  padding: 28px 28px 24px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(34px, 6vw, 56px);
  letter-spacing: 1px;
  line-height: 0.95;
}

h1 .sonic {
  color: var(--sonic);
  text-shadow: 0 3px 0 #0a2a66, 0 0 18px rgba(40, 130, 255, 0.45);
}

h1 .vs {
  color: var(--gold);
  font-size: 0.55em;
  padding: 0 8px;
}

h1 .mario {
  color: var(--mario);
  text-shadow: 0 3px 0 #6b1010, 0 0 18px rgba(255, 70, 70, 0.4);
}

.tag {
  margin: 0 0 16px;
  color: #d7e7ff;
  font-size: 15px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 20px;
  text-align: left;
}

.pad {
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
}

.pad.sonic {
  border: 1px solid rgba(50, 140, 255, 0.7);
}

.pad.mario {
  border: 1px solid rgba(255, 80, 80, 0.7);
}

.pad strong {
  display: block;
  margin-bottom: 4px;
}

.pad.sonic strong {
  color: #7eb6ff;
}

.pad.mario strong {
  color: #ff8b8b;
}

.pad span {
  font-size: 13px;
  color: #d5dcea;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 28px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #1a1208;
  background: linear-gradient(180deg, #ffe56a, #f0b42a);
  cursor: pointer;
  box-shadow: 0 4px 0 #9a6b10;
}

button:hover {
  filter: brightness(1.06);
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #9a6b10;
}

#victory h2 {
  margin: 0 0 8px;
  font-size: clamp(40px, 7vw, 64px);
  color: var(--sonic);
  text-shadow: 0 4px 0 #0a2a66;
}

#victory .sub {
  margin: 0 0 18px;
  color: #ffe9a0;
}

.hint {
  font-size: 13px;
  color: #b9c6d6;
}

@media (max-width: 720px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 20px 16px;
  }
}

#stageClear h2 {
  margin: 0 0 8px;
  font-size: clamp(36px, 6vw, 56px);
  color: var(--gold);
  text-shadow: 0 4px 0 #6b4a10;
}

#stageClear .sub {
  margin: 0 0 12px;
  color: #d7e7ff;
  font-size: 18px;
}

#stageClear .level-next {
  margin: 8px 0 0;
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 800;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 4px 0 #1a2a44, 0 0 24px rgba(93, 255, 154, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}

#stageClear .level-next.show {
  opacity: 1;
}

.stage-clear-card {
  min-height: 180px;
}
