/* Scoped overrides preserve panel geometry; alignment is independent per viewport. */
body .workspace-card .workspace-grip,
body .workspace-card.workspace-minimized .workspace-grip {
 text-align:var(--panel-label-align,left)!important;
 justify-content:var(--panel-label-justify,flex-start)!important;
}
body .mobile-control-heading>strong,body .mobile-layout-heading>strong,
body .controls-minimized .layout-mini-transport>span {
 text-align:var(--panel-label-align,left)!important;
}
.panel-follow-option{display:flex;align-items:center;gap:7px;padding:7px 12px;font-size:11px;border-bottom:1px solid var(--border,#35414b)}
.panel-follow-option input{width:16px;height:16px;margin:0}
.workspace-minimized .panel-follow-option{display:none}
.workspace-grip .chess-pawn{display:block;width:22px;height:27px}
.workspace-grip:has(.chess-pawn){display:flex}
.panel-button-editor{display:none;gap:6px;padding:7px 10px;flex-wrap:wrap;border-bottom:1px dashed var(--border,#35414b)}
.button-customizing .panel-button-editor{display:flex}
body:not(.workspace-editing) .workspace-card-size{display:none!important}
.panel-shortcuts{display:flex;gap:6px;flex-wrap:wrap;padding:6px 10px}
.panel-shortcuts:empty{display:none}
.user-hidden-button{display:none!important}
.button-customizing [data-custom-button]{outline:1px dashed #71bfb8;cursor:grab;touch-action:none}
.button-customizing [data-custom-button].button-drag-target{outline:3px solid #f5ba66}
.button-editor-dialog{width:min(560px,92vw);max-height:85vh}
.button-editor-list{display:grid;gap:6px;max-height:45vh;overflow:auto}
.button-editor-row{display:flex;gap:6px;align-items:center}
.button-editor-row>span{flex:1;min-width:0}
.button-editor-row button{min-width:36px}
.chess-panel{padding:10px;container-type:inline-size}
.chess-options{display:flex;flex-wrap:wrap;gap:8px}
.chess-options label{display:flex;flex-direction:column;gap:4px;min-width:90px;flex:1;font-size:11px}
.chess-options select{max-width:100%;width:100%;font-size:11px}
.chess-status{font-size:12px;min-height:18px;margin:10px 0}
.chess-board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));width:min(100%,440px);aspect-ratio:1;margin:auto;border:2px solid #465448;border-radius:4px;overflow:hidden}
.chess-board .chess-square{position:relative;display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;padding:0;border:0;border-radius:0;aspect-ratio:1;line-height:1;font-family:Georgia,serif;font-size:clamp(20px,8cqw,43px);box-shadow:none}
.chess-square.light{background:#dcdcc8}.chess-square.dark{background:#647c6c}
.chess-square.white-piece{color:#fff;text-shadow:0 1px 2px #101b19;-webkit-text-stroke:.5px #263832}
.chess-square.black-piece{color:#16231f;text-shadow:0 1px 1px #d9e2d8}
.chess-square.selected{box-shadow:inset 0 0 0 3px #f5c15b}
.chess-square.legal:after{content:'';position:absolute;width:20%;height:20%;border-radius:50%;background:#efba43;border:1px solid #263832;opacity:.9}
.chess-square small{position:absolute;bottom:2px;left:2px;font:8px/1 sans-serif;color:#152b24;text-shadow:none;-webkit-text-stroke:0}
.chess-board .chess-square,.chess-board .chess-square>span{font-family:Georgia,serif!important;font-size:clamp(20px,8cqw,43px)!important;line-height:1!important}
.chess-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.chess-performance,.chess-history{display:block;font-size:10px;color:var(--muted,#929d9a);overflow-wrap:anywhere;margin:8px 0}
.chess-panel .widget-hint{font-size:10px}
@container(max-width:340px){.chess-options{display:grid;grid-template-columns:1fr 1fr}.chess-options>label:first-child{grid-column:1/-1}}

/* Text selection that starts in a panel stays in that panel. */
body.panel-text-selecting :not([data-text-select-panel],[data-text-select-panel] *){-webkit-user-select:none!important;user-select:none!important}
body.panel-text-selecting [data-text-select-panel]{-webkit-user-select:text;user-select:text}
/* The live emission status alternates between one- and two-line messages; reserve
   both lines so the Direction panel (and the page below it) never shifts. */
.readout>div:has(>#emission){min-height:2.6em;min-height:2lh}
/* Drag handles move panels; dragging across them must never start a page-wide text selection. */
[data-mobile-drag-handle],.workspace-grip,.mobile-control-heading,.layout-mini-transport{-webkit-user-select:none;user-select:none}
/* Custom button rows: buttons share the row's width equally unless given their own width. */
.custom-button-row{display:flex;flex-wrap:nowrap;gap:6px;align-items:stretch;min-width:0;box-sizing:border-box}
.custom-button-row.row-block{width:100%;margin:6px 0}
.custom-button-row.row-inline{flex:var(--row-count,1) 1 0;width:auto;margin:0}
.custom-button-row.row-empty{display:none}
.custom-button-row>[data-custom-button]{flex:1 1 0!important;min-width:0!important;width:auto!important;max-width:none!important;margin:0!important;overflow:hidden;text-overflow:ellipsis;padding-left:min(10px,8%);padding-right:min(10px,8%)}
.custom-button-row>[data-custom-button].btn-w{flex:0 0 var(--btn-w)!important;width:var(--btn-w)!important}
[data-custom-button].btn-w{width:var(--btn-w)!important;min-width:0!important;max-width:none!important}
[data-custom-button].btn-h{height:var(--btn-h)!important;min-height:var(--btn-h)!important;max-height:none!important}
.button-customizing .custom-button-row{outline:1px dashed rgba(113,191,184,.55);outline-offset:3px;min-height:30px}
.button-customizing [data-custom-button]{background-image:linear-gradient(135deg,transparent 0 62%,#71bfb8 62% 70%,transparent 70% 80%,#71bfb8 80% 88%,transparent 88%);background-repeat:no-repeat;background-position:right 1px bottom 1px;background-size:12px 12px}
.button-customizing [data-custom-button].button-dragging{opacity:.4;outline-style:solid}
.button-drop-marker{position:fixed;z-index:3000;pointer-events:none;background:#f5ba66;border-radius:2px;box-shadow:0 0 0 1px #2a1d08}
.button-drag-chip{position:fixed;z-index:3001;pointer-events:none;padding:4px 8px;border-radius:6px;background:#1c2a2e;color:#e8f2ef;border:1px solid #71bfb8;font-size:11px;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.button-size-popover{position:fixed;z-index:3002;display:grid;gap:7px;width:230px;padding:10px;border-radius:8px;background:var(--panel,#162024);color:var(--text,#e6efec);border:1px solid #71bfb8;box-shadow:0 10px 30px rgba(0,0,0,.45);font-size:12px}
.button-size-popover>strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.button-size-popover label{display:grid;grid-template-columns:56px 1fr;align-items:center;gap:6px}
.button-size-popover input{width:100%;min-width:0;box-sizing:border-box}
.button-size-popover .widget-hint{margin:0;font-size:10px}
.button-size-actions{display:flex;gap:6px;flex-wrap:wrap}
.button-size-actions button{flex:1 1 auto}
.button-editor-size{width:62px}
/* Bin that pops up while a button is dragged in Customize Workspace. */
.button-trash{position:fixed;z-index:3001;display:flex;align-items:center;gap:6px;padding:8px 11px;border-radius:999px;background:#2a1717;color:#ffd0c9;border:1px solid #c9554a;box-shadow:0 8px 22px rgba(0,0,0,.45);font-size:11px;font-weight:600;pointer-events:none;opacity:0;transform:scale(.8) translateY(6px);transition:opacity .14s ease,transform .14s ease}
.button-trash.shown{opacity:1;transform:none}
.button-trash.over{background:#c9554a;color:#fff;transform:scale(1.12)}
.button-trash.locked{background:#22282b;color:#aab5b2;border-color:#56636a}
.button-trash.locked.over{background:#3a4448;color:#fff}
@media (prefers-reduced-motion:reduce){.button-trash{transition:none}}
.layout-library-dialog{width:min(520px,92vw)}
.layout-library-save{display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap}
.layout-library-save label{display:grid;gap:4px;flex:1 1 220px;font-size:12px}
.layout-library-list{display:grid;gap:6px;max-height:45vh;overflow:auto;margin:8px 0}
.layout-library-row{display:flex;gap:8px;align-items:center;padding:6px 8px;border:1px solid var(--border,#35414b);border-radius:6px}
.layout-library-row>span{flex:1;min-width:0;display:grid}
.layout-library-row strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.layout-library-row small{color:var(--muted,#929d9a);font-size:10px}
.layout-library-status{min-height:1.2em;font-size:12px;margin:6px 0}
