:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5c6b80;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --border: #dbe3ef;
  --ok: #0f766e;
  --err: #b91c1c;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(26, 35, 50, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef4ff 0%, var(--bg) 220px);
  line-height: 1.55;
}

.wrap {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.nav a:hover {
  color: var(--primary);
}

.nav a.btn-primary,
.nav a.btn-primary:hover {
  color: #fff;
}

.site-main {
  padding: 2rem 0 3rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-promo {
  padding: 2rem 0 1rem;
}

.hero h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  margin: 0.35rem 0 1rem;
}

.hero-promo h1 {
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  margin: 0.35rem 0 1rem;
  letter-spacing: -0.02em;
}

.lead {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 42rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin: 2.5rem 0;
}

.feature-card,
.panel,
.deck-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.feature-card {
  padding: 1.25rem;
}

.feature-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.cta-band {
  text-align: center;
  padding: 2rem 1.25rem;
  border-radius: var(--radius);
  background: #1e3a8a;
  color: #fff;
}

.cta-band p {
  color: #dbeafe;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--primary);
  border-color: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-lg {
  padding: 0.75rem 1.35rem;
}

.panel {
  padding: 1.5rem;
  margin-top: 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin: 0.85rem 0 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 500;
  margin-top: 1rem;
}

.checkbox input {
  margin-top: 0.25rem;
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
}

.search-bar input {
  flex: 1 1 220px;
}

.deck-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.deck-card {
  padding: 1.15rem 1.25rem;
}

.deck-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
}

.deck-card a {
  color: inherit;
  text-decoration: none;
}

.deck-desc {
  color: var(--muted);
  margin: 0.35rem 0;
}

.deck-meta,
.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.flash.ok {
  background: #ecfdf5;
  color: var(--ok);
}

.flash.err {
  background: #fef2f2;
  color: var(--err);
}

.empty {
  color: var(--muted);
  padding: 2rem 0;
}

.toolbar {
  margin: 1rem 0;
}

.preview-list {
  padding-left: 1.25rem;
}

.study-app {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.study-question {
  font-size: 1.25rem;
  margin: 0.5rem 0 1rem;
}

.study-choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.study-choices button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.study-choices button:hover:not(:disabled) {
  border-color: var(--primary);
}

.study-choices button.correct {
  border-color: var(--ok);
  background: #ecfdf5;
}

.study-choices button.incorrect {
  border-color: var(--err);
  background: #fef2f2;
}

.study-feedback {
  font-weight: 600;
  margin: 1rem 0 0.5rem;
}

.study-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.auth-modal-overlay[hidden] {
  display: none;
}

.auth-modal-panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  width: min(420px, 100%);
  position: relative;
  box-shadow: var(--shadow);
}

.auth-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {
  .nav {
    justify-content: flex-end;
  }
}
