:root{--bg:#121d16;--panel:#1c2b20;--surface:#28392c;--edge:#405344;--text:#f5f2e8;--muted:#bac7b9;--accent:#e8c49a;--accent-ink:#231e16;--green:#3bf083;--yellow:#f2c54b;--red:#fa7777;--nav:#18261d;--shadow:#0005;color-scheme:dark}
:root[data-theme=light]{--bg:#f5f6f0;--panel:#fff;--surface:#edf1eb;--edge:#cbd6cb;--text:#182b20;--muted:#4b6252;--accent:#d8b687;--accent-ink:#201c15;--green:#07813e;--yellow:#946000;--red:#b52e2e;--nav:#fff;--shadow:#0001;color-scheme:light}
:root[data-theme=black]{--bg:#08090b;--panel:#181a1c;--surface:#252729;--edge:#44474b;--text:#f4f2ee;--muted:#b8beb9;--accent:#e8c49a;--accent-ink:#1a1612;--green:#35e67b;--yellow:#ffdc5e;--red:#ff7f7f;--nav:#121416;--shadow:#0008;color-scheme:dark}
*{box-sizing:border-box}html{scroll-behavior:auto}body{background:var(--bg);color:var(--text);font:16px/1.55 system-ui,-apple-system,'Segoe UI',sans-serif;margin:0}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{opacity:.55;cursor:not-allowed}a{color:var(--accent);text-decoration:underline;text-underline-offset:3px}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible{outline:3px solid var(--accent);outline-offset:3px}.sr{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}[hidden]{display:none!important}
.shell{max-width:1280px;min-height:100vh;margin:auto;display:grid;grid-template-columns:244px minmax(0,1fr)}.sidebar{position:sticky;top:0;height:100vh;border-right:1px solid var(--edge);padding:26px 13px}.brand{display:flex;align-items:center;gap:12px;font-weight:850;line-height:1.15;font-size:19px;padding:12px 9px 29px}.brand small{display:block;letter-spacing:.1em;color:var(--muted);font-size:10px;margin-top:5px;font-weight:500}.mark{display:grid;place-items:center;width:43px;height:43px;border:2px solid var(--accent);border-radius:12px;font-size:27px;color:var(--accent)}.side-nav{display:grid;gap:5px}.side-nav button{min-height:49px;border:0;background:transparent;color:var(--muted);text-align:left;border-radius:11px;padding:12px 17px;display:flex;align-items:center;gap:16px;font-size:15px}.side-nav button.active{background:var(--surface);color:var(--accent);font-weight:800}.side-foot{position:absolute;bottom:18px;color:var(--muted);font-size:11px;left:22px}.app{min-width:0;max-width:100%;padding:0 32px}.topbar{max-width:900px;margin:0 auto;display:flex;justify-content:space-between;align-items:center;min-height:84px;gap:14px;border-bottom:1px solid var(--edge)}.top-title .tiny{display:block;font-size:10px;font-weight:800;letter-spacing:.17em;color:var(--muted)}.top-title strong{display:block;font-size:17px}.top-actions{display:flex;gap:8px;align-items:center}select,input,textarea{background:var(--surface);color:var(--text);border:1px solid var(--edge);border-radius:11px;padding:12px 13px;min-height:47px;min-width:0}#theme{max-width:145px;padding:9px 8px;font-size:13px}.feedback-small{background:var(--panel);border:1px solid var(--edge);border-radius:11px;min-height:44px;color:var(--text);padding:8px 12px;font-weight:700}
main{max-width:900px;min-height:65vh;margin:26px auto 60px;outline:none}.page{display:none}.page.active{display:block}.eyebrow{font-size:12px;text-transform:uppercase;letter-spacing:.14em;font-weight:850;color:var(--accent);margin:0 0 7px}.heading{margin:8px 0 22px}h1{font-size:clamp(29px,4vw,41px);line-height:1.16;letter-spacing:-.035em;margin:4px 0 14px}h2{font-size:21px;letter-spacing:-.02em;margin:0 0 12px}h3{font-size:17px;margin:0 0 9px}p{color:var(--muted);margin:8px 0}.intro{margin:14px 0 24px}.intro p:last-child{max-width:620px}.card{border:1px solid var(--edge);border-radius:18px;background:var(--panel);padding:22px}.callout{margin:18px 0;display:flex;align-items:center;justify-content:space-between;gap:22px;background:linear-gradient(118deg,var(--surface),var(--panel))}.callout>div{max-width:540px}.btn{border:0;border-radius:11px;font-size:15px;padding:12px 18px;min-height:47px;font-weight:800}.btn.primary{color:var(--accent-ink);background:var(--accent)}.btn.secondary{color:var(--text);background:var(--surface);border:1px solid var(--edge)}.btn.full{width:100%}.btn:hover:not(:disabled){filter:brightness(1.075)}.invite{width:100%;min-height:94px;display:flex;gap:15px;align-items:center;padding:18px 22px;text-align:left;background:var(--accent);color:var(--accent-ink);border:0;border-radius:17px;box-shadow:0 6px 20px var(--shadow)}.invite-symbol{font-size:35px;line-height:1;font-weight:600}.invite strong{display:block;font-size:19px}.invite small{display:block;opacity:.79;margin-top:2px}.invite b{margin-left:auto;font-size:27px}.two-col{display:grid;grid-template-columns:1fr 1fr;gap:13px}.feature{color:var(--text);text-align:left;display:grid;gap:11px;min-height:153px}.feature strong{font-size:19px}.feature span{color:var(--muted)}.feature em{font-style:normal;color:var(--accent);font-weight:800}.toolbar{display:flex;gap:12px;align-items:center;justify-content:space-between;margin:15px 0 21px}.toolbar input{width:min(100%,500px)}.toolbar.stacked{display:grid;grid-template-columns:130px minmax(0,1fr);max-width:650px}.toolbar.stacked select{width:100%}.checklabel{color:var(--muted);font-size:14px;white-space:nowrap;display:flex;gap:7px;align-items:center}.checklabel input{width:19px;height:19px;min-height:0;accent-color:var(--accent)}.catalog{display:grid;grid-template-columns:1fr 1fr;gap:15px}.rule-card{display:flex;flex-direction:column;gap:11px;min-width:0}.rule-card .top{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.star{font-size:29px;color:var(--muted);border:1px solid var(--edge);border-radius:10px;background:transparent;width:44px;height:44px;flex:none;line-height:1}.star.selected{color:#ecc17b;border-color:#9a7750}.rule-card h2{margin:0;max-width:92%;font-size:20px;overflow-wrap:anywhere}.rule-card .meta{font-size:13px;color:var(--muted)}.rule-card .foot{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;margin-top:auto}.rule-card .foot .btn{flex:1}.backline{margin-bottom:17px}.text-button{border:0;background:transparent;color:var(--accent);padding:8px 0;font-weight:750}.source-strip{display:flex;gap:12px;flex-wrap:wrap;align-items:center;color:var(--muted);font-size:13px;margin:17px 0}.source-strip>*{min-width:0;overflow-wrap:anywhere}.document{overflow-wrap:anywhere;font-size:15px;line-height:1.69}.document h1,.document h2,.document h3{margin:24px 0 11px;line-height:1.35}.document h1{font-size:25px}.document h2{font-size:21px}.document h3{font-size:18px}.document ul,.document ol{padding-left:25px}.document p{color:var(--text)}.document table{display:block;overflow-x:auto;max-width:100%;border-collapse:collapse;margin:16px 0}.document td,.document th{border:1px solid var(--edge);padding:7px 10px;min-width:90px}.document th{background:var(--surface)}.document blockquote{border-left:3px solid var(--accent);padding-left:13px;margin-left:0}.document mark{background:var(--accent);color:var(--accent-ink);border-radius:2px}.mt{margin-top:18px}.selector{width:100%;max-width:630px;margin-bottom:17px}.exam-settings{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin-bottom:20px}.exam-settings>div{background:var(--surface);border:1px solid var(--edge);padding:14px 10px;border-radius:11px;text-align:center}.exam-settings strong{display:block;font-size:29px;line-height:1.1}.exam-settings span{display:block;color:var(--muted);font-size:12px;margin-top:7px}.small-note{font-size:13px;margin:12px 0 19px}.question .qmeta{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;color:var(--muted);font-size:13px;margin-bottom:13px}.question h2{font-size:clamp(19px,3vw,24px);line-height:1.38;margin:4px 0 20px}.answers{display:grid;gap:10px;margin-bottom:19px}.option{border:1px solid var(--edge);border-radius:11px;padding:15px 16px;min-height:56px;background:var(--surface);color:var(--text);width:100%;text-align:left;display:flex;gap:13px;align-items:flex-start}.option .symbol{font-size:16px;border:2px solid var(--muted);border-radius:50%;width:21px;height:21px;flex:none;text-align:center;line-height:17px;margin-top:2px}.option.selected{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 9%,var(--surface))}.option.selected .symbol{border-color:var(--accent);background:var(--accent);color:var(--accent-ink)}.option.correct{border-color:var(--green)}.option.wrong{border-color:var(--red)}.option:disabled{opacity:1;cursor:default}.answer-feedback{margin:12px 0 20px;border:1px solid var(--edge);padding:14px;border-radius:11px;background:var(--surface);scroll-margin-bottom:100px}.answer-feedback strong{display:block;margin-bottom:6px}.answer-feedback .good{color:var(--green)}.answer-feedback .bad{color:var(--red)}.answer-feedback details{font-size:14px;margin-top:10px}.timerpanel{position:sticky;top:7px;z-index:6;border:2px solid var(--edge);border-radius:17px;background:var(--panel);padding:10px 21px 13px;text-align:center;margin-bottom:14px;box-shadow:0 4px 18px var(--shadow)}.timerpanel>span{font-size:12px;letter-spacing:.17em;color:var(--muted);font-weight:800}.timerpanel>strong{display:block;font-size:clamp(45px,9vw,76px);line-height:1.16;font-variant-numeric:tabular-nums;color:var(--accent);letter-spacing:.03em}.timerpanel.danger{border-color:var(--red)}.timerpanel.danger>strong{color:var(--red)}.timer-track{height:5px;background:var(--surface);border-radius:5px;overflow:hidden}.timer-track>div{height:100%;background:var(--accent);width:100%}.exam-buttons{display:flex;justify-content:space-between;gap:11px}.exam-buttons .btn{flex:1}.result-card{text-align:center;padding:27px}.result-count{font-size:clamp(52px,11vw,83px);line-height:1.17;font-weight:900;letter-spacing:-.04em;font-variant-numeric:tabular-nums;margin:18px 0}.result-count.green{color:var(--green)}.result-count.yellow{color:var(--yellow)}.result-count.red{color:var(--red)}.review-heading{margin:30px 0 16px}.mistakes{display:grid;gap:10px}.mistake{padding:16px}.mistake strong{display:block;font-size:16px;line-height:1.4}.mistake .wrong{color:var(--red)}.mistake .correct{color:var(--green)}.mistake p{font-size:14px}.profile-stars{display:grid;gap:10px}.profile-star{display:flex;align-items:center;gap:13px;padding:11px;background:var(--surface);border-radius:11px}.profile-star span{flex:1}.profile-star .star{order:2}.footer{color:var(--muted);font-size:11px;text-align:center;margin:0 auto 35px;max-width:860px}.mobile-nav{display:none}.modal{width:min(94vw,520px);max-height:min(90vh,720px);overflow:auto;padding:23px;border:1px solid var(--edge);border-radius:20px;background:var(--panel);color:var(--text);box-shadow:0 16px 90px #0008}.modal::backdrop{background:#000b}.modal form{display:grid;gap:10px}.modal label{font-weight:700;font-size:14px}.modal input,.modal textarea,.modal select{width:100%}.modal textarea{min-height:110px;resize:vertical}.modal-buttons{display:flex;flex-wrap:wrap;gap:10px;margin-top:8px}.status{min-height:16px;color:var(--muted);font-size:13px}.toast{position:fixed;z-index:30;right:20px;bottom:22px;max-width:min(85vw,400px);background:var(--accent);color:var(--accent-ink);border-radius:12px;padding:12px 17px;font-size:14px;font-weight:750;box-shadow:0 5px 22px #0006}
@media(max-width:900px){.shell{grid-template-columns:1fr}.sidebar{display:none}.app{padding:0 19px}.topbar{min-height:72px}.mobile-nav{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;bottom:0;left:0;right:0;z-index:15;background:var(--nav);border-top:1px solid var(--edge);padding:5px 4px calc(5px + env(safe-area-inset-bottom));box-shadow:0 -4px 20px var(--shadow)}.mobile-nav button{border:0;background:transparent;color:var(--muted);font-size:11px;font-weight:650;min-height:58px;border-radius:9px;display:grid;justify-items:center;align-content:center;gap:1px}.mobile-nav button span{font-size:22px;line-height:1.2}.mobile-nav button.active{color:var(--accent);background:var(--surface)}main{margin:20px auto 90px}.footer{padding-bottom:88px}.toast{bottom:85px}.timerpanel{top:5px}}
@media(max-width:570px){.app{padding:0 13px}.topbar{gap:6px;min-height:67px}.top-title .tiny{font-size:9px}.top-title strong{font-size:15px}.top-actions{gap:5px}#theme{max-width:99px;font-size:12px;padding:9px 3px}.feedback-small{padding:8px;font-size:15px}.feedback-small span{display:none}.card{padding:16px;border-radius:15px}.callout{display:block}.callout .btn{margin-top:13px;width:100%}.invite{padding:16px;min-height:86px}.invite strong{font-size:17px}.two-col,.catalog{grid-template-columns:1fr}.toolbar{display:grid;grid-template-columns:1fr}.toolbar input{width:100%}.toolbar.stacked{grid-template-columns:1fr;gap:6px}.toolbar.stacked label:not(:first-child){margin-top:7px}.rule-card .foot .btn{width:100%}.timerpanel{padding:8px 12px}.exam-settings strong{font-size:23px}.exam-settings span{font-size:11px}.option{padding:13px;min-height:55px}.exam-buttons{flex-wrap:wrap}.exam-buttons .btn{min-height:52px}.source-strip{gap:8px;font-size:12px}.document{padding:15px;font-size:15px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation:none!important;transition:none!important}}

/* During an active exam the bottom navigation must never cover answer controls. */
body.exam-running .mobile-nav{display:none!important}
body.exam-running #exam{padding-bottom:max(30px,env(safe-area-inset-bottom))}
body.exam-running .footer{display:none}
@media(min-width:901px){body.exam-running .side-nav{pointer-events:none;opacity:.6}}

.brand-icon{object-fit:contain;border:0!important;background:#15231a;border-radius:12px}.network-state{margin:14px auto 0;max-width:900px;border-left:3px solid var(--accent);background:var(--panel);padding:10px 14px;border-radius:8px;font-size:14px;overflow-wrap:anywhere}.network-state[data-kind=error]{border-color:var(--red)}.network-state[data-kind=offline]{border-color:var(--yellow)}.network-state[data-kind=online]{border-color:var(--edge);color:var(--muted)}.workflow-actions{display:flex;flex-wrap:wrap;gap:10px;margin:16px 0}.workflow-card{margin:16px 0;overflow-wrap:anywhere}.workflow-card .btn{margin:6px 8px 0 0}.receipt{margin:18px 0;padding:16px;border:1px solid var(--accent);border-radius:12px;display:grid;gap:12px}#identityBlock form,#ownedTicket form{display:grid;gap:10px;margin-top:22px}#ownedTicket>p{white-space:pre-wrap;overflow-wrap:anywhere}#ownedTicket textarea{width:100%;min-height:110px}.checkline{display:flex;align-items:flex-start;gap:12px;line-height:1.4}.checkline input{width:22px;min-height:22px;flex:none}.modal textarea{width:100%;min-height:90px}.modal{max-height:calc(100dvh - 32px);overflow:auto;overscroll-behavior:contain}.modal form{padding-bottom:env(safe-area-inset-bottom)}button,a,input,select,textarea{touch-action:manipulation}input,textarea{max-width:100%}.status{white-space:pre-wrap;overflow-wrap:anywhere}.btn:focus-visible{outline-offset:4px}@media(max-width:600px){.network-state{font-size:13px}.workflow-actions>.btn{flex:1 1 140px}.workflow-card{padding:16px}#tickets h1,#notifications h1,#ticket h1{font-size:28px}#main{padding-bottom:calc(30px + env(safe-area-inset-bottom))}}@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

.landing{margin:28px 0 34px}
.landing h1{font-size:clamp(36px,6vw,68px);line-height:1.04;letter-spacing:-.045em;margin:.18em 0 .32em;overflow-wrap:anywhere}
.landing-copy>p:not(.eyebrow){max-width:34ch;color:var(--muted)}
.landing-actions{display:flex;flex-wrap:wrap;gap:10px;margin:24px 0 10px}
.landing-profile{margin:3px 0 0;text-align:left}
#home>.invite{margin-top:16px}
@media(max-width:390px){.landing-actions>.btn{width:100%}}
/* Shared PРАВИЛ.НЕТ shell for the browser and installed PWA. */
:root{--bg:#061f14;--panel:#102c20;--surface:#18392b;--edge:#365244;--text:#f4f0e7;--muted:#a9bcb0;--accent:#f5c677;--accent-ink:#191a12;--nav:#0d281d}
:root[data-theme=light]{--bg:#f4f0e7;--panel:#fffdf7;--surface:#eee8db;--edge:#cfc6b6;--text:#232b27;--muted:#4e5e55;--accent:#76501a;--accent-ink:#fffdf7;--nav:#fffdf7}
.shell{display:block;max-width:none}
.app{padding:0 28px}
.topbar,main{max-width:1120px}
.topbar{min-height:80px;gap:14px}
.brand-home{background:none;color:var(--text);border:0;padding:0;min-height:48px;text-align:left;white-space:nowrap;gap:8px}
.brand-home img{display:block;width:92px;height:76px;object-fit:contain}
:root[data-theme=light] .brand-home img{background:#102c20;border-radius:12px}
.landing-copy h1 span{color:var(--accent)}
.desktop-nav{display:flex;align-items:center;gap:3px;margin-left:auto}
.desktop-nav button{background:none;border:0;border-radius:8px;min-height:48px;padding:8px 10px;color:var(--muted);font-weight:700}
.desktop-nav button[aria-current=page]{color:var(--accent)}
.desktop-profile{white-space:nowrap}
.landing h1{max-width:15ch;font-size:clamp(36px,5.1vw,69px);font-weight:870}
.landing-copy>p:not(.eyebrow){font-size:clamp(16px,2vw,19px)}
.preparation{margin-top:24px}
.preparation-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.preparation-grid .feature{min-width:0;min-height:110px;text-align:left;border-radius:15px}
.home-library{margin:30px 0}
.home-library-top{display:flex;justify-content:space-between;align-items:baseline;gap:12px}
.direction-chips{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 21px}
.direction-chips button{border:1px solid var(--edge);border-radius:99px;background:var(--panel);color:var(--text);min-height:44px;padding:8px 15px}
.direction-chips button[aria-pressed=true]{background:var(--accent);border-color:var(--accent);color:var(--accent-ink);font-weight:750}
.catalog-tools>label:not(.checklabel){display:grid;gap:5px}
.catalog-tools select{width:100%}
.catalog-tools .checklabel{display:flex;justify-content:flex-start;align-items:center;gap:8px;white-space:nowrap;min-height:48px}
.catalog-tools .checklabel input{width:18px;height:18px;min-height:18px;margin:0}
.app .network-state{max-width:1120px}
.rule-category{margin:0 0 7px;font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.055em}
.library-proposal{margin-top:18px}
.btn{min-height:48px}
@media(max-width:900px){
 .desktop-nav,.desktop-profile{display:none}
 .app{padding:0 16px}
 .preparation-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:570px){
 .topbar{min-height:66px}
 .brand-home img{width:76px;height:64px}
 .landing{margin:18px 0 24px}
 .landing-copy{padding:0}
 .landing-actions .btn{min-width:0}
 .preparation-grid .feature{min-height:95px}
}

/* The site and installed app share this shell. */
:root:not([data-theme=light]) {
  --bg: #242526;
  --panel: #2e3031;
  --surface: #383a39;
  --nav: #292a2b;
  --edge: #686961;
  --text: #ded9ce;
  --muted: #bbb6a9;
  --accent: #cbb893;
  --accent-ink: #23221c;
  --green: #b7c394;
  --yellow: #d7bc82;
  --red: #e5a89e;
  --action: #545d42;
  --action-text: #e5dfd1;
  --action-edge: #8d9874;
  --secondary-action: #494037;
  --shadow: #14141466;
  color-scheme: dark;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-text-size-adjust: 100%;
}

.topbar { gap: 12px; padding-block: 9px; }
.top-actions { flex: 0 0 auto; }
.brand-home {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 3px;
  min-width: 0;
  padding: 3px 0;
}
.brand-home .wordmark {
  color: var(--text);
  font-size: clamp(19px, 3.2vw, 29px);
  font-weight: 780;
  line-height: 1.06;
  letter-spacing: .025em;
}
.brand-home small {
  margin: 0;
  color: var(--muted);
  font-size: clamp(10px, 1.25vw, 13px);
  font-weight: 550;
  line-height: 1.3;
  letter-spacing: .015em;
}

:root:not([data-theme=light]) :is(.btn.primary, .invite, .direction-chips button[aria-pressed=true]) {
  background: var(--action);
  color: var(--action-text);
  border: 1px solid var(--action-edge);
}
:root:not([data-theme=light]) .btn.secondary { background: var(--secondary-action); }
:root:not([data-theme=light]) .invite small { color: var(--action-text); opacity: 1; }
:root:not([data-theme=light]) .star.selected { color: var(--accent); border-color: var(--edge); }

h1, h2, h3 { line-height: 1.2; text-wrap: pretty; }
.landing h1 { font-weight: 780; letter-spacing: -.025em; line-height: 1.08; }
.btn { font-weight: 700; }
:is(.btn, .option, .direction-chips button, .invite, .preparation-grid .feature) {
  overflow-wrap: anywhere;
  min-width: 0;
}
.card > :first-child, .modal h2, .workflow-card > h2 { margin-top: 0; }
.workflow-card { display: grid; align-items: start; gap: 10px; }
.workflow-card > :is(h2,p,details,button) { margin: 0; }
.workflow-card > button { justify-self: start; max-width: 100%; }
.workflow-card details { padding: 10px 12px; border: 1px solid var(--edge); border-radius: 10px; }
.workflow-card summary { cursor: pointer; color: var(--text); font-weight: 650; }
.workflow-card details ul { margin: 8px 0 0; padding-inline-start: 20px; }
.workflow-card details li + li { margin-top: 7px; }
.catalog-tools > label, .toolbar > *, .exam-settings > * { min-width: 0; }
.document { overflow-wrap: anywhere; }
.document table { max-width: 100%; }
.document :is(td, th) { overflow-wrap: normal; }

@media (max-width: 600px) {
  .app { padding-inline: clamp(12px, 4vw, 22px); }
  .top-actions { gap: 6px; }
  .top-actions select { padding-inline: 8px; max-width: 102px; }
  .card, .modal { padding: clamp(15px, 4vw, 22px); }
  .landing-copy h1 { max-width: none; }
  .preparation-grid { gap: 9px; }
  .preparation-grid .feature { gap: 5px; }
  .preparation-grid .feature strong { font-size: clamp(15px, 4.1vw, 18px); }
  .home-library-top { align-items: start; flex-wrap: wrap; gap: 4px 12px; }
  .exam-buttons .btn { flex: 1 1 140px; }
  .modal-buttons > .btn { flex: 1 1 120px; }
}

@media (max-width: 350px) {
  .mobile-nav button { font-size: 10px; }
  .brand-home .wordmark { font-size: 17px; }
}

.topbar [data-route="profile"], .mobile-nav [data-route="profile"] {
  position: relative;
}

.topbar .profile-unread, .mobile-nav .profile-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  padding: 1px 5px;
  border-radius: 12px;
  color: var(--accent-ink);
  background: var(--accent);
  font: 700 11px/1 system-ui, sans-serif;
}

.topbar .profile-unread { margin-inline-start: 6px; }
.mobile-nav .profile-unread { position: absolute; inset-block-start: 3px; inset-inline-start: calc(50% + 9px); }

.theme-choices { display: flex; align-items: center; gap: 1px; }
.theme-choice {
 display: grid; place-items: center; width: 34px; min-height: 44px;
 border: 0; background: transparent; padding: 0;
}
.theme-choice::before {
 content: ''; width: 15px; height: 15px; border-radius: 50%;
 border: 1px solid #85837c;
}
.theme-choice[data-theme-choice=light]::before { background: #e6decb; }
.theme-choice[data-theme-choice=forest]::before { background: #28292a; }
.theme-choice[data-theme-choice=system]::before { background: linear-gradient(90deg, #e6decb 50%, #28292a 50%); }
.theme-choice[aria-pressed=true]::before { outline: 2px solid var(--accent); outline-offset: 3px; }
.header-link {
 border: 0; background: transparent; color: var(--muted); font: inherit;
 font-weight: 700; min-height: 44px; padding: 8px; border-radius: 8px;
}
.header-link:is(:hover,[aria-current=page]) { color: var(--accent); }
.header-link.feedback-small span { display: inline; }
.desktop-profile { max-width: 185px; }
.profile-label { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desktop-profile .profile-label { max-width: calc(100% - 25px); vertical-align: middle; }
.mobile-nav button .profile-label { font: inherit; max-width: calc(100% - 8px); }
.mobile-nav [data-route=profile] { min-width: 0; }
@media (min-width: 901px) and (max-width: 1100px) {
 .desktop-nav button { padding-inline: 5px; }
 .desktop-profile { max-width: 128px; }
 .theme-choice { width: 30px; }
}
@media (max-width: 450px) {
 .theme-choice { width: 30px; }
 .header-link.feedback-small { padding-inline: 5px; }
}

.team-office-form { display: grid; gap: 12px; max-width: 620px; }
.team-office-form label { display: grid; gap: 6px; }
.team-office-form input, .team-office-form select { width: 100%; }
.team-office-form button { justify-self: start; }
.team-office-form .status:empty { display: none; }
.team-office-member { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-block: 4px; }
.team-office-members { min-width: 0; }

@media (min-width: 901px) {
  .topbar .desktop-profile {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 170px;
    min-width: max-content;
  }
  .topbar .desktop-profile .profile-label { max-width: clamp(11ch, 14vw, 18ch); }
  .topbar .profile-unread { margin-inline-start: 0; }
  .desktop-nav button { padding-inline: clamp(5px, .75vw, 10px); }
}
@media (min-width: 901px) and (max-width: 1020px) {
  .topbar { gap: 6px; }
  .top-actions { gap: 4px; }
  .topbar .desktop-profile .profile-label { max-width: 11ch; }
}
.landing { margin-block: 18px 24px; }
.landing h1 { font-size: clamp(30px, 4.8vw, 54px); max-width: none; }
.home-library { margin-block: 20px; }
.home-book-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,210px),1fr)); gap: 12px; }
.home-book { display: grid; align-content: start; text-align: left; gap: 5px; }
.home-book :is(h3,p,.text-button) { margin: 0; }
.home-book .text-button { justify-self: start; }
#homeResume { margin-block: 14px; }
#homeResume h2 { font-size: 19px; margin-bottom: 8px; }
.reader-header { max-width: 82ch; }
.reader-actions, .reader-search, .reader-tools, .practice-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reader-actions { margin-block: 12px; }
.reader-actions .text-button { padding-inline: 8px; min-height: 44px; }
.reader-search { margin-block: 14px 5px; }
.reader-search input { width: min(100%,30ch); flex: 0 1 30ch; }
.reader-search button { min-width: 44px; }
.reader-search #readerSearchStatus { flex-basis: 100%; min-height: 1.4em; color: var(--muted); }
.reader-tools { margin-block: 10px 18px; }
.reader-tools .text-button { padding: 8px 10px; min-height: 44px; }
.reader-layout { display: grid; gap: 14px; align-items: start; }
.reader-toc { background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; padding: 12px 16px; }
.reader-toc summary { cursor: pointer; font-weight: 700; }
.reader-toc ul { list-style: none; padding: 0; margin-bottom: 0; }
.reader-toc li button { text-align: left; line-height: 1.35; }
.reader-body { min-width: 0; }
#rulesDocument { font-size: clamp(17px, 1.6vw, 18px); line-height: 1.63; max-width: 76ch; }
#rulesDocument[data-text-size='0'] { font-size: 16px; }
#rulesDocument[data-text-size='2'] { font-size: 20px; }
#rulesDocument[data-text-size='3'] { font-size: 22px; }
#rulesDocument :is(h1,h2,h3,h4,p,ol,ul) { scroll-margin-top: 20px; }
#rulesDocument :is(h2,h3,h4) { margin-top: 1.25em; line-height: 1.25; }
#rulesDocument table { display: block; overflow-x: auto; }
#rulesDocument .rule-point-active { border-inline-start: 3px solid var(--accent); padding-inline-start: 10px; background: var(--surface); }
#rulesDocument mark.rule-match { color: var(--text); background: var(--surface); border-radius: 2px; }
#rulesDocument mark.current-match { color: var(--accent-ink); background: var(--accent); }
.rule-passage { white-space: pre-line; font-size: 1rem; line-height: 1.55; }
.training-source summary { cursor: pointer; padding-block: 8px; font-weight: 650; }
#trainingSummary .btn { margin: 6px 6px 0 0; }
#trainingProgress { text-align: right; }
.practice-mode { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.study-review { scroll-margin-top: 12px; }
.study-modal { max-height: min(calc(var(--study-viewport-height, 100dvh) - 24px), 800px); }
.study-modal .modal-title { display: flex; align-items: start; gap: 12px; justify-content: space-between; position: sticky; top: 0; z-index: 1; background: var(--panel); }
.study-modal .modal-title h2 { margin: 0; }
.study-modal .modal-close { padding: 0; min-width: 42px; min-height: 42px; border: 1px solid var(--edge); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 21px; }
.study-modal .modal-buttons { position: sticky; bottom: 0; background: var(--panel); padding-block: 7px; }
#suggestExtras { border: 1px solid var(--edge); border-radius: 9px; padding: 9px 12px; }
#suggestExtras summary { cursor: pointer; font-weight: 650; }
#suggestExtras label { display: block; margin-top: 8px; }

@media (min-width: 980px) {
  .reader-layout { grid-template-columns: minmax(175px,225px) minmax(0,1fr); gap: 20px; }
  .reader-layout:has(.reader-toc[hidden]) { display: block; }
  .reader-toc { position: sticky; top: 12px; max-height: calc(100dvh - 24px); overflow: auto; }
}
@media (max-width: 480px) {
  .reader-search input { flex: 1 1 100%; }
  .reader-search button { min-height: 44px; }
  .reader-tools { gap: 5px; }
  #rulesDocument { padding: clamp(12px,4vw,16px); }
  .home-book :is(h3,p) { overflow-wrap: anywhere; }
}


.exam-book-picker{display:grid;gap:12px;max-width:760px;margin:12px 0 0}
.exam-book-picker label{font-weight:650}
#examBook.selector{width:100%;margin:0}
.exam-reading{display:flex;flex-wrap:wrap;align-items:center;gap:4px 18px;margin:12px 0 16px}
.exam-reading .text-button{min-height:44px;text-align:left}
.exam-reading .source-strip{margin:0}
