/* ===== Geometry Dash — Stereo Madness styles ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

/* ---------- MENU ---------- */
#menu {
  background: linear-gradient(180deg, #3a0a55 0%, #5a1577 30%, #7a2596 60%, #9a35b8 100%);
  overflow: hidden;
  position: absolute;
  z-index: 10;
}

.bg-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 60% 70%, #fff, transparent),
    radial-gradient(1px 1px at 80% 20%, #fff, transparent),
    radial-gradient(1px 1px at 30% 80%, #fff, transparent),
    radial-gradient(1px 1px at 90% 50%, #fff, transparent),
    radial-gradient(1px 1px at 50% 40%, #fff, transparent),
    radial-gradient(2px 2px at 15% 60%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 2px at 75% 25%, rgba(255,255,255,.5), transparent);
  animation: twinkle 4s linear infinite;
  opacity: .8;
}
@keyframes twinkle {
  0% { opacity: .4; }
  50% { opacity: .9; }
  100% { opacity: .4; }
}

.bg-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, transparent 0%, rgba(255,255,255,.04) 50%, transparent 100%),
    repeating-linear-gradient(90deg, transparent 0, transparent 80px, rgba(255,255,255,.04) 80px, rgba(255,255,255,.04) 81px),
    repeating-linear-gradient(0deg, transparent 0, transparent 80px, rgba(255,255,255,.04) 80px, rgba(255,255,255,.04) 81px);
  mask-image: linear-gradient(180deg, transparent 0%, black 30%, black 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 30%, black 80%, transparent 100%);
}

.menu-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.title {
  font-size: clamp(48px, 9vw, 140px);
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1;
  text-shadow:
    0 4px 0 #1a0530,
    0 6px 0 rgba(0,0,0,.5),
    0 0 30px rgba(255,100,200,.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0;
}
.title-geom {
  color: #ffffff;
  background: linear-gradient(180deg, #ffffff 0%, #ffd0ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 180, 230, .6));
}
.title-dash {
  color: #ff6ad5;
  background: linear-gradient(180deg, #ff8de0 0%, #c724b1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 80, 200, .7));
  margin-top: -10px;
}

.subtitle {
  font-size: clamp(18px, 2.4vw, 32px);
  font-weight: 700;
  letter-spacing: 8px;
  color: #fff;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent);
  padding: 6px 30px;
  border-top: 2px solid rgba(255,255,255,.4);
  border-bottom: 2px solid rgba(255,255,255,.4);
  text-shadow: 0 0 12px rgba(255,255,255,.5);
}

/* 3D cube preview */
.cube-preview {
  perspective: 600px;
  width: 100px;
  height: 100px;
  margin: 10px 0 20px;
}
.cube-spin {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: spinCube 5s linear infinite;
}
.face {
  position: absolute;
  width: 100px;
  height: 100px;
  border: 3px solid #1a0530;
  background: linear-gradient(135deg, #ff6ad5 0%, #c724b1 100%);
  box-shadow: inset 0 0 20px rgba(255,255,255,.2);
}
.face.front  { transform: translateZ(50px); }
.face.back   { transform: rotateY(180deg) translateZ(50px); }
.face.right  { transform: rotateY(90deg) translateZ(50px); background: linear-gradient(135deg, #ff8de0 0%, #e040c0 100%); }
.face.left   { transform: rotateY(-90deg) translateZ(50px); background: linear-gradient(135deg, #d44ba0 0%, #8a1a78 100%); }
.face.top    { transform: rotateX(90deg) translateZ(50px); background: linear-gradient(135deg, #ffb0e8 0%, #ff6ad5 100%); }
.face.bottom { transform: rotateX(-90deg) translateZ(50px); background: linear-gradient(135deg, #8a1a78 0%, #4a0e5a 100%); }
@keyframes spinCube {
  0%   { transform: rotateX(-20deg) rotateY(0deg); }
  100% { transform: rotateX(-20deg) rotateY(360deg); }
}

.play-btn {
  position: relative;
  padding: 18px 60px;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  background: linear-gradient(180deg, #ff6ad5 0%, #c724b1 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-shadow: 0 2px 0 rgba(0,0,0,.4);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.4),
    inset 0 -4px 0 rgba(0,0,0,.25),
    0 6px 0 #6a1a78,
    0 10px 20px rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform .08s ease, box-shadow .08s ease;
  font-family: inherit;
}
.play-btn:hover {
  filter: brightness(1.1);
}
.play-btn:active {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.4),
    inset 0 -4px 0 rgba(0,0,0,.25),
    0 2px 0 #6a1a78,
    0 4px 10px rgba(0,0,0,.4);
}
.play-icon {
  font-size: 22px;
}

.hints {
  margin-top: 8px;
  font-size: 14px;
  color: rgba(255,255,255,.8);
  text-align: center;
  line-height: 1.7;
}
.hints kbd {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  margin: 0 2px;
}

.footer {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
}

/* ---------- GAME SCREEN ---------- */
#gameScreen {
  background: #1a0530;
  z-index: 5;
  display: none;
}
#gameScreen.active {
  display: flex;
}

#game {
  display: block;
  background: #1a0530;
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* HUD */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 5;
}
.hud-left, .hud-right {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-shadow:
    -2px 0 #000, 2px 0 #000, 0 -2px #000, 0 2px #000,
    -2px -2px #000, 2px 2px #000, -2px 2px #000, 2px -2px #000;
  letter-spacing: 2px;
}
.hud-center {
  flex: 1;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.progress-bar {
  width: 100%;
  max-width: 500px;
  height: 14px;
  background: rgba(0,0,0,.5);
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ff6ad5, #ffa0e8, #fff);
  transition: width .12s linear;
  box-shadow: 0 0 10px rgba(255,180,230,.8);
}
.progress-text {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow:
    -2px 0 #000, 2px 0 #000, 0 -2px #000, 0 2px #000,
    -2px -2px #000, 2px 2px #000, -2px 2px #000, 2px -2px #000;
  letter-spacing: 2px;
}

/* Overlays */
.death-overlay, .complete-overlay, .pause-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
  z-index: 10;
  pointer-events: none;
}
.death-overlay.show, .complete-overlay.show, .pause-overlay.show { display: flex; }
.death-text {
  font-size: 88px;
  font-weight: 900;
  color: #ff4060;
  text-shadow:
    0 4px 0 #1a0530,
    0 0 30px rgba(255,60,80,.8);
  letter-spacing: 6px;
  animation: shake .4s ease;
}
.complete-text {
  font-size: 72px;
  font-weight: 900;
  color: #fff;
  text-shadow:
    0 4px 0 #1a0530,
    0 0 40px rgba(255,180,230,1),
    0 0 80px rgba(255,80,200,.8);
  letter-spacing: 6px;
  animation: pulse 1.2s ease-in-out infinite;
}
.attempts-text {
  margin-top: 16px;
  font-size: 22px;
  color: #fff;
  letter-spacing: 2px;
}
.retry-text, .pause-sub {
  margin-top: 26px;
  font-size: 18px;
  color: rgba(255,255,255,.8);
  letter-spacing: 2px;
}
.pause-text {
  font-size: 88px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 8px;
  text-shadow: 0 4px 0 #1a0530, 0 0 30px rgba(255,255,255,.6);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px); }
  40% { transform: translateX(12px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Pause / back buttons */
.pause-btn, .back-btn {
  position: absolute;
  top: 20px;
  z-index: 15;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255,255,255,.7);
  background: rgba(0,0,0,.4);
  color: #fff;
  font-size: 18px;
  border-radius: 8px;
  cursor: pointer;
  pointer-events: auto;
  font-family: inherit;
}
.pause-btn { right: 80px; }
.back-btn {
  right: 24px;
  font-size: 22px;
  font-weight: 700;
}
.pause-btn:hover, .back-btn:hover { background: rgba(0,0,0,.6); }

#gameScreen.hidden { display: none; }
