/**
 * Main Styles
 * Base styles, CSS variables, and global resets
 */

/* CSS Variables */
:root {
  /* Colors */
  --color-bg: #000000;
  --color-surface: rgba(255, 255, 255, 0.08);
  --color-surface-hover: rgba(255, 255, 255, 0.12);
  --color-border: rgba(255, 255, 255, 0.15);
  --color-text: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.6);
  --color-text-subtle: rgba(255, 255, 255, 0.4);
  --color-accent: #60a5fa;
  --color-accent-hover: #3b82f6;
  --color-danger: #f87171;
  --color-danger-hover: #ef4444;
  
  /* Glassmorphism */
  --glass-bg: rgba(0, 0, 0, 0.5);
  --glass-blur: 10px;
  --glass-border: rgba(255, 255, 255, 0.1);
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-family-mono: 'SF Mono', 'Fira Code', monospace;
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
  
  /* Z-index layers */
  --z-canvas: 0;
  --z-clock: 100;
  --z-menu: 200;
  --z-overlay: 300;
  --z-setup: 400;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* Prevent pull-to-refresh on mobile */
body {
  overscroll-behavior: none;
}

/* App Container */
#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* Canvas */
#canvas {
  position: absolute;
  inset: 0;
  z-index: var(--z-canvas);
  display: block;
}

/* Touch Target */
#touch-target {
  position: absolute;
  inset: 0;
  z-index: var(--z-clock);
  pointer-events: auto;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Fade animations */
.fade-out {
  opacity: 0;
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

/* Scrollbar styles for panels */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Focus styles */
:focus {
  outline: none;
}

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

/* Button reset */
button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Input reset */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
  height: 4px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--color-accent);
  border-radius: 50%;
  margin-top: -8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--color-accent);
  border-radius: 50%;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Safe area padding for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
  .safe-area-top {
    padding-top: env(safe-area-inset-top);
  }
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
