:root {
  --bg-1: #0f1a2b;
  --bg-2: #132238;
  --accent: #ffb703;
  --accent-2: #fb8500;
  --cyan: #4cc9f0;
  --pink: #ff4d6d;
  --panel: rgba(18, 26, 44, 0.85);
  --text: #f1f5ff;
  --muted: rgba(241, 245, 255, 0.65);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", "Noto Sans", sans-serif;
  background: radial-gradient(circle at 20% 10%, rgba(76, 201, 240, 0.15), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(255, 77, 109, 0.18), transparent 45%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  grid-template-rows: auto 1fr;
  gap: 20px;
  width: min(1200px, 100%);
}

.hud {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  padding: 16px 20px;
  border-radius: 16px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.title h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 1px;
  font-family: "Georgia", "Times New Roman", serif;
}

.badge {
  background: var(--accent-2);
  color: #1a0f00;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.stats div {
  display: grid;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.stats strong {
  font-size: 18px;
  color: var(--text);
}

.controls {
  display: flex;
  gap: 10px;
}

button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.stage {
  position: relative;
  background: rgba(6, 10, 20, 0.65);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  min-height: 540px;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 10, 20, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.panel {
  background: rgba(20, 26, 40, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 24px;
  border-radius: 16px;
  max-width: 360px;
  text-align: center;
}

.panel h2 {
  margin-top: 0;
  font-family: "Georgia", "Times New Roman", serif;
}

.panel p {
  color: var(--muted);
  line-height: 1.5;
}

.sidebar {
  display: grid;
  gap: 16px;
}

.sidebar section {
  background: var(--panel);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar h3 {
  margin-top: 0;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.tuner {
  display: grid;
  gap: 12px;
}

.tuner label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.mode-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mode-buttons button {
  padding: 6px 8px;
  font-size: 12px;
}

.mode-buttons button.active {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.45);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.tuner input[type="range"] {
  width: 100%;
}

.tuner strong {
  color: var(--text);
  font-size: 14px;
}

.powerups {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.dot.wide { background: var(--accent); }
.dot.slow { background: var(--cyan); }
.dot.multi { background: var(--pink); }
.dot.pierce { background: #8ecae6; }
.dot.magnet { background: #b5179e; }
.dot.bomb { background: #ff6d00; }

.achievements {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.theme-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.theme-buttons button.active {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.45);
}

.hidden-panel {
  display: none;
}

body.theme-day {
  --bg-1: #f6f7fb;
  --bg-2: #e6eef8;
  --panel: rgba(255, 255, 255, 0.8);
  --text: #1a1f36;
  --muted: rgba(26, 31, 54, 0.6);
}

body.theme-retro {
  --bg-1: #1b1b3a;
  --bg-2: #693668;
  --accent: #f2e863;
  --accent-2: #f25f5c;
  --text: #f7f7ff;
  --muted: rgba(247, 247, 255, 0.7);
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  body {
    padding: 12px;
  }
  .hud {
    flex-direction: column;
    align-items: flex-start;
  }
  .sidebar {
    grid-template-columns: 1fr;
  }
  .stage {
    min-height: 420px;
  }
}
