/* ─── Variables ──────────────────────────────────────────── */
:root {
  --primary:       #2563EB;
  --primary-dark:  #1D4ED8;
  --primary-light: #EFF6FF;
  --primary-mid:   #BFDBFE;
  --bg:            #F8FAFC;
  --white:         #FFFFFF;
  --text:          #0F172A;
  --muted:         #64748B;
  --subtle:        #94A3B8;
  --border:        #E2E8F0;
  --border-dark:   #CBD5E1;
  --success:       #16A34A;
  --success-light: #F0FDF4;
  --danger:        #DC2626;
  --danger-light:  #FEF2F2;
  --warning:       #D97706;
  --warning-light: #FFFBEB;
  --shadow-sm:     0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
  --shadow:        0 4px 12px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.05);
  --shadow-lg:     0 10px 40px rgba(15,23,42,.12), 0 4px 16px rgba(15,23,42,.07);
  --shadow-xl:     0 20px 60px rgba(15,23,42,.16);
  --radius:        10px;
  --radius-lg:     16px;
  --radius-xl:     24px;
  --nav-h:         64px;
  --font:          'Inter', system-ui, -apple-system, sans-serif;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 20px;
}
.nav-logo {
  font-size: 19px; font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.6px;
  white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.nav-logo-mark {
  width: 30px; height: 30px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 15px; font-weight: 900;
  flex-shrink: 0;
}
.nav-logo-text { color: var(--text); }
.nav-logo-text em { color: var(--primary); font-style: normal; }

.nav-search {
  flex: 1; max-width: 440px;
  position: relative;
}
.nav-search input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 8px 16px 8px 40px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.nav-search input:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.nav-search .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; font-size: 15px;
  display: flex;
}

.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 4px; }
.nav-links a {
  padding: 7px 13px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--bg); color: var(--text); }
.nav-links a.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.nav-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
  color: white;
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.nav-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 192px;
  overflow: hidden;
  display: none;
  z-index: 200;
}
.nav-dropdown.open { display: block; }
.nav-dropdown a, .nav-dropdown button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  background: none; border: none;
  transition: background .15s;
  font-weight: 500;
}
.nav-dropdown a:hover, .nav-dropdown button:hover { background: var(--bg); }
.nav-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ─── Page wrapper ───────────────────────────────────────── */
.page { padding-top: calc(var(--nav-h) + 36px); min-height: 100vh; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 28px; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 28px; }
.container-xs { max-width: 480px; margin: 0 auto; padding: 0 28px; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  border: 2px solid transparent;
  transition: all .18s;
  white-space: nowrap;
  letter-spacing: .01em;
}
.btn-primary {
  background: var(--primary); color: white; border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary:hover {
  background: var(--primary-dark); border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(37,99,235,.4);
  transform: translateY(-1px);
}
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-lg { padding: 13px 28px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 8px; border-radius: 8px; }
.btn:disabled { opacity: .45; pointer-events: none; transform: none !important; box-shadow: none !important; }

/* ─── Form controls ──────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .6px;
}
.input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.input.error { border-color: var(--danger); }
.input::placeholder { color: #C1C9D6; }
textarea.input { resize: vertical; min-height: 90px; }
.form-error { color: var(--danger); font-size: 12px; margin-top: 5px; font-weight: 500; }

/* ─── Cards (set preview) ────────────────────────────────── */
.sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
}
.set-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  cursor: pointer;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  display: flex; flex-direction: column; gap: 10px;
}
.set-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--primary-mid);
}
.set-card-accent {
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, #7C3AED 100%);
  border-radius: 4px;
  margin-bottom: 2px;
  opacity: 0;
  transition: opacity .2s;
}
.set-card:hover .set-card-accent { opacity: 1; }
.set-card-title {
  font-size: 16px; font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.set-card-desc {
  font-size: 13px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.5;
}
.set-card-meta {
  margin-top: auto;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.set-card-count {
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px; border-radius: 20px;
  font-weight: 700; font-size: 12px;
}
.set-card-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
  color: white; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ─── Section title ──────────────────────────────────────── */
.section-title {
  font-size: 22px; font-weight: 800;
  color: var(--text); margin-bottom: 18px;
  display: flex; align-items: center; gap: 12px;
}
.section-title a { font-size: 13px; font-weight: 600; color: var(--primary); margin-left: auto; }
.section { margin-bottom: 56px; }

/* ─── Badge / pill ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-red { background: var(--danger-light); color: var(--danger); }

/* ─── Empty state ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 72px 24px;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; line-height: 1; }
.empty-state h3 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 15px; margin-bottom: 24px; }

/* ─── Loading spinner ────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 48px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; justify-content: center; }

/* ─── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1e293b; color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px; font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--danger); }
.toast.toast-success { background: var(--success); }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 36px;
  max-width: 480px; width: 100%;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(.97); transition: transform .22s, opacity .22s;
  opacity: 0;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); opacity: 1; }
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; }

/* ─── Hero (home page) ───────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1E3A8A 0%, var(--primary) 45%, #3B82F6 100%);
  color: white;
  text-align: center;
  padding: 0 24px 88px;
  margin-top: calc(-1 * var(--nav-h));
  padding-top: calc(var(--nav-h) + 96px);
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50px;
  padding: 5px 14px 5px 10px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 28px;
  backdrop-filter: blur(8px);
}
.hero-badge-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34D399; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(52,211,153,.3);
}
.hero h1 {
  font-size: 54px; font-weight: 900;
  line-height: 1.1; margin-bottom: 20px;
  letter-spacing: -1.5px;
  text-shadow: 0 2px 20px rgba(0,0,0,.2);
}
.hero h1 em { font-style: normal; opacity: .85; }
.hero p { font-size: 18px; opacity: .88; margin-bottom: 40px; max-width: 520px; margin-left: auto; margin-right: auto; line-height: 1.65; }
.hero-search {
  max-width: 560px; margin: 0 auto 44px;
  display: flex; gap: 10px;
  position: relative; z-index: 1;
}
.hero-search input {
  flex: 1; padding: 15px 22px;
  border-radius: 12px; border: none;
  font-size: 15px; outline: none;
  color: var(--text);
  box-shadow: 0 4px 24px rgba(0,0,0,.2);
}
.hero-search input:focus { box-shadow: 0 4px 24px rgba(0,0,0,.25), 0 0 0 3px rgba(255,255,255,.3); }
.hero-search button {
  background: white; color: var(--primary);
  border: none; border-radius: 12px;
  padding: 15px 28px; font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
}
.hero-search button:hover { background: var(--primary); color: white; transform: translateY(-1px); }
.hero-stats {
  display: flex; align-items: center; justify-content: center; gap: 32px;
  flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat-num { font-size: 22px; font-weight: 900; }
.hero-stat-label { font-size: 12px; opacity: .75; font-weight: 500; margin-top: 2px; }
.hero-stat-sep { width: 1px; height: 36px; background: rgba(255,255,255,.25); }
.hero-wave {
  position: absolute; bottom: -1px; left: 0; right: 0;
  height: 64px; background: var(--bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}

/* ─── Features section ───────────────────────────────────── */
.features-section {
  padding: 80px 0;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.features-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--primary);
  margin-bottom: 14px; text-align: center;
}
.features-title {
  font-size: 36px; font-weight: 900;
  color: var(--text); text-align: center;
  margin-bottom: 12px; letter-spacing: -.8px;
}
.features-sub {
  font-size: 17px; color: var(--muted); text-align: center;
  max-width: 520px; margin: 0 auto 56px; line-height: 1.65;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: all .2s;
  text-decoration: none; color: inherit;
  display: block;
}
.feature-card:hover {
  background: var(--white);
  border-color: var(--primary-mid);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.feature-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 16px;
}
.feature-icon-blue { background: var(--primary-light); }
.feature-icon-purple { background: #F3E8FF; }
.feature-icon-green { background: var(--success-light); }
.feature-icon-orange { background: var(--warning-light); }
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.feature-card p { font-size: 14px; color: var(--muted); line-height: 1.55; }

/* ─── Auth page ──────────────────────────────────────────── */
.auth-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  margin-top: 32px;
}
.auth-logo {
  text-align: center; font-size: 24px; font-weight: 900;
  margin-bottom: 6px;
}
.auth-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: var(--primary);
  border-radius: 12px;
  color: white; font-size: 20px; font-weight: 900;
  margin: 0 auto 12px;
}
.auth-tagline { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: var(--radius); padding: 4px; margin-bottom: 28px; gap: 4px; }
.auth-tab {
  flex: 1; padding: 9px; text-align: center;
  font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer;
  border-radius: 7px;
  transition: all .2s;
}
.auth-tab.active { background: var(--white); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-divider {
  text-align: center; position: relative; margin: 20px 0;
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 40%; height: 1px; background: var(--border);
}
.auth-divider::before { left: 0; } .auth-divider::after { right: 0; }
.btn-google {
  width: 100%; background: white; border: 1.5px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: 11px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all .2s;
}
.btn-google:hover { background: var(--bg); border-color: var(--border-dark); box-shadow: var(--shadow-sm); }
.auth-footer { text-align: center; font-size: 13px; color: var(--muted); margin-top: 20px; }
.auth-footer a { color: var(--primary); font-weight: 600; }

/* ─── Create set ─────────────────────────────────────────── */
.create-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px; flex-wrap: wrap; gap: 12px;
}
.create-header h1 { font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.create-fields { margin-bottom: 28px; }
.create-fields .input { font-size: 18px; font-weight: 600; }
.cards-list { display: flex; flex-direction: column; gap: 12px; }
.card-row {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
}
.card-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.card-row-header {
  background: var(--bg);
  padding: 8px 18px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
}
.card-row-num { margin-right: auto; }
.card-row-body {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
}
.card-row-body .card-input {
  padding: 18px;
  border: none; outline: none;
  font-size: 15px; color: var(--text);
  background: transparent;
  min-height: 76px; resize: none;
  width: 100%;
  transition: background .15s;
}
.card-row-body .card-input:focus { background: var(--primary-light); }
.card-row-body .card-divider { width: 1px; background: var(--border); }
.card-row-labels {
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 4px 18px 0;
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
}
.add-card-btn {
  background: var(--white);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-align: center;
  color: var(--primary);
  font-weight: 700; font-size: 15px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-top: 4px;
}
.add-card-btn:hover { border-color: var(--primary); background: var(--primary-light); }

/* ─── Set view page ──────────────────────────────────────── */
.set-hero {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 44px 0 36px;
}
.set-hero-title { font-size: 34px; font-weight: 900; margin-bottom: 12px; letter-spacing: -.6px; }
.set-hero-meta {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; font-size: 14px; color: var(--muted);
}
.set-hero-meta a { color: var(--primary); font-weight: 600; }
.study-modes {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin: 32px 0;
}
@media (max-width: 700px) { .study-modes { grid-template-columns: repeat(2, 1fr); } }
.study-mode-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 24px 16px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all .2s;
  text-decoration: none; color: var(--text);
}
.study-mode-btn:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  background: var(--primary-light);
}
.study-mode-icon {
  width: 48px; height: 48px;
  background: var(--bg);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  transition: background .2s;
}
.study-mode-btn:hover .study-mode-icon { background: white; }
.study-mode-label { font-size: 14px; font-weight: 700; }

.cards-preview { margin-top: 28px; }
.card-preview-item {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 8px;
  font-size: 15px;
  transition: border-color .2s;
}
.card-preview-item:hover { border-color: var(--primary-mid); }
.card-preview-term { font-weight: 600; }
.card-preview-def {
  color: var(--muted);
  border-left: 2px solid var(--border);
  padding-left: 18px;
}

/* ─── Flashcard study ────────────────────────────────────── */
.study-page { padding-top: calc(var(--nav-h) + 16px); min-height: 100vh; }
.study-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex; align-items: center; gap: 16px;
}
.study-bar .back-btn { color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; display: flex; align-items: center; }
.study-bar .back-btn:hover { color: var(--text); }
.study-bar .study-title {
  font-size: 15px; font-weight: 700; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.study-bar .progress-wrap { flex: 1; max-width: 200px; }
.progress-bar { height: 6px; background: var(--border); border-radius: 10px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #7C3AED 100%);
  border-radius: 10px; transition: width .35s ease;
}
.progress-label { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }

/* Flashcard flip */
.fc-area {
  display: flex; flex-direction: column; align-items: center;
  padding: 36px 24px 28px;
}
.fc-wrap {
  perspective: 1200px;
  width: 100%; max-width: 700px;
  height: 370px; margin-bottom: 32px;
  cursor: pointer;
}
.fc-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.4,0,.2,1);
}
.fc-wrap.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 44px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  user-select: none;
}
.fc-face-back { transform: rotateY(180deg); background: var(--primary-light); }
.fc-face .fc-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); margin-bottom: 18px;
}
.fc-face .fc-text {
  font-size: 28px; font-weight: 700; line-height: 1.3;
  color: var(--text);
}
.fc-hint { font-size: 13px; color: var(--subtle); margin-top: 20px; }

.fc-controls {
  display: flex; align-items: center; gap: 20px;
}
.fc-nav {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--white);
  border: 1.5px solid var(--border);
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s;
  color: var(--text);
}
.fc-nav:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); box-shadow: var(--shadow-sm); }
.fc-nav:disabled { opacity: .3; pointer-events: none; }
.fc-counter { font-size: 16px; font-weight: 700; color: var(--text); min-width: 64px; text-align: center; }

.fc-actions { display: flex; gap: 10px; margin-top: 12px; }

/* Know / Don't know buttons */
.fc-know-btns {
  display: flex; gap: 16px; margin-top: 24px;
  width: 100%; max-width: 420px; justify-content: center;
}
.fc-know-btn {
  flex: 1; padding: 13px;
  border-radius: var(--radius);
  font-size: 15px; font-weight: 700;
  border: 2px solid;
  cursor: pointer; transition: all .18s;
}
.fc-know-btn.dont { color: var(--danger); border-color: var(--danger); background: var(--danger-light); }
.fc-know-btn.dont:hover { background: var(--danger); color: white; transform: scale(1.02); }
.fc-know-btn.know { color: var(--success); border-color: var(--success); background: var(--success-light); }
.fc-know-btn.know:hover { background: var(--success); color: white; transform: scale(1.02); }

