/* Shared mobile and web experience, September 2026. */
body { font-size: 16px; line-height: 1.5; }
button, input, textarea { font: inherit; }
[hidden] { display: none !important; }
.ui-icon { width: 22px; height: 22px; flex: 0 0 22px; }
.brand-wordmark { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.edition-badge { display: inline-flex; align-items: center; width: fit-content; background: #c34e43; color: #fff; border-radius: 6px; padding: 4px 7px; font-size: 10px; line-height: 1; font-weight: 800; letter-spacing: .65px; white-space: nowrap; }
.header .brand { gap: 10px; }
.header .brand-logo { height: 50px; width: 50px; border-radius: 16px; }
.header-actions .tag { display: flex; align-items: center; gap: 5px; font-size: 12px; min-height: 44px; padding: 9px 11px; color: #536c62; }
.header-actions .tag .ui-icon { width: 16px; height: 16px; flex-basis: 16px; }
.eyebrow { font-size: 11px; letter-spacing: 1.1px; }
.intro p, .note, .hint-line, .footer, .settings-intro { font-size: 14px; }
.primary-button, .next-button { font-size: 17px; min-height: 54px; }
.small-button, .text-button { font-size: 15px; min-height: 44px; }
.navigation > button { font-size: 12px; min-height: 62px; }
.icon-button, .bookmark { width: 44px; height: 44px; min-width: 44px; display: inline-grid; place-items: center; padding: 0; border-radius: 14px; }
.mode-art { display: block; width: 86px; height: 86px; object-fit: contain; flex-shrink: 0; }
.finish-stepan { width: 180px; height: 180px; object-fit: contain; margin: 0 auto 12px; }
.exam-toolbar { padding-top: 16px; }
.action-icon.with-art { width: 64px; height: 64px; flex: 0 0 64px; background: transparent; overflow: visible; }
.action-icon.with-art .mode-art { width: 74px; height: 74px; max-width: none; }

/* A lesson owns the viewport: no global header or tab bar. */
body.immersive #app { max-width: 1140px; padding-bottom: 32px; }
body.immersive .header, body.immersive .navigation, body.immersive .footer { display: none; }
.lesson-header { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 12px 0; }
.lesson-back { color: var(--ink); background: #e9ede5; }
.lesson-heading { min-width: 0; flex: 1; }
.lesson-heading h1 { margin: 0; font-size: 20px; line-height: 1.25; letter-spacing: -.45px; overflow-wrap: anywhere; }
.lesson-heading small { display: block; margin-top: 3px; color: #697e73; font-size: 12px; }
.lesson-header .bookmark { background: #fff; border: 1px solid var(--line); color: #698077; border-radius: 14px; }
.bookmark.saved, .lesson-header .bookmark.saved { background: #e7f0e0; border-color: #afc59d; color: #286148; }
.bookmark.saved svg { fill: currentColor; opacity: 1; }
.lesson-toolbar { display: flex; align-items: center; gap: 16px; padding: 0 0 14px; }
.counter-button { display: inline-flex; align-items: center; gap: 14px; font-size: 15px; padding: 10px 14px; min-height: 48px; border-radius: 14px; }
.counter-button b { font-size: 18px; color: var(--ink); }
.counter-button .counter-label { font-size: 12px; color: #647c6e; }
.counter-button .counter-value { display: flex; align-items: baseline; gap: 7px; }
.counter-button .ui-icon { width: 18px; height: 18px; flex-basis: 18px; }
.lesson-completion { flex: 1; display: grid; gap: 7px; min-width: 60px; }
.lesson-completion small { font-size: 12px; color: #647c6e; text-align: right; }
.lesson-completion .progress-line { margin: 0; height: 5px; }
.question-layout { margin-top: 0; }
.question-meta { margin: 0 0 12px; }
.question-meta .eyebrow { font-size: 11px; }
.question-panel h2, .exam-question h2 { font-size: 23px; line-height: 1.4; letter-spacing: -.55px; }
.answer, .exam-question .answer { font-size: 16px; line-height: 1.5; padding: 16px 14px; min-height: 64px; gap: 13px; }
.answers { gap: 10px; }
.answer-index { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 10px; font-size: 13px; }
.answer-index .ui-icon { width: 19px; height: 19px; flex-basis: 19px; opacity: 1; }
.result-title { display: flex; gap: 9px; align-items: center; font-size: 18px; }
.result p, .playback-summary p { font-size: 15px; line-height: 1.7; }
.result-title .ui-icon { width: 22px; height: 22px; color: #3c7550; }
.question-nav { gap: 12px; }
.question-nav .text-button { display: flex; align-items: center; gap: 6px; }
.comment-button, .mentor-button { font-size: 14px; min-height: 48px; }
.scene-legend, .before-answer-note, .scene-help { font-size: 13px; }
.view-switch button { min-height: 35px; font-size: 12px; padding: 7px 10px; }
.scene-badge { font-size: 9px; }
.scene-option { min-height: 62px; }
.scene-option b { font-size: 15px; }
.scene-option small { font-size: 12px; }
.pro-features, .mentor-steps li, .topic-stats b { font-size: 16px; }
.tariff small, .topic-stats span, form label, .sign-detail a { font-size: 14px; }
.pro-intro h3 { font-size: 21px; }
.inline-notice { font-size: 15px; }
.sync-state { font-size: 13px !important; }
.question-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
.question-cell { position: relative; aspect-ratio: 1; border: 1px solid #dce4d4; border-radius: 14px; background: #fff; font-size: 18px; font-weight: 800; display: grid; place-items: center; }
.question-cell.current { outline: 2px solid #254f40; outline-offset: 2px; }
.question-cell.correct { background: #e6f0df; color: #365c3b; }
.question-cell.wrong { background: #f9e7de; color: #a94735; }
.question-cell .ui-icon { position: absolute; width: 12px; height: 12px; bottom: 4px; right: 4px; }
.picker-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: #607466; }
.picker-legend span { display: inline-flex; align-items: center; gap: 6px; }
.picker-legend i { width: 10px; height: 10px; border-radius: 3px; background: #d2e3c8; }
.picker-legend .wrong-dot { background: #edbaab; }
.picker-legend .current-dot { background: #fff; border: 2px solid #254f40; }

/* Native dialog supplies focus trapping; the surface slides up from the edge. */
body.dialog-open, body.onboarding-open { overflow: hidden; }
dialog:not([open]) { display: none; }
dialog.dialog-fallback[open] { position: fixed; z-index: 50; box-shadow: 0 0 0 100vmax #19342965, 0 -10px 70px #163e302b; }
#modal.dialog-fallback[open] { inset: auto 0 0; }
#onboarding.dialog-fallback[open] { inset: 0; }
#modal { padding: 0; width: min(640px, 100%); max-width: none; border: 0; max-height: 90vh; max-height: 90dvh; overflow: hidden; border-radius: 28px 28px 0 0; margin: auto auto 0; box-shadow: 0 -10px 70px #163e302b; }
#modal[open] { display: flex; flex-direction: column; animation: sheet-in .28s cubic-bezier(.2,.7,.2,1); }
.sheet-handle { display: flex; justify-content: center; align-items: center; height: 24px; flex: 0 0 24px; touch-action: none; cursor: grab; }
.sheet-handle i { width: 38px; height: 4px; border-radius: 10px; background: #c8d2c4; }
#modal .modal-head { padding: 4px 22px 16px; margin: 0; flex: 0 0 auto; }
#modal-title { font-size: 22px; line-height: 1.3; }
#modal .close-modal { background: #e9ede5; }
#modal-body { overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px max(24px, env(safe-area-inset-bottom)); min-height: 0; }
#modal-body p { font-size: 15px; line-height: 1.65; color: #536b5e; }
#modal-body h3 { font-size: 18px; }
#modal-body .note { font-size: 13px; }
#modal[data-presentation="full"] { height: 96vh; max-height: 96vh; height: 96dvh; max-height: 96dvh; }
.setting-row { padding: 18px 0; gap: 15px; min-height: 90px; }
.setting-row b { font-size: 17px; }
.setting-row small { font-size: 13px; }
.comment-form textarea, .comment-edit textarea, #modal input, #modal textarea { font-size: 16px; }
@keyframes sheet-in { from { transform: translateY(65px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

#boot-screen { position: fixed; inset: 0; z-index: 30; background: #f7f6f0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
#boot-screen > b { font-size: 34px; letter-spacing: -1px; }
#boot-screen > p { font-size: 15px; color: #698074; margin: 12px 0 4px; }
.loading-wheel { width: 112px; height: 112px; border-radius: 50%; animation: wheel-rock 2.1s ease-in-out infinite; }
.loading-track { width: 112px; height: 4px; background: #e3e8da; overflow: hidden; border-radius: 10px; }
.loading-track i { display: block; width: 45%; height: 100%; background: #5b7965; border-radius: inherit; animation: loading-travel 1.7s ease-in-out infinite alternate; }
@keyframes wheel-rock { 0%, 100% { transform: rotate(-22deg); } 50% { transform: rotate(22deg); } }
@keyframes loading-travel { from { transform: translateX(-50%); } to { transform: translateX(175%); } }

#onboarding { padding: 24px; border: 0; width: 100%; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; background: #f7f6f0; }
#onboarding[open] { display: flex; flex-direction: column; overflow-y: auto; }
.onboarding-top { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.onboarding-top > span { font-size: 24px; font-weight: 800; letter-spacing: -.8px; }
.onboarding-top .text-button { font-size: 13px; color: #6b7e71; }
.onboarding-art { position: relative; flex: 1; min-height: 160px; max-height: 290px; display: flex; justify-content: center; align-items: center; margin: 20px 0 22px; }
.onboarding-art::before { content: ''; position: absolute; width: 230px; height: 230px; max-height: 100%; max-width: 100%; border-radius: 50%; background: radial-gradient(circle, #e3ebda 25%, #e3ebda00 72%); }
.onboarding-art img { position: relative; object-fit: contain; height: 100%; max-height: 260px; width: min(75%, 250px); }
.onboarding-art .onboarding-wheel { height: 180px; width: 180px; border-radius: 38px; transform: rotate(-8deg); box-shadow: 0 15px 40px #36533c18; }
.onboarding-art .onboarding-stepan { height: 260px; width: 235px; object-fit: contain; }
.onboarding-copy { flex-shrink: 0; max-width: 460px; margin: 0 auto; width: 100%; }
.onboarding-copy h1 { font-size: clamp(28px, 8vw, 38px); line-height: 1.15; letter-spacing: -1.3px; margin: 12px 0 16px; color: #193e34; outline: none; }
.onboarding-copy > p { font-size: 16px; line-height: 1.65; color: #5b7164; margin: 0 0 20px; }
.onboarding-detail { display: flex; align-items: center; gap: 12px; padding: 15px; background: #eaf0e2; border-radius: 17px; font-size: 12px; line-height: 1.55; color: #4d6556; }
.onboarding-detail .edition-badge { font-size: 9px; padding: 7px; }
.onboarding-bottom { padding-top: 24px; padding-bottom: env(safe-area-inset-bottom); max-width: 460px; margin: auto auto 0; width: 100%; }
.onboarding-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 20px; }
.onboarding-dots span { width: 6px; height: 6px; border-radius: 10px; background: #d6dfcf; }
.onboarding-dots .current { width: 24px; background: #284f3e; }
.onboarding-actions { display: flex; gap: 12px; align-items: center; }
.onboarding-actions .primary-button { flex: 1; margin: 0; }
.onboarding-back { background: #e6eddf; min-height: 54px; }
@media (min-width: 780px) {
  #onboarding { width: 520px; height: min(850px, 96vh); height: min(850px, 96dvh); margin: auto; border-radius: 30px; padding: 28px; }
  #modal { margin: auto; border-radius: 26px; max-height: 90vh; max-height: 90dvh; }
  #modal.dialog-fallback[open] { inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
  #modal[data-presentation="full"] { height: 90vh; max-height: 90vh; height: 90dvh; max-height: 90dvh; width: 700px; }
  .lesson-header { padding-top: 22px; }
}
@media (max-width: 779px) {
  body.immersive #app { padding: 0 16px 24px; }
  .header { height: 87px; }
  .header-actions .tag { display: flex; }
  .question-panel { padding: 19px 0; }
  .question-layout .scene-panel { height: 270px; border-radius: 20px; }
  .question-layout.no-3d .scene-panel { height: auto; min-height: 165px; aspect-ratio: 2; }
  .question-panel h2, .exam-question h2 { font-size: 21px; }
  .scene-badge { font-size: 8px; padding: 7px; }
  .scene-bar { left: 9px; right: 9px; top: 9px; }
  .question-nav .text-button { font-size: 14px; }
  .lesson-heading h1 { font-size: 18px; }
  .lesson-header { gap: 10px; }
  .lesson-toolbar { gap: 12px; }
  .counter-button { gap: 10px; padding: 9px 12px; }
  .counter-button .counter-label { display: none; }
  .answer, .exam-question .answer { font-size: 16px; }
}
@media (max-width: 360px) {
  .header .brand { font-size: 25px; }
  .header .brand-logo { height: 42px; width: 42px; }
  .header-actions .tag { font-size: 10px; padding: 7px 8px; }
  #onboarding { padding: 18px; }
  .onboarding-art { min-height: 130px; margin: 10px 0 16px; }
  .onboarding-art .onboarding-wheel { width: 130px; height: 130px; }
  .onboarding-copy > p { font-size: 15px; }
  .onboarding-detail { font-size: 11px; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #modal[open], .loading-wheel, .loading-track i { animation: none; }
  .loading-track i { width: 65%; }
}
