/* Stage 99 — one fixed shared window for Viewer tools. */
#viewerSection #s99ToolWindow[hidden]{display:none!important}
#viewerSection #s99ToolWindow{position:fixed;z-index:220;display:flex;flex-direction:column;box-sizing:border-box;min-width:0;min-height:0;overflow:hidden;background:#191d32;color:#eeeefa;border:1px solid #454967;border-radius:0 0 12px 12px;box-shadow:0 18px 55px #050611b8;isolation:isolate;resize:none}
#viewerSection #s99ToolWindow .s99-tool-header{display:flex;align-items:center;gap:8px;flex:0 0 auto;padding:10px 15px;background:#222742;border-bottom:1px solid #373c58}
#viewerSection #s99ToolTitle{margin:0;flex:1;min-width:0;font-size:16px;line-height:1.35;overflow-wrap:anywhere;color:#f0effa}
#viewerSection #s99ToolWindow .s99-tool-header button{display:grid;place-items:center;min-width:32px;min-height:32px;padding:4px;background:#292e49;color:#dbe0f5;border:1px solid #454967;border-radius:6px;cursor:pointer}
#viewerSection #s99ToolWindow .s99-tool-pin[aria-pressed=true]{background:#6650d7;color:#fff;border-color:#a5a2ff}
#viewerSection #s99ToolWindow .s99-tool-slot{flex:1 1 auto;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;scrollbar-color:#454967 #171b30}
#viewerSection #s99ToolWindow .s99-tool-slot>.s99-tool-pane{position:static!important;inset:auto!important;margin:0!important;transform:none!important;float:none!important;z-index:auto!important;box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:none!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;resize:none!important;box-shadow:none!important;border:0!important;border-radius:0!important;background:transparent!important;color:inherit!important}
#viewerSection #s99ToolWindow .s99-tool-pane[hidden],#viewerSection #s99ToolWindow dialog.s99-tool-pane:not([open]){display:none!important}
#viewerSection #s99ToolWindow .s99-tool-pane>header{cursor:default!important;touch-action:auto!important;user-select:auto!important;background:transparent!important;border:0!important;padding:0 14px!important;min-height:0!important}
/* Preserve useful secondary actions in a panel header (e.g. position editor), suppress redundant heading/close controls. */
#viewerSection #s99ToolWindow .s99-tool-pane>header>h2,#viewerSection #s99ToolWindow .s99-tool-pane>header>button[data-s99-duplicate-close],#viewerSection #s99ToolWindow #viewerChatDrag{display:none!important}
#viewerSection #s99ToolWindow .s99-tool-pane>header:not(:has(>button:not([data-s99-duplicate-close]))){display:none!important}
#viewerSection #s99ToolWindow :is(.stage61-settings-content,.stage68-content,.stage66-content,.stage82-body,.viewer-chat-body){max-height:none!important;height:auto!important;min-height:0!important;overflow:visible!important;flex:none!important}
#viewerSection #s99ToolWindow #viewerChatList{max-height:min(50vh,460px)!important;height:auto!important;overflow-y:auto!important}
#viewerSection #s99ToolWindow .viewer-pattern-panel:not([hidden]){position:static!important;inset:auto!important;transform:none!important;margin:12px 0 0!important;width:100%!important;min-width:0!important;max-width:none!important;height:auto!important;min-height:0!important;max-height:none!important;resize:none!important;overflow:visible!important;border:1px solid #454967;background:#20243b;box-shadow:none!important}
#viewerSection #s99ToolWindow .viewer-pattern-header{cursor:default!important;touch-action:auto!important}
#viewerSection .viewer-secondary-actions #s92MapTab:not([data-s99-active]){background:transparent!important;border-color:transparent!important;color:#dbe0f5!important}
#viewerSection .viewer-secondary-actions button[data-s99-active=true]{background:#393779!important;border-color:#61599c!important;color:#eeeefa!important}
#viewerSection .stage60-grenade-menu{width:min(440px,calc(100vw - 16px));background:#191d32;border-color:#454967;color:#eeeefa;max-height:min(65vh,calc(100dvh - 16px));gap:7px}
#viewerSection .stage60-grenade-menu button{background:#292e49;border-color:#454967;color:#e5e5fa}
#viewerSection .s99-grenade-info{display:grid;gap:3px;padding:9px 10px;background:#222742;border:1px solid #373c58;border-radius:6px}
#viewerSection .s99-grenade-info strong{color:#e5dfff;font-size:13px}
#viewerSection .s99-grenade-info small{color:#bfc3df;line-height:1.4;font-size:12px;white-space:normal;overflow-wrap:anywhere}
@media(max-width:650px){#viewerSection #s99ToolWindow .s99-tool-header{padding:7px 9px}#viewerSection #s99ToolTitle{font-size:14px}#viewerSection #s99ToolWindow .stage61-settings-content{padding:10px}}

#viewerSection #s99ToolWindow .stage62-analysis-section[hidden]{display:none!important}


/* Stage 100 — content-sized, headerless tool dock; independent centered round clock. */
#viewerSection #s99ToolWindow{width:fit-content;max-width:calc(100vw - 16px);transform:translateX(-50%);border-radius:0 0 9px 9px;min-width:0}
#viewerSection #s99ToolWindow .s100-tool-actions{position:absolute;top:6px;right:7px;display:flex;gap:4px;z-index:5;align-items:center}
#viewerSection #s99ToolWindow .s100-tool-actions button{display:grid;place-items:center;min-width:27px;width:27px;min-height:27px;height:27px;padding:3px;background:#292e49;color:#dbe0f5;border:1px solid #454967;border-radius:5px;cursor:pointer;font-size:13px}
#viewerSection #s99ToolWindow .s100-tool-actions button svg{width:16px;height:16px}
#viewerSection #s99ToolWindow .s100-tool-actions button:focus-visible{outline:2px solid #c4bfff;outline-offset:1px}
#viewerSection #s99ToolWindow .s100-tool-actions .s99-tool-pin[aria-pressed=true]{background:#6650d7;color:#fff;border-color:#a5a2ff}
/* Reserve a narrow right gutter for controls; no full-width title row. */
#viewerSection #s99ToolWindow .s99-tool-slot{padding:7px 68px 7px 8px;box-sizing:border-box;min-width:0;max-width:100%;overflow:auto}
#viewerSection #s99ToolWindow .s99-tool-slot>.s99-tool-pane{width:auto!important;max-width:100%!important;min-width:0!important;overflow-wrap:anywhere}
#viewerSection #s99ToolWindow .s99-tool-pane :is(.stage61-settings-content,.stage68-content,.stage66-content,.stage82-body,.viewer-chat-body,.viewer-voice-body){padding:6px 8px!important;gap:7px!important;min-width:0;max-width:100%;box-sizing:border-box}
#viewerSection #s99ToolWindow .s99-tool-pane :is(p,h3,h4){margin-block:4px 7px;line-height:1.35}
#viewerSection #s99ToolWindow .s99-tool-pane p[role=status]:empty{display:none!important}
#viewerSection #s99ToolWindow .s99-tool-pane :is(input,select,textarea,button){max-width:100%;box-sizing:border-box}
#viewerSection #s99ToolWindow .s99-tool-pane :is(button,select,input:not([type=checkbox]):not([type=radio]):not([type=range])){min-height:28px;padding-block:4px;font-size:12px}
#viewerSection #s99ToolWindow .s99-tool-pane :is(.stage61-settings-tabs,.stage71-filters,.stage78-route-choices,.stage82-actions,.stage82-filters,.stage66-actions,.stage64-note-actions){gap:5px!important;padding-block:4px!important;margin-block:4px!important}
#viewerSection #s99ToolWindow .s99-tool-pane :is(.stage68-table-wrap,.stage90-pattern-results){max-width:100%;overflow:auto}
#viewerSection #s99ToolWindow .s99-tool-pane :is(th,td){padding:5px 7px!important}
#viewerSection #s99ToolWindow .s99-tool-pane :is(.viewer-voice-manual-hint,#viewerVoiceDrag){display:none!important}
#viewerSection #s99ToolWindow .s99-tool-pane .stage62-analysis-section{margin:5px 0!important;padding:6px!important}
#viewerSection #s99ToolWindow .s99-tool-pane .stage62-analysis-section label{gap:3px!important;margin-block:3px!important}
#viewerSection #s99ToolWindow .s99-tool-pane .viewer-pattern-panel:not([hidden]){margin-top:5px!important}
#viewerSection #s99ToolWindow .s99-tool-pane .stage90-pattern-results li{padding:5px;gap:4px}
#viewerSection #s99ToolWindow :is(#stage64Notes,#stage65Annotations){width:min(440px,calc(100vw - 100px))!important}
#viewerSection #s99ToolWindow #stage65Annotations{width:min(505px,calc(100vw - 100px))!important}
#viewerSection #s99ToolWindow #stage64Notes .stage61-settings-content{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:5px!important}
#viewerSection #s99ToolWindow #stage64Notes .stage61-settings-content>:is(textarea,p,.stage64-note-list){grid-column:1/-1}
#viewerSection #s99ToolWindow #stage64Notes .stage61-settings-content>button:nth-of-type(2){grid-column:2;justify-self:end}
#viewerSection #s99ToolWindow :is(#stage64Notes,#stage65Annotations) textarea{margin:0!important;min-height:52px!important;padding:6px 8px!important;resize:vertical;line-height:1.35}
#viewerSection #s99ToolWindow :is(#stage64Notes,#stage65Annotations) button{margin:0!important}
#viewerSection #s99ToolWindow #stage65Annotations .stage65-editor:not([hidden]){gap:5px!important;margin-bottom:5px!important;grid-template-columns:minmax(0,1fr) auto}
#viewerSection #s99ToolWindow #stage65Annotations .stage65-editor select{grid-column:1/-1}
#viewerSection #s99ToolWindow .stage64-note-list article{padding:6px 0!important}
#viewerSection #s99ToolWindow .stage64-note-list p{margin:3px 0!important}
#viewerSection #s99ToolWindow #stage65Annotations .stage64-note-list small{margin:2px 0!important}
/* Larger content may take more room, with a viewport cap and scrolling tables. */
#viewerSection #s99ToolWindow #stage61SettingsDialog{width:min(580px,calc(100vw - 100px))!important}
#viewerSection #s99ToolWindow #stage62AnalysisDialog{width:min(530px,calc(100vw - 100px))!important}
#viewerSection #s99ToolWindow #stage66Tasks{width:min(650px,calc(100vw - 100px))!important}
#viewerSection #s99ToolWindow #stage82Library{width:min(710px,calc(100vw - 100px))!important}
#viewerSection #s99ToolWindow #viewerChat{width:min(440px,calc(100vw - 100px))!important}
#viewerSection #s99ToolWindow #viewerVoice{width:min(570px,calc(100vw - 100px))!important}
#viewerSection #s99ToolWindow .stage68-dialog{width:fit-content!important;max-width:calc(100vw - 100px)!important}
#viewerSection #s99ToolWindow .stage68-content{min-width:min(360px,calc(100vw - 110px));max-width:calc(100vw - 100px)!important}
/* Timer straddles the boundary, not the score text; menu remains unobstructed. */
#viewerSection .viewer-pro-header.viewer-top{z-index:17!important;overflow:visible!important;padding-bottom:15px!important}
#viewerSection .viewer-pro-header #viewerScoreboard{position:static!important;overflow:visible!important}
#viewerSection .viewer-pro-header #viewerRoundTimer{position:absolute!important;inset:auto!important;left:50%!important;top:100%!important;transform:translate(-50%,-50%)!important;z-index:2;min-width:50px;text-align:center;padding:4px 9px;font-size:14px;line-height:1.15;background:#292e49;border:1px solid #454967;border-radius:6px;pointer-events:none;white-space:nowrap;box-sizing:border-box}
#viewerSection .viewer-secondary-actions{padding-top:17px!important}
@media(max-width:650px){#viewerSection #s99ToolWindow .s99-tool-slot{padding-right:61px;padding-left:4px}#viewerSection #s99ToolWindow .s100-tool-actions{right:4px;gap:3px}#viewerSection #s99ToolWindow .s100-tool-actions button{width:25px;min-width:25px;height:25px;min-height:25px}#viewerSection .viewer-pro-header #viewerRoundTimer{font-size:12px}}

#viewerSection #s99ToolWindow .s100-library-help{display:none!important}
#viewerSection #s99ToolWindow .s100-method{font-size:12px;padding:4px 0;margin:3px 0;color:#b0b4d2}
#viewerSection #s99ToolWindow .s100-method summary{cursor:pointer}
#viewerSection #s99ToolWindow .viewer-heatmap-config{display:grid!important;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:5px!important;padding-top:5px}
#viewerSection #s99ToolWindow .viewer-heatmap-config :is(.viewer-heatmap-hint,.s96-heat-options){grid-column:1/-1}
#viewerSection #s99ToolWindow .viewer-heatmap-config>label{display:flex!important;flex-direction:row!important;align-items:center;justify-content:flex-end;margin:0!important;font-size:12px}
#viewerSection #s99ToolWindow .s96-heat-options{grid-template-columns:repeat(auto-fit,minmax(min(135px,100%),1fr));gap:5px 8px;margin-top:3px}
#viewerSection #s99ToolWindow .s96-heat-options label{margin:0!important;gap:2px!important}
#viewerSection #s99ToolWindow .s96-heat-options button{align-self:end;margin:0!important}
#viewerSection #s99ToolWindow #stage62AnalysisDialog .stage61-settings-content>button{margin:2px 3px 2px 0}
#viewerSection #s99ToolWindow #stage66Tasks .stage66-form:not([hidden]){grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding-bottom:7px}
#viewerSection #s99ToolWindow #stage66Tasks .stage66-form>:is(h3,label:nth-of-type(4),label:nth-of-type(5)){grid-column:1/-1}
#viewerSection #s99ToolWindow #stage66Tasks .stage66-form>button{justify-self:start}
#viewerSection #s99ToolWindow :is(#stage66Tasks,#stage82Library) :is(article,.stage82-editor){padding:7px;margin:5px 0;gap:5px}
#viewerSection #s99ToolWindow :is(#stage66Tasks,#stage82Library) label{gap:3px}
#viewerSection #s99ToolWindow .stage81-exit-settings{gap:7px}
#viewerSection #s99ToolWindow .stage81-zone-controls{gap:5px}
@media(max-width:500px){#viewerSection #s99ToolWindow .viewer-heatmap-config{grid-template-columns:minmax(0,1fr)}#viewerSection #s99ToolWindow .viewer-heatmap-config>label{justify-content:flex-start}#viewerSection #s99ToolWindow #stage66Tasks .stage66-form:not([hidden]){grid-template-columns:minmax(0,1fr)}}

/* Stage 101: persistent active Viewer tab and compact round result strip. */
#viewerSection .viewer-secondary-actions button[data-s99-active="true"]:not([hidden]){background:#494185!important;border:1px solid #8a7bd9!important;color:#fff!important;box-shadow:inset 0 -2px 0 #b8afff!important;font-weight:600}
#viewerSection .s101-round-history{margin:8px 0;padding:5px 8px;display:grid;gap:4px;background:#171b30;border-radius:6px;color:#dbe0f5;font-size:12px}
#viewerSection .s101-round-strip{display:flex;flex-wrap:wrap;gap:3px;align-items:center}
#viewerSection .s101-round-tile{min-width:31px;display:grid;justify-items:center;gap:1px;padding:3px 4px;border:1px solid #454967;background:#23283b;border-radius:4px;font-size:10px;font-variant-numeric:tabular-nums}
#viewerSection .s101-round-tile.ct{background:#203d60;color:#a8d7ff;border-color:#41658c}
#viewerSection .s101-round-tile.t{background:#4b3529;color:#ffcf94;border-color:#886543}
#viewerSection .s101-round-tile.division{margin-left:9px}
#viewerSection .s101-round-tile small{font-size:10px;opacity:.85}
#viewerSection .s101-round-tile span{white-space:nowrap;font-size:10px}
.s92-match-thumb{object-fit:contain!important;background:transparent!important;border:0!important;padding:3px}

/* Stage 102 — native CS2-style round strip, all 13 statistics columns. */
#viewerSection #viewerTabScoreboard{width:min(1540px,calc(100% - 24px));max-height:88dvh;top:6%;padding:12px 14px;overflow:auto;box-sizing:border-box}
#viewerSection #viewerTabScoreboard .viewer-scoreboard-team,#viewerSection #viewerTabScoreboard .s102-history{min-width:1050px;width:100%;box-sizing:border-box}
#viewerSection #viewerTabScoreboard table{table-layout:fixed;width:100%;min-width:0}
#viewerSection #viewerTabScoreboard th:nth-child(n){width:auto}
#viewerSection #viewerTabScoreboard :is(th,td){padding:6px 5px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal;vertical-align:middle}
#viewerSection #viewerTabScoreboard :is(th,td):nth-last-child(-n+2){white-space:normal;overflow-wrap:normal;word-break:normal}
#viewerSection #viewerTabScoreboard th{font-size:11px}
#viewerSection #viewerTabScoreboard .s96-role-note{margin:4px 0;font-size:11px}
#viewerSection .s102-history{margin:9px 0;background:#0b0f10;padding:10px 12px;border-radius:3px;overflow:auto}
#viewerSection .s102-history-strip{display:grid;grid-template-columns:repeat(var(--round-count),minmax(28px,1fr));min-width:calc(var(--round-count)*32px);gap:3px}
#viewerSection .s102-round{display:grid;grid-template-rows:28px 29px 29px 29px 28px;gap:3px;min-width:0;color:#101619;font-variant-numeric:tabular-nums}
#viewerSection .s102-round.division{border-left:2px solid #536064;padding-left:4px}
#viewerSection .s102-round :is(.ct,.t){--side:#4c9cda}
#viewerSection .s102-round .t{--side:#efa249}
#viewerSection .s102-bars{display:grid;grid-auto-rows:minmax(0,1fr);gap:2px}
#viewerSection .s102-bars i{display:block;background:#232b2b;min-height:1px}
#viewerSection .s102-bars i.alive{background:var(--side)}
#viewerSection .s102-bars.unknown i{background:repeating-linear-gradient(135deg,#303737 0 2px,#1c2222 2px 4px)}
#viewerSection .s102-number,#viewerSection .s102-result{display:grid;place-items:center;background:#202727;color:#758481;font-size:13px;font-weight:800;min-width:0}
#viewerSection .s102-number.ct,#viewerSection .s102-number.t,#viewerSection .s102-result.ct,#viewerSection .s102-result.t{background:var(--side);color:#142022}
#viewerSection .s102-result svg{width:17px;height:17px;fill:currentColor}
/* Dedicated role editor; original height-zone editor remains unchanged. */
.s102-zone-editor{box-sizing:border-box;width:min(1440px,96vw);height:min(900px,94dvh);max-width:96vw;max-height:94dvh;padding:12px;background:#141829;color:#eeeefa;border:1px solid #454967;border-radius:10px;overflow:hidden}
.s102-zone-editor[open]{display:flex;flex-direction:column;gap:9px}.s102-zone-editor::backdrop{background:#080b17cc}
.s102-zone-editor .s102-editor-head,.s102-zone-editor .s102-editor-toolbar,.s102-zone-editor .s102-editor-footer{display:flex;gap:6px;align-items:center;flex-wrap:wrap;flex:0 0 auto}
.s102-zone-editor h2{margin:0 auto 0 0;font-size:18px}.s102-zone-editor h3{margin:4px 0;font-size:13px}.s102-zone-editor button{font-size:12px;padding:6px 9px;min-height:31px;white-space:normal}
.s102-zone-editor button[aria-pressed=true]{background:#494185!important;border-color:#8a7bd9!important;color:#fff!important}
.s102-zone-editor .s102-editor-layout{display:grid;grid-template-columns:minmax(220px,265px) minmax(0,1fr);gap:10px;min-height:0;flex:1;overflow:hidden}
.s102-zone-editor .s102-editor-sidebar{display:flex;flex-direction:column;gap:6px;overflow:auto;padding:9px;background:#191d32;border:1px solid #373c58;border-radius:7px;min-height:0}
.s102-zone-editor .s102-zone-list{display:flex;flex-direction:column;gap:3px;max-height:38%;min-height:70px;overflow:auto}.s102-zone-editor .s102-zone-item{display:flex;justify-content:space-between;align-items:center;text-align:left;gap:8px;background:#242944;color:#eeeefa;border:1px solid #373c58}.s102-zone-editor .s102-zone-item small{font-size:10px;color:#b0b4d2;flex-shrink:0}
.s102-zone-editor label{display:block;font-size:12px;color:#c6c8e5}.s102-zone-editor label input[type=text]{display:block;width:100%;margin-top:4px}.s102-zone-editor small{color:#b0b4d2}
.s102-zone-editor .s102-editor-map{display:grid;place-items:center;min-height:0;min-width:0;background:#0b0e18;border:1px solid #373c58;border-radius:7px;overflow:hidden}
.s102-zone-editor .s102-editor-map svg{display:block;width:100%;height:100%;touch-action:none;user-select:none;cursor:crosshair}.s102-zone-editor svg[data-mode=pan]{cursor:grab}.s102-zone-editor svg [data-vertex]{cursor:move}.s102-zone-editor svg[data-mode=select] polygon{cursor:pointer}
.s102-zone-editor .s102-zone-status{flex:1;min-width:180px;font-size:12px;color:#c6c8e5}.s102-zone-editor .s102-zone-status.error{color:#ff9b9b}
@media(max-width:700px){.s102-zone-editor{height:96dvh;max-height:96dvh;overflow:auto}.s102-zone-editor .s102-editor-layout{display:flex;flex-direction:column;overflow:auto;flex:1}.s102-zone-editor .s102-editor-map{order:-1;min-height:300px;height:48dvh;flex:none}.s102-zone-editor .s102-editor-sidebar{overflow:visible}.s102-zone-editor .s102-zone-list{max-height:160px}}
.s102-zone-editor .s102-editor-footer{padding:0;margin:0;text-align:left;min-height:36px}
.s102-zone-editor button.subtle{background:#252a43;color:#e5e6f4;border:1px solid #454967}.s102-zone-editor button.subtle:not(:disabled):hover{background:#343957}
.s102-zone-editor button.primary{margin:0;background:#6650d7;color:#fff;border:1px solid #8277d9}.s102-zone-editor button.primary:not(:disabled):hover{background:#7563df}

/* Stage 103 — side selection in role-zone editor */
.s102-zone-editor .s102-editor-toolbar select[aria-label="Сторона"]{min-width:145px;font-weight:650;color:#dbe5fa;border-color:#69619b}
