:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-muted: rgba(59, 130, 246, 0.12);
  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.12);

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --touch-min: 44px;
  --transition: 180ms ease;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.08);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: 56px;
  --header-h: 52px;
}

html[data-theme="light"],
html:not([data-theme]) {
  color-scheme: light;
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --bg-grouped: #ffffff;
  --text: #1c1c1e;
  --text-secondary: #636366;
  --text-tertiary: #8e8e93;
  --separator: rgba(60, 60, 67, 0.12);
  --glass: rgba(255, 255, 255, 0.82);
  --overlay: rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-grouped: #2c2c2e;
  --text: #f5f5f7;
  --text-secondary: #aeaeb2;
  --text-tertiary: #636366;
  --separator: rgba(84, 84, 88, 0.65);
  --glass: rgba(28, 28, 30, 0.88);
  --overlay: rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-grouped: #2c2c2e;
    --text: #f5f5f7;
    --text-secondary: #aeaeb2;
    --text-tertiary: #636366;
    --separator: rgba(84, 84, 88, 0.65);
    --glass: rgba(28, 28, 30, 0.88);
    --overlay: rgba(0, 0, 0, 0.55);
  }
}

@media (prefers-color-scheme: light) {
  html[data-theme="system"] {
    color-scheme: light;
    --bg: #f2f2f7;
    --bg-elevated: #ffffff;
    --bg-grouped: #ffffff;
    --text: #1c1c1e;
    --text-secondary: #636366;
    --text-tertiary: #8e8e93;
    --separator: rgba(60, 60, 67, 0.12);
    --glass: rgba(255, 255, 255, 0.82);
    --overlay: rgba(0, 0, 0, 0.4);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
}
