:root {
  --bg-top: #0a0a1a;
  --bg-bot: #000008;
  --ground: #1a1a2e;
  --ground-highlight: #16213e;
  --ball: #00f5d4;
  --accent: #7b2cbf;
  --accent-light: #9d4edd;
  --tri: #ff6b6b;
  --ui: #f0f4ff;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glow: rgba(0, 245, 212, 0.4);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--bg-top) 0%, var(--bg-bot) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(123, 44, 191, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 245, 212, 0.1), transparent);
  pointer-events: none;
}

#gameWrap {
  width: 900px;
  max-width: 95vw;
  height: 540px;
  background: linear-gradient(180deg, rgba(10, 10, 26, 0.9) 0%, rgba(0, 0, 8, 0.95) 100%);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 0 120px rgba(123, 44, 191, 0.1);
  position: relative;
  overflow: hidden;
}

#gameWrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  border-radius: 24px;
}

.ui {
  position: absolute;
  left: 16px;
  top: 16px;
  color: var(--ui);
  font-size: 13px;
  font-weight: 500;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.big {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--ball), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

#waveBadge {
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.15), rgba(123, 44, 191, 0.15));
  color: var(--ui);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.home-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 40;
}

.home-card {
  background: linear-gradient(180deg, rgba(26, 26, 46, 0.8), rgba(22, 33, 62, 0.6));
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 28px;
  border: 1px solid var(--glass-border);
  padding: 36px 44px;
  text-align: center;
  color: var(--ui);
  box-shadow: 
    0 30px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 0 80px rgba(0, 245, 212, 0.05);
  max-width: 420px;
  width: 90%;
}

.home-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 245, 212, 0.5), transparent);
}

.home-card h1 {
  margin: 0 0 8px 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--ball) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.home-card p {
  margin: 0 0 20px 0;
  opacity: 0.7;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
}

.home-card .settings {
  font-size: 13px;
  color: var(--ui);
  text-align: left;
}

.home-card .settings label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-weight: 500;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.home-card .settings label:hover {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

.home-card .settings input[type=range] {
  width: 140px;
  margin: 0 12px;
}

.home-card .settings span {
  min-width: 28px;
  text-align: right;
  font-weight: 700;
  font-size: 14px;
  color: var(--ball);
}

.home-card .settings > div {
  margin-top: 20px;
}

.home-card .settings button {
  width: auto;
  height: 44px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 600;
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 24px;
  background: transparent;
  cursor: pointer;
}

input[type=range]:focus {
  outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 245, 212, 0.2), rgba(123, 44, 191, 0.3));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

input[type=range]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 245, 212, 0.2), rgba(123, 44, 191, 0.3));
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  margin-top: -9px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--ball), #00c4a7);
  box-shadow: 
    0 4px 16px rgba(0, 245, 212, 0.4),
    0 0 0 3px rgba(0, 245, 212, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 
    0 6px 24px rgba(0, 245, 212, 0.5),
    0 0 0 4px rgba(0, 245, 212, 0.25);
}

input[type=range]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--ball);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.wave-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: var(--ui);
  font-weight: 800;
  font-size: 96px;
  letter-spacing: -2px;
  text-shadow: 
    0 0 60px rgba(0, 245, 212, 0.5),
    0 0 120px rgba(123, 44, 191, 0.3);
  opacity: 0;
  transform: scale(0.8);
  transition: 
    opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 45;
}

.wave-overlay.show {
  opacity: 1;
  transform: scale(1);
}

button {
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  color: var(--ui);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: 
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

button:hover {
  transform: translateY(-3px) scale(1.02);
  background: linear-gradient(180deg, rgba(0, 245, 212, 0.2), rgba(123, 44, 191, 0.15));
  border-color: rgba(0, 245, 212, 0.3);
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(0, 245, 212, 0.2);
}

button:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

#startBtn, #saveSettingsBtn {
  background: linear-gradient(135deg, var(--ball), var(--accent));
  border: none;
  color: #000;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 
    0 8px 32px rgba(0, 245, 212, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

#startBtn:hover, #saveSettingsBtn:hover {
  background: linear-gradient(135deg, #00ffd9, #9d4edd);
  box-shadow: 
    0 12px 40px rgba(0, 245, 212, 0.4),
    0 0 60px rgba(0, 245, 212, 0.2);
  transform: translateY(-3px) scale(1.02);
  border: none;
}

#saveSettingsBtn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  color: var(--ui);
  border: 1px solid var(--glass-border);
}

#saveSettingsBtn:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.footer {
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: 12px;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.3px;
}

.ui .big {
  color: var(--ball);
}

.ui p {
  margin: 6px 0 0 0;
  color: rgba(255, 255, 255, 0.6);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 245, 212, 0.3); }
  50% { box-shadow: 0 0 40px rgba(0, 245, 212, 0.5); }
}
