:root {
  --bg: #f4f7f3;
  --bg-deep: #e7efe6;
  --ink: #1c2a22;
  --muted: #5c6b61;
  --line: #d5e0d6;
  --surface: rgba(255, 255, 255, 0.72);
  --accent: #2f6b4f;
  --accent-soft: #d9ebe1;
  --warn: #9a6b2f;
  --danger: #8b3a3a;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(28, 42, 34, 0.08);
  --font-ui: "Sora", sans-serif;
  --font-display: "Literata", Georgia, serif;
  --max: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #dff0e4 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #efe8d8 0%, transparent 45%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  min-height: 100vh;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #214c38; }

.wrap { width: min(var(--max), calc(100% - 2rem)); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(244, 247, 243, 0.78);
  border-bottom: 1px solid rgba(213, 224, 214, 0.8);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
  gap: 1rem;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}
.nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.nav a:hover { color: var(--ink); }

.hero {
  position: relative;
  min-height: min(78vh, 640px);
  display: grid;
  align-items: end;
  padding: 4.5rem 0 3rem;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(244,247,243,0.15), rgba(244,247,243,0.92)),
    url("/assets/hero.jpg") center/cover no-repeat,
    linear-gradient(135deg, #cfe5d6, #f3efe4 55%, #d7e4ef);
  z-index: -1;
  animation: wash 12s ease-in-out infinite alternate;
}
@keyframes wash {
  from { filter: saturate(1) brightness(1); }
  to { filter: saturate(1.08) brightness(1.03); }
}
.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0 0 0.75rem;
}
.hero p {
  max-width: 34rem;
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: #f7fbf8;
  box-shadow: 0 10px 24px rgba(47, 107, 79, 0.22);
}
.btn-primary:hover { background: #254f3a; color: #fff; }
.btn-ghost {
  background: rgba(255,255,255,0.7);
  color: var(--ink);
  border: 1px solid var(--line);
}
.search-shell {
  margin-top: 1.5rem;
  max-width: 40rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem;
  display: flex;
  gap: 0.35rem;
  box-shadow: var(--shadow);
  transition: box-shadow 180ms ease, border-color 180ms ease;
}
.search-shell:focus-within {
  border-color: #9bbfad;
  box-shadow: 0 0 0 4px rgba(47, 107, 79, 0.12), var(--shadow);
}
.search-shell input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0.85rem 1rem;
  font: inherit;
  outline: none;
}
.search-shell button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 0.85rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.section { padding: 2.75rem 0; }
.section h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
}
.section .lede { color: var(--muted); margin: 0 0 1.25rem; }

.topic-strip {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.topic-chip {
  display: inline-flex;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 160ms ease, transform 160ms ease;
}
.topic-chip:hover { background: #c7dfd1; transform: translateY(-1px); color: var(--ink); }

.list {
  display: grid;
  gap: 0.75rem;
}
.list a.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: rgba(255,255,255,0.55);
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.list a.row:hover {
  border-color: var(--line);
  background: #fff;
  transform: translateY(-1px);
}
.list .meta { color: var(--muted); font-size: 0.9rem; }
.list .name { font-weight: 600; }

.page-head { padding: 2.5rem 0 1rem; }
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}
.page-head p { color: var(--muted); margin: 0; max-width: 40rem; }

.cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.25rem 0; }

.prose {
  max-width: 42rem;
  background: rgba(255,255,255,0.55);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
}
.prose h2, .prose h3 { font-family: var(--font-display); letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.tiny { font-size: 0.85rem; }

.site-footer {
  margin-top: 3rem;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--line);
}
.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
}
.footer-tag { color: var(--muted); margin: 0.35rem 0 1rem; max-width: 28rem; }
.policy-links {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.policy-links a {
  color: #7a8a7f;
  font-size: 0.8rem;
  text-decoration: none;
}
.policy-links a:hover { color: var(--muted); }

.auth-box, .panel {
  width: min(420px, 100%);
  margin: 2rem auto;
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
label { display: block; font-size: 0.88rem; font-weight: 500; margin: 0.75rem 0 0.3rem; }
input[type="email"], input[type="password"], input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  font: inherit;
  background: #fff;
}
.error {
  background: #f8e8e8;
  color: var(--danger);
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
}

.tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0 1.25rem; }
.tabs a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
}
.tabs a.active {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

/* Study UI */
.study-shell {
  width: min(720px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
}
.progress {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 220ms ease;
}
.q-card {
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  animation: rise 220ms ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.q-text {
  font-size: 1.15rem;
  font-weight: 500;
  margin: 0 0 1rem;
}
.opts { display: grid; gap: 0.55rem; }
.opt {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font: inherit;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.opt:hover { border-color: #a7c4b3; }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.correct { border-color: var(--accent); background: #dff3e7; }
.opt.wrong { border-color: var(--danger); background: #f8e8e8; }
.explain {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: #f3f7f1;
  color: var(--ink);
  display: none;
}
.explain.show { display: block; animation: rise 200ms ease; }
.study-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.gate {
  margin-top: 1.25rem;
  padding: 1.1rem;
  border-radius: var(--radius);
  background: #fff8e8;
  border: 1px solid #ead7a8;
}

.faq { margin-top: 2rem; display: grid; gap: 0.75rem; }
.faq details {
  background: rgba(255,255,255,0.55);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
}
.faq summary { cursor: pointer; font-weight: 600; }

@media (max-width: 640px) {
  .nav { gap: 0.7rem; }
  .hero { min-height: 70vh; padding-top: 3rem; }
  .list a.row { grid-template-columns: 1fr; }
}
