/* ============================================================
   BASE.CSS — Shared design tokens, reset, utilities
   LiveJS Playground © 2025
   ============================================================ */

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

/* ── Design tokens (dark mode default) ── */
:root {
  --bg:           #0b0b10;
  --bg-alt:       #0f0f16;
  --surface:      #14141c;
  --surface2:     #1a1a25;
  --surface3:     #20202e;
  --border:       #252535;
  --border-strong:#333348;

  --accent:       #6366f1;
  --accent-dark:  #4f52d6;
  --accent-light: #818cf8;
  --accent-glow:  rgba(99,102,241,0.30);
  --accent-subtle:rgba(99,102,241,0.08);

  --violet:       #a78bfa;
  --green:        #34d399;
  --green-dim:    rgba(52,211,153,0.15);
  --red:          #f87171;
  --yellow:       #fbbf24;
  --blue:         #60a5fa;
  --cyan:         #22d3ee;

  --text:         #f0f0f8;
  --text-secondary:#a0a0bc;
  --text-muted:   #6b6b8a;
  --text-dim:     #42425a;

  --mono: 'Cascadia Code', 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 16px 48px rgba(0,0,0,0.6);
  --shadow-xl:  0 32px 80px rgba(0,0,0,0.7);
}

/* ── Light mode tokens ── */
body.light {
  --bg:           #f5f6fa;
  --bg-alt:       #eef0f8;
  --surface:      #ffffff;
  --surface2:     #f0f1f8;
  --surface3:     #e8eaf4;
  --border:       #e2e4f0;
  --border-strong:#c8cbdf;

  --accent:       #4f46e5;
  --accent-dark:  #4338ca;
  --accent-light: #6366f1;
  --accent-glow:  rgba(79,70,229,0.20);
  --accent-subtle:rgba(79,70,229,0.06);

  --violet:       #7c3aed;
  --green:        #059669;
  --green-dim:    rgba(5,150,105,0.10);
  --red:          #dc2626;
  --yellow:       #d97706;
  --blue:         #2563eb;
  --cyan:         #0891b2;

  --text:         #0d0d1a;
  --text-secondary:#4a4a6a;
  --text-muted:   #6b6b8a;
  --text-dim:     #a0a0bc;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow:     0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 16px 48px rgba(0,0,0,0.12);
  --shadow-xl:  0 32px 80px rgba(0,0,0,0.14);
}

/* ── Base ── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Shared button components ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-family: var(--sans);
  transition: all 0.2s ease;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 24px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 0 36px var(--accent-glow);
  transform: translateY(-2px);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 0 16px var(--accent-glow); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-sm { padding: 7px 16px; font-size: 13px; border-radius: var(--radius-sm); }

/* ── Icon button ── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border-strong); }

/* ── Toggle switch ── */
.switch { position: relative; width: 34px; height: 20px; flex-shrink: 0; }
.switch input { display: none; }
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 10px;
  transition: background 0.2s;
}
.switch-thumb {
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.switch input:checked ~ .switch-track { background: var(--accent); }
.switch input:checked ~ .switch-thumb { transform: translateX(14px); }

/* ── Select ── */
.styled-select {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  padding: 0 32px 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b8a' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--sans);
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}
.styled-select:hover { border-color: var(--border-strong); color: var(--text); }
.styled-select:focus { border-color: var(--accent); color: var(--text); }
.styled-select option { background: #14141c; color: #f0f0f8; }
body.light .styled-select option { background: #f0f1f8; color: #0d0d1a; }

/* ── Pulse animation ── */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ── Fade in ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-fade-up { animation: fadeUp 0.6s ease both; }
.animate-fade-in { animation: fadeIn 0.4s ease both; }

/* ── 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;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 768px) {
  .container { padding: 0 20px; }
}
