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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Playful palette */
  --sky-50:  #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-200: #bae6fd;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;
  --sky-700: #0369a1;

  --coral-50:  #fff1f0;
  --coral-100: #ffe4e0;
  --coral-400: #fb7156;
  --coral-500: #f95a3a;
  --coral-600: #e04524;

  --sun-50:  #fffbeb;
  --sun-100: #fef3c7;
  --sun-300: #fcd34d;
  --sun-400: #fbbf24;
  --sun-500: #f59e0b;

  --lime-50:  #f7fee7;
  --lime-100: #ecfccb;
  --lime-400: #a3e635;
  --lime-500: #84cc16;
  --lime-600: #65a30d;

  --purple-50:  #faf5ff;
  --purple-100: #f3e8ff;
  --purple-400: #c084fc;
  --purple-500: #a855f7;
  --purple-600: #9333ea;

  --neutral-50:  #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-900: #171717;

  --white: #ffffff;
  --bg: #fefefe;

  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,.07);
  --shadow-md: 0 4px 20px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.12);
  --shadow-xl: 0 16px 56px rgba(0,0,0,.14);
}

html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--neutral-900); line-height: 1.6; overflow-x: hidden; }

h1,h2,h3,h4,h5 { font-family: var(--font-display); line-height: 1.2; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 26px; border-radius: var(--radius-pill); font-family: var(--font-body); font-weight: 700; font-size: 15px; cursor: pointer; transition: all .2s; border: none; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--coral-500); color: white; box-shadow: 0 4px 14px rgba(249,90,58,.35); }
.btn-primary:hover { background: var(--coral-600); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(249,90,58,.4); }
.btn-secondary { background: white; color: var(--neutral-700); border: 2px solid var(--neutral-200); }
.btn-secondary:hover { border-color: var(--neutral-400); background: var(--neutral-50); }
.btn-sky { background: var(--sky-500); color: white; box-shadow: 0 4px 14px rgba(14,165,233,.35); }
.btn-sky:hover { background: var(--sky-600); transform: translateY(-1px); }
.btn-white { background: white; color: var(--neutral-800); font-weight: 700; }
.btn-white:hover { background: var(--neutral-100); }
.btn-sm { padding: 8px 18px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Cards ── */
.card { background: white; border-radius: var(--radius-xl); border: 2px solid var(--neutral-100); padding: 24px; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; font-family: var(--font-body); }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-amber  { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-sky    { background: var(--sky-100); color: var(--sky-700); }
.badge-coral  { background: var(--coral-100); color: var(--coral-600); }
.badge-sun    { background: var(--sun-100); color: #92400e; }
.badge-purple { background: var(--purple-100); color: var(--purple-600); }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 14px; font-weight: 700; color: var(--neutral-700); margin-bottom: 7px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px 16px; border-radius: var(--radius-md);
  border: 2px solid var(--neutral-200); background: white;
  font-family: var(--font-body); font-size: 15px; color: var(--neutral-900);
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--sky-400); box-shadow: 0 0 0 4px rgba(56,189,248,.15);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-error { font-size: 12px; color: #dc2626; margin-top: 5px; font-weight: 600; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media(max-width:600px){ .form-grid-2 { grid-template-columns: 1fr; } }

/* ── Subject Pills ── */
.subject-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.subject-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-pill);
  border: 2px solid var(--neutral-200); background: white;
  cursor: pointer; transition: all .2s; font-weight: 700; font-size: 14px; color: var(--neutral-600);
}
.subject-pill:hover { border-color: var(--sky-400); color: var(--sky-600); background: var(--sky-50); }
.subject-pill.active { background: var(--sky-500); color: white; border-color: var(--sky-500); }
.pill-icon { font-size: 18px; }

/* ── Progress Bar ── */
.progress-bar { height: 10px; background: var(--neutral-100); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.progress-sky    { background: linear-gradient(90deg, var(--sky-400), var(--sky-500)); }
.progress-coral  { background: linear-gradient(90deg, var(--coral-400), var(--coral-500)); }
.progress-sun    { background: linear-gradient(90deg, var(--sun-300), var(--sun-500)); }
.progress-green  { background: #22c55e; }
.progress-sage   { background: var(--sky-500); }
.progress-terra  { background: var(--coral-500); }
.progress-amber  { background: var(--sun-400); }

/* ── Avatar ── */
.avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--sky-100); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--sky-700); font-size: 16px; flex-shrink: 0; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }

/* ── Toast ── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 360px; padding: 14px 18px; border-radius: var(--radius-lg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; display: flex; align-items: center; gap: 10px; }
.toast-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.toast-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.toast-info    { background: var(--sky-100); color: var(--sky-700); border: 1px solid var(--sky-200); }
@keyframes toastIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

/* ── Loading ── */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.85); display: flex; align-items: center; justify-content: center; z-index: 9998; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--sky-100); border-top-color: var(--sky-500); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ── Util ── */
.text-center { text-align: center; }
.text-sm  { font-size: 13px; }
.text-xs  { font-size: 12px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1{margin-top:4px} .mt-2{margin-top:8px} .mt-3{margin-top:12px} .mt-4{margin-top:16px}
.mb-1{margin-bottom:4px} .mb-2{margin-bottom:8px} .mb-3{margin-bottom:12px} .mb-4{margin-bottom:16px} .mb-6{margin-bottom:24px} .mb-8{margin-bottom:32px}
.gap-2{gap:8px} .gap-3{gap:12px} .gap-4{gap:16px}
.flex{display:flex} .flex-wrap{flex-wrap:wrap} .items-center{align-items:center} .justify-between{justify-content:space-between}
.w-full{width:100%} .mx-auto{margin-left:auto;margin-right:auto}
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.italic{font-style:italic}

/* ── Scrollbar ── */
::-webkit-scrollbar{width:6px;height:6px} ::-webkit-scrollbar-track{background:var(--neutral-50)} ::-webkit-scrollbar-thumb{background:var(--neutral-200);border-radius:3px}

/* ── Scroll animation ── */
.fade-up { opacity: 0; transform: translateY(28px); transition: opacity .55s ease, transform .55s ease; }
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* ── Container ── */
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
