:root {
  /* Color Scheme */
  --primary: #646cff;
  --primary-hover: #535bf2;
  --primary-active: #434af0;
  --background: #242424;
  --surface: #1a1a1a;
  --text-primary: rgba(255, 255, 255, 0.87);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --border-radius: 8px;
  --transition: all 0.25s ease;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  
  /* Typography */
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 
               Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  line-height: 1.5;
  font-weight: 400;
  font-size: 16px;
  
  color-scheme: light dark;
  color: var(--text-primary);
  background-color: var(--background);
  
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2em);
}

p {
  margin-bottom: var(--space-md);
  max-width: 65ch;
}

/* Links */
a {
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}

a:hover {
  color: var(--primary-hover);
}

a:active {
  color: var(--primary-active);
}

/* Buttons */
button {
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  padding: var(--space-sm) var(--space-md);
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  background-color: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

button:hover {
  border-color: var(--primary);
  background-color: rgba(100, 108, 255, 0.1);
}

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

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Forms */
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  padding: var(--space-sm);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--surface);
  color: var(--text-primary);
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(100, 108, 255, 0.2);
}

/* Utility Classes */
.container {
  width: 100%;
  max-width: auto;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

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

/* Light Mode */
@media (prefers-color-scheme: light) {
  :root {
    --background: #ffffff;
    --surface: #f9f9f9;
    --text-primary: #213547;
    --text-secondary: rgba(0, 0, 0, 0.7);
  }
  
  a:hover {
    color: #747bff;
  }
  
  button {
    background-color: var(--surface);
    color: var(--text-primary);
  }
  
  input, textarea, select {
    background-color: var(--surface);
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.1);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print Styles */
@media print {
  body {
    background-color: white;
    color: black;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  nav, footer {
    display: none;
  }
}