:root {
  --lc-night: #102d3c; --lc-ink: #173e47; --lc-pearl: #f5f8f5; --lc-mint: #b6f1df;
  --lc-edge: rgba(196,231,242,.38); --lc-ease: cubic-bezier(.18,.75,.24,1);
  --lc-top: calc(52px + env(safe-area-inset-top,0px)); --lc-bottom: max(8px,env(safe-area-inset-bottom,0px));
  --lc-pad: max(10px,env(safe-area-inset-left,0px),env(safe-area-inset-right,0px));
  --lc-window: clamp(130px,24dvh,300px);
}
.v5-scene { isolation:isolate; touch-action:auto }
.v5-stage { position:absolute; inset:0; z-index:3; pointer-events:none }
.v5-atlas-bg { z-index:1 }
.v5-graph-mini {pointer-events:auto}
.v5-gb-btn {touch-action:manipulation}
.v5-gb-btn>span {pointer-events:none}
body.ub-touch .v5-scene .v5-plate::before,body.ub-touch.v3-off .v5-bg::after {animation:none}
.v5-scene :focus-visible,.lc-pagebar :focus-visible,#ub-version-tag:focus-visible { outline:3px solid #58bbba; outline-offset:2px }
body.ub-one-stage .v5-plate { background:radial-gradient(ellipse at 12% 0%,#faffff 0%,transparent 56%),linear-gradient(142deg,#e5f1f1,#f2f2ed 54%,#dcece9)!important; color:var(--lc-ink);border:1px solid rgba(255,255,255,.78);box-shadow:inset 0 2px 1px #fff,0 18px 48px #08263338 }
.v5-plate::before { pointer-events:none }
.v5-explore { color:#fff!important; background:linear-gradient(105deg,#235751,#2b6476 68%,#465a77)!important;box-shadow:inset 0 1px 1px #d7fcff75,0 5px 18px #102a3540!important }
.v5-explore::after { animation-iteration-count:1 }
body.ub-one-stage .v5-sat.is-predicted { border-color:var(--lc-mint)!important;box-shadow:inset 3px 0 0 #a6e9d7,inset 0 1px 0 #d7fff344,0 5px 20px #09293748 }
.v5-sat.is-predicted .v5-s-badge { color:#123a39;background:#b6f1df;border:0 }
.v5-sat .v5-s-kicker { color:#d2e7e9 }
#ub-version-tag { display:inline-flex;align-items:center;justify-content:center;min-height:44px;top:5px;pointer-events:auto;text-decoration:none;color:#e4f4f3;font:600 11px/1 system-ui;letter-spacing:.055em;text-shadow:0 1px 5px #07323c }
.lc-node-nav { display:inline-flex;gap:2px;align-items:center }
.lc-node-nav button,.lc-reader-foot button { border:1px solid #37666d42;background:#ffffff9c;color:var(--lc-ink);border-radius:14px;min-width:44px;min-height:44px;cursor:pointer;font:600 20px/1 system-ui }
.lc-reader-foot { display:none }
.lc-search-done {display:none}
body:not(.ub-one-stage) :is(#v3-toggle,#v5-cloudscape) { visibility:hidden;pointer-events:none }
.lc-pagebar:not([hidden]) { position:sticky;top:0;z-index:30;display:flex;align-items:center;gap:8px;padding:calc(4px + env(safe-area-inset-top,0px)) var(--lc-pad) 4px;background:#153944;color:#effaf7;border-bottom:1px solid #64838b }
.lc-pagebar :is(a,summary) { display:inline-flex;align-items:center;min-height:44px;padding:0 12px;color:inherit;text-decoration:none;cursor:pointer;border-radius:12px }
.lc-pagebar :is(a,summary):hover { background:#c6f4f01a }
.lc-pagebar details { margin-left:auto }
.lc-directory { position:absolute;top:100%;right:var(--lc-pad);width:min(440px,calc(100% - 2 * var(--lc-pad)));max-height:72dvh;overflow:auto;overscroll-behavior:contain;display:grid;grid-template-columns:1fr 1fr;padding:12px;background:#173c47;color:#f2fbfa;border:1px solid var(--lc-edge);border-radius:0 0 20px 20px;box-shadow:0 12px 45px #04151b66 }
.lc-directory strong { grid-column:1/-1;padding:12px;color:#b6eada;font-size:.78rem;letter-spacing:.07em }
body:not(.ub-one-stage) #view { min-width:0;overflow-wrap:anywhere }
body:not(.ub-one-stage) #view :is(img,video,iframe) { max-width:100% }
@media(max-width:1365px) {
  .v5-stage {position:fixed}
  .v5-scene[data-os-state]:is([data-os-state="atlas"],[data-os-state="world"]) .v5-stage {padding-top:calc(var(--lc-top) + var(--lc-window) + 8px)}
  .v5-scene:not([data-graph-expanded="1"]) .v5-atlas-bg { inset:var(--lc-top) var(--lc-pad) auto; width:calc(100% - 2 * var(--lc-pad)); height:var(--lc-window);border-radius:20px;box-shadow:0 0 0 1px var(--lc-edge) }
  .v5-graph-bar,.v5-scene[data-graph-expanded="1"] .v5-graph-bar { top:calc(var(--lc-top) + 5px);right:calc(var(--lc-pad) + 6px);left:auto;transform:none }
  .v5-scene:not([data-graph-expanded="1"]) .v5-gb-zoom,.v5-gb-hint {display:none}
  .v5-gb-btn,.v5-gm-open {min-width:44px;height:44px;padding-inline:12px}
  .v5-graph-mini {pointer-events:auto}
  .v5-scene[data-os-state] .v5-stage {padding-inline:var(--lc-pad);padding-bottom:var(--lc-bottom);box-sizing:border-box}
  .v5-scene[data-os-state="reader"] .v5-plate-anchor { margin-top:0 }
  .v5-reader-head {position:relative;inset:auto!important;order:-1;max-width:100%;width:100%;margin:0 0 5px;gap:5px;flex:none}
  .v5-rh-title {min-width:0;flex:1 1 auto;justify-content:flex-start}
  .v5-rh-name {max-width:none;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .v5-rh-chapter,.v5-rh-title,.v5-rh-progress {min-height:44px}
  .v5-scene[data-os-state="reader"] .v5-plate-inner {padding:12px clamp(14px,3vw,38px) 6px}
  .v5-contour,.v5-contour-track {display:none}
  .v5-scene[data-os-state="reader"] .vp-paras {margin-top:0;overscroll-behavior-y:contain;touch-action:pan-y pinch-zoom}
  .v5-scene[data-os-state="reader"] .vp-para {font:clamp(1.04rem,1.3vw,1.22rem)/1.62 Georgia,'Times New Roman',serif;color:#183b44}
  .lc-reader-foot {display:flex;justify-content:space-between;align-items:center;gap:8px;max-width:65ch;width:100%;margin:auto auto 0;border-top:1px solid #426d771f;color:#49656c;font:500 11px/1.25 system-ui}
  .lc-reader-foot button {padding:0 9px;background:transparent;border:0;font-size:13px}
  .v5-plate-inner>.v5-hub-world {display:grid;flex:1 1 0;min-height:0;grid-template-rows:minmax(50px,1fr) auto;gap:6px;border-radius:16px;overflow:auto;overscroll-behavior:contain}
  .v5-hub-canvas {position:relative;inset:auto;min-height:0;height:100%;width:100%;grid-row:1;touch-action:pan-y}
  .v5-hub-focus {position:relative;inset:auto;grid-row:2;width:100%;max-height:none;gap:3px;padding:8px 12px;grid-template-columns:minmax(0,1fr);border-radius:16px}
  .v5-hub-focus>* {grid-column:1;grid-row:auto}
  .v5-hf-actions {flex-direction:row;justify-content:flex-start;gap:8px;flex-wrap:wrap}
  .v5-hf-open {min-height:44px;flex:1 1 auto}
  .v5-hf-progress,.v5-hub-hint {display:none}
  .v5-hf-line {display:-webkit-box;-webkit-line-clamp:2}
  .v5-scene:is([data-os-state="world"],[data-os-state="atlas"]) .v5-plate-inner {padding:0!important}
  .aa-wrap {padding:0 14px!important}
  .aa-frame {overflow:auto;overscroll-behavior:contain;touch-action:pan-y pinch-zoom;padding:5px 0 16px;mask-image:none!important}
  .aa-frame>* {flex:0 0 auto!important}
  .aa-sheet-bar {display:flex;position:static;min-height:36px;margin:0;width:100%;background:transparent}
  .aa-actions {position:static!important;opacity:1!important;transform:none!important;pointer-events:auto!important}
  .aa-icon,.aa-rels .aa-rel {min-width:44px;min-height:44px}
  .aa-results {position:static;max-height:9rem;overflow:auto}
  .v5-intent-chip {display:none!important}
  .v5-scene .v5-sat {min-width:0}
  .v5-sat .v5-s-title,.v5-explore-label {font-size:clamp(12px,1.5vw,15px)}
}
@media(max-width:720px) {
  .v5-scene[data-os-state] .v5-stage {gap:5px}
  .v5-scene:not([data-os-state="atlas"]):not([data-os-state="world"]) .v5-stage {padding-top:var(--lc-top)}
  .v3-toggle,.ub-onboard-help,#ub-version-tag {top:calc(3px + env(safe-area-inset-top,0px));min-height:44px}
  .ub-onboard-help {width:44px;height:44px;right:var(--lc-pad)}
  #ub-version-tag {right:calc(var(--lc-pad) + 50px);font-size:10px}
  .v5-sat-grid {gap:5px}
  .v5-scene .v5-sat {height:auto!important;min-height:49px!important;border-radius:16px!important}
  .v5-sat .v5-sat-inner {padding:5px 9px;gap:2px}
  .v5-sat .v5-s-body {display:none}
  .v5-sat .v5-s-title {font-size:13px;white-space:normal;line-height:1.12;overflow-wrap:anywhere}
  .v5-scene .v5-explore {min-height:44px;width:100%;border-radius:17px}
  .v5-explore-place {overflow:hidden;max-width:48%;text-overflow:ellipsis;white-space:nowrap}
  .v5-stats {margin-top:2px}
  .v5-stat {min-height:34px}
  .cab-case {grid-template-columns:repeat(auto-fit,minmax(60px,1fr))!important}
  .v5-plate-inner>.cab-wrap {overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y pinch-zoom}
  .cab-wrap>* {flex-shrink:0}
  .cab-wrap .cab-case {flex:0 0 auto;overflow:visible}
  .cab-item:not(.is-found) {opacity:.88;filter:none}
  .aa-title {overflow-wrap:anywhere}
  .aa-search-zone {min-width:0}
  .aa-rels-list,.aa-data {touch-action:pan-x pan-y}
  .aa-sheet-bar {min-height:44px}
  .lc-invite {animation:lcInvite .9s var(--lc-ease) 2 alternate}
  @keyframes lcInvite {to {box-shadow:0 0 0 4px #b6f1df42,inset 0 1px 0 #ffffffb3}}
}
@media(min-width:600px) and (max-width:1365px) and (max-height:650px) and (orientation:landscape) {
  :root {--lc-side:clamp(192px,28vw,320px)}
  .v5-scene[data-os-state] .v5-stage {display:grid;grid-template-columns:minmax(0,1fr) var(--lc-side);grid-template-rows:minmax(0,1fr) auto;align-items:stretch;gap:6px 10px;padding:var(--lc-top) var(--lc-pad) var(--lc-bottom)!important}
  .v5-scene[data-os-state] .v5-plate-anchor {grid-area:1/1/3/2;align-self:stretch;width:100%!important;margin:0}
  .v5-sat-grid {grid-area:1/2;display:grid;grid-template-columns:1fr 1fr;align-content:end;width:100%;gap:5px}
  .v5-scene .v5-sat {min-height:48px!important;height:auto!important}
  .v5-scene .v5-explore {grid-area:2/2;width:100%;min-height:44px;place-self:end center;transform:none!important}
  .v5-collapse,.v5-s-body,.lc-reader-foot span {display:none}
  .v5-scene:is([data-os-state="world"],[data-os-state="atlas"]) .v5-stage {grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);grid-template-rows:minmax(0,1fr) auto}
  .v5-scene:is([data-os-state="world"],[data-os-state="atlas"]) .v5-plate-anchor {grid-area:1/2}
  .v5-scene:is([data-os-state="world"],[data-os-state="atlas"]) .v5-sat-grid {grid-area:2/2;grid-template-columns:repeat(2,minmax(0,1fr))}
  .v5-scene:is([data-os-state="world"],[data-os-state="atlas"]) .v5-explore {grid-area:2/1;align-self:end}
  .v5-scene:not([data-graph-expanded="1"]) .v5-atlas-bg {width:calc((100% - 2 * var(--lc-pad) - 10px) / 2.1);height:calc(100% - var(--lc-top) - var(--lc-bottom) - 72px)}
  .v5-scene:not([data-graph-expanded="1"]) .v5-graph-bar {left:calc(var(--lc-pad) + 4px);right:auto}
}
@media(prefers-reduced-motion:reduce) { .lc-invite {animation:none} }
@media(pointer:coarse) and (max-width:1365px), (max-width:720px) {
  /* v0.11: раскладка «под клавиатуру» включается только при ОТКРЫТОМ поиске. Раньше её
     запускал любой фокус в зоне — в том числе на самой лупе, и тап по ней терялся. */
  .v5-scene:has(.aa-search-zone.is-open:focus-within) {--lc-window:56px}
  .v5-scene[data-os-state="atlas"]:has(.aa-search-zone.is-open:focus-within) .v5-stage {display:flex;height:min(100dvh,var(--lc-visible-height,100dvh));padding-top:calc(var(--lc-top) + var(--lc-window) + 5px)!important}
  .v5-scene:has(.aa-search-zone.is-open:focus-within) :is(.v5-stats,.v5-collapse,.v5-explore,.v5-sat-grid,.aa-sheet-bar) {display:none!important}
  .aa-search-zone:focus-within .aa-search {display:flex;align-items:center;gap:4px}
  .aa-search-zone:focus-within input {min-width:0}
  .aa-search-zone:focus-within .lc-search-done {display:inline-flex;align-items:center;min-height:44px;padding:0 10px;border:0;border-radius:12px;background:#23595c;color:#fff}
  .aa-search-zone .aa-results {max-height:none;overflow:visible}
  .aa-search-zone .aa-results button {min-height:44px}
}
@media(max-width:720px) and (min-height:740px) {
  .v5-sat.is-predicted .v5-s-body {display:block;color:#d3eee9;font-size:11px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
}
