/* ============================================================
   main.css – CSS Variables, Reset, Typography
   ============================================================ */

/* ── Light Mode (default) ── */
:root {
  --color-bg: #ffffff;
  --color-surface: #f4f4f4;
  --color-surface-2: #e8e8e8;
  --color-border: #d0d0d0;
  --color-text: #111111;
  --color-text-muted: #888888;
  --color-text-inverse: #ffffff;
  --color-accent: #e85d04;
  --color-accent-hover: #c94f03;
  --color-success: #2a9d5c;
  --color-danger: #d32f2f;
  --color-danger-hover: #b71c1c;

  --color-keyboard-bg: #2a2a2a;
  --color-keyboard-surface: #3a3a3a;
  --color-keyboard-btn: #444444;
  --color-keyboard-btn-hover: #555555;
  --color-keyboard-btn-active: #e85d04;
  --color-keyboard-text: #f0f0f0;
  --color-keyboard-tab-active: #e8e8e8;
  --color-keyboard-tab-text: #cccccc;

  --color-player-active: #111111;
  --color-player-inactive: #aaaaaa;
  --color-score-active: #111111;
  --color-score-inactive: #cccccc;

  --color-leg-dot-filled: #e85d04;
  --color-leg-dot-empty: #d0d0d0;

  --color-dart-indicator: #444444;
  --color-dart-empty: #d0d0d0;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 15px;
  --font-size-md: 18px;
  --font-size-lg: 24px;
  --font-size-xl: 36px;
  --font-size-2xl: 56px;
  --font-size-3xl: 80px;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-overlay: 0 8px 32px rgba(0,0,0,0.18);

  --header-height: 48px;
  --keyboard-height: 340px;
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --color-bg: #1a1a1a;
  --color-surface: #242424;
  --color-surface-2: #2e2e2e;
  --color-border: #383838;
  --color-text: #f0f0f0;
  --color-text-muted: #666666;
  --color-text-inverse: #111111;

  --color-keyboard-bg: #111111;
  --color-keyboard-surface: #1e1e1e;
  --color-keyboard-btn: #2a2a2a;
  --color-keyboard-btn-hover: #333333;
  --color-keyboard-tab-active: #2a2a2a;
  --color-keyboard-tab-text: #aaaaaa;

  --color-player-active: #f0f0f0;
  --color-player-inactive: #555555;
  --color-score-active: #f0f0f0;
  --color-score-inactive: #444444;

  --color-leg-dot-empty: #383838;
  --color-dart-empty: #383838;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-overlay: 0 8px 32px rgba(0,0,0,0.6);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  outline: none;
  transition: border-color var(--transition-fast);
}

input:focus, select:focus {
  border-color: var(--color-accent);
}

ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

/* ── Typography ── */
h1 { font-size: var(--font-size-xl); font-weight: var(--font-weight-bold); }
h2 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); }
h3 { font-size: var(--font-size-md); font-weight: var(--font-weight-semibold); }

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

.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-center { text-align: center; }
.fw-bold { font-weight: var(--font-weight-bold); }

.hidden { display: none !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
