:root {
  --bg: #050505;
  --grid-dark: #1a1a1a;
  --grid-light: #2a2a2a;
  --panel: #0d0d0d;
  --text: #d7d7d7;
  --muted: #9a9a9a;
  --red: #ff3d3d;
  --blue: #4aa6ff;
  --green: #4cff6b;
  --yellow: #ffd84a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.5)),
    url("assets-retro-sunset.svg") center / cover no-repeat fixed;
  color: var(--text);
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.app {
  width: min(100%, 1100px);
  padding: 1rem;
}

.hud {
  background: linear-gradient(180deg, rgba(18, 18, 18, 0.9) 0%, rgba(11, 11, 11, 0.92) 100%);
  border: 1px solid #2b2b2b;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.9rem;
  backdrop-filter: blur(4px);
}

h1 {
  margin: 0 0 0.4rem;
  letter-spacing: 0.08em;
  font-size: 1.25rem;
  color: #efefef;
}

kbd {
  border: 1px solid #4d4d4d;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
}

.controls-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.85rem;
  color: #d4c2df;
}

.controls-info p {
  margin: 0;
}

.top-bar {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

select,
button {
  font: inherit;
  background: #151515;
  color: var(--text);
  border: 1px solid #373737;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
}

button {
  cursor: pointer;
}

button:hover,
select:hover,
.checkbox-option:hover {
  border-color: #8b59aa;
}

.checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid #373737;
  border-radius: 6px;
  background: #151515;
  cursor: pointer;
}

.checkbox-option input {
  margin: 0;
}

.jukebox {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.45rem;
  padding: 0.8rem 0.9rem 0.95rem;
  border: 1px solid rgba(255, 98, 180, 0.55);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(18, 11, 26, 0.95), rgba(8, 16, 30, 0.92)),
    radial-gradient(circle at top, rgba(255, 217, 102, 0.12), transparent 52%);
  box-shadow: inset 0 0 18px rgba(255, 86, 190, 0.12), 0 0 22px rgba(46, 180, 255, 0.12);
}

.jukebox-marquee {
  justify-self: start;
  padding: 0.2rem 0.75rem;
  border: 1px solid rgba(255, 217, 102, 0.65);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 98, 180, 0.2), rgba(255, 217, 102, 0.18));
  color: #ffe27a;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.74rem;
  text-shadow: 0 0 8px rgba(255, 217, 102, 0.45);
}

.jukebox-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: end;
}

.jukebox-label {
  grid-column: 1 / -1;
  color: #8ee7ff;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.jukebox-select {
  min-width: 0;
  border-color: rgba(92, 214, 255, 0.6);
  background: linear-gradient(180deg, rgba(8, 20, 32, 0.95), rgba(18, 8, 28, 0.95));
  color: #f7f2ff;
  box-shadow: inset 0 0 12px rgba(92, 214, 255, 0.12);
}

.jukebox-button {
  border-color: rgba(255, 217, 102, 0.7);
  background: linear-gradient(180deg, rgba(74, 31, 66, 0.95), rgba(31, 20, 56, 0.95));
  color: #ffe27a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: inset 0 0 10px rgba(255, 217, 102, 0.1);
}

.scoreboard {
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.95rem;
  align-items: center;
  flex-wrap: wrap;
}

#speedLabel,
#decayLabel,
#timerLabel {
  color: var(--muted);
}

#musicToggle,
#sfxToggle {
  padding-inline: 0.75rem;
}

.red {
  color: var(--red);
}

.blue {
  color: var(--blue);
}

.green {
  color: var(--green);
}

.yellow {
  color: var(--yellow);
}

.hidden {
  display: none;
}

.arena-wrap {
  position: relative;
  border: 1px solid rgba(111, 78, 138, 0.55);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.45), inset 0 0 40px rgba(200, 120, 255, 0.08);
}

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

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms linear;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-card {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid #6c4f7d;
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.82);
  min-width: min(320px, calc(100vw - 3rem));
  box-shadow: 0 0 18px rgba(201, 118, 255, 0.18);
}

#overlayText {
  margin: 0;
  color: #f3ddff;
  text-align: center;
}

#overlayButton {
  padding: 0.55rem 1rem;
  min-width: 11rem;
}

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

  .scoreboard {
    flex-direction: column;
    align-items: flex-start;
  }
}