@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --cream: #FFF7E6;
  --paper: #FFFDF6;
  --ink: #22422C;
  --ink-soft: #4B6155;
  --coral: #FF7A50;
  --coral-deep: #E85A2E;
  --sun: #FFC93C;
  --sky: #3FA7C0;
  --bloom: #E85A8A;
  --leaf: #6FA76F;
  --good: #3F9A5C;
  --bad: #D9483D;
  --line: rgba(34, 66, 44, 0.14);
  --shadow: rgba(34, 66, 44, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --cream: #12241A;
    --paper: #1B3226;
    --ink: #F3EFDD;
    --ink-soft: #C7D6C9;
    --coral: #FF8F63;
    --coral-deep: #FFA97D;
    --sun: #FFD66B;
    --sky: #6FCBE0;
    --bloom: #F27FA6;
    --leaf: #8FC28F;
    --good: #6FCF8E;
    --bad: #F0776D;
    --line: rgba(243, 239, 221, 0.16);
    --shadow: rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 1.02rem;
  line-height: 1.55;
}
h1, h2, h3 { font-family: 'Fredoka', system-ui, sans-serif; margin: 0 0 .4em; }
a { color: var(--coral-deep); }
p { margin: 0 0 1em; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px 64px; }
.wrap.narrow { max-width: 460px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--cream) 90%, transparent);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px);
}
.brand { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.brand .mark { width: 30px; height: 30px; border-radius: 50%; background: var(--coral); color: #fff5ee; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.nav-links { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: .92rem; }
.nav-links a, .nav-links form button { color: var(--ink-soft); text-decoration: none; }
.nav-links a:hover { color: var(--ink); }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px; box-shadow: 0 10px 26px -18px var(--shadow);
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; border-radius: 999px;
  padding: 11px 22px; font-weight: 800; font-size: .95rem; cursor: pointer;
  font-family: inherit; text-decoration: none; box-shadow: 0 6px 0 0 var(--coral-deep);
  transition: transform .1s ease;
}
.btn.primary { background: var(--coral); color: #fff5ee; }
.btn.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 0 var(--coral-deep); }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); box-shadow: none; padding: 9px 20px; }
.btn.small { padding: 7px 16px; font-size: .85rem; box-shadow: none; border: 1.5px solid var(--line); background: var(--cream); color: var(--ink); }
.btn.danger { background: var(--bad); color: #fff; box-shadow: 0 6px 0 0 color-mix(in srgb, var(--bad) 70%, black); }
.btn[disabled] { opacity: .55; cursor: default; }

label { display: block; font-weight: 800; font-size: .85rem; margin: 14px 0 6px; color: var(--ink-soft); }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--cream); color: var(--ink); font-family: inherit; font-size: 1rem;
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
form.inline { display: inline; }

.badge { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; font-weight: 800; font-size: .78rem; }
.badge.active { background: color-mix(in srgb, var(--good) 18%, var(--paper)); color: var(--good); }
.badge.suspended { background: color-mix(in srgb, var(--bad) 16%, var(--paper)); color: var(--bad); }
.badge.locked { background: color-mix(in srgb, var(--ink-soft) 16%, var(--paper)); color: var(--ink-soft); }
.badge.passed { background: color-mix(in srgb, var(--good) 18%, var(--paper)); color: var(--good); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: .92rem; }
th { color: var(--ink-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }

.bar-track { height: 9px; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }

.error-msg { background: color-mix(in srgb, var(--bad) 12%, var(--paper)); color: var(--bad); border: 1px solid var(--bad); border-radius: 12px; padding: 12px 16px; font-weight: 700; margin-bottom: 8px; }
.note { background: color-mix(in srgb, var(--sun) 20%, var(--paper)); border: 1px solid var(--sun); border-radius: 12px; padding: 14px 16px; font-weight: 700; }
.muted { color: var(--ink-soft); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.space-between { justify-content: space-between; }

footer.site { text-align: center; color: var(--ink-soft); font-weight: 700; font-size: .85rem; padding: 40px 20px; }

/* ---------- Lesson: teach cards ---------- */
.vcard { background: var(--cream); border: 1px solid var(--line); border-radius: 18px; padding: 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.vcard-art svg { width: 68px; height: 68px; }
.count-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 120px; }
.count-row svg { width: 15px; height: 15px; }
.quiz-prompt-art { text-align: center; margin-bottom: 12px; }
.quiz-prompt-art .count-row { max-width: 220px; margin: 0 auto; }
.quiz-prompt-art .count-row svg { width: 22px; height: 22px; }
.vcard-word { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 1.1rem; }
.speak-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.speak-btn svg { width: 16px; height: 16px; }

/* ---------- Lesson: quiz ---------- */
.quiz-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.quiz-progress .bar-track { flex: 1; }
.quiz-count { font-weight: 900; color: var(--ink-soft); font-size: .9rem; font-variant-numeric: tabular-nums; }
.quiz-prompt { text-align: center; font-size: clamp(1.25rem, 3vw, 1.7rem); margin-bottom: 20px; }
.quiz-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 480px; margin: 0 auto; }
.opt { background: var(--cream); border: 2px solid var(--line); border-radius: 16px; padding: 16px 10px; display: flex; align-items: center; justify-content: center; min-height: 64px; }
.opt svg { width: 56px; height: 56px; }
.opt-text { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 1.2rem; }
.opt.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--cream)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--cream)); }
.opt[disabled] { cursor: default; }
.quiz-feedback { text-align: center; margin-top: 18px; font-weight: 800; font-family: 'Fredoka', sans-serif; font-size: 1.1rem; min-height: 1.4em; }
.quiz-feedback.good { color: var(--good); }
.quiz-feedback.bad { color: var(--bad); }
.quiz-next { display: block; margin: 20px auto 0; }

.results { text-align: center; }
.stars-row { display: flex; justify-content: center; gap: 8px; margin: 4px 0 16px; }
.stars-row svg { width: 38px; height: 38px; }
.score-big { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: clamp(2.2rem, 6vw, 3rem); font-variant-numeric: tabular-nums; }
.score-msg { color: var(--ink-soft); font-weight: 800; margin: 6px 0 20px; }

/* ---------- Lesson list (tier view) ---------- */
.lesson-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.lesson-row:last-child { border-bottom: none; }
.lesson-row .lstep { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-family: 'Fredoka', sans-serif; background: var(--coral); color: #fff5ee; flex: none; }
.lesson-row.locked .lstep { background: var(--line); color: var(--ink-soft); }
.lesson-row .ltitle { font-weight: 800; }
