*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body {
  color: var(--text);
  background: var(--bg-0);
  min-height: 100vh;
  overflow: hidden;
  transition: background 0.2s;
}
body.black { background: #000; color: #fff; }
a { color: inherit; }
button { font-family: inherit; }

/* ============ Design Tokens ============ */
:root {
  --grad-blue: #4fb3ff;
  --grad-purple: #7c3aff;
  --grad: linear-gradient(135deg, #4fb3ff 0%, #7c3aff 100%);
  --grad-text: linear-gradient(135deg, #6bd8ff 0%, #a48bff 60%, #d9b0ff 100%);
}

/* Dark (default) */
:root, [data-theme="dark"] {
  --bg-0: #0a0a12;
  --bg-1: #14141e;
  --bg-2: #1a1a26;
  --card: rgba(20, 20, 30, 0.85);
  --card-solid: #14141e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #ffffff;
  --text-2: #a0a4b8;
  --text-3: #6b6f80;
  --surface-0: rgba(255, 255, 255, 0.03);
  --surface-1: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(255, 255, 255, 0.05);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.6);
}

/* Light */
[data-theme="light"] {
  --bg-0: #f5f5f7;
  --bg-1: #ffffff;
  --bg-2: #ffffff;
  --card: rgba(255, 255, 255, 0.85);
  --card-solid: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --text: #0a0a12;
  --text-2: #545766;
  --text-3: #8a8d9a;
  --surface-0: rgba(0, 0, 0, 0.03);
  --surface-1: rgba(0, 0, 0, 0.04);
  --surface-2: rgba(0, 0, 0, 0.07);
  --input-bg: rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.18);
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-solid);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  padding: 12px 20px;
  border-radius: 14px;
  color: var(--text);
  font-size: 14px;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
  max-width: 90%;
}
.toast.error { border-color: rgba(255, 80, 100, 0.5); }
.toast.success { border-color: rgba(52, 199, 89, 0.5); }
@keyframes toastIn {
  from {transform: translate(-50%, 20px); opacity: 0;}
  to {transform: translate(-50%, 0); opacity: 1;}
}

/* ============ Overlay + Sheets ============ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 500;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.overlay[hidden] { display: none; }
.sheet {
  background: var(--card-solid);
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 40px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  animation: sheetUp 0.28s cubic-bezier(.2,.9,.3,1);
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  margin: 0 auto 20px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
