:root {
  --bg-top: #09111f;
  --bg-bottom: #02060d;
  --panel: rgba(5, 15, 30, 0.72);
  --panel-border: rgba(160, 222, 255, 0.16);
  --text: #edf6ff;
  --muted: #9eb1c6;
  --accent: #5df2d6;
  --accent-2: #ffb454;
  --danger: #ff5d73;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(93, 242, 214, 0.16), transparent 32%),
    radial-gradient(circle at 80% 20%, rgba(255, 180, 84, 0.18), transparent 25%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero {
  padding: 8px 4px 28px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-family: "Black Ops One", system-ui;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.95;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary {
  width: min(62ch, 100%);
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.controls span,
.stat {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 10px 14px;
  backdrop-filter: blur(14px);
}

kbd {
  display: inline-block;
  margin: 0 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(93, 242, 214, 0.14);
  border: 1px solid rgba(93, 242, 214, 0.3);
  font-family: inherit;
  font-size: 0.9rem;
}

.game-panel {
  position: relative;
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.game-panel::before {
  content: "";
  position: absolute;
  inset: auto -20% -35% 40%;
  height: 260px;
  background: radial-gradient(circle, rgba(255, 180, 84, 0.18), transparent 58%);
  filter: blur(18px);
}

.hud {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  min-width: 106px;
  border-radius: 18px;
}

.stage-stat {
  min-width: 180px;
}

.label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 1.5rem;
}

.audio-toggle {
  margin-top: 0;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  box-shadow: none;
}

.audio-toggle:hover {
  transform: translateY(-1px);
  background: rgba(93, 242, 214, 0.14);
}

.progress-wrap {
  position: relative;
  z-index: 1;
  margin: 0 0 16px;
}

.progress-copy {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.progress-bar {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 28px rgba(93, 242, 214, 0.3);
  transition: width 140ms linear;
}

.level-track {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.level-chip {
  min-width: 0;
  padding: 10px 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.level-chip strong {
  display: block;
  font-size: 0.96rem;
}

.level-chip span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-chip.is-cleared {
  background: rgba(93, 242, 214, 0.12);
  border-color: rgba(93, 242, 214, 0.3);
}

.level-chip.is-current {
  transform: translateY(-2px);
  background: rgba(255, 180, 84, 0.14);
  border-color: rgba(255, 180, 84, 0.34);
}

.level-chip.is-upcoming {
  opacity: 0.7;
}

.canvas-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(2, 4, 9, 0.4));
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(2, 7, 16, 0.26), rgba(2, 7, 16, 0.68));
  transition: opacity 180ms ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.card {
  width: min(760px, 100%);
  padding: 28px;
  border-radius: 26px;
  background: rgba(5, 14, 28, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.34);
}

.overlay-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.card-tag {
  margin: 0 0 10px;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-2);
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
}

h3 {
  margin: 0;
  font-size: 1.05rem;
}

#overlay-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.summary-item {
  padding: 12px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.summary-item strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
}

.shop-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.shop-kicker {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.shop-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.shop-note-wide {
  max-width: 72ch;
  margin-bottom: 14px;
}

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

.skin-card {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.skin-card.is-featured {
  border-color: rgba(255, 180, 84, 0.35);
  box-shadow: 0 0 0 1px rgba(255, 180, 84, 0.14) inset;
}

.skin-card.is-equipped {
  border-color: rgba(93, 242, 214, 0.35);
  box-shadow: 0 0 0 1px rgba(93, 242, 214, 0.14) inset;
}

.skin-preview {
  height: 44px;
  margin-bottom: 10px;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.skin-preview::after {
  content: "";
  position: absolute;
  inset: 14px 12px 14px auto;
  width: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
}

.skin-name {
  margin: 0;
  font-weight: 700;
}

.skin-meta {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.skin-actions {
  display: flex;
  gap: 8px;
}

.skin-actions button {
  margin-top: 0;
  padding: 9px 12px;
  font-size: 0.82rem;
  box-shadow: none;
}

.skin-actions .secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.skin-card.is-locked {
  opacity: 0.66;
}

button {
  padding: 14px 26px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #04131c;
  background: linear-gradient(135deg, var(--accent), #84ffd3);
  font: inherit;
  font-weight: 700;
  box-shadow: 0 18px 30px rgba(93, 242, 214, 0.24);
}

button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
}

.secondary-button.is-highlighted {
  background: linear-gradient(135deg, rgba(255, 180, 84, 0.24), rgba(93, 242, 214, 0.18));
  border: 1px solid rgba(255, 180, 84, 0.28);
}

.close-button {
  padding: 10px 16px;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 7, 16, 0.72);
  backdrop-filter: blur(10px);
}

.modal-shell.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: min(84vh, 920px);
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 14, 28, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

@media (max-width: 720px) {
  .shell {
    width: 100vw;
    padding: 0;
  }

  .hero {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 10px;
    right: 10px;
    z-index: 8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    pointer-events: none;
  }

  .back-link {
    margin: 0;
    padding: 8px 12px;
    font-size: 0.88rem;
    pointer-events: auto;
  }

  .eyebrow,
  .summary,
  h1,
  .controls {
    display: none;
  }

  .game-panel {
    min-height: 100svh;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .game-panel::before {
    display: none;
  }

  .canvas-wrap {
    margin: 0;
    min-height: 100svh;
    display: flex;
    align-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: hidden;
  }

  canvas {
    width: 100%;
    height: auto;
    max-height: 100svh;
    aspect-ratio: 16 / 9;
  }

  .hud {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 62px);
    left: 10px;
    right: 10px;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
  }

  .progress-wrap {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 86px;
    z-index: 4;
    margin: 0;
  }

  .level-track {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    z-index: 4;
    display: flex;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 0;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .stat,
  .audio-toggle {
    min-width: 0;
    width: 100%;
    border-radius: 12px;
    padding: 7px 9px;
    background: rgba(8, 17, 31, 0.74);
    backdrop-filter: blur(10px);
  }

  .stage-stat {
    display: none;
  }

  .label,
  .progress-copy,
  .level-chip span {
    font-size: 0.62rem;
  }

  .stat strong {
    font-size: 0.95rem;
    margin-top: 2px;
  }

  .audio-toggle {
    grid-column: span 1;
    padding: 7px 9px;
    font-size: 0.82rem;
    align-self: stretch;
  }

  .progress-bar {
    height: 8px;
    background: rgba(8, 17, 31, 0.74);
  }

  .level-chip {
    flex: 0 0 58px;
    padding: 6px 4px;
    border-radius: 10px;
    background: rgba(8, 17, 31, 0.74);
    backdrop-filter: blur(10px);
  }

  .level-chip strong {
    font-size: 0.8rem;
  }

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

  .overlay-actions {
    flex-direction: column;
  }

  .overlay {
    position: fixed;
    inset: 10px;
    z-index: 30;
    padding: 14px;
    align-items: center;
  }

  .shop-head {
    flex-direction: column;
  }

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

  .card {
    max-height: calc(100svh - 20px);
    overflow: auto;
    padding: 22px 18px;
  }
}
