/* ==========================================================================
   Design Tokens — Unified Radii, Spacing, Elevation & Light/Dark Theme
   ========================================================================== */

:root {
  /* Palette — Light Ceramic & Sapphire */
  --bg: #f3f6fb;
  --bg-glow-a: rgba(59, 130, 246, 0.11);
  --bg-glow-b: rgba(6, 182, 212, 0.09);
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-2: #f4f7fc;
  --surface-3: #e9eff8;
  --border: rgba(15, 23, 42, 0.085);
  --border-strong: rgba(15, 23, 42, 0.16);
  --card-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  /* Brand & Semantic */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-grad: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  --primary-grad-hover: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  --primary-soft: rgba(37, 99, 235, 0.09);
  --primary-soft-hover: rgba(37, 99, 235, 0.14);
  --primary-border: rgba(37, 99, 235, 0.28);
  --primary-ring: rgba(37, 99, 235, 0.22);
  --accent: #06b6d4;
  --success: #15803d;
  --success-soft: rgba(22, 163, 74, 0.11);
  --success-border: rgba(22, 163, 74, 0.22);
  --warning: #b45309;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --warning-border: rgba(217, 119, 6, 0.26);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.09);

  /* Layered Soft Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 12px 32px -6px rgba(15, 23, 42, 0.07), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 56px -12px rgba(15, 23, 42, 0.18), 0 8px 20px -4px rgba(15, 23, 42, 0.08);
  --shadow-primary: 0 6px 18px -4px rgba(37, 99, 235, 0.38), 0 2px 6px -1px rgba(37, 99, 235, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  --shadow-primary-hover: 0 10px 24px -5px rgba(37, 99, 235, 0.44), 0 3px 8px -2px rgba(37, 99, 235, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.25);

  /* Unified Concentric Rounded-Corner Scale */
  --radius-2xl: 24px;
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-pill: 999px;

  /* Backward-compatible aliases */
  --radius: var(--radius-xl);

  /* Unified 4px / 8px Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;

  /* Unified Control Heights */
  --ctrl-sm: 34px;
  --ctrl-md: 40px;
  --ctrl-lg: 46px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* Checkerboard */
  --checker-a: #e2e8f0;
  --checker-b: #ffffff;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #080e1a;
  --bg-glow-a: rgba(59, 130, 246, 0.16);
  --bg-glow-b: rgba(6, 182, 212, 0.11);
  --surface: #11192b;
  --surface-elevated: #152036;
  --surface-2: #19243b;
  --surface-3: #23314d;
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.24);
  --card-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-grad: linear-gradient(180deg, #4f8ff8 0%, #2563eb 100%);
  --primary-grad-hover: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
  --primary-soft: rgba(59, 130, 246, 0.16);
  --primary-soft-hover: rgba(59, 130, 246, 0.23);
  --primary-border: rgba(96, 165, 250, 0.35);
  --primary-ring: rgba(59, 130, 246, 0.32);
  --accent: #22d3ee;
  --success: #4ade80;
  --success-soft: rgba(34, 197, 94, 0.14);
  --success-border: rgba(74, 222, 128, 0.24);
  --warning: #fbbf24;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --warning-border: rgba(251, 191, 36, 0.28);
  --danger: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.15);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28), 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 16px 40px -8px rgba(0, 0, 0, 0.5), 0 4px 14px -2px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 28px 64px -12px rgba(0, 0, 0, 0.68), 0 8px 24px -4px rgba(0, 0, 0, 0.4);
  --shadow-primary: 0 6px 20px -4px rgba(37, 99, 235, 0.5), 0 2px 6px -1px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  --shadow-primary-hover: 0 10px 26px -4px rgba(59, 130, 246, 0.55), 0 3px 10px -2px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.24);

  --checker-a: #1e293b;
  --checker-b: #0f172a;
}
