:root {
  color-scheme: dark;
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bg: #090c17;
  --bg-2: #10162a;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-2: rgba(255, 255, 255, 0.1);
  --surface-solid: #151c33;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #eef1ff;
  --muted: #9aa4c7;
  --accent: #8b6cff;
  --accent-2: #38d9ff;
  --accent-grad: linear-gradient(135deg, #8b6cff, #38d9ff);
  --success: #3ce38a;
  --warn: #ffb547;
  --danger: #ff5c7a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 6px 18px -6px rgba(0, 0, 0, 0.5);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --slide-ms: 170ms;
  --orb-opacity: 0.55;
}

[data-theme='light'] {
  color-scheme: light;
  --bg: #eef1fb;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(255, 255, 255, 0.95);
  --surface-solid: #ffffff;
  --border: rgba(20, 30, 70, 0.1);
  --border-strong: rgba(20, 30, 70, 0.2);
  --text: #141a30;
  --muted: #5d6786;
  --shadow: 0 18px 50px -14px rgba(30, 40, 90, 0.28);
  --shadow-sm: 0 6px 18px -8px rgba(30, 40, 90, 0.25);
  --orb-opacity: 0.35;
}

.reduced-motion * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.05s !important; }
.reduced-motion .tile { transition-duration: 90ms !important; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h3 { font-size: 1.05rem; font-weight: 600; margin-top: 1.4rem; margin-bottom: 0.5rem; }
kbd {
  font-family: inherit; font-size: 0.72em; font-weight: 600; padding: 0.1em 0.45em; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: 0 1px 0 var(--border-strong); margin-left: 0.35em; vertical-align: middle;
}
.muted { color: var(--muted); font-size: 0.92rem; }
.grad { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* background orbs */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; opacity: var(--orb-opacity); }
.bg-orbs span { position: absolute; border-radius: 50%; filter: blur(70px); will-change: transform; }
.bg-orbs span:nth-child(1) { width: 55vw; height: 55vw; left: -12vw; top: -18vw; background: #5b3dff; animation: orb1 26s ease-in-out infinite alternate; }
.bg-orbs span:nth-child(2) { width: 45vw; height: 45vw; right: -12vw; top: 10vh; background: #1aa3ff; animation: orb2 30s ease-in-out infinite alternate; }
.bg-orbs span:nth-child(3) { width: 40vw; height: 40vw; left: 30vw; bottom: -25vw; background: #ff4fa3; animation: orb3 34s ease-in-out infinite alternate; }
@keyframes orb1 { to { transform: translate(12vw, 8vh) scale(1.1); } }
@keyframes orb2 { to { transform: translate(-10vw, 14vh) scale(0.9); } }
@keyframes orb3 { to { transform: translate(-14vw, -8vh) scale(1.15); } }

#fx { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  padding: 0.6rem 1.05rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.95rem;
  transition: transform 0.15s var(--ease-out), background 0.2s, box-shadow 0.2s, border-color 0.2s;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-2); transform: translateY(-1px); border-color: var(--border-strong); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-primary { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 22px -8px rgba(139, 108, 255, 0.8); }
.btn-primary:hover { background: var(--accent-grad); filter: brightness(1.08); box-shadow: 0 12px 28px -8px rgba(56, 217, 255, 0.7); }
.btn-ghost { background: var(--surface); }
.btn-danger { color: var(--danger); border-color: rgba(255, 92, 122, 0.4); }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1.05rem; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-toggle[aria-pressed='true'] { background: rgba(139, 108, 255, 0.22); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.btn kbd { margin-left: 0.2em; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; transition: background 0.2s, transform 0.15s;
}
.icon-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* segmented control, chips, switch, progress */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); padding: 0.35rem 0.75rem; border-radius: 999px; font-weight: 600; font-size: 0.85rem;
  transition: background 0.2s, color 0.2s;
}
.seg button.active { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 12px -4px rgba(139, 108, 255, 0.8); }
.seg button:hover:not(.active) { color: var(--text); background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.5rem 0 0.8rem; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 0.3rem 0.75rem; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.chip.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong); transition: background 0.2s; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease-out); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: var(--accent-grad); transition: width 0.35s var(--ease-out); }
.progress-fill.ghost { background: linear-gradient(90deg, #c084fc, #f0abfc); }
.progress-fill.you { background: linear-gradient(90deg, #3ce38a, #38d9ff); }
input[type='range'] { accent-color: var(--accent); width: 160px; }

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