:root {
  font-family: Vazirmatn, Tahoma, Arial, sans-serif;
  color: #1d2a22;
  background: #f5f7f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green: #286448;
  --muted: #4b5c51;
  --line: #d6dfd7;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
.app-shell { max-width: 1440px; min-height: 100vh; margin: auto; display: grid; grid-template-columns: 252px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 32px 22px 20px; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 15px; color: white; background: var(--green); font-size: 25px; font-weight: 800; }
.brand b, .brand small, .profile b, .profile small { display: block; }
.brand b { font-size: 17px; }
.brand small, .profile small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.profile { width: 100%; margin: 42px 0 24px; padding: 14px 11px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 16px; background: #f7f9f6; color: inherit; text-align: right; cursor: pointer; font-size: 12px; }
.profile:hover { background: #edf4ee; }
.avatar { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px; background: #e4f2e9; font-size: 22px; }
.sidebar nav { display: grid; gap: 7px; }
.nav-item { padding: 12px 13px; display: flex; align-items: center; gap: 12px; border-radius: 12px; color: #718078; text-decoration: none; font-size: 20px; }
.nav-item span { font-size: 13px; }
.nav-item.active { background: #eaf4ed; color: var(--green); font-weight: 700; }
.sidebar-note { margin-top: auto; padding: 15px; border: 1px solid #f6ead5; border-radius: 16px; background: #fff5e8; font-size: 12px; }
.sidebar-note > span { font-size: 20px; }
.sidebar-note b { display: block; margin: 8px 0 4px; }
.sidebar-note p { margin: 0; color: #7e776d; line-height: 1.8; }
.version { margin: 14px 3px 0; color: #a0aaa3; font-size: 10px; }
.main-content { width: 100%; max-width: 1120px; margin: auto; padding: 35px 48px 24px; }
.topbar { margin-bottom: 25px; display: flex; align-items: center; justify-content: space-between; }
.eyebrow { color: #88978d; font-size: 11px; font-weight: 600; }
.topbar h1 { margin: 4px 0; font-size: 25px; }
.topbar h1 span { font-size: 20px; }
.topbar p { margin: 0; color: var(--muted); font-size: 12px; }
.current-stage { min-width: 128px; padding: 9px 13px; display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.current-stage small { color: var(--muted); font-size: 10px; }
.current-stage b { color: var(--green); font-size: 12px; }
.grade-picker { display: grid; gap: 6px; color: #748179; font-size: 11px; }
.grade-picker select { min-width: 150px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 11px; outline-color: var(--green); color: #33453b; background: white; }
.welcome-card { min-height: 238px; padding: 30px 34px; position: relative; overflow: hidden; display: flex; align-items: center; border-radius: 24px; color: white; background: linear-gradient(115deg,#286448,#337957); }
body[data-mood="playful"] .welcome-card { background: linear-gradient(115deg,#26704f,#54a47b); }
body[data-mood="bright"] .welcome-card { background: linear-gradient(115deg,#335f8d,#6797c2); }
body[data-mood="calm"] .welcome-card { background: linear-gradient(115deg,#343e6b,#586ba1); }
.welcome-copy { max-width: 480px; position: relative; z-index: 2; }
.pill { padding: 5px 10px; display: inline-block; border: 1px solid #ffffff40; border-radius: 99px; color: #e0f2e5; font-size: 10px; }
.welcome-copy h2 { margin: 10px 0 4px; font-size: 25px; line-height: 1.6; }
.welcome-copy p { max-width: 410px; margin: 0 0 14px; color: #d6e8da; font-size: 11px; line-height: 1.9; }
.button { padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 11px; text-decoration: none; font-size: 12px; font-weight: 600; cursor: pointer; }
.button-light { color: var(--green); background: white; }
.button-primary { color: white; background: var(--green); }
.button-secondary { color: var(--green); background: #eef4ef; }
.welcome-art { width: 300px; height: 220px; position: absolute; left: 3%; bottom: 0; }
.sun { width: 75px; height: 75px; position: absolute; left: 64px; top: 17px; border-radius: 50%; background: #e9c46a; }
.book { position: absolute; left: 90px; top: 70px; z-index: 2; font-size: 108px; filter: drop-shadow(0 9px 0 #173c2b22); }
.hill { width: 350px; height: 200px; position: absolute; left: -20px; bottom: -105px; border-radius: 50%; background: #347553; }
body[data-mood="bright"] .hill { background: #477cab; }
body[data-mood="calm"] .hill { background: #46578a; }
.sparkle { position: absolute; color: #f9daa0; font-size: 28px; }
.s1 { left: 28px; top: 72px; }
.s2 { left: 207px; top: 43px; }
.school-bag, .pencil { position: absolute; z-index: 2; font-size: 33px; filter: drop-shadow(0 3px 0 #173c2b22); }
.school-bag { left: 218px; top: 113px; }
.pencil { left: 42px; top: 135px; transform: rotate(-22deg); }
.stats { margin: 18px 0 28px; display: grid; grid-template-columns: repeat(3,1fr); gap: 13px; }
.stat-card { padding: 14px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.stat-card small, .stat-card b { display: block; }
.stat-card small { color: var(--muted); font-size: 10px; }
.stat-card b { margin-top: 3px; font-size: 15px; }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; }
.green { color: #317150; background: #e5f3e9; }
.yellow { color: #bb8731; background: #fff3d8; }
.blue { color: #5581b3; background: #e6eff9; }
.section-heading { margin-bottom: 14px; display: flex; align-items: end; justify-content: space-between; }
.section-heading h2 { margin: 4px 0 0; font-size: 17px; }
.section-hint { color: var(--muted); font-size: 10px; }
.grade-path { margin: 22px 0 27px; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.path-heading { margin-bottom: 13px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.path-heading h2 { margin: 4px 0 0; font-size: 15px; }
.path-heading > small { color: var(--muted); font-size: 9px; }
.grade-track { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; padding: 2px 1px 8px; }
.grade-group { border: 1px solid var(--line); border-radius: 14px; background: #f9faf8; overflow: hidden; }
.grade-group > summary { min-height: 52px; padding: 9px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #34463a; cursor: pointer; list-style: none; }
.grade-group > summary::-webkit-details-marker, .catalog-body summary::-webkit-details-marker { display: none; }
.grade-group > summary b, .grade-group > summary small { display: block; }
.grade-group > summary b { font-size: 13px; }
.grade-group > summary small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.grade-chevron { color: var(--green); font-size: 17px; transition: transform .2s; }
.grade-group[open] .grade-chevron { transform: rotate(180deg); }
.grade-options { padding: 0 10px 10px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.grade-choice { min-height: 38px; padding: 6px; border: 1px solid #e4eae3; border-radius: 10px; color: #637269; background: #fff; font-size: 10px; cursor: pointer; }
.grade-choice:hover, .grade-choice.selected { border-color: #6da783; color: var(--green); background: #eaf4ed; }
.catalog-trigger { padding: 9px 13px; flex: 0 0 auto; font-size: 11px; }
.catalog-dialog { width: min(760px,calc(100% - 24px)); overflow-y: auto; }
.catalog-body { display: grid; gap: 9px; }
.catalog-grade-group, .catalog-grade, .catalog-subject { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.catalog-grade-group { padding: 10px; background: #f7f9f6; }
.catalog-body summary { padding: 9px 11px; color: #34463a; cursor: pointer; list-style: none; }
.catalog-grade-group > summary { font-size: 14px; font-weight: 700; }
.catalog-grade { margin: 6px 0; padding: 2px 7px; }
.catalog-grade > summary { font-size: 12px; font-weight: 600; }
.catalog-subject { margin: 5px 0; padding: 1px 7px; background: #fbfcfa; }
.catalog-subject > summary { font-size: 11px; }
.catalog-chapters { margin: 0 8px 9px; padding-right: 23px; color: #6b7970; font-size: 10px; line-height: 2; }
.catalog-empty { margin: 0 11px 10px; color: var(--muted); font-size: 11px; }
.catalog-open-course { margin: 0 10px 6px; font-size: 10px; }
.subject-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.subject-card { min-height: 148px; padding: 17px; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); border-radius: 17px; background: white; transition: transform .2s,box-shadow .2s; }
.subject-card:hover { transform: translateY(-2px); box-shadow: 0 7px 25px #1b41210c; }
.subject-icon { width: 44px; height: 44px; margin-bottom: 11px; display: grid; place-items: center; border-radius: 14px; font-size: 23px; }
.subject-card h3 { margin: 0 0 3px; font-size: 13px; }
.subject-card p { margin: 0 0 12px; color: var(--muted); font-size: 10px; }
.subject-card button { padding: 0; border: 0; color: var(--green); background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }
.subject-progress { width: 100%; height: 4px; margin-top: auto; margin-bottom: 9px; overflow: hidden; border-radius: 9px; background: #eef1ed; }
.subject-progress i { height: 100%; display: block; border-radius: 9px; background: #68a47d; }
.main-content footer { margin: 25px 0; color: #8c9890; font-size: 10px; line-height: 1.8; }
.dialog { width: min(560px,calc(100% - 28px)); max-height: min(85vh,760px); padding: 24px; border: 0; border-radius: 20px; color: #26332d; box-shadow: 0 20px 80px #15281b35; }
.dialog::backdrop { background: #12251b83; backdrop-filter: blur(3px); }
.dialog-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog h2 { margin: 3px 0 0; font-size: 18px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 11px; color: #718078; background: white; font: 24px Arial,sans-serif; cursor: pointer; }
.dialog-description { margin-bottom: 8px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.chapter-list { margin-top: 18px; display: grid; gap: 9px; }
.chapter-row { padding: 12px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; }
.chapter-row.locked { opacity: .55; background: #f8f9f7; }
.chapter-number { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px; color: var(--green); background: #eaf4ed; font-size: 12px; font-weight: 700; }
.chapter-row h3 { margin: 0; font-size: 12px; }
.chapter-row p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.chapter-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.chapter-row button { padding: 8px 10px; border: 0; border-radius: 9px; color: white; background: var(--green); font-size: 10px; font-weight: 600; cursor: pointer; }
.chapter-row button.chapter-exam { color: var(--green); background: #eaf4ed; }
.chapter-row button:disabled { color: #9aa49c; background: #eef1ed; cursor: not-allowed; }
.lesson-body { margin: 17px 0; padding: 16px; border-radius: 14px; color: #4c5d53; background: #f7f9f6; font-size: 13px; line-height: 2; }
.lesson-body h3 { margin: 0 0 6px; color: #26332d; font-size: 14px; }
.lesson-body p { margin: 8px 0; }
.dictation-practice { margin: 14px 0; padding: 16px; border: 2px solid #b6d3bd; border-radius: 16px; background: #f4faf5; }
.dictation-practice h3 { margin: 0; color: #234b32; font-size: 17px; }
.dictation-practice > p { margin: 7px 0 10px; color: #405349; font-size: 14px; line-height: 1.9; }
.dictation-practice textarea { width: 100%; min-height: 100px; padding: 12px; border: 2px solid #b9cbbd; border-radius: 12px; color: #1d2a22; background: white; font: inherit; font-size: 16px; line-height: 1.8; resize: vertical; }
.dictation-practice textarea:focus { outline: 3px solid #bddbc5; border-color: #286448; }
.dictation-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.dictation-practice #dictationFeedback { min-height: 24px; margin: 8px 0 0; color: #234b32; font-size: 14px; font-weight: 700; }
.text-button { padding: 5px 0; border: 0; color: var(--green); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.listen-button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 4px 0 12px; padding: 9px 13px; border-radius: 12px; background: #eaf4ed; font-size: 14px; }
.trace-practice { margin: 12px 0 16px; padding: 12px; border: 1px solid #e2eae2; border-radius: 14px; background: #fbfcfa; }
.trace-practice > div { display: flex; align-items: center; justify-content: space-between; color: #637269; font-size: 11px; }
.trace-practice canvas { width: 100%; height: 125px; margin-top: 8px; display: block; border: 1px dashed #c9d7cb; border-radius: 10px; background: white; touch-action: none; }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.question-meta { margin: 18px 0 10px; display: flex; justify-content: space-between; color: #829087; font-size: 11px; }
.question-card { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #f7f9f6; }
.question-card h3 { margin: 0 0 13px; font-size: 15px; line-height: 1.8; }
.answers { display: grid; gap: 8px; }
.answer-option { padding: 11px 13px; border: 1px solid #e3eae4; border-radius: 11px; color: #3d4b42; background: white; text-align: right; font-size: 12px; cursor: pointer; }
.answer-option:hover { border-color: #90b49a; }
.answer-option.correct { border-color: #5b9b70; background: #e8f5eb; }
.answer-option.wrong { border-color: #e7937b; background: #fff0eb; }
.answer-option:disabled { cursor: default; }
.feedback { min-height: 27px; margin: 10px 0; color: var(--green); font-size: 12px; }
.result-box { padding: 24px 8px; text-align: center; }
.result-emoji { font-size: 48px; }
.result-box h3 { margin: 8px; font-size: 19px; }
.result-box p { color: var(--muted); font-size: 12px; line-height: 1.9; }
.score-ring { width: 92px; height: 92px; margin: 14px auto; display: grid; place-items: center; border: 7px solid #e5f3e9; border-radius: 50%; color: var(--green); font-size: 21px; font-weight: 800; }
.result-actions { margin-top: 18px; display: flex; justify-content: center; gap: 9px; }
.form-label { margin: 22px 0; display: grid; gap: 8px; color: #637269; font-size: 12px; }
#trackField[hidden] { display: none; }
  .form-label input, .form-label select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; outline-color: var(--green); background: white; font: inherit; font-size: 14px; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.mobile-tabs { display: none; }


@media (max-width: 1050px) {
  .subject-grid { grid-template-columns: repeat(2,1fr); }
  .main-content { padding: 30px; }
}

@media (max-width: 720px) {
  .app-shell { display: block; padding-bottom: 68px; }
  .sidebar { display: none; }
  .main-content { padding: 23px 17px 20px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 21px; }
  .topbar p { max-width: 220px; line-height: 1.8; }
  .current-stage { min-width: auto; padding: 8px 10px; }
  .current-stage b { max-width: 95px; font-size: 10px; }
  .welcome-card { min-height: 240px; padding: 22px; }
  .welcome-copy { max-width: 70%; }
  .welcome-copy h2 { font-size: 21px; }
  .welcome-copy p { font-size: 10px; }
  .welcome-art { left: -62px; opacity: .56; }
  body[data-mood="playful"] .welcome-art { transform: scale(1.06); }
  body[data-mood="calm"] .welcome-art { opacity: .7; }
  .stats { gap: 7px; }
  .stat-card { padding: 10px 8px; gap: 7px; }
  .stat-icon { width: 29px; height: 29px; }
  .stat-card small { font-size: 9px; }
  .stat-card b { font-size: 13px; }
  .section-heading { align-items: flex-start; gap: 8px; }
  .grade-path { margin: 17px 0 22px; padding: 13px; }
  .path-heading { align-items: flex-start; }
  .path-heading h2 { font-size: 13px; }
  .path-heading > small { max-width: 110px; line-height: 1.7; text-align: left; }
  .section-heading h2 { font-size: 15px; }
  .catalog-trigger { padding: 8px 10px; white-space: nowrap; font-size: 10px; }
  .grade-track { grid-template-columns: 1fr; }
  .grade-options { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .subject-grid { gap: 9px; }
  .subject-card { min-height: 145px; padding: 13px; }
  .subject-card h3 { font-size: 12px; }
  .mobile-tabs { position: fixed; z-index: 4; right: 0; bottom: 0; left: 0; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); display: flex; justify-content: space-around; border-top: 1px solid var(--line); background: white; }
  .mobile-tabs a { display: grid; justify-items: center; gap: 2px; color: #718078; text-decoration: none; font-size: 10px; }
  .mobile-tabs a:first-child { color: var(--green); font-weight: 700; }
  .mobile-tabs b { font-size: 18px; }
  .dialog { padding: 19px; }
  .chapter-row { grid-template-columns: 32px 1fr; }
  .chapter-actions { grid-column: 2; justify-content: flex-start; }
  .lesson-actions .button { flex: 1; }
}

/* Readability: keep supporting text comfortably legible on laptop and phone. */
.brand small, .profile small, .sidebar-note p, .version, .eyebrow,
.topbar p, .current-stage small, .grade-picker, .grade-group > summary small,
.section-hint, .path-heading > small, .grade-choice, .catalog-chapters,
.catalog-empty, .catalog-open-course, .subject-card p, .subject-card button,
.main-content footer, .dialog-description, .chapter-row p, .text-button,
.trace-practice > div, .question-meta, .answer-option, .feedback,
.result-box p, .form-label, .stat-card small, .mobile-tabs a {
  color: #435449;
  font-size: 13px;
}
.topbar p, .welcome-copy p, .dialog-description, .lesson-body,
.chapter-row p, .answer-option, .feedback, .result-box p { line-height: 1.9; }
.welcome-copy p { color: #f3fff5; font-size: 14px; }
.pill { color: #fff; font-size: 12px; }
.section-heading h2, .path-heading h2 { font-size: 18px; }
.subject-card h3, .chapter-row h3 { font-size: 15px; }
.subject-card button, .chapter-row button, .button, .catalog-trigger { font-size: 13px; }
.lesson-body { color: #34463a; font-size: 16px; }
.lesson-body h3 { font-size: 17px; }
.question-card h3 { font-size: 18px; }
.answer-option { color: #26382d; font-size: 15px; }
.listen-button { color: #174d31; font-size: 15px; font-weight: 700; }
.chapter-number { font-size: 14px; }
.question-meta { flex-wrap: wrap; gap: 6px 12px; color: #435449; }
.grade-group > summary b, .catalog-grade-group > summary { font-size: 15px; }
.catalog-grade > summary { font-size: 14px; }
.catalog-subject > summary { font-size: 13px; }
.button-primary { background: #1f5738; }
.nav-item, .icon-button { color: #405348; }
.grade-choice { color: #354a3c; }
.subject-card p, .chapter-row p { color: #46584d; }
.sidebar-note p, .main-content footer, .catalog-chapters { color: #4c5c51; }
.eyebrow, .version { color: #45584b; }
