:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #0f3d2e;
  --primary-light: #e7f4ee;
  --accent: #d4af37;
  --danger: #fff7ed;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 84px;
}

.topbar {
  background: linear-gradient(135deg, #0f3d2e, #155c45);
  color: white;
  padding: 22px 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 24px; line-height: 1.1; margin-bottom: 0; }
h2 { font-size: 24px; margin: 12px 0 16px; }
h3 { font-size: 18px; margin-bottom: 8px; }
p { color: var(--muted); line-height: 1.55; }
.eyebrow { color: #d7f5e7; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }

main { max-width: 980px; margin: -14px auto 0; padding: 0 14px; }
.page { display: none; }
.page.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}
.hero h2 { font-size: 28px; }
.grid { display: grid; gap: 12px; }
.two { grid-template-columns: 1fr 1fr; }
.stat span { display: block; font-size: 34px; font-weight: 800; color: var(--primary); }
.stat p { margin-bottom: 0; }
.warning { background: var(--danger); }
.locked { background: #f9fafb; }

button {
  border: none;
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}
button:hover { opacity: .93; }
.ghost { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); }

.list { display: grid; gap: 12px; }
.lesson, .term, .entry {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.lesson.done { background: var(--primary-light); border-color: #b7dbc9; }
.lesson-header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.badge { font-size: 12px; background: #eef2ff; color: #3730a3; padding: 5px 9px; border-radius: 999px; }
.done .badge { background: var(--primary); color: white; }

.form-card label { display: block; margin: 12px 0 6px; font-weight: 700; }
input, textarea, .search {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 15px;
  background: white;
}
textarea { min-height: 90px; resize: vertical; }
.search { margin-bottom: 14px; }
.result { display: none; }
.result.active { display: block; }
.result strong { color: var(--primary); }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px;
  gap: 6px;
}
.bottom-nav button {
  background: transparent;
  color: var(--muted);
  padding: 10px 4px;
  font-size: 12px;
}
.bottom-nav button.active { color: var(--primary); background: var(--primary-light); }

@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .bottom-nav { position: sticky; bottom: auto; top: 0; max-width: 980px; margin: 0 auto; border-radius: 0 0 18px 18px; }
  main { padding-top: 14px; }
  .hero h2 { max-width: 620px; }
}
.lesson-summary { font-weight: 650; color: #263238; }
.lesson-section { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.lesson-section h4, .quiz-box h4 { margin: 0 0 6px; font-size: 15px; color: var(--primary); }
.lesson-content p { margin-bottom: 0; }
.quiz-box { background: var(--primary-light); border: 1px solid #cfeadd; border-radius: 14px; padding: 12px 14px; margin: 14px 0; }
.quiz-box ol { margin: 6px 0 0 20px; padding: 0; color: var(--text); }
.quiz-box li { margin-bottom: 6px; line-height: 1.45; }
