* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --fg: #e8e8f0;
  --accent: #00f3ff;
  --accent2: #9d00ff;
  --card: rgba(16, 16, 24, 0.9);
  --border: rgba(0, 243, 255, 0.3);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, sans-serif;
}

#game-container {
  width: 100%;
  height: 100%;
  position: relative;
}

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

#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.screen {
  pointer-events: auto;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

.screen.active {
  display: flex;
}

#title-screen {
  background: radial-gradient(ellipse at center, rgba(0, 243, 255, 0.08) 0%, transparent 70%);
}

#title-screen h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.1em;
}

#title-screen p {
  color: rgba(232, 232, 240, 0.7);
  font-size: clamp(1rem, 3vw, 1.25rem);
  max-width: 80%;
}

button {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 4px;
  color: var(--bg);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

button:hover {
  transform: scale(1.03);
  box-shadow: 0 0 30px rgba(0, 243, 255, 0.4);
}

button:active {
  transform: scale(0.98);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#hud {
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem;
  gap: 1rem;
}

#hud > div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  color: var(--accent);
}

#win-screen {
  background: radial-gradient(ellipse at center, rgba(157, 0, 255, 0.1) 0%, transparent 70%);
}

#win-screen h1 {
  font-size: clamp(2rem, 8vw, 3.5rem);
  color: var(--accent);
}

#win-time {
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent2);
}

#mobile-controls {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  pointer-events: auto;
  z-index: 10;
}

#mobile-controls.hidden {
  display: none;
}

#joystick-container {
  width: 120px;
  height: 120px;
  position: relative;
}

#joystick-base {
  width: 100%;
  height: 100%;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  position: relative;
  touch-action: none;
}

#joystick-stick {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.05s linear;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
}

#jump-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  padding: 0;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

@media (hover: none) and (pointer: coarse) {
  #mobile-controls.hidden {
    display: flex;
  }
}

@media (max-width: 768px) {
  #hud {
    padding: 1rem;
    flex-wrap: wrap;
  }
  
  #hud > div {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
}