:root {
  --olive: #6b7043;
  --olive-dark: #4d5231;
  --olive-soft: #e8eadb;
  --wine: #7a2e3a;
  --wine-dark: #5e202b;
  --wine-soft: #f2dfe2;
  --cream: #f6f1e7;
  --paper: #fffdf8;
  --ink: #2c2a27;
  --muted: #706c65;
  --line: #ded7ca;
  --shadow: 0 18px 46px rgba(62, 52, 42, .10);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { background: var(--cream); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 100% 0, rgba(122,46,58,.10), transparent 32rem), var(--cream); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 920px); min-height: 100vh; margin: 0 auto; background: rgba(255,253,248,.7); position: relative; padding-bottom: 92px; box-shadow: 0 0 70px rgba(68, 59, 48, .08); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: max(14px, env(safe-area-inset-top)) 20px 14px; background: rgba(246,241,231,.92); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(107,112,67,.12); }
.brand { display: flex; align-items: center; gap: 12px; border: 0; padding: 0; background: transparent; color: var(--ink); text-align: left; }
.brand-mark { display: grid; place-items: center; width: 42px; aspect-ratio: 1; border-radius: 14px 14px 14px 5px; background: var(--wine); color: white; font: 700 22px/1 Georgia, serif; box-shadow: 0 8px 22px rgba(122,46,58,.22); }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 17px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.icon-button { width: 43px; aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--olive-dark); }
.icon-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
main { min-height: calc(100vh - 170px); padding: 22px 20px 30px; }
.eyebrow { margin: 0 0 9px; color: var(--wine); font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; line-height: 1.12; }
h1 { font-size: clamp(34px, 7vw, 54px); }
h2 { font-size: clamp(25px, 5vw, 34px); }
h3 { font-size: 20px; }
p { line-height: 1.62; }
.muted { color: var(--muted); }
.hero { position: relative; overflow: hidden; padding: 30px; border-radius: 30px; color: white; background: linear-gradient(135deg, var(--olive-dark), var(--olive) 68%, #7f8254); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; width: 170px; height: 170px; right: -60px; top: -54px; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,.05), 0 0 0 58px rgba(255,255,255,.04); }
.hero p { max-width: 590px; margin: 12px 0 22px; color: rgba(255,255,255,.82); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.button { min-height: 48px; padding: 0 18px; border: 0; border-radius: 15px; background: var(--wine); color: white; font-weight: 750; box-shadow: 0 9px 24px rgba(94,32,43,.18); }
.button:hover { background: var(--wine-dark); }
.button.secondary { background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.28); box-shadow: none; }
.button.light { background: var(--paper); color: var(--wine); border: 1px solid var(--line); box-shadow: none; }
.button.wide { width: 100%; }
.section { margin-top: 28px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-heading button { border: 0; background: transparent; color: var(--wine); font-weight: 750; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { padding: 15px; border: 1px solid rgba(255,255,255,.18); border-radius: 18px; background: rgba(255,255,255,.08); }
.stat strong, .stat span { display: block; }
.stat strong { font: 700 24px/1 Georgia, serif; }
.stat span { margin-top: 6px; font-size: 12px; color: rgba(255,255,255,.72); }
.feature-card { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 22px; border-radius: var(--radius); background: linear-gradient(135deg, var(--wine), #8e3d49); color: white; box-shadow: var(--shadow); }
.feature-card p { margin: 8px 0 0; color: rgba(255,255,255,.78); }
.feature-number { display: grid; place-items: center; width: 74px; aspect-ratio: 1; border-radius: 24px 24px 24px 8px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); font: 700 26px/1 Georgia, serif; }
.cards { display: grid; gap: 12px; }
.course-card, .task-card, .profile-card, .chat-card { border: 1px solid var(--line); border-radius: 21px; background: var(--paper); box-shadow: 0 8px 24px rgba(51,45,39,.05); }
.course-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; width: 100%; padding: 17px; color: inherit; text-align: left; }
.course-card:disabled { cursor: default; opacity: .58; }
.locked-card { cursor: pointer; }
.course-index { display: grid; place-items: center; width: 48px; aspect-ratio: 1; border-radius: 15px; background: var(--olive-soft); color: var(--olive-dark); font-weight: 800; }
.course-card.available .course-index { background: var(--wine-soft); color: var(--wine); }
.course-copy strong, .course-copy small { display: block; }
.course-copy strong { font-size: 16px; line-height: 1.3; }
.course-copy small { margin-top: 5px; color: var(--muted); }
.chevron { color: var(--wine); font-size: 22px; }
.progress { height: 8px; border-radius: 99px; background: #e8e1d6; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--wine), #a8505d); transition: width .3s ease; }
.progress-row { display: flex; justify-content: space-between; gap: 12px; margin: 14px 0 8px; color: var(--muted); font-size: 13px; }
.page-head { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.back { flex: 0 0 auto; display: grid; place-items: center; width: 42px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font-size: 22px; }
.intro-card { padding: 22px; border-radius: var(--radius); background: var(--olive-soft); color: var(--olive-dark); }
.intro-card p:last-child { margin-bottom: 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin: 20px 0; border-radius: 16px; background: #e8e1d6; }
.tab { border: 0; border-radius: 12px; padding: 11px; background: transparent; color: var(--muted); font-weight: 750; }
.tab.active { background: var(--paper); color: var(--wine); box-shadow: 0 4px 12px rgba(57,48,41,.08); }
.task-card { padding: 18px; }
.task-top { display: flex; align-items: flex-start; gap: 12px; }
.check { flex: 0 0 auto; display: grid; place-items: center; width: 30px; aspect-ratio: 1; border: 2px solid #b9b3a8; border-radius: 10px; background: transparent; color: white; }
.check.done { border-color: var(--olive); background: var(--olive); }
.task-card p { margin: 10px 0 0; color: var(--muted); }
.task-detail { margin: 14px 0 0 42px; padding-top: 14px; border-top: 1px solid var(--line); }
.task-detail strong { color: var(--wine); }
.task-detail ul { padding-left: 20px; line-height: 1.55; }
.lesson-content { max-width: 720px; margin: 0 auto; }
.lesson-content h1 { font-size: clamp(30px, 6vw, 46px); }
.lesson-content h3 { margin-top: 26px; color: var(--wine); }
.lesson-content p, .lesson-content li { font-size: 17px; line-height: 1.68; }
.lesson-content ul, .lesson-content ol { padding-left: 24px; }
.lesson-note { margin: 24px 0; padding: 20px; border-radius: 20px; background: var(--olive-soft); color: var(--olive-dark); }
.lesson-footer { position: sticky; bottom: 78px; padding-top: 18px; background: linear-gradient(transparent, var(--cream) 22%); }
.quiz { display: grid; gap: 10px; margin-top: 20px; }
.quiz-option { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); text-align: left; }
.quiz-option.selected { border-color: var(--olive); background: var(--olive-soft); }
.profile-card, .chat-card { padding: 22px; }
.avatar { display: grid; place-items: center; width: 76px; aspect-ratio: 1; margin-bottom: 16px; border-radius: 26px 26px 26px 8px; background: var(--wine); color: white; font: 700 28px/1 Georgia, serif; }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.settings-row:first-of-type { margin-top: 20px; }
.message-list { display: grid; gap: 12px; min-height: 220px; }
.message { width: fit-content; max-width: 82%; padding: 12px 14px; border-radius: 17px 17px 17px 5px; background: var(--olive-soft); line-height: 1.45; }
.message.own { margin-left: auto; border-radius: 17px 17px 5px 17px; background: var(--wine); color: white; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 18px; }
.chat-form input { min-width: 0; border: 1px solid var(--line); border-radius: 15px; padding: 13px 14px; background: var(--paper); color: var(--ink); }
.chat-form button { width: 48px; border: 0; border-radius: 15px; background: var(--wine); color: white; font-size: 20px; }
.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 920px); display: grid; grid-template-columns: repeat(4, 1fr); padding: 9px 12px max(9px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,253,248,.95); backdrop-filter: blur(18px); }
.nav-item { display: grid; justify-items: center; gap: 3px; border: 0; padding: 6px 2px; background: transparent; color: #7f7a72; font-size: 11px; }
.nav-item span { font-size: 21px; line-height: 1; }
.nav-item.active { color: var(--wine); font-weight: 750; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 98px; transform: translate(-50%, 25px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: white; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.hero-eyebrow { color: #f3d7dc; }
.status { flex: 0 0 auto; padding: 7px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status.open { color: var(--olive-dark); background: var(--olive-soft); }
.status.locked { color: var(--wine); background: var(--wine-soft); }
.access-card { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; margin-top: 22px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.access-card p { margin: 8px 0; color: var(--muted); }
.access-icon { display: grid; place-items: center; width: 48px; aspect-ratio: 1; border-radius: 16px; background: var(--wine-soft); font-size: 22px; }
.access-form { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.access-form input, .teacher-form input { min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; background: #fff; color: var(--ink); }
.welcome { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 16px; padding: 12px 16px; border-radius: 16px; background: var(--olive-soft); color: var(--olive-dark); font-weight: 700; }
.welcome button, .teacher-link, .student-card button { border: 0; background: transparent; color: var(--wine); font-weight: 800; }
.locked-panel { padding: 42px 22px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.locked-panel > span { font-size: 38px; }
.locked-panel h2 { margin-top: 14px; }
.locked-panel p { max-width: 500px; margin: 10px auto 0; color: var(--muted); }
.loading { padding: 70px 20px; text-align: center; color: var(--muted); }
.full-text { margin-top: 28px; }
.full-text p, .full-intro p, .result-card p { margin: 12px 0; font-size: 17px; line-height: 1.72; }
.full-text h3, .full-intro h3, .result-card h3 { margin: 30px 0 12px; color: var(--wine); }
.text-space { height: 9px; }
.text-bullet { padding-left: 22px; text-indent: -20px; }
.text-number { padding-left: 20px; }
.result-card, .test-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.test-card { background: var(--wine-soft); }
.teacher-link { display: block; margin: 28px auto 0; padding: 10px; }
.teacher-form { display: grid; gap: 14px; margin-top: 20px; }
.teacher-form > label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 750; }
.teacher-form fieldset { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; }
.teacher-form legend { padding: 0 8px; font-weight: 800; }
.student-card { display: flex; justify-content: space-between; gap: 15px; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.student-card strong, .student-card small { display: block; }
.student-card small { margin-top: 4px; color: var(--muted); }
.student-card p { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.error-text { color: var(--wine); }
@media (min-width: 720px) {
  main { padding: 34px 42px 52px; }
  .topbar { padding-inline: 42px; }
  .cards.two-col { grid-template-columns: 1fr 1fr; }
  .hero { padding: 38px; }
  .bottom-nav { position: sticky; margin-top: -76px; border: 1px solid var(--line); border-radius: 22px 22px 0 0; }
}
@media (max-width: 520px) {
  .access-form { grid-template-columns: 1fr; }
  .status { font-size: 10px; }
  .course-card { grid-template-columns: auto 1fr auto; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
