:root {
  --ink: #17211b;
  --muted: #69736d;
  --paper: #f7f6f1;
  --card: #ffffff;
  --green: #176b4d;
  --green-2: #24936b;
  --mint: #dff3e9;
  --lime: #c8f04b;
  --amber: #ffb84d;
  --red: #d94d4d;
  --line: #e7e7e1;
  --shadow: 0 14px 40px rgba(23, 33, 27, .08);
  --radius: 24px;
  --app-safe-top: max(env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px));
  --app-safe-bottom: max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overscroll-behavior-y: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
body { padding: var(--app-safe-top) 0 var(--app-safe-bottom); }
#app { width: min(100%, 620px); margin: 0 auto; min-height: 100vh; padding-bottom: 94px; }
.page { padding: 22px 18px 30px; animation: appear .24s ease; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 850; font-size: 22px; letter-spacing: -.04em; }
.logo { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--ink); color: var(--lime); font-size: 22px; transform: rotate(-3deg); }
.avatar { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--mint); color: var(--green); font-weight: 800; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(30px, 8vw, 42px); line-height: 1.04; letter-spacing: -.055em; }
h2 { font-size: 25px; letter-spacing: -.035em; }
.muted { color: var(--muted); line-height: 1.48; }
.screen-translation { margin: -17px 0 20px 50px; color: var(--muted); font-size: 13px; font-weight: 650; }
.bilingual-copy span, .bilingual-copy small { display: block; }
.bilingual-copy small { margin-top: 5px; color: #8a928d; font-size: 13px; }
.hero { position: relative; overflow: hidden; min-height: 270px; border-radius: 30px; padding: 25px; color: white; background: linear-gradient(145deg, #0d4935, #177253); box-shadow: var(--shadow); }
.hero:after { content: ''; position: absolute; width: 180px; height: 180px; right: -45px; bottom: -65px; border-radius: 50%; background: var(--lime); opacity: .95; }
.hero-road { position: absolute; width: 130px; height: 220px; right: 25px; top: 25px; border-radius: 70px 70px 0 0; background: #29332d; transform: rotate(20deg); opacity: .95; }
.hero-road:after { content: ''; position: absolute; width: 5px; height: 140px; left: 62px; top: 20px; background: repeating-linear-gradient(to bottom, #fff 0 14px, transparent 14px 28px); opacity: .75; }
.hero-content { position: relative; z-index: 2; width: 70%; }
.hero h1 { max-width: 340px; }
.hero p { color: rgba(255,255,255,.75); line-height: 1.4; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 12px; font-weight: 750; margin-bottom: 26px; }
.btn { min-height: 54px; border: 0; border-radius: 17px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 800; transition: transform .15s ease, opacity .15s ease; }
.btn:active { transform: scale(.98); }
.btn-primary { color: var(--ink); background: var(--lime); }
.btn-dark { color: white; background: var(--ink); }
.btn-soft { color: var(--green); background: var(--mint); }
.btn-ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.btn-wide { width: 100%; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 28px 2px 14px; }
.section-head h2 { margin: 0; }
.link { border: 0; background: none; color: var(--green); font-weight: 750; padding: 5px; }
.daily { display: grid; grid-template-columns: 78px 1fr; gap: 16px; align-items: center; padding: 18px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.ring { --p: 68; width: 72px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green-2) calc(var(--p) * 1%), var(--mint) 0); position: relative; font-weight: 850; }
.ring:before { content: ''; position: absolute; inset: 7px; background: white; border-radius: 50%; }
.ring span { position: relative; font-size: 15px; }
.daily h3 { margin-bottom: 4px; }
.daily p { margin-bottom: 0; font-size: 14px; color: var(--muted); }
.cards { display: grid; gap: 12px; }
.mode-card { width: 100%; border: 0; text-align: left; padding: 18px; border-radius: 21px; background: var(--card); display: grid; grid-template-columns: 48px 1fr 24px; align-items: center; gap: 14px; box-shadow: 0 7px 22px rgba(23,33,27,.045); }
.mode-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: #f0f2ed; font-size: 22px; }
.mode-card h3 { margin: 0 0 4px; font-size: 17px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 13px; }
.arrow { color: #a7aea9; font-size: 24px; }
.nav { position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 620px); display: grid; grid-template-columns: repeat(4, 1fr); padding: 9px 10px calc(9px + var(--app-safe-bottom)); background: rgba(255,255,255,.92); border-top: 1px solid rgba(0,0,0,.05); backdrop-filter: blur(18px); }
.nav button { border: 0; background: transparent; color: #89908b; display: grid; place-items: center; gap: 3px; font-size: 11px; font-weight: 650; }
.nav .active { color: var(--green); }
.nav-icon { font-size: 21px; height: 25px; }
.progress-head { background: var(--ink); color: white; margin: -22px -18px 22px; padding: 25px 20px 30px; border-radius: 0 0 30px 30px; }
.progress-head .muted { color: rgba(255,255,255,.65); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { padding: 18px; border-radius: 20px; background: white; }
.stat strong { display: block; font-size: 28px; letter-spacing: -.04em; }
.stat span { color: var(--muted); font-size: 13px; }
.topic { border: 0; width: 100%; background: white; border-radius: 20px; padding: 17px; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 14px; }
.topic h3 { margin: 0 0 5px; font-size: 17px; }
.topic p { margin: 0; font-size: 13px; color: var(--muted); }
.topic small { display: block; margin-top: 7px; color: #9aa19c; font-size: 11px; }
.learn-summary { margin: 18px 0; padding: 18px 20px; border-radius: 20px; background: var(--ink); color: white; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 14px; }
.learn-summary span { color: rgba(255,255,255,.68); font-size: 13px; }
.learn-summary span small { display: block; margin-top: 3px; color: rgba(255,255,255,.48); }
.learn-summary strong { grid-row: 1 / 3; grid-column: 2; font-size: 38px; line-height: 1; letter-spacing: -.05em; }
.learn-summary small { font-size: 14px; font-weight: 750; }
.topic-count { width: 50px; min-width: 50px; max-width: 50px; height: 50px; min-height: 50px; aspect-ratio: 1; align-self: center; color: var(--green); background: var(--mint); border-radius: 50%; padding: 0; display: inline-grid; place-items: center; white-space: nowrap; font-weight: 850; font-size: 12px; line-height: 1; }
.quiz { min-height: calc(100vh - 30px); display: flex; flex-direction: column; }
.quiz-top { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 9px; margin-bottom: 10px; }
.icon-btn { border: 0; background: white; width: 42px; height: 42px; border-radius: 14px; font-size: 19px; }
.quiz-meta { text-align: center; font-size: 13px; color: var(--muted); }
.bar { height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 24px; }
.bar span { display: block; height: 100%; background: var(--green-2); transition: width .3s ease; }
.question-card { flex: 1; }
.question-media { margin: 0 0 18px; overflow: hidden; border-radius: 20px; background: white; box-shadow: 0 6px 20px rgba(23,33,27,.05); }
.question-media img { display: block; width: 100%; max-height: 290px; object-fit: contain; background: #f3f3ef; }
.question-media figcaption { padding: 8px 12px; color: var(--muted); font-size: 11px; text-align: right; }
.question-media a { color: var(--green); font-weight: 750; text-decoration: none; }
.language-toggle { display: inline-flex; border: 0; background: #fff1d8; color: #a85c00; border-radius: 10px; padding: 8px 11px; font-weight: 800; font-size: 13px; margin-bottom: 14px; }
.question-es { font-size: 23px; line-height: 1.3; letter-spacing: -.025em; margin-bottom: 8px; }
.question-ru { padding-left: 13px; border-left: 3px solid var(--amber); color: var(--muted); line-height: 1.45; margin-bottom: 18px; }
.answers { display: grid; gap: 10px; margin-top: 20px; }
.answer { width: 100%; border: 2px solid transparent; border-radius: 19px; background: white; padding: 16px; display: grid; grid-template-columns: 27px 1fr; gap: 11px; text-align: left; box-shadow: 0 5px 18px rgba(23,33,27,.04); }
.answer.selected { border-color: var(--amber); background: #fffaf1; }
.answer.correct { border-color: var(--green-2); background: #effaf5; }
.answer.wrong { border-color: var(--red); background: #fff4f4; }
.choice { width: 23px; height: 23px; border: 2px solid #c9cec9; border-radius: 50%; display: grid; place-items: center; }
.selected .choice:after { content: ''; width: 11px; height: 11px; border-radius: 50%; background: var(--amber); }
.answer-es { display: block; font-weight: 700; line-height: 1.35; }
.answer-ru { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; line-height: 1.35; }
.quiz-actions { display: grid; grid-template-columns: 1fr 58px; gap: 10px; margin-top: 20px; position: sticky; bottom: 8px; }
.explanation { margin-top: 18px; background: var(--mint); border-radius: 20px; padding: 18px; }
.explanation h3 { margin-bottom: 10px; color: var(--green); }
.explanation h3 small, .eyebrow small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0; text-transform: none; }
.explanation p { margin-bottom: 8px; line-height: 1.45; }
.translation { color: var(--muted); }
.terms { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.term { padding: 7px 9px; border-radius: 9px; background: white; font-size: 12px; font-weight: 700; }
.full-rule { margin: 18px -4px -4px; padding: 17px; border-radius: 16px; background: white; }
.full-rule p { line-height: 1.55; }
.full-rule small { display: block; margin-top: 8px; color: var(--muted); }
.source-link { color: var(--green); font-size: 13px; font-weight: 800; text-decoration: none; }
.result { text-align: center; padding-top: 40px; }
.result-mark { width: 104px; height: 104px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 36px; background: var(--mint); font-size: 48px; transform: rotate(-5deg); }
.result strong { font-size: 58px; letter-spacing: -.06em; }
.notice { border-radius: 16px; padding: 13px 15px; background: #fff1d8; color: #8c560f; font-size: 13px; line-height: 1.4; margin: 16px 0; }
.admin-card { background: white; border-radius: 20px; padding: 18px; }
.admin-list { display: grid; gap: 10px; }
.admin-row { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 95px; transform: translate(-50%, 20px); background: var(--ink); color: white; padding: 12px 16px; border-radius: 13px; opacity: 0; pointer-events: none; transition: .2s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 35px 20px; border: 1px dashed #ccd1cc; border-radius: 20px; text-align: center; color: var(--muted); }
.loader { display: grid; place-items: center; min-height: 80vh; font-weight: 800; color: var(--green); }
.curriculum-summary { display: grid; grid-template-columns: 1fr 84px; gap: 16px; align-items: center; padding: 20px; margin: 18px 0 12px; border-radius: 24px; color: white; background: linear-gradient(145deg, #10271d, #176b4d); box-shadow: var(--shadow); }
.curriculum-summary strong { display: block; font-size: 38px; letter-spacing: -.05em; }
.curriculum-summary p { margin: 3px 0 0; color: rgba(255,255,255,.65); font-size: 12px; }
.curriculum-summary .eyebrow { color: var(--lime); }
.curriculum-summary .eyebrow small { color: rgba(255,255,255,.55); }
.study-ring { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; position: relative; background: conic-gradient(var(--lime) calc(var(--p) * 1%), rgba(255,255,255,.13) 0); }
.study-ring:before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: #18523e; }
.study-ring span { position: relative; font-weight: 850; font-size: 14px; }
.continue-card { width: 100%; display: grid; grid-template-columns: 46px 1fr; gap: 13px; align-items: center; border: 0; padding: 15px; text-align: left; border-radius: 20px; color: var(--ink); background: var(--lime); }
.continue-card small, .continue-card strong, .continue-card em { display: block; }
.continue-card small { margin-bottom: 3px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.continue-card strong { font-size: 15px; }
.continue-card em { margin-top: 2px; color: #3f4d38; font-size: 12px; font-style: normal; }
.complete-banner { margin: 12px 0; padding: 16px; border-radius: 18px; color: var(--green); background: var(--mint); font-weight: 850; text-align: center; }
.module-list { display: grid; gap: 12px; }
.module-card { width: 100%; display: grid; grid-template-columns: 44px 1fr 54px; gap: 12px; align-items: center; border: 1px solid transparent; padding: 16px 14px; text-align: left; border-radius: 22px; color: var(--ink); background: white; box-shadow: 0 7px 22px rgba(23,33,27,.04); }
.module-card.ready { border-color: #b9decf; }
.module-number { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--ink); color: var(--lime); font-weight: 900; }
.module-copy strong, .module-copy em, .module-copy small { display: block; }
.module-copy strong { font-size: 16px; line-height: 1.25; }
.module-copy em { margin: 3px 0 6px; color: var(--muted); font-size: 13px; font-style: normal; }
.module-copy small { color: #929a95; font-size: 10px; }
.status { display: inline-flex; width: fit-content; margin-top: 8px; padding: 5px 8px; border-radius: 8px; color: #59635d; background: #f0f2ef; font-size: 9px; font-weight: 800; }
.status-ready { color: var(--green); background: var(--mint); }
.module-progress { --p: 0; width: 52px; height: 52px; position: relative; display: grid; place-items: center; flex: 0 0 52px; border-radius: 50%; background: conic-gradient(var(--green-2) calc(var(--p) * 1%), var(--mint) 0); }
.module-progress:before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: white; }
.module-progress b { position: relative; font-size: 10px; }
.subhead { display: grid; grid-template-columns: 42px 1fr 45px; gap: 11px; align-items: center; margin-bottom: 20px; }
.subhead div small, .subhead div strong, .subhead div em { display: block; }
.subhead div small { margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.subhead div strong { font-size: 17px; line-height: 1.2; }
.subhead div em { margin-top: 2px; color: var(--muted); font-size: 11px; font-style: normal; }
.mini-progress { text-align: right; color: var(--green); font-size: 12px; font-weight: 850; }
.module-hero { padding: 20px; border-radius: 24px; background: white; box-shadow: 0 8px 25px rgba(23,33,27,.05); }
.module-hero p { margin-bottom: 8px; line-height: 1.5; }
.lesson-bar { margin: 18px 0 0; }
.lesson-list { display: grid; gap: 10px; margin-top: 18px; }
.lesson-row { width: 100%; display: grid; grid-template-columns: 38px 1fr 15px; gap: 12px; align-items: center; border: 0; padding: 14px; text-align: left; border-radius: 18px; color: var(--ink); background: white; }
.lesson-row.done { background: #f1faf6; }
.lesson-index { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: #eef0ec; color: var(--muted); font-weight: 850; }
.lesson-row.done .lesson-index { color: white; background: var(--green-2); }
.lesson-row strong, .lesson-row em { display: block; }
.lesson-row strong { font-size: 14px; }
.lesson-row em { margin-top: 3px; color: var(--muted); font-size: 11px; font-style: normal; }
.practice-gate { margin-top: 20px; padding: 18px; border: 1px dashed #c8cdc8; border-radius: 22px; background: rgba(255,255,255,.45); }
.practice-gate.unlocked { border: 0; background: var(--mint); }
.practice-gate p { margin: 0 0 4px; font-size: 13px; }
.practice-gate .btn { width: 100%; margin-top: 13px; }
.btn:disabled { cursor: default; opacity: .55; }
.source-card { display: block; margin-top: 14px; padding: 14px; border-radius: 16px; color: var(--green); background: white; font-size: 12px; font-weight: 800; text-decoration: none; }
.lesson-content h1 { margin-bottom: 5px; }
.lesson-content h2 { margin-bottom: 22px; color: var(--muted); font-size: 20px; }
.language-block { position: relative; margin-bottom: 13px; padding: 20px 17px 16px; border-radius: 20px; background: white; }
.language-block > span { position: absolute; top: -7px; left: 16px; padding: 4px 7px; border-radius: 7px; color: white; background: var(--green); font-size: 9px; font-weight: 900; }
.language-block p { margin: 0; line-height: 1.65; font-size: 16px; }
.ru-block { background: #eef7f3; }
.ru-block > span { background: #5f7d70; }
.ru-block p { color: #4f5f57; }
.lesson-source { margin-top: 20px; padding: 16px; border-left: 3px solid var(--amber); border-radius: 0 16px 16px 0; background: #fff8eb; }
.lesson-source p { margin: 5px 0; color: var(--muted); font-size: 12px; }
.lesson-source a { color: #966015; font-size: 12px; font-weight: 800; text-decoration: none; }
.lesson-actions { position: sticky; bottom: 8px; margin-top: 24px; padding: 8px 0; background: linear-gradient(transparent, var(--paper) 24%); }
.btn-done { color: var(--green); background: var(--mint); }
.manual-progress-card { display: grid; grid-template-columns: 1fr auto; gap: 15px; align-items: center; margin-top: 14px; padding: 18px; border-radius: 22px; color: white; background: var(--green); }
.manual-progress-card .eyebrow { color: var(--lime); }
.manual-progress-card .eyebrow small { color: rgba(255,255,255,.55); }
.manual-progress-card strong { display: block; font-size: 34px; }
.manual-progress-card p { max-width: 260px; margin: 2px 0 0; color: rgba(255,255,255,.68); font-size: 11px; }
.manual-progress-card .btn { min-height: 46px; padding: 0 13px; font-size: 11px; }
@media (min-width: 621px) { body { padding: 20px 0; } #app { border-radius: 28px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.12); min-height: calc(100vh - 40px); background: var(--paper); } .nav { bottom: 20px; border-radius: 0 0 28px 28px; } }
