/* StudyWay — Кабинет. Shared semantic tokens for both themes. */
:root,:root[data-theme="light"]{color-scheme:light;--bg:#f4f2f6;--bg-soft:#ebe7ef;--surface:#fff;--surface-2:#f8f6fa;--surface-3:#ebe3f1;--text:#292531;--muted:#68616f;--muted-2:#68616f;--border:#dfdbe4;--border-strong:#b7aabc;--accent:#654580;--accent-blue:#654580;--accent-violet:#654580;--accent-teal:#325843;--accent-green:#325843;--accent-amber:#785126;--on-accent:#fff;--sage:#e3eee7;--sage-ink:#325843;--amber:#f4eadb;--amber-ink:#785126;--blue:#e4ecf5;--blue-ink:#355b80;--danger:#a23049;--shadow:0 12px 32px #2925310a;--radius-xl:20px;--radius-lg:16px;--radius-md:10px}
:root[data-theme="dark"]{color-scheme:dark;--bg:#0d1017;--bg-soft:#121722;--surface:#171c27;--surface-2:#1c2230;--surface-3:#28233e;--text:#edf0f7;--muted:#adb7cc;--muted-2:#adb7cc;--border:#323c50;--border-strong:#66728b;--accent:#c6b1f2;--accent-blue:#c6b1f2;--accent-violet:#c6b1f2;--accent-teal:#b0decf;--accent-green:#b0decf;--accent-amber:#e4c496;--on-accent:#221737;--sage:#172f2b;--sage-ink:#b0decf;--amber:#332b20;--amber-ink:#e4c496;--blue:#1c2b40;--blue-ink:#b3d0f1;--danger:#ffafbd;--shadow:none}
body{background:var(--bg);color:var(--text);font-family:Inter,"Segoe UI",Arial,sans-serif;line-height:1.55}button,input,select{font:inherit}button,a,input,select,summary{touch-action:manipulation}a{text-decoration:none}button:disabled{opacity:.5;cursor:not-allowed}a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid var(--accent);outline-offset:3px}h1,h2,h3,p{margin-top:0}h1,h2,h3,b,strong,dt,dd,summary{color:inherit}h2{font-size:24px;line-height:1.25;letter-spacing:-.6px;margin-bottom:12px}h3{font-size:18px;margin-bottom:8px}p{color:var(--muted);line-height:1.65}hr{border:0;border-top:1px solid var(--border);margin:28px 0}.muted{color:var(--muted);font-size:13px}.eyebrow{display:block;font-size:10px;font-weight:700;letter-spacing:1.8px;color:var(--muted);margin-bottom:12px}.app-shell,.app-shell.is-sidebar-collapsed{display:block;max-width:1440px;margin:auto;min-height:100vh}.app-shell .sidebar,.app-shell.is-sidebar-collapsed .sidebar{position:relative;transform:none;width:auto;height:auto;display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;background:transparent;color:var(--text);border:0;border-bottom:1px solid var(--border);padding:24px 42px 0;gap:20px}.sidebar__brand{margin:0}.brand-title{font-size:22px;font-weight:700;letter-spacing:-1px;text-transform:none}.brand-subtitle{color:var(--muted);font-size:11px}.logo{width:48px;height:48px;min-width:48px;background:var(--accent);color:var(--on-accent);border-radius:14px;font-family:Georgia,serif;font-style:italic;text-transform:none;font-size:28px;box-shadow:none;letter-spacing:-5px;padding-right:5px}.sidebar__nav{display:flex;width:100%;order:3;gap:5px;overflow:auto;padding:0 0 14px}.nav-item{flex:none;display:flex;align-items:center;padding:9px 14px;border-radius:9px;color:var(--muted);font-size:13px;gap:7px}.nav-item__icon .icon{width:16px;height:16px}.nav-item:hover,.nav-item--active{background:var(--surface-3);color:var(--accent)}.nav-item--active{box-shadow:none}.nav-item--active:before{display:none}.nav-section,.sidebar__spacer,.premium-card,.user-mini,.menu-button,.sidebar-backdrop{display:none!important}.main-area{min-width:0}.topbar{height:auto;min-height:0;border:0;background:transparent;padding:20px 42px 0;position:static;display:flex;align-items:center;justify-content:space-between}.breadcrumb{font-size:12px;color:var(--muted)}.topbar__right{gap:8px}.icon-button{background:var(--surface);border:1px solid var(--border);color:var(--text);box-shadow:none;border-radius:10px}.user-panel{border:0;background:none}.user-panel__role{color:var(--muted)}.avatar{background:var(--surface-3);color:var(--accent)}.badge-count{display:none}.content{padding:28px 42px 36px;max-width:none}.page-header{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:28px}.page-header h1{font-size:clamp(28px,3.1vw,42px);font-weight:650;letter-spacing:-1.4px;line-height:1.12;margin:0 0 12px}.page-header p{font-size:14px;max-width:640px;margin:0}.button,.premium-card__button{background:var(--accent);color:var(--on-accent);border:1px solid var(--accent);border-radius:9px;box-shadow:none;font-size:13px;font-weight:650;padding:12px 18px;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;cursor:pointer;transition:transform .18s,background .18s}.button:hover{transform:translateY(-2px);box-shadow:none}.button--ghost{background:transparent;color:var(--text);border-color:var(--border-strong)}.button-row{display:flex;gap:10px;flex-wrap:wrap}.card{background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:16px;box-shadow:none;padding:26px}.card__head{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:16px}.card__head p{margin:0}.card__head h2,.card__head h3{margin:0}.section-gap{margin-top:22px}.section-heading{display:flex;justify-content:space-between;align-items:center;margin:32px 0 20px}.section-heading h2{margin:0}.section-heading>span{font-size:13px;color:var(--muted)}.cab-hero{border:1px solid var(--border);border-radius:20px;background:var(--surface-3);display:grid;grid-template-columns:1.5fr 1fr;align-items:center;gap:32px;padding:38px;overflow:hidden}.cab-hero h2{font-family:Georgia,serif;font-weight:500;font-size:clamp(30px,3.6vw,48px);line-height:1.08;max-width:640px}.cab-hero p{max-width:540px;font-size:15px}.cab-art{position:relative;height:210px;display:grid;place-items:center}.art-x{font:italic 160px/1 Georgia,serif;color:var(--accent);transform:rotate(-12deg)}.art-orbit{position:absolute;width:230px;height:155px;border:1px solid var(--accent);border-radius:50%;transform:rotate(-25deg);opacity:.45}.art-note{position:absolute;right:0;bottom:0;transform:rotate(5deg);background:var(--sage);color:var(--sage-ink);border:1px solid var(--border);padding:12px 18px;font:italic 16px/1.3 Georgia,serif}.art-plus{position:absolute;top:0;left:5%;font-size:40px;color:var(--accent)}.cab-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:24px 0;margin:10px 0 22px;border-bottom:1px solid var(--border);gap:16px}.cab-metric{padding:0 20px;border-right:1px solid var(--border);display:flex;flex-direction:column}.cab-metric:first-child{padding-left:0}.cab-metric:last-child{border:0}.cab-metric b{font-size:32px;font-weight:650;line-height:1.3;font-variant-numeric:tabular-nums}.cab-metric span{font-size:13px;color:var(--muted);margin-top:4px}.cab-metric small{font-size:11px;color:var(--muted);margin-top:3px}.cab-two{display:grid;grid-template-columns:1fr 1fr;gap:22px}.cab-topic-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}.tone-violet{--tone:var(--surface-3);--tone-ink:var(--accent)}.tone-sage{--tone:var(--sage);--tone-ink:var(--sage-ink)}.tone-amber{--tone:var(--amber);--tone-ink:var(--amber-ink)}.tone-blue{--tone:var(--blue);--tone-ink:var(--blue-ink)}.cab-topic{display:block;background:var(--surface);border:1px solid var(--border);border-radius:18px;padding:26px;transition:transform .2s,border-color .2s}.cab-topic:hover{transform:translateY(-4px);border-color:var(--tone-ink)}.cab-topic-top{display:flex;align-items:center;gap:14px;margin-bottom:24px}.cab-topic-top .eyebrow{margin:0}.cab-symbol{font:italic 36px/1 Georgia,serif;width:64px;height:64px;background:var(--tone,var(--surface-3));color:var(--tone-ink,var(--accent));display:grid;place-items:center;border-radius:18px;flex-shrink:0}.topic-arrow{margin-left:auto;font-size:24px;color:var(--tone-ink)}.cab-topic h2{font-size:27px;margin-bottom:8px}.cab-topic p{font-size:14px;min-height:24px}.cab-topic-bottom{display:flex;justify-content:space-between;font-size:13px;margin:26px 0 10px;color:var(--muted)}.cab-topic-bottom b{color:var(--text)}.progress{height:6px;background:var(--bg-soft);overflow:hidden;border-radius:8px}.progress span{display:block;height:100%;background:var(--tone-ink,var(--accent));border-radius:8px;transition:width .6s ease}.cab-topic-foot{display:flex;justify-content:space-between;gap:16px;border-top:1px solid var(--border);padding-top:16px;margin-top:20px;font-size:12px;color:var(--muted)}.cab-topic-foot>span:last-child{color:var(--tone-ink);white-space:nowrap}.cab-topic-intro{padding:24px;background:var(--surface);border:1px solid var(--border);border-radius:18px;display:flex;gap:22px;align-items:center}.cab-topic-intro>div{flex:1}.cab-topic-intro h2{font-size:20px}.cab-blocks{display:flex;flex-direction:column;gap:12px}.cab-block{display:grid;grid-template-columns:auto 1fr auto;gap:22px;padding:24px;align-items:center;border:1px solid var(--border);border-radius:14px;background:var(--surface)}.block-num{font-family:Georgia,serif;font-size:30px;color:var(--accent);align-self:start}.cab-block p{font-size:13px;margin-bottom:7px;max-width:630px}.block-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.cab-profile{display:flex;align-items:center;gap:24px;padding:30px;border-radius:18px;background:var(--surface-3);border:1px solid var(--border)}.cab-profile h2{font-size:30px;margin:0 0 4px}.cab-profile p{margin:0;overflow-wrap:anywhere}.cab-profile>.chip{margin-left:auto}.cab-avatar{background:var(--accent);color:var(--on-accent);font-size:42px;width:88px;height:88px;border-radius:24px;display:grid;place-items:center;flex-shrink:0}.chip{color:var(--muted);background:var(--bg-soft);border:1px solid var(--border);font-size:11px;padding:5px 9px}.chip--success{color:var(--sage-ink);background:var(--sage);border-color:var(--border)}.subscription+.subscription{border-top:1px solid var(--border);margin-top:24px;padding-top:24px}dl{margin:18px 0 0}dl>div{display:flex;gap:16px;justify-content:space-between;border-bottom:1px solid var(--border);padding:10px 0}dt{color:var(--muted);font-size:13px}dd{font-size:13px;margin:0;text-align:right}.cab-recommendations{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}.cab-recommendations .card{display:flex;flex-direction:column}.cab-recommendations .button{margin-top:auto}.cab-filters{display:flex;flex-wrap:wrap;gap:16px;margin-bottom:22px;padding:18px}.cab-filters label{font-size:12px;color:var(--muted);flex:1;min-width:145px}.input,.select{background:var(--bg);color:var(--text);border:1px solid var(--border-strong);border-radius:8px;padding:11px 13px;font-size:14px;min-height:44px;width:100%}.cab-filters .select{display:block;margin-top:6px}.bank-grid{display:grid;grid-template-columns:1fr;gap:18px}.task-sidebar{padding:18px 22px}.task-sidebar .card__head{margin-bottom:12px}.task-sidebar h2{font-size:16px}.task-list{display:flex;flex-wrap:wrap;gap:8px;max-height:170px;overflow:auto}.task-list__item{width:auto;display:flex;gap:8px;background:var(--bg);border:1px solid var(--border);color:var(--text);border-radius:8px;padding:8px 12px;font-size:12px}.task-list__item.is-active{background:var(--surface-3);border-color:var(--accent);color:var(--text)}.task-list__item>span:nth-child(2){display:none}.task-list__num{width:auto;height:auto;background:none}.solve-panel{border-radius:10px;padding:30px 38px}.solve-panel__top{padding-bottom:16px;border-bottom:1px solid var(--border);font-size:13px;color:var(--muted)}.task-text{font-family:Georgia,"Times New Roman",serif;font-size:21px;line-height:1.85;color:var(--text);margin:28px 0;min-height:0}.task-text p{font:inherit;color:inherit}.task-text .katex-display{padding:18px 0;overflow-x:auto;overflow-y:hidden}.task-text .katex{font-size:1.16em}.answer-label{display:block;font-size:12px;color:var(--muted);margin:24px 0 8px}.answer-row{display:flex;gap:12px;max-width:560px}.answer-row .input{min-width:0;flex:1}.answer-row .button{flex-shrink:0}.solve-footer{display:flex;justify-content:space-between;gap:12px;margin-top:26px;padding-top:20px;border-top:1px solid var(--border)}.answer-result{padding:12px 16px;margin-top:18px;border:1px solid var(--border);border-radius:8px}.answer-result--ok{background:var(--sage);color:var(--sage-ink)}.answer-result--bad{background:var(--amber);color:var(--amber-ink)}.hint-box{background:var(--surface-3);color:var(--text);padding:16px;border-radius:12px}.test-panel .cab-metrics{grid-template-columns:repeat(3,1fr);margin-top:0}.test-task{padding-top:24px}.test-task .button-row{margin-top:22px}.stats-table-wrap{overflow:auto}.stats-table{width:100%;border-collapse:collapse;min-width:560px;font-size:13px}.stats-table td,.stats-table th{padding:14px;text-align:left;border-bottom:1px solid var(--border);color:var(--text);white-space:nowrap}.stats-table thead th{font-weight:500;color:var(--muted);background:var(--bg)}.cab-chart{display:block;width:100%;height:auto;overflow:visible;margin-top:22px}.cab-chart text{fill:var(--muted);font:10px "Segoe UI",sans-serif}.chart-line{stroke-dasharray:1;stroke-dashoffset:0;animation:draw-line .8s ease both}.chart-bar{transform-origin:center 190px;animation:grow-bar .7s ease both}.cab-distribution{display:flex;gap:28px;align-items:center}.cab-donut{width:150px;height:150px;border-radius:50%;flex-shrink:0;background:conic-gradient(var(--sage-ink) var(--portion),var(--surface-3) 0);padding:15px;animation:turn-in .65s ease}.cab-donut>div{background:var(--surface);height:100%;border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center}.cab-donut b{font-size:28px}.cab-donut span{font-size:12px;color:var(--muted)}.distribution-track{height:8px;background:var(--surface-3);border-radius:8px;overflow:hidden}.distribution-track span{display:block;background:var(--sage-ink);height:100%;transition:width .6s}summary{cursor:pointer;font-weight:600}details[open] summary{margin-bottom:18px}.cab-footer{display:flex;justify-content:space-between;gap:12px;padding-top:22px;margin-top:36px;border-top:1px solid var(--border);color:var(--muted);font-size:11px}.empty-state{display:block;text-align:left}.empty-state p{margin:0}.reveal{opacity:1;transform:none;animation:none}.reveal.entered{animation:rise-in .45s ease both}.is-hidden{display:none!important}.loading{padding:50px 0;color:var(--muted)}.auth-modal,.topbar-panel{background:var(--surface);color:var(--text)}.auth-modal p,.topbar-panel p{color:var(--muted)}.auth-submit{color:var(--on-accent)}.auth-logo{background:var(--accent);color:var(--on-accent)}
/* The paper keeps its original colors. Surrounding reader uses the selected theme. */
.theory-dialog{background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:18px;width:min(1050px,96vw);max-width:96vw;max-height:94dvh;padding:0;box-shadow:0 24px 100px #0006}.theory-dialog::backdrop{background:#090d19ad;backdrop-filter:blur(5px)}.theory-dialog.expanded{width:98vw;max-width:98vw;max-height:98dvh}.theory-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 22px;border-bottom:1px solid var(--border)}.theory-head h2{font-size:20px;margin:0}.theory-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:12px 22px;border-bottom:1px solid var(--border)}.theory-toolbar .button{padding:8px 12px;min-height:38px}.theory-toolbar .select{width:auto;min-height:38px;padding:6px}.theory-search{width:175px!important;min-height:38px!important;padding:6px 10px!important}.pdf-viewport{overflow:auto;max-height:54dvh;min-height:160px;background:var(--bg-soft);padding:20px;text-align:center}.expanded .pdf-viewport{max-height:70dvh}.pdf-viewport canvas{background:white;max-width:none;display:block;margin:auto;box-shadow:0 2px 18px #0002}.pdf-status{padding:0 22px;font-size:13px;color:var(--muted)}.pdf-text{margin:12px 22px;max-height:150px;overflow:auto;font-size:13px}.pdf-text p{white-space:pre-wrap}.pdf-search-results{display:flex;gap:8px;flex-wrap:wrap;padding:0 22px}.pdf-footer{display:flex;justify-content:space-between;padding:12px 22px;color:var(--muted);font-size:11px}.pdf-page-label{font-size:12px;min-width:76px;text-align:center}.icon-button.close-pdf{font-size:24px}.landing-shell{--accent:var(--accent-violet)}
@keyframes rise-in{from{opacity:.35;transform:translateY(12px)}to{opacity:1;transform:none}}@keyframes draw-line{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}@keyframes grow-bar{from{transform:scaleY(.05)}to{transform:scaleY(1)}}@keyframes turn-in{from{opacity:.3;transform:rotate(-25deg)}to{opacity:1;transform:rotate(0)}}
@media(min-width:1000px){.topbar__right{position:absolute;right:max(42px,calc((100vw - 1440px)/2 + 42px));top:26px}.topbar{padding-top:18px}.user-panel{padding:0 0 0 8px}.sidebar__brand{margin-bottom:4px}}
@media(max-width:800px){.app-shell .sidebar{padding:20px 22px 0}.topbar{padding:18px 22px 0}.content{padding:24px 22px}.cab-hero{padding:26px;grid-template-columns:1fr .7fr}.cab-art{height:160px}.art-x{font-size:120px}.art-orbit{width:170px;height:110px}.art-note{font-size:12px}.cab-two,.cab-recommendations{grid-template-columns:1fr}.cab-block{grid-template-columns:auto 1fr}.block-actions{grid-column:2}.cab-metrics{gap:8px}.cab-metric{padding:0 10px}.cab-metric b{font-size:26px}.cab-profile{flex-wrap:wrap}.cab-profile>.chip{margin-left:0}.solve-panel{padding:24px}.topbar__right .user-panel__role{display:none}.page-header{flex-wrap:wrap}.nav-item{padding:9px 11px;font-size:12px}.cab-filters label{min-width:40%}}
@media(max-width:520px){.app-shell .sidebar{padding:16px 16px 0}.topbar{padding:14px 16px 0}.content{padding:24px 16px}.user-panel{padding:0}.user-panel__name{display:none}.topbar__right{gap:5px}.topbar .icon-button{width:36px;height:36px}.cab-hero{grid-template-columns:1fr;padding:24px}.cab-art{display:none}.cab-topic-grid{grid-template-columns:1fr}.cab-metrics{grid-template-columns:1fr 1fr;gap:20px}.cab-metric:nth-child(odd){padding-left:0}.cab-metric:nth-child(even){border:0}.cab-topic-intro{flex-wrap:wrap}.cab-topic-intro .button{width:100%}.cab-block{padding:18px;gap:12px}.cab-block .button{font-size:12px}.card{padding:20px}.cab-profile{padding:22px}.cab-avatar{width:60px;height:60px;font-size:32px;border-radius:16px}.cab-profile h2{font-size:24px}.cab-filters{padding:14px;gap:12px}.task-text{font-size:19px}.answer-row{flex-direction:column}.solve-footer .button{padding:10px;font-size:11px}.cab-distribution{flex-direction:column;align-items:start}.cab-footer{flex-direction:column}.pdf-viewport{padding:10px}.theory-head,.theory-toolbar{padding:12px}.theory-head h2{font-size:16px}.pdf-footer{font-size:10px;gap:10px}.theory-toolbar .button{font-size:11px}.test-panel .cab-metric{padding:0;border:0}.test-panel .cab-metric b{font-size:20px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
:root[data-theme] .app-shell .sidebar{background:transparent;color:var(--text)}
.logo{padding:0;letter-spacing:normal}
body.is-public-landing{background:var(--bg)}
body.is-public-landing .sidebar,body.is-public-landing .topbar{display:none!important}
.landing-header{position:relative;background:var(--bg);backdrop-filter:none}
.landing-brand__logo{box-shadow:none;border:0;background:none}
.landing-brand b{text-transform:none;letter-spacing:-1px;font-size:22px}
.landing-hero{min-height:0;padding-top:64px;padding-bottom:64px}
.landing-hero h1{font-weight:600;letter-spacing:-2px}
.landing-hero h1 em{background:none;-webkit-text-fill-color:var(--accent);color:var(--accent);font-family:Georgia,serif;font-weight:400}
.landing-eyebrow,.landing-proof__icon{color:var(--accent)}
:root[data-theme] .landing-preview{background:var(--surface);color:var(--text);box-shadow:none;border-color:var(--border)}
.landing-direction{background:var(--surface);box-shadow:none;min-height:0}
.landing-direction--blue{color:var(--blue-ink)}.landing-direction--violet{color:var(--accent)}.landing-direction--teal{color:var(--sage-ink)}
.landing-direction p{min-height:0}.landing-button--primary{background:var(--accent);color:var(--on-accent)}

/* Readable cabinet scale. Keep responsive layout and theme tokens. */
.app-shell {font-size:17px}
.app-shell .nav-item {font-size:16px;padding:12px 16px;gap:10px}
.app-shell .nav-item span {color:inherit}
.app-shell .nav-item__icon .icon {width:20px;height:20px}
.app-shell .brand-subtitle,.app-shell .user-panel__role {font-size:13px}
.app-shell .user-panel__name,.app-shell .breadcrumb {font-size:15px}
.app-shell .eyebrow {font-size:12px;letter-spacing:1.5px}
.app-shell .page-header p {font-size:17px;max-width:760px}
.app-shell .button {font-size:16px;min-height:48px;padding:12px 20px}
.app-shell .card__head p,.app-shell .muted {font-size:15px}
.app-shell .cab-topic p,.app-shell .cab-block p {font-size:17px}
.app-shell .cab-topic-bottom,.app-shell .cab-topic-foot {font-size:15px}
.app-shell .cab-topic-foot {align-items:center;line-height:1.6}
.app-shell .cab-topic-foot>span:first-child {min-width:0;overflow-wrap:anywhere}
.app-shell .cab-symbol {width:76px;height:76px;border-radius:21px}
.app-shell .cab-symbol svg {width:52px;height:52px}
.app-shell .cab-symbol svg text {fill:currentColor;stroke:none;text-anchor:middle;font:italic 22px Georgia,serif}
.app-shell .cab-metric span,.app-shell .cab-metric small {font-size:15px}
.app-shell .cab-hero p {font-size:18px}
.app-shell .cab-filters label,.app-shell .answer-label {font-size:15px}
.app-shell .input,.app-shell .select {font-size:17px;min-height:48px}
.app-shell .chip,.app-shell dt,.app-shell dd {font-size:14px}
.app-shell .task-list__item,.app-shell .solve-panel__top,.app-shell .stats-table {font-size:15px}
.app-shell .task-sidebar h2 {font-size:20px}
.app-shell .task-text {font-size:24px}
.app-shell .cab-footer {font-size:14px}
@media(max-width:800px){
  .app-shell .sidebar__nav {gap:4px}
  .app-shell .nav-item {font-size:15px;padding:11px 12px}
  .app-shell .cab-topic-grid {grid-template-columns:1fr}
  .app-shell .page-header p {font-size:16px}
}
@media(max-width:520px){
  .app-shell .cab-topic {padding:22px}
  .app-shell .cab-symbol {width:64px;height:64px;border-radius:18px}
  .app-shell .cab-symbol svg {width:46px;height:46px}
  .app-shell .cab-topic h2 {font-size:25px}
  .app-shell .cab-topic-foot {flex-wrap:wrap;gap:10px}
  .app-shell .cab-topic-foot>span:last-child {margin-left:auto}
  .app-shell .button {font-size:15px;padding:11px 15px}
  .app-shell .solve-footer {flex-wrap:wrap}
  .app-shell .task-text {font-size:21px}
}
/* One header row for identity and controls; navigation is below it. */
.app-shell .sidebar,.app-shell.is-sidebar-collapsed .sidebar {padding-top:28px;align-items:center;gap:20px}
.app-shell .sidebar__brand {order:1;flex-shrink:0;margin-bottom:0}
.app-shell .sidebar>.topbar__right {order:2;position:static!important;margin-left:auto;display:flex;align-items:center;gap:12px}
.app-shell .topbar {display:none}
.app-shell .sidebar__nav {order:3;margin-top:8px}
.app-shell .sidebar>.topbar__right .icon-button {width:48px;height:48px;flex-shrink:0}
.app-shell .sidebar>.topbar__right .icon {width:24px;height:24px}
.app-shell .sidebar>.topbar__right .avatar {width:48px;height:48px;font-size:22px}
.app-shell .sidebar>.topbar__right .user-panel {display:flex;gap:12px;align-items:center;padding:4px 0 4px 12px}
.app-shell .user-panel__name {font-size:17px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.app-shell .user-panel__role {font-size:14px}
.app-shell .content {padding-top:36px}
/* Rich progress rows keep all the statistics available. */
.app-shell .stats-table th,.app-shell .stats-table td {background:transparent;padding:18px 14px}
.app-shell .stats-table thead th {background:var(--surface-3);color:var(--text);font-size:14px;font-weight:650}
.app-shell .stats-table tbody tr:hover {background:var(--surface-2)}
.stats-topic-link {display:flex;align-items:center;gap:14px;color:var(--text);white-space:normal;min-width:210px;max-width:350px;line-height:1.45}
.app-shell .stats-topic-link .cab-symbol {width:46px;height:46px;border-radius:13px}
.app-shell .stats-topic-link .cab-symbol svg {width:36px;height:36px}
.stats-progress-cell {min-width:110px;display:grid;gap:9px}
.stats-progress-cell b {font-weight:650}
.stats-accuracy {display:inline-block;padding:6px 12px;border-radius:9px;color:var(--tone-ink,var(--accent));background:var(--tone,var(--surface-3));font-weight:650;font-variant-numeric:tabular-nums}
.stats-accuracy--empty {background:var(--bg-soft);color:var(--muted)}
/* Custom listboxes use the same theme tokens as cards and buttons. */
.sw-select {position:relative;display:block;min-width:0;margin-top:6px;isolation:isolate}
.sw-select-native {display:none!important}
.sw-select-trigger {display:flex;align-items:center;justify-content:space-between;gap:14px;text-align:left;width:100%;min-height:48px;padding:12px 15px;border:1px solid var(--border-strong);border-radius:11px;background:var(--surface);color:var(--text);font:inherit;cursor:pointer}
.sw-select-trigger:hover {border-color:var(--accent);background:var(--surface-2)}
.sw-select-trigger:focus-visible {outline:3px solid var(--accent);outline-offset:3px}
.sw-select-value {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sw-select-chevron {color:var(--accent);font-size:22px;line-height:1;flex-shrink:0;transition:transform .15s}
.sw-select.is-open {z-index:30}
.sw-select.is-open .sw-select-chevron {transform:rotate(180deg)}
.sw-select-menu {position:fixed;z-index:1000;box-sizing:border-box;display:block;overflow:auto;overscroll-behavior:contain;padding:6px;border:1px solid var(--border-strong);border-radius:13px;background:var(--surface);color:var(--text);box-shadow:0 12px 32px #0003;max-height:320px;scrollbar-width:thin;scrollbar-color:var(--border-strong) var(--surface);font-family:Inter,"Segoe UI",Arial,sans-serif}
.sw-select-menu[hidden],.sw-select-option[hidden] {display:none!important}
.sw-select-option {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;border-radius:8px;color:var(--text);font-size:16px;line-height:1.45;cursor:pointer;white-space:normal}
.sw-select-option.is-highlighted {background:var(--surface-3);color:var(--accent)}
.sw-select-option[aria-selected="true"] {font-weight:650;color:var(--accent)}
.sw-select-check {visibility:hidden;flex-shrink:0}
.sw-select-option[aria-selected="true"] .sw-select-check {visibility:visible}
.sw-select-option[aria-disabled="true"] {opacity:.5;cursor:not-allowed}
.theory-toolbar .sw-select {width:130px;margin-top:0}
.landing-plan__caption {padding:12px 0;margin:0;font-size:15px!important;color:var(--muted)!important}
.landing-plan__status {color:var(--accent)!important;background:var(--surface-3)!important;border-color:var(--border)!important}
.landing-plan__top>div>span,.landing-plan__topic small,.landing-plan__topic p,.landing-plan__steps small {color:var(--muted)!important}
.landing-demo__copy>span,.landing-demo .landing-text-link {color:var(--accent)}
.landing-demo__label {color:var(--accent);background:var(--surface-3)}
@media(max-width:1100px){.app-shell .sidebar>.topbar__right .user-panel__role{display:none}}
@media(max-width:800px){
 .app-shell .sidebar,.app-shell.is-sidebar-collapsed .sidebar {padding:22px 22px 0;gap:18px}
 .app-shell .sidebar>.topbar__right {gap:8px}
 .app-shell .sidebar>.topbar__right .icon-button,.app-shell .sidebar>.topbar__right .avatar {width:44px;height:44px}
 .app-shell .sidebar>.topbar__right .user-panel {padding-left:0}
 .app-shell .user-panel__name {display:none}
 .app-shell .content {padding-top:28px}
}
@media(max-width:580px){
 .app-shell .sidebar,.app-shell.is-sidebar-collapsed .sidebar {padding:18px 16px 0;gap:12px}
 .app-shell .sidebar__brand {max-width:calc(100% - 54px)}
 .app-shell .brand-subtitle {font-size:12px}
 .app-shell .sidebar>.topbar__right {width:100%;justify-content:flex-end;margin-left:0}
 .app-shell .sidebar>.topbar__right .user-panel {margin-left:auto;order:-1}
 .app-shell .sidebar>.topbar__right .user-panel__name {display:block;font-size:15px;max-width:140px}
 .app-shell .sidebar__nav {margin-top:0}
 .app-shell .content {padding-top:24px}
}
.plan-heading {display:flex;justify-content:space-between;align-items:start;gap:24px;margin-bottom:18px}
.plan-heading p {margin:0;max-width:730px}
.plan-total {flex-shrink:0;background:var(--surface-3);color:var(--accent);padding:9px 14px;border-radius:12px;font-weight:650}
.plan-steps {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin-top:24px}
.plan-step {padding:22px;border:1px solid var(--border);border-radius:14px;background:var(--surface-2)}
.plan-step-number {display:block;color:var(--accent);font-size:12px;font-weight:700;letter-spacing:1px;margin-bottom:16px}
.plan-step p {font-size:16px}
.plan-task {display:flex;gap:10px;align-items:center;padding:12px 0;border-top:1px solid var(--border);color:var(--text)}
.plan-task>span:nth-child(2) {flex:1;min-width:0;overflow-wrap:anywhere}
.plan-task>span:first-child {color:var(--accent)}
.plan-task small {font-size:12px;color:var(--muted)}
.plan-task.is-done>span:first-child {color:var(--sage-ink)}
.plan-check {display:flex;gap:10px;align-items:center;margin-top:18px;font-size:15px;cursor:pointer}
.plan-check input {accent-color:var(--accent);width:20px;height:20px;flex-shrink:0}
.plan-note {font-size:14px;margin:20px 0 0}
.plan-error {color:var(--danger)}
@media(max-width:1100px){.plan-steps{grid-template-columns:1fr}.plan-heading{flex-wrap:wrap}.plan-step{padding:20px}}
.app-shell .daily-plan {background:var(--surface-3);border-radius:20px;padding:30px}
.daily-plan .plan-step {background:var(--surface)}
.daily-plan .plan-heading h2 {font-size:clamp(27px,2.6vw,36px)}
.plan-step.is-done {border-color:var(--sage-ink)}
@media(max-width:520px){.app-shell .daily-plan{padding:22px}.plan-total{font-size:15px}}

/* One task, three stages. Shared grid keeps the section steady between slides. */
.task-demo {min-width:0;overflow:hidden;background:var(--surface-2);border:1px solid var(--border);border-radius:22px;color:var(--text)}
.demo-tabs {display:flex;gap:4px;padding:14px;border-bottom:1px solid var(--border)}
.demo-tabs button {flex:1;padding:11px 7px;border:0;border-radius:10px;background:transparent;color:var(--muted);font:inherit;font-size:14px;font-weight:650;cursor:pointer}
.demo-tabs button[aria-pressed="true"] {color:var(--accent);background:var(--surface-3)}
.demo-tabs button:hover,.demo-arrow:hover,.demo-pause:hover {background:var(--surface-3);color:var(--accent)}
.task-demo button:focus-visible,.demo-hint summary:focus-visible {outline:2px solid var(--accent);outline-offset:3px}
.demo-stage {display:grid;padding:26px;min-width:0}
.demo-slide {grid-area:1/1;min-width:0;align-self:start}
.demo-slide[hidden] {display:block!important;visibility:hidden;pointer-events:none}
.demo-slide.is-current {animation:task-demo-appear .35s ease-out}
.demo-slide .landing-demo__label {display:inline-block;font-size:12px;margin-bottom:16px;letter-spacing:.02em;text-transform:none}
.demo-slide h3 {font-size:23px;line-height:1.3;margin:0 0 18px;color:var(--text)}
.demo-slide p {font-size:16px;line-height:1.65;color:var(--text)}
.demo-formula {padding:10px 0 18px;font-size:22px;overflow-x:auto}
.demo-formula .katex-display {margin:.5em 0}
.demo-answer-example {display:grid;gap:10px;margin-top:22px;font-size:15px}
.demo-answer-example>span:last-child {padding:15px;border:1px solid var(--border);border-radius:10px;color:var(--muted);background:var(--surface)}
.demo-slide .demo-small,.landing-demo__copy .demo-example-note {font-size:14px;color:var(--muted)}
.demo-hint {border:1px solid var(--border);background:var(--surface);border-radius:12px;overflow:hidden}
.demo-hint summary {display:flex;gap:10px;align-items:center;padding:16px;list-style:none;color:var(--accent);font-size:16px;font-weight:650;cursor:pointer}
.demo-hint summary::-webkit-details-marker {display:none}
.demo-hint summary svg {width:20px;height:20px;flex-shrink:0}
.demo-hint summary>span {margin-left:auto;transition:transform .2s}
.demo-hint[open] summary>span {transform:rotate(180deg)}
.demo-hint>div {padding:0 16px 18px}
.demo-hint p {margin:0 0 12px}
.demo-hint small {color:var(--muted);font-size:14px;line-height:1.6}
.demo-solution {padding-left:24px;margin:0;font-size:16px;line-height:1.65}
.demo-solution li {padding-left:5px;margin-bottom:16px}
.demo-solution li::marker {color:var(--accent);font-weight:700}
.demo-solution li>div {margin-top:6px;overflow-x:auto;padding-bottom:3px}
.demo-final-answer {display:flex;flex-wrap:wrap;gap:12px;padding:15px;border-radius:12px;background:var(--surface-3);color:var(--text)}
.demo-final-answer b {color:var(--accent)}
.demo-controls {display:flex;justify-content:space-between;align-items:center;gap:10px;padding:14px 20px;border-top:1px solid var(--border)}
.demo-controls>div {display:flex;align-items:center;gap:12px}
.demo-arrow,.demo-pause {min-height:44px;border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:10px;font:inherit;font-size:15px;cursor:pointer}
.demo-arrow {width:44px;font-size:22px}
.demo-pause {padding:8px 14px}
.demo-counter {color:var(--muted);font-size:14px;font-variant-numeric:tabular-nums}
@keyframes task-demo-appear {from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:580px){.demo-stage{padding:20px}.demo-tabs{padding:10px;gap:2px}.demo-tabs button{font-size:12px;padding:11px 4px}.demo-controls{padding:12px}.demo-slide h3{font-size:21px}.demo-formula{font-size:20px}}
@media(prefers-reduced-motion:reduce){.demo-slide.is-current{animation:none}.demo-hint summary>span{transition:none}}
/* Center a complete menu; auto margins collapse to zero when it overflows. */
.app-shell .sidebar__nav>.nav-item:first-child {margin-left:auto}
.app-shell .sidebar__nav>.nav-item:last-child {margin-right:auto}
.topic-programs {margin:0 0 24px;color:var(--muted);font-size:14px}
.topic-programs>span {display:block;margin-bottom:10px}
.topic-programs ul {display:flex;flex-wrap:wrap;gap:8px;list-style:none;padding:0;margin:0}
.topic-programs li {padding:7px 12px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--text)}
.cab-topic-foot {justify-content:flex-end}
/* Modal tour uses a cut-out over the real navigation and shared theme tokens. */
.tour-dialog {position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;border:0;padding:0;margin:0;background:transparent;color:var(--text);overflow:hidden;overscroll-behavior:none;touch-action:none}
.tour-dialog::backdrop {background:transparent}
.tour-shade {position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.tour-shade path {fill:#060911ad}
.tour-spotlight {position:absolute;box-sizing:border-box;border:2px solid var(--accent);border-radius:12px;pointer-events:none;box-shadow:0 0 0 2px var(--surface)}
.tour-spotlight[hidden],.tour-intro[hidden] {display:none}
.tour-panel {position:fixed;transform:translateY(-50%);touch-action:pan-y;box-sizing:border-box;padding:24px;border:1px solid var(--border-strong);border-radius:18px;background:var(--surface);box-shadow:0 24px 70px #0005;overflow:auto;overscroll-behavior:contain}
.tour-head {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px;font-size:13px;color:var(--muted)}
.tour-skip {border:0;background:transparent;color:var(--accent);padding:6px;cursor:pointer;font-size:14px}
.tour-progress {height:4px;background:var(--bg-soft);border-radius:4px;margin-bottom:22px;overflow:hidden}
.tour-progress span {display:block;height:100%;background:var(--accent);transition:width .22s ease}
.tour-content h2 {font-size:26px;margin-bottom:12px}
.tour-content p {font-size:16px;line-height:1.55}
.tour-content .tour-intro {font-size:13px;margin-bottom:18px}
.tour-content .tour-tip {padding:12px 14px;border-radius:10px;background:var(--surface-3);color:var(--accent);font-size:14px;margin:18px 0 22px}
.tour-actions {display:flex;align-items:center;justify-content:space-between;gap:8px}
.tour-actions .button {font-size:14px;padding:10px 12px;min-height:44px}
.tour-count {color:var(--muted);font-size:13px;white-space:nowrap}
.tour-enter {animation:tour-appear .22s ease both}
@keyframes tour-appear {from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@media(max-width:580px){.tour-panel{padding:18px}.tour-content h2{font-size:23px}.app-shell .sidebar__nav>.nav-item:first-child{margin-left:0}.app-shell .sidebar__nav>.nav-item:last-child{margin-right:0}}
@media(prefers-reduced-motion:reduce){.tour-enter{animation:none}.tour-progress span{transition:none}}

.catalog-section{margin-bottom:28px}.catalog-revision{margin-top:32px;padding-top:24px;border-top:1px solid var(--border)}.catalog-path{font-size:14px;color:var(--muted);overflow-wrap:anywhere}.is-preparing{border-style:dashed}.is-preparing:hover{transform:none;border-color:var(--border)}.catalog-topic-label{display:block;margin-bottom:20px;color:var(--muted)}.catalog-topic-label .select{margin-top:6px}.subject-progress{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:20px}

/* Subject symbols inherit the exact program header colour from the theory templates. */
.tone-school {--topic-ink:#285943;--topic-bg:#e5eee8}
.tone-oge {--topic-ink:#245a91;--topic-bg:#e5edf7}
.tone-ege {--topic-ink:#434078;--topic-bg:#eceaf5}
.tone-olympiad {--topic-ink:#783b50;--topic-bg:#f3e7eb}
.cab-topic .cab-symbol,.stats-topic-link .cab-symbol {color:var(--topic-ink);background:var(--topic-bg)}
[data-theme="dark"] .tone-school {--topic-ink:#99c9ad;--topic-bg:#233e32}
[data-theme="dark"] .tone-oge {--topic-ink:#9dc2ec;--topic-bg:#223b56}
[data-theme="dark"] .tone-ege {--topic-ink:#c2b9f1;--topic-bg:#383453}
[data-theme="dark"] .tone-olympiad {--topic-ink:#e2adc0;--topic-bg:#4b2d3a}
.catalog-search {display:grid;gap:8px;max-width:560px;margin:20px 0}
.catalog-pagination {display:flex;align-items:center;justify-content:center;gap:20px;margin:28px 0;flex-wrap:wrap}
.profile-names {display:flex;align-items:end;gap:18px;flex-wrap:wrap}
.profile-names label {display:grid;gap:8px;flex:1;min-width:180px}
.profile-names [role="status"] {flex-basis:100%;margin:0}
.sw-select-chevron {display:flex;align-items:center;justify-content:center;width:20px;height:20px}
.stats-date-range {display:flex;gap:16px;flex-wrap:wrap;margin:16px 0}
.stats-date-range label {display:grid;gap:8px}
.stats-date-range[hidden] {display:none}

.sw-select-search {position:sticky;top:0;display:block;width:100%;padding:12px;border:1px solid var(--border-strong);border-radius:8px;background:var(--surface);color:var(--text);font:inherit;margin-bottom:8px;z-index:1}

.tone-school,.tone-oge,.tone-ege,.tone-olympiad {--tone:var(--topic-bg);--tone-ink:var(--topic-ink)}
/* Account settings and daily streak share both theme palettes. */
.cab-avatar{overflow:hidden;flex-shrink:0}.cab-avatar img{width:100%;height:100%;object-fit:cover}.cab-profile>[data-profile-settings]{margin-left:auto}
.streak-card{display:flex;align-items:center;gap:20px;padding:22px 26px;margin:0 0 22px;border:1px solid var(--border);border-radius:16px;background:var(--surface-2);flex-wrap:wrap}.streak-card h2{font-size:22px;margin-bottom:5px}.streak-card p{margin:0}.streak-card small{color:var(--muted)}.streak-flame{width:36px;color:var(--muted);flex-shrink:0}.streak-flame svg{width:100%;display:block}.is-burning .streak-flame{color:#d36327}.is-burning .streak-flame svg{animation:streak-glow 2.5s ease-in-out infinite}:root[data-theme="dark"] .is-burning .streak-flame{color:#ffa963}.streak-calendar{display:grid;grid-template-columns:repeat(14,1fr);gap:6px;width:100%;max-width:540px}.streak-calendar>span{background:var(--surface-3);color:var(--muted);border:1px solid var(--border);border-radius:6px;text-align:center;font-size:12px;padding:4px}.streak-calendar>.is-complete{background:var(--sage);color:var(--sage-ink);border-color:var(--sage-ink)}
.account-dialog{position:fixed;inset:0;margin:auto;width:min(560px,calc(100vw - 28px));max-height:calc(100dvh - 32px);padding:0;overflow:hidden;border:1px solid var(--border-strong);border-radius:18px;background:var(--surface);color:var(--text);box-shadow:0 20px 70px #0005}.account-dialog::backdrop{background:#090d18a6}.account-dialog[open]{display:flex;flex-direction:column;animation:account-appear .18s ease-out}.account-dialog>header{flex-shrink:0;display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid var(--border);gap:14px}.account-dialog h2{margin:0;font-size:23px}.account-dialog-body{padding:24px;overflow-y:auto;overscroll-behavior:contain}.account-dialog label{display:block;margin-bottom:16px}.account-dialog label .input,.account-dialog label .select{display:block;width:100%;margin-top:7px}.account-dialog small{color:var(--muted)}.account-avatar-row{display:flex;align-items:center;gap:18px;margin-bottom:16px}.account-avatar-row label.button{display:inline-flex;margin:0}.account-avatar-row p{font-size:12px;margin:8px 0 0}.account-dialog [hidden]{display:none!important}.subscription-request{padding:16px 0;border-top:1px solid var(--border);display:flex;align-items:center;flex-wrap:wrap;gap:10px}.subscription-request strong{flex-basis:100%}.subscription-request span{color:var(--muted);flex:1}.account-dialog .sw-select-menu{z-index:10}.subscription>[data-subscriptions]{margin-bottom:14px}[data-plan-review]{margin-top:8px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@keyframes account-appear{from{opacity:0}to{opacity:1}}@keyframes streak-glow{50%{filter:drop-shadow(0 0 4px #e7893555)}}
@media(max-width:600px){.account-dialog{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);border-radius:14px}.account-dialog-body{padding:18px}.account-dialog>header{padding:16px 18px}.streak-card{padding:18px;gap:14px}.streak-calendar{grid-template-columns:repeat(7,1fr)}.cab-profile>[data-profile-settings]{margin-left:0}.account-avatar-row{align-items:flex-start}}
@media(prefers-reduced-motion:reduce){.account-dialog[open],.is-burning .streak-flame svg{animation:none}}

.avatar{overflow:hidden}.avatar img{width:100%;height:100%;object-fit:cover}.streak-history{width:100%}.streak-history>p{font-size:13px;margin-bottom:8px}