/* ─── Learn mode ─────────────────────────────────────────── */
.learn-area {
  max-width: 640px; margin: 44px auto; padding: 0 24px;
}
.learn-question-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  text-align: center;
  border: 1.5px solid var(--border);
}
.learn-q-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 14px; }
.learn-q-text { font-size: 24px; font-weight: 700; line-height: 1.35; color: var(--text); }

.learn-options { display: flex; flex-direction: column; gap: 10px; }
.learn-option {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 22px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; text-align: left;
  transition: all .15s;
  color: var(--text);
  width: 100%;
}
.learn-option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.learn-option.correct { border-color: var(--success); background: var(--success-light); color: var(--success); }
.learn-option.wrong { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }
.learn-option:disabled { cursor: default; }

.learn-type-area { display: flex; gap: 10px; }
.learn-type-area .input { flex: 1; }
.learn-feedback {
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  margin-top: 12px;
}
.learn-feedback.correct { background: var(--success-light); color: var(--success); }
.learn-feedback.wrong { background: var(--danger-light); color: var(--danger); }

.learn-controls { display: flex; justify-content: flex-end; margin-top: 16px; }

/* ─── Match game ─────────────────────────────────────────── */
.match-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: var(--white); border-bottom: 1px solid var(--border);
}
.match-timer {
  font-size: 22px; font-weight: 800; color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.match-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 32px 28px;
  max-width: 880px; margin: 0 auto;
}
.match-tile {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  text-align: center;
  min-height: 96px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  line-height: 1.4;
  color: var(--text);
  user-select: none;
}
.match-tile:hover:not(.matched):not(.disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.02);
  box-shadow: var(--shadow-sm);
}
.match-tile.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(37,99,235,.2);
}
.match-tile.matched {
  border-color: var(--success); background: var(--success-light);
  color: var(--success); pointer-events: none;
}
.match-tile.wrong { border-color: var(--danger); background: var(--danger-light); animation: shake .4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.match-tile.disabled { opacity: .35; pointer-events: none; }

/* ─── Test mode ──────────────────────────────────────────── */
.test-area { max-width: 700px; margin: 36px auto; padding: 0 28px; }
.test-question-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 16px;
  border: 1.5px solid var(--border);
}
.test-q-num { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 10px; }
.test-q-prompt { font-size: 18px; font-weight: 700; margin-bottom: 20px; line-height: 1.4; }
.test-options { display: flex; flex-direction: column; gap: 8px; }
.test-option {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 18px;
  cursor: pointer; font-size: 14px; font-weight: 600;
  text-align: left; background: none;
  color: var(--text);
  width: 100%;
  transition: all .15s;
}
.test-option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.test-option.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.test-option.correct { border-color: var(--success); background: var(--success-light); color: var(--success); }
.test-option.wrong { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }

/* Results */
.results-card {
  background: var(--white); border-radius: var(--radius-xl);
  padding: 48px 36px; text-align: center;
  box-shadow: var(--shadow-lg); max-width: 480px; margin: 52px auto;
  border: 1.5px solid var(--border);
}
.results-score { font-size: 80px; font-weight: 900; color: var(--primary); line-height: 1; }
.results-score span { font-size: 30px; color: var(--muted); }
.results-title { font-size: 24px; font-weight: 800; margin: 14px 0 6px; }
.results-sub { color: var(--muted); font-size: 15px; margin-bottom: 32px; }

/* ─── Dashboard ──────────────────────────────────────────── */
.dash-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 36px; flex-wrap: wrap;
}
.dash-header h1 { font-size: 28px; font-weight: 900; letter-spacing: -.5px; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .hero h1 { font-size: 36px; letter-spacing: -.8px; }
  .hero p { font-size: 16px; }
  .hero-search { flex-direction: column; }
  .hero-stat-sep { display: none; }
  .nav-search { display: none; }
  .auth-card { padding: 28px 20px; }
  .card-row-body { grid-template-columns: 1fr; }
  .card-row-body .card-divider { width: 100%; height: 1px; }
  .card-preview-item { grid-template-columns: 1fr; }
  .card-preview-def { border-left: none; border-top: 1px solid var(--border); padding-left: 0; padding-top: 10px; }
  .fc-face .fc-text { font-size: 22px; }
  .fc-wrap { height: 290px; }
  .match-area { grid-template-columns: 1fr; }
  .study-modes { grid-template-columns: repeat(2,1fr); }
  .set-hero-title { font-size: 26px; }
  .features-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .features-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 16px; }
}

/* ─── Utility ────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.fw-bold { font-weight: 700; }
.hidden { display: none !important; }
