/* Section filter in the bottom dock. */
.dock-sections{position:relative;display:flex;min-width:0}
#sections-toggle{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:100%;white-space:nowrap}
#sections-toggle svg{width:14px;height:14px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;transition:transform .15s}
#sections-toggle[aria-expanded=true] svg{transform:rotate(180deg)}
.sections-pop{position:absolute;z-index:20;left:50%;bottom:calc(100% + 10px);transform:translateX(-50%);width:max-content;min-width:220px;max-width:calc(100vw - 24px);padding:8px;border:1px solid #9f957466;border-radius:12px;box-shadow:0 14px 34px #0006}
.sections-pop[hidden]{display:none}
.sections-pop-row{display:flex;align-items:center;gap:10px;min-height:36px;padding:6px 8px;border-radius:7px;color:var(--ui-text,#eeeae0);font:500 12px system-ui;cursor:pointer;white-space:nowrap}
.sections-pop-row[data-loading]::after{content:"загрузка…";margin-left:auto;color:var(--ui-muted,#aaa);font-size:10px}
.sections-pop-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:6px;padding-top:8px;border-top:1px solid var(--ui-line,#ffffff22)}
.sections-pop-actions button{min-height:32px;border:1px solid var(--ui-line,#ffffff33);border-radius:8px;background:var(--ui-surface,#29312d);color:var(--ui-text,#eee);font:600 11px system-ui;cursor:pointer}
html[data-theme=light] .sections-pop{background:#fafaf6;border-color:#bcc9bc;box-shadow:0 14px 34px #273c2c2b}
html[data-theme=light] .sections-pop-row{color:#293c31}
html[data-theme=light] .sections-pop-row:hover{background:#e7ece5}
html[data-theme=light] .sections-pop-actions button{background:#f0eee9;border-color:#b8c1b7;color:#27332f}
html[data-theme=light] .viewtools #sections-toggle{background:#f0eee9!important;color:#27332f!important;border-color:#b8c1b7!important}

/* Floor picker only matters while walking. */
.presentation-select:has(#floor-select){width:190px}
body:not(.walking) .viewtools .presentation-select:has(#floor-select){display:none!important}

/* Desktop walk: height buttons next to the arrow pad, clear of the open side panel. */
@media(min-width:901px){body.workspace-open #walkpad{left:352px}}
#walkpad .height-grid{display:grid;grid-template-rows:repeat(2,42px);gap:4px}
#walkpad .height-grid button{display:inline-flex;align-items:center;gap:6px;padding:0 12px}
#walkpad .height-grid svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* Touch walk: height buttons on the right edge, clear of both sticks. */
#walk-vertical{display:none;position:absolute;z-index:3;right:12px;top:50%;transform:translateY(-50%);flex-direction:column;gap:10px}
#walk-vertical button{width:52px;height:52px;display:grid;place-items:center;border:1px solid #ffffffa8;border-radius:50%;background:#183b3b55;color:#fff;touch-action:none;backdrop-filter:blur(6px)}
#walk-vertical svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
html[data-theme=light] #walk-vertical button{background:#f0eee9cc;border-color:#93a794;color:#27332f}
@media(max-width:700px){
 body.walking #walk-vertical{display:flex}
 body.workspace-open.walking #walk-vertical,body.tool-panel-open.walking #walk-vertical{visibility:hidden}
 .viewtools{grid-template-columns:repeat(4,minmax(0,1fr))!important}
 .viewtools>#types-toggle{order:2}.viewtools>#mobile-tools-toggle{order:3}

 .sections-pop{position:fixed;left:8px;right:8px;transform:none;bottom:calc(var(--mobile-dock-height,48px) + 18px + env(safe-area-inset-bottom));width:auto;min-width:0}
 .presentation-select:has(#floor-select){width:100%}
 #minimap{display:none!important}
}

/* Phones in landscape: compact chrome, sticks instead of the desktop arrow pad, no map. */
@media(pointer:coarse) and (orientation:landscape) and (max-height:540px){
 .topbar{top:6px;left:6px;right:6px;height:40px;padding:4px 10px;border-radius:9px}
 .topbar .brand span,.topbar .brand div{display:none}
 .weon-logo{width:58px}
 .topbar button{min-height:30px;height:30px;padding:0 9px;font-size:11px}
 .topbar #fullscreen span{display:none}
 .viewtools{bottom:calc(6px + env(safe-area-inset-bottom));padding:4px;gap:4px;flex-wrap:wrap;justify-content:center;max-width:calc(100% - 12px)}
 .viewtools button,.viewtools .presentation-select-trigger{min-height:32px;height:32px;padding:0 9px;font-size:11px}
 body.walking .viewtools>:not(#home):not(#walk):not(#types-toggle):not(.presentation-select:has(#floor-select)){display:none!important}
 #walkpad,#minimap,#model-legend{display:none!important}
 body.walking #joystick-wrap,body.walking #look-wrap{display:flex!important;position:absolute;width:auto;flex-direction:column;align-items:center;gap:5px;color:#fff;font-size:10px;font-weight:650;text-shadow:0 1px 3px #000b;pointer-events:none;bottom:calc(58px + env(safe-area-inset-bottom))!important;z-index:3}
 #joystick-wrap{left:22px!important}#look-wrap{right:22px!important}
 #joystick,#look-joystick{position:relative;width:96px!important;height:96px!important;border:1px solid #ffffffa8;border-radius:50%;background:#183b3b39;touch-action:none;pointer-events:auto}
 #joystick-knob,#look-knob{position:absolute;border-radius:50%;background:#ffffffe6;transform:translate(-50%,-50%);pointer-events:none}
 #joystick-knob,#look-knob{top:50%!important;left:50%!important;width:38px!important;height:38px!important}
 body.walking #walk-vertical{display:flex;right:48px;top:auto;bottom:calc(172px + env(safe-area-inset-bottom));transform:none}
 body.walking .viewtools{left:50%!important;right:auto!important;transform:translateX(-50%);flex-wrap:nowrap;max-width:calc(100% - 290px)}
 body.walking .presentation-select:has(#floor-select){width:150px}
 #walk-vertical button{width:44px;height:44px}
 .sections-pop{max-height:calc(100dvh - 70px);overflow:auto}
 .model-panel,.tool-panel{top:52px;bottom:52px;max-height:none}
}
@media(prefers-reduced-motion:reduce){#sections-toggle svg{transition:none}}

/* Unified "Разделы" panel: section visibility + grouped element types. */
#types-panel{width:300px}
#types-panel .type-group summary,#types-panel .type-group-plain>div{gap:9px}
#types-panel .type-group-plain>div{display:flex;align-items:center;min-height:40px;padding:8px 10px;color:var(--ui-text);font:600 11px system-ui}
#types-panel .type-group-plain>div::before{content:"";width:7px;flex:none}
#types-panel .type-group-count{margin-left:auto;color:var(--ui-muted,#aaa);font:500 10px system-ui}
#types-panel .type-group.section-off>summary>span,#types-panel .type-group-plain.section-off>div>span{opacity:.55}
.type-subgroup{margin:2px 10px 6px;border-left:1px solid var(--ui-line);padding-left:6px}
.type-subgroup>summary{display:flex;align-items:center;gap:8px;min-height:34px;padding:4px 6px;border-radius:6px;color:var(--ui-text);font:600 11px system-ui;cursor:pointer;list-style:none}
.type-subgroup>summary::-webkit-details-marker{display:none}
.type-subgroup>summary:hover{background:#ffffff08}
.type-subgroup>summary>.type-group-count{order:2}
.type-subgroup>label{padding-left:28px!important}
input[type=checkbox]:indeterminate::after{width:8px;height:0;border-left:0;border-bottom:2px solid currentColor;transform:none}
html[data-theme=light] .type-subgroup>summary{color:#293c31}
html[data-theme=light] .type-subgroup>summary:hover{background:#e4ebe3}
@media(max-width:700px){#types-panel{width:auto}}
.type-group .type-subgroup:not([open])>summary::before{transform:rotate(-45deg)}

/* Graphics detail switch: explicit two-state choice instead of a vague "Подробнее". */
.quality-switch{display:inline-flex;align-items:center;gap:2px;padding:2px;border:1px solid var(--ui-line);border-radius:9px;background:var(--ui-surface)}
.quality-caption{padding:0 6px 0 8px;color:var(--ui-muted,#aab);font:600 10px system-ui;text-transform:uppercase;letter-spacing:.04em}
.viewtools .quality-switch button{min-height:28px!important;height:28px;padding:0 10px!important;border:1px solid transparent!important;border-radius:7px!important;background:transparent!important;color:var(--ui-text)!important;font:600 11px system-ui}
.viewtools .quality-switch button[aria-checked=true]{background:#2c4a36!important;border-color:#cdb886!important;color:#fff8e6!important}
.viewtools .quality-switch button:disabled{cursor:progress;opacity:.7}
.quality-switch[aria-busy]::after{content:"";width:12px;height:12px;margin:0 6px;border:2px solid #cdb88655;border-top-color:#cdb886;border-radius:50%;animation:quality-spin .8s linear infinite}
@keyframes quality-spin{to{transform:rotate(360deg)}}
html[data-theme=light] .quality-switch{background:#f0eee9;border-color:#b8c1b7}
html[data-theme=light] .viewtools .quality-switch button{color:#27332f!important}
html[data-theme=light] .viewtools .quality-switch button[aria-checked=true]{background:#dfe8dc!important;border-color:#6f8f73!important;color:#1d3027!important}
@media(max-width:700px){.viewtools>.quality-switch{grid-column:1/-1;justify-content:center}}
@media(prefers-reduced-motion:reduce){.quality-switch[aria-busy]::after{animation:none}}

/* Official site link in the header. */
.site-link{display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:0 12px;border:1px solid var(--ui-line);border-radius:8px;background:var(--ui-surface);color:var(--ui-text);font:600 11px system-ui;text-decoration:none;white-space:nowrap}
.site-link svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.site-link:hover{border-color:#bfae8580;background:#22402f}
.site-link:focus-visible{outline:2px solid #d7c8a3;outline-offset:2px}
html[data-theme=light] .site-link{background:#f0eee9;border-color:#b8c1b7;color:#27332f}
html[data-theme=light] .site-link:hover{background:#e1e7df}
@media(max-width:700px){.site-link span{display:none}.site-link{min-height:32px;padding:0 8px}}
@media(pointer:coarse) and (orientation:landscape) and (max-height:540px){.site-link{min-height:30px;height:30px}}
.viewtools #quality::before{content:none!important;display:none!important}

/* Desktop walk pad: every on-screen button shows its keyboard key. */
#walkpad{align-items:flex-end;gap:14px}
#walkpad .pad-block{display:flex;flex-direction:column;align-items:center;gap:5px}
#walkpad .pad-title{color:#eef0e8;font:700 9px system-ui;letter-spacing:.06em;text-transform:uppercase;text-shadow:0 1px 3px #000c}
#walkpad button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;padding:0!important;transition:background .1s,border-color .1s,transform .1s}
#walkpad kbd{font:700 13px ui-monospace,SFMono-Regular,Consolas,monospace;line-height:1}
#walkpad small{font:600 8px system-ui;opacity:.8}
#walkpad .height-grid{grid-template-rows:repeat(2,42px)}
#walkpad .height-grid button{width:58px;flex-direction:column;gap:1px}
#walkpad .look-grid kbd{font-size:16px}
#walkpad .pad-shift button{width:64px;height:42px}
#walkpad button.pressed,#walkpad button:active{background:#3d6248!important;border-color:#e2cf9f!important;transform:translateY(1px)}
html[data-theme=light] #walkpad .pad-title{color:#27332f;text-shadow:0 1px 3px #fffc}
html[data-theme=light] #walkpad button.pressed{background:#cfe0cc!important;border-color:#506e56!important}

/* Interactive minimap with a view cone. */
#minimap{pointer-events:auto;width:180px}
#minimap .map-caption small{display:block;margin-top:1px;font-size:8px;font-weight:500;letter-spacing:0;text-transform:none;opacity:.75}
#minimap .map-surface{cursor:crosshair;touch-action:none;user-select:none}
#minimap .map-surface.dragging{cursor:grabbing}
#minimap .map-surface img{pointer-events:none}
#map-position{z-index:1;pointer-events:none}
.map-cone{position:absolute;left:50%;top:50%;width:0;height:0;border-left:11px solid transparent;border-right:11px solid transparent;border-bottom:26px solid #e8443c88;transform-origin:50% 0;transform:translate(-50%,0) rotate(calc(var(--yaw,0rad) + 180deg));pointer-events:none}
#walkpad .pad-title{padding:2px 7px;border-radius:5px;background:rgba(15,31,25,.82);text-shadow:none}html[data-theme=light] #walkpad .pad-title{background:#f0eee9e6}
