:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: rgba(15, 23, 42, 0.09);
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 75% 45% at 15% -10%, rgba(37, 99, 235, 0.09), transparent),
    radial-gradient(ellipse 60% 40% at 90% 5%, rgba(16, 185, 129, 0.08), transparent);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  display: grid;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 4px 20px -6px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.04);
}
.auth-card { width: 100%; max-width: 440px; }
.paywall-card { width: 100%; max-width: 560px; display: grid; gap: 16px; }
.clerk-mount { margin-top: 14px; }

.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  box-shadow: 0 6px 14px -4px rgba(37, 99, 235, 0.45);
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }

.eyebrow { font-size: 10.5px; letter-spacing: 0.14em; color: var(--primary); font-weight: 700; }
h1 { margin: 4px 0 0; font-size: 21px; font-weight: 700; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }
.muted-text { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 18px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.kpi-card:nth-child(1) { border-top: 3px solid #2563eb; }
.kpi-card:nth-child(2) { border-top: 3px solid #10b981; }
.kpi-card:nth-child(3) { border-top: 3px solid #6366f1; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-sm { font-size: 15px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.lang-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

input {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
}
.search-input { width: 240px; }
@media (max-width: 640px) { .search-input { width: 100%; } }
.inline-row { display: flex; gap: 8px; margin-top: 6px; }
label span { font-size: 12px; font-weight: 600; color: var(--muted); }

.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: linear-gradient(180deg, #2563eb, #1d4ed8); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border-color: rgba(15, 23, 42, 0.14); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.status-ok { background: #ecfdf5; color: #047857; }

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.vocab-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
  display: grid;
  gap: 6px;
}
.vocab-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vocab-word { font-size: 16px; font-weight: 700; }
.vocab-trans { font-size: 14px; color: var(--primary); font-weight: 600; }
.vocab-ctx { font-size: 12.5px; color: var(--muted); margin: 0; }
.tag {
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: #334155;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
}

.flashcard-stage { display: grid; gap: 16px; justify-items: center; padding: 10px 0; }
.flashcard {
  width: 100%;
  max-width: 520px;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: 0 12px 28px -12px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  display: grid;
  gap: 12px;
  align-content: center;
  text-align: center;
}
.fc-meta { display: flex; justify-content: center; gap: 8px; align-items: center; }
.fc-word { font-size: 28px; font-weight: 800; }
.fc-ipa { font-size: 14px; color: var(--muted); }
.fc-translation { font-size: 24px; font-weight: 700; color: var(--primary); }
.fc-context { font-size: 14px; color: #334155; margin: 8px 0 0; }
.fc-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.feedback {
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.feedback.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
