.three-board-wrap{position:relative;width:fit-content;max-width:100%;margin:auto;isolation:isolate}.three-canvas{position:absolute;inset:0;width:100%;height:100%;display:none;touch-action:pan-y;cursor:pointer;filter:drop-shadow(0 14px 18px #19342830)}.three-active>.three-canvas{display:block}.three-active>.board,.three-active>#board{opacity:0;pointer-events:none}.three-tools{display:flex;align-items:center;justify-content:center;gap:8px;margin:4px 0 8px;font:500 11px system-ui;color:#587066}.three-tools button{font:600 12px system-ui;border:1px solid #b7c6b9;background:#edf2e9;color:#294c3d;padding:8px 11px;border-radius:10px;min-height:36px}.three-tools button:focus-visible{outline:3px solid #288bdd;outline-offset:2px}.three-tools span{max-width:155px}.three-notice{font:12px system-ui;color:#70451b;text-align:center}@media(max-width:480px){.three-tools{gap:5px}.three-tools span{max-width:100px;font-size:10px}}
.three-board-wrap{width:100%}.three-board-wrap:has(#coach-board){width:min(100%,calc(100dvh - 230px))}.three-board-wrap>#coach-board{width:100%}.three-board-wrap>.board{margin:0}.three-active ~ .file-labels{visibility:hidden}.board-container:has(.three-active) .rank-labels{visibility:hidden}@media(max-width:720px){.three-board-wrap:has(#coach-board){width:min(100%,calc(100dvh - 365px))}}

.board-surround>.three-board-wrap{grid-column:2;grid-row:1}.board-surround:has(.three-active)>.rank-labels,.board-surround:has(.three-active)>.file-labels{visibility:hidden}

.three-tools button{white-space:nowrap;flex-shrink:0}@media(max-width:760px){.three-tools{margin:2px 0 3px;gap:6px}.three-tools span{display:none}.three-tools button{padding:6px 10px;font-size:11px;min-height:32px}}

/* Never leave an invisible/inactive canvas above the playable 2D cells. */
.three-board-wrap:not(.three-active)>.three-canvas,.three-canvas[hidden]{display:none!important;pointer-events:none!important}
/* Compact board-local display controls. Hidden means absent in 2D. */
.three-tools{justify-content:flex-end}.three-angle[hidden]{display:none!important}
body[data-palette] .three-tools{justify-content:flex-end}
body[data-palette] .rank-labels,body[data-palette] .file-labels{color:#fff1ca;font-size:12px;font-weight:800}

/* Drag rotates the real camera. A stationary tap remains a move. */
.three-canvas{touch-action:none;cursor:grab}.three-canvas:active{cursor:grabbing}
/* Occupied destinations get an edge outline, never a dot on the piece. */
#coach-board button.target:has(.piece):not(.suggested-to):after,#board .legal.occupied:not(.suggested-to):not(.suggested-from):after{inset:3px;width:auto;height:auto;border:3px solid #33735c;background:transparent;box-shadow:none;border-radius:6px;z-index:1}
#coach-board .piece,#board .piece{z-index:2}
.three-zoom[hidden]{display:none!important}.three-tools .three-zoom{min-width:30px;font-size:16px;padding:3px 8px}
/* Let magnified 3D reach the viewport edge, not a narrow inner board frame. */
.three-board-wrap>.three-canvas{left:calc(50% - 50vw);right:auto;width:100vw;max-width:none}
#coach-board button.suggested-to:not(:has(.piece)):after,#board .suggested-to:not(:has(.piece)):after{top:50%;bottom:auto;left:50%;transform:translate(-50%,-50%)}
.board-pending .rank-labels,.board-pending .file-labels{visibility:hidden}
#train-view .board-surround:has(.three-active){display:block}
#train-view .board-surround:has(.three-active)>.rank-labels,#train-view .board-surround:has(.three-active)>.file-labels{display:none}
@media(max-width:720px){body[data-palette] .three-tools:has(.three-toggle[aria-pressed="false"]){margin-bottom:10px}}
.flat-coordinates{position:absolute;inset:0;pointer-events:none;color:#f2e8c7;font:700 11px system-ui}.flat-rank{position:absolute;left:-12px;transform:translateY(-50%)}.flat-file{position:absolute;bottom:-15px;transform:translateX(-50%)}.three-active>.flat-coordinates,.board-pending .flat-coordinates{display:none}.three-coordinates-ready #coach-board .coordinate{display:none}.three-coordinates-ready:not(.three-active){margin-bottom:16px}
#train-view .board-surround:has(.three-coordinates-ready){display:block}#train-view .board-surround:has(.three-coordinates-ready)>.rank-labels,#train-view .board-surround:has(.three-coordinates-ready)>.file-labels{display:none}
body[data-palette] .three-board-wrap.three-coordinates-ready:not(.three-active){margin-bottom:18px}
body[data-palette] .three-tools{display:grid;grid-template-columns:1fr auto 1fr;justify-content:center;column-gap:7px;row-gap:4px;margin-bottom:8px}
.three-tools .three-toggle{grid-column:2;grid-row:1}.three-tools .three-zoom:first-of-type{grid-column:1}
.three-tools .three-zoom{grid-row:1}.three-tools .three-toggle+.three-zoom{grid-column:1;justify-self:end}.three-tools .three-zoom+.three-zoom{grid-column:3;justify-self:start}.three-tools .three-angle{grid-column:1/-1;grid-row:2;justify-self:center}
.three-tools .three-zoom-group{grid-column:1;grid-row:1;display:flex;gap:5px;justify-self:end}.three-tools .three-angle{grid-column:3;grid-row:1;justify-self:start;min-width:30px;font-size:18px;padding:3px 8px}
.board-pending #board,.board-pending #coach-board{position:relative}
.board-pending #board:before,.board-pending #coach-board:before{content:'Загружаем доску…';position:absolute;inset:0;display:flex;align-items:center;justify-content:center;visibility:visible;color:#c9d9c9;font:500 13px system-ui;background:transparent;pointer-events:none}
.board-pending .three-active>#board,.board-pending .three-active>#coach-board{opacity:1!important}
.board-pending .three-canvas{visibility:hidden}
.board-load-timeout .three-canvas{display:none!important;pointer-events:none!important}.board-load-timeout .three-active>#board,.board-load-timeout .three-active>#coach-board{opacity:1!important;pointer-events:auto!important;visibility:visible!important}.board-load-timeout .three-tools:after{content:'3D ещё не готово: доступен 2D.';grid-column:1/-1;font:11px system-ui;color:#d9caa7}

/* The capture outline and hint label must not share an inset rectangle. */
#coach-board button.suggested-to:has(.piece):after,#board .suggested-to:has(.piece):after,#board .suggested-from:after{inset:auto;left:50%;bottom:2px;width:max-content;height:auto;transform:translateX(-50%);border:0;border-radius:3px;padding:1px 3px;z-index:6;box-sizing:border-box}
