:root {
  --ink: #1f3a2e;
  --paper: #f7fbf6;
  --leaf: #1a7a55;
  --leaf-dark: #0d4f38;
  --sun: #e8a317;
  --mist: #d7ebe2;
  --line: #c5ddd2;
  --ok: #1f8a70;
  --bad: #b42318;
  --muted: #5b7368;
  --shadow: 0 18px 40px rgba(13, 79, 56, 0.12);
  --font-display: "Be Vietnam Pro", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 45% at 0% 0%, #dff3ea 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 10%, #ffe9bf 0%, transparent 50%),
    linear-gradient(180deg, #f4faf6 0%, #e8f2ec 100%);
}

a { color: var(--leaf-dark); }
button, input, select, textarea { font: inherit; }

.site-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(247, 251, 246, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(197, 221, 210, 0.7);
}
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit;
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(145deg, var(--leaf), var(--leaf-dark));
  color: #fff; display: grid; place-items: center; font-weight: 800;
}
.brand b { font-family: var(--font-display); font-size: 1.15rem; }
.brand span { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.nav-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
  border: 0; border-radius: 999px; padding: 10px 16px; cursor: pointer; font-weight: 800;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--leaf-dark); color: #fff; box-shadow: 0 8px 20px rgba(13,79,56,.22); }
.btn-secondary { background: #fff; color: var(--leaf-dark); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--leaf-dark); }
.btn-danger { background: #fde8e6; color: var(--bad); }
.btn-sun { background: var(--sun); color: #1f2a22; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.hero {
  position: relative;
  min-height: calc(100svh - 72px);
  display: grid;
  align-items: end;
  overflow: hidden;
}
.hero-media {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(13,79,56,.78) 0%, rgba(13,79,56,.35) 42%, rgba(13,79,56,.15) 100%),
    url("/assets/learning-garden.png") center/cover no-repeat;
  transform: scale(1.02);
  animation: drift 18s ease-in-out infinite alternate;
}
.hero-copy {
  position: relative; z-index: 1;
  max-width: 640px;
  padding: clamp(28px, 6vw, 72px);
  color: #fff;
  animation: rise .8s ease both;
}
.hero-copy .eyebrow {
  display: inline-block; margin-bottom: 14px;
  font-size: .85rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  opacity: .92;
}
.hero-copy h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.05;
  font-weight: 800;
}
.hero-copy p {
  margin: 0 0 22px;
  max-width: 34rem;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  line-height: 1.55;
  opacity: .95;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }

.section {
  padding: clamp(40px, 7vw, 80px) clamp(16px, 4vw, 40px);
  max-width: 1120px; margin: 0 auto;
}
.section h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}
.section .lead { margin: 0 0 28px; color: var(--muted); max-width: 40rem; }

.feature-row {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: clamp(20px, 4vw, 40px);
  align-items: center;
}
.feature-row.reverse { grid-template-columns: .9fr 1.1fr; }
.feature-row img {
  width: 100%; border-radius: 28px; display: block;
  box-shadow: var(--shadow);
  animation: float 5s ease-in-out infinite;
}
.mascot-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.mascot-pair figure {
  margin: 0; padding: 16px; border-radius: 24px;
  background: #fff; box-shadow: var(--shadow);
  text-align: center;
}
.mascot-pair img { width: 100%; max-height: 180px; object-fit: contain; animation: float 4.5s ease-in-out infinite; }
.mascot-pair figcaption { margin-top: 8px; font-weight: 800; color: var(--leaf-dark); }
.mascot-pair figure:nth-child(2) img { animation-delay: .4s; }

.grade-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.grade-strip a,
.grade-strip button {
  text-decoration: none; color: inherit;
  padding: 18px 12px; border-radius: 18px; text-align: center;
  background: #fff; border: 1px solid var(--line);
  font-weight: 800; transition: border-color .15s, transform .15s;
  cursor: pointer; font: inherit;
}
.grade-strip a:hover,
.grade-strip button:hover { border-color: var(--leaf); transform: translateY(-2px); }
.grade-strip b { display: block; font-family: var(--font-display); font-size: 1.3rem; color: var(--leaf-dark); }

.final-cta {
  margin: 0 clamp(16px, 4vw, 40px) 60px;
  padding: clamp(28px, 5vw, 48px);
  border-radius: 28px;
  background: linear-gradient(135deg, var(--leaf-dark), #196b4c);
  color: #fff;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center;
}
.final-cta h2 { margin: 0 0 6px; font-family: var(--font-display); }
.final-cta p { margin: 0; opacity: .92; }

.dialog-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 40, 30, .45);
  display: grid; place-items: center; padding: 16px;
}
.dialog {
  width: min(480px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
  animation: rise .25s ease both;
}
.dialog h3 { margin: 0 0 6px; font-family: var(--font-display); }
.dialog p.hint { margin: 0 0 14px; color: var(--muted); font-size: .92rem; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: .85rem; font-weight: 800; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; background: #fbfffd;
}
.field textarea { min-height: 88px; resize: vertical; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.alert {
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-weight: 700; font-size: .92rem;
}
.alert-ok { background: #e5f7f1; color: var(--ok); }
.alert-bad { background: #fdecea; color: var(--bad); }
.hidden { display: none !important; }

/* Admin */
.admin-shell { max-width: 1200px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 28px) 60px; }
.admin-top {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start;
  margin-bottom: 18px;
}
.admin-top h1 { margin: 0; font-family: var(--font-display); font-size: 1.8rem; }
.admin-top p { margin: 4px 0 0; color: var(--muted); }
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-nav .btn.on { background: var(--leaf-dark); color: #fff; }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px;
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 1.15rem; font-family: var(--font-display); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: end; }
.toolbar .field { margin: 0; min-width: 120px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.badge {
  display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: .75rem; font-weight: 800;
}
.badge-pending { background: #fff3d6; color: #8a5a00; }
.badge-approved { background: #e5f7f1; color: var(--ok); }
.badge-rejected { background: #fdecea; color: var(--bad); }
.badge-off { background: #eee; color: #666; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.split {
  display: grid; grid-template-columns: 320px 1fr; gap: 14px;
}
.lesson-list { max-height: 70vh; overflow: auto; }
.lesson-item {
  width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer;
  padding: 10px; border-radius: 12px; border: 1px solid transparent;
}
.lesson-item:hover, .lesson-item.on { background: var(--mist); border-color: var(--line); }
.lesson-item b { display: block; font-size: .95rem; }
.lesson-item span { font-size: .8rem; color: var(--muted); }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.editor-grid .full { grid-column: 1 / -1; }
.ex-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: #fbfffd;
}
.ex-card header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-weight: 800; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes drift {
  from { transform: scale(1.02) translate3d(0,0,0); }
  to { transform: scale(1.06) translate3d(-1.5%, 1%, 0); }
}

@media (max-width: 900px) {
  .feature-row, .feature-row.reverse, .split, .editor-grid { grid-template-columns: 1fr; }
  .grade-strip { grid-template-columns: repeat(2, 1fr); }
  .hero { min-height: calc(100svh - 64px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
