/* 复习通 — Design Tokens
   Teal/cyan cool tones · Card-based · iOS motion */

:root {
  /* === Color Palette (OKLch) === */
  --bg:           oklch(97% 0.006 200);
  --bg-warm:      oklch(96% 0.008 200);
  --surface:      oklch(100% 0 0);
  --surface-hover:oklch(98% 0.004 200);
  --fg:           oklch(18% 0.015 220);
  --fg-secondary: oklch(35% 0.015 210);
  --muted:        oklch(52% 0.018 210);
  --border:       oklch(90% 0.008 210);
  --border-light: oklch(94% 0.005 200);

  /* Primary accent — teal */
  --accent:       oklch(58% 0.12 190);
  --accent-hover: oklch(52% 0.14 190);
  --accent-active:oklch(46% 0.12 190);
  --accent-light: oklch(92% 0.04 190);
  --accent-on:    oklch(100% 0 0);

  /* Secondary — blue */
  --secondary:    oklch(60% 0.10 250);
  --secondary-light: oklch(92% 0.03 250);

  /* Status */
  --success:      oklch(62% 0.17 155);
  --success-light:oklch(93% 0.05 155);
  --warn:         oklch(75% 0.15 85);
  --warn-light:   oklch(95% 0.05 85);
  --danger:       oklch(58% 0.20 25);
  --danger-light: oklch(93% 0.05 25);

  /* === Typography === */
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif;
  --font-mono:    'SF Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* Scale (px) */
  --text-xs:    0.75rem;
  --text-sm:    0.875rem;
  --text-base:  1rem;
  --text-lg:    1.125rem;
  --text-xl:    1.25rem;
  --text-2xl:   1.5rem;
  --text-3xl:   2rem;
  --text-4xl:   2.5rem;
  --text-5xl:   clamp(2.5rem, 5vw, 3.5rem);

  --leading-tight:  1.2;
  --leading-normal: 1.5;
  --leading-relaxed:1.65;
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide:  0.02em;

  /* === Spacing (4px scale) === */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* === Radius === */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-2xl:  28px;
  --radius-full: 9999px;

  /* === Shadows (iOS-like subtle) === */
  --shadow-sm:  0 1px 2px oklch(0% 0 0 / 0.04);
  --shadow-md:  0 2px 8px oklch(0% 0 0 / 0.06), 0 1px 2px oklch(0% 0 0 / 0.04);
  --shadow-lg:  0 4px 16px oklch(0% 0 0 / 0.08), 0 2px 4px oklch(0% 0 0 / 0.04);
  --shadow-xl:  0 8px 32px oklch(0% 0 0 / 0.10), 0 2px 8px oklch(0% 0 0 / 0.04);
  --shadow-card:0 1px 3px oklch(0% 0 0 / 0.04), 0 0 0 1px oklch(0% 0 0 / 0.02);
  --shadow-float:0 8px 30px oklch(0% 0 0 / 0.12);

  /* === Motion (iOS spring-like) === */
  --ease-out:    cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:   150ms;
  --duration-normal: 250ms;
  --duration-slow:   400ms;

  /* === Layout === */
  --max-width:  1200px;
  --sidebar-w:  260px;
  --header-h:   64px;
  --bottom-bar: 80px;
  --safe-top:   env(safe-area-inset-top, 0px);
  --safe-bottom:env(safe-area-inset-bottom, 0px);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--fg);
  background: var(--bg);
  overflow-x: hidden;
}

/* === iOS-like glass card === */
.glass-card {
  background: oklch(100% 0 0 / 0.72);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid oklch(100% 0 0 / 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform var(--duration-normal) var(--ease-spring),
              box-shadow var(--duration-normal) var(--ease-out);
}

.glass-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* === Card (standard) === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: transform var(--duration-normal) var(--ease-spring),
              box-shadow var(--duration-normal) var(--ease-out);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-on);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); transform: scale(0.97); }

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--muted); }
.btn-secondary:active { transform: scale(0.97); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { color: var(--fg); background: var(--surface-hover); }

.btn-lg {
  padding: 14px 28px;
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  line-height: 1;
}
.badge-accent  { background: var(--accent-light); color: var(--accent); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warn    { background: var(--warn-light); color: var(--warn); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }

/* === Inputs === */
.input {
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--fg);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  width: 100%;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(58% 0.12 190 / 0.15);
}
.input::placeholder { color: var(--muted); }

/* === Progress bar === */
.progress {
  height: 6px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

/* === Utility === */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-6); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fade-in { animation: fadeIn var(--duration-normal) var(--ease-out) both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.slide-up { animation: slideUp var(--duration-slow) var(--ease-spring) both; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.scale-in { animation: scaleIn var(--duration-normal) var(--ease-spring) both; }
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.stagger > * { animation: fadeIn var(--duration-normal) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; }
.stagger > *:nth-child(7) { animation-delay: 300ms; }
.stagger > *:nth-child(8) { animation-delay: 350ms; }
