/* 共通可変道具BOX v1.1.0 */
/* 移動・可変の道具BOX */
.vtb-host .atb-toolbox{display:flex;position:fixed;right:16px;bottom:84px;width:244px;height:380px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 64px);padding:0;gap:0;align-items:stretch;flex-direction:column;background:#f5f7fc;border:2px solid #c8d3e3;border-radius:16px;box-shadow:0 6px 24px #13274240;overflow:hidden;z-index:1000;box-sizing:border-box;container-type:inline-size}
.vtb-host .atb-toolbox-head{display:flex;flex-shrink:0;height:44px;background:var(--navy,#1e3a5f);color:white;align-items:center}
.vtb-host .atb-toolbox-head button{border:0;background:transparent;color:white;height:44px;margin:0;padding:0 12px;font-family:inherit;font-size:16px;font-weight:bold;box-shadow:none;border-radius:0}
.vtb-host .atb-toolbox-grip{flex:1;text-align:left;cursor:move;touch-action:none;user-select:none}
.vtb-host .atb-toolbox-fold{width:40px;font-size:24px!important;cursor:pointer}
.vtb-host .atb-toolbox-body{display:grid;grid-template-columns:repeat(auto-fit,minmax(94px,1fr));align-content:start;gap:8px;padding:10px 10px 24px;overflow:auto;min-height:0;flex:1}
.vtb-host .atb-toolbox .atb-toolbar-group{display:contents;border-radius:0;box-shadow:none}
.vtb-host .atb-toolbox-body button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;width:100%;height:68px;min-height:48px;margin:0;padding:6px;border:1px solid #d7dfeb;border-radius:12px;background:white;color:var(--navy,#1e3a5f);box-shadow:0 2px 4px #13274212;cursor:pointer;font-family:inherit}
.vtb-host .atb-toolbox-body button.mode-on{background:var(--gold,#d4af37);border-color:var(--gold,#d4af37)}
.vtb-host .atb-toolbox-body button:disabled{opacity:.35;cursor:default}
.vtb-host .atb-toolbox-body .atb-tool-icon{width:26px;height:26px;flex-shrink:0}
.vtb-host .atb-toolbox-body .atb-tool-label{font-size:13px;font-weight:bold;line-height:1.2;white-space:normal;text-align:center}
.vtb-host .atb-toolbox-resize{position:absolute;right:0;bottom:0;width:26px;height:24px;border:0;background:#e4eaf4;color:var(--navy,#1e3a5f);font-size:20px;cursor:nwse-resize;touch-action:none;padding:0;margin:0}
.vtb-host .atb-toolbox.atb-toolbox-compact .atb-toolbox-body{grid-template-columns:repeat(auto-fit,minmax(44px,1fr));padding:6px 6px 24px}
.vtb-host .atb-toolbox.atb-toolbox-compact .atb-toolbox-body button{width:44px;height:44px;min-height:44px;border-radius:50%;justify-self:center;gap:0}
.vtb-host .atb-toolbox.atb-toolbox-compact .atb-tool-label{display:none}
.vtb-host .atb-toolbox.atb-toolbox-compact button:has(img[hidden]) .atb-tool-label{display:block;font-size:10px}
.vtb-host .atb-toolbox-closed{height:44px!important;min-height:44px}
.vtb-host .atb-toolbox-closed .atb-toolbox-body,
.vtb-host .atb-toolbox-closed .atb-toolbox-resize{display:none}
.vtb-host .atb-toolbox button:focus-visible{outline:3px solid #4d97ff;outline-offset:-3px}


.vtb-host .atb-toolbox-layouts{display:flex;flex-shrink:0;gap:4px;padding:5px;background:#e7edf6}
.vtb-host .atb-toolbox-layouts button{flex:1;min-width:0;height:32px;margin:0;padding:2px;border:1px solid #c7d2e3;border-radius:7px;background:white;color:var(--navy,#1e3a5f);font-family:inherit;font-size:12px;font-weight:bold;cursor:pointer}
.vtb-host .atb-toolbox-layouts button[aria-pressed="true"]{background:var(--gold,#d4af37);border-color:var(--gold,#d4af37)}
.vtb-host .atb-toolbox[data-layout] .atb-toolbox-body{grid-template-columns:repeat(var(--atb-tool-columns),minmax(0,1fr))}
.vtb-host .atb-toolbox-closed .atb-toolbox-layouts{display:none}

/* 役割ごとの固定色。丸形・文字付きで共通。 */
.vtb-host .atb-toolbox-body button{--tool-bg:#eef1f5;--tool-border:#cbd2dc;--tool-ink:#394657;--tool-active:#465568;background:var(--tool-bg);border-color:var(--tool-border);color:var(--tool-ink)}
.vtb-host .atb-toolbox-body button[data-color="blue"]{--tool-bg:#e0edff;--tool-border:#9abce9;--tool-ink:#184d91;--tool-active:#245fa8}
.vtb-host .atb-toolbox-body button[data-color="orange"]{--tool-bg:#ffead4;--tool-border:#e6b07a;--tool-ink:#8b420c;--tool-active:#a64c10}
.vtb-host .atb-toolbox-body button[data-color="green"]{--tool-bg:#dcf2e5;--tool-border:#91c7a8;--tool-ink:#1d6342;--tool-active:#24734d}
.vtb-host .atb-toolbox-body button[data-color="purple"]{--tool-bg:#ede4fb;--tool-border:#bda2df;--tool-ink:#654091;--tool-active:#7045a1}
.vtb-host .atb-toolbox-body button[data-color="navy"]{--tool-bg:#e3eaf4;--tool-border:#9eafc7;--tool-ink:#1e3a5f;--tool-active:#1e3a5f}
.vtb-host .atb-toolbox-body button:hover:not(:disabled){box-shadow:0 0 0 2px var(--tool-border)}
.vtb-host .atb-toolbox-body button.mode-on{background:var(--tool-active);border-color:var(--tool-active);color:#fff;box-shadow:inset 0 0 0 2px #ffffff80}
.vtb-host .atb-toolbox-body button.mode-on img.atb-tool-icon{filter:brightness(0) invert(1)}


.vtb-host .atb-tool-icon{width:26px;height:26px;display:block;fill:currentColor}.vtb-host .atb-toolbox-settings svg{fill:currentColor}

.vtb-host .atb-toolbox [hidden]{display:none!important}
.vtb-host .atb-toolbox-grip{font-size:15px!important;line-height:1.2!important;min-width:0;white-space:normal}
.vtb-host .atb-toolbox-body>label,.vtb-host .atb-toolbox-body>select,.vtb-host .atb-toolbox-body>.tool-options,.vtb-host .atb-toolbox-body>.tool-info{grid-column:1/-1;min-width:0;margin:0;padding:6px;position:static;transform:none;background:transparent;box-shadow:none}
.vtb-host .atb-toolbox-body label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:14px;color:#1e3a5f}
.vtb-host .atb-toolbox-body select{min-width:0;max-width:100%;width:100%;height:44px;background:white;color:#1e3a5f;border:1px solid #c7d2e3;border-radius:8px;font-size:14px}
.vtb-host .atb-toolbox-body .tool-options{display:flex;flex-direction:column;gap:8px}
.vtb-host .atb-toolbox-body :is(.atb-toolbar-group,.piece-tools,nav){display:contents;position:static;transform:none;padding:0;background:none;box-shadow:none}
.vtb-host .atb-toolbox-body button{border-radius:12px!important;font-size:14px;line-height:1.3!important}
.vtb-host .atb-toolbox-body img.atb-tool-icon,.vtb-host .atb-toolbox-body svg.atb-tool-icon{width:26px!important;height:26px!important;fill:currentColor;stroke:none;touch-action:auto}
.vtb-host .atb-toolbox-head svg{width:24px!important;height:24px!important;fill:currentColor}
.vtb-host .atb-toolbox-compact .atb-toolbox-body button{border-radius:50%!important}
.vtb-host .atb-toolbox-body .tool-info{font-size:13px;text-align:center;color:#1e3a5f}
.vtb-host .atb-toolbox-body [aria-pressed=true]{background:var(--tool-active,#245fa8);color:white}
@media print{.vtb-host .atb-toolbox{display:none!important}}

/* 分数ラボの旧フロート装飾との干渉を抑える */
.fl-shell .atb-toolbox{pointer-events:auto;transform:none;gap:0;}
.fl-shell .atb-toolbox-body .fm-tool-symbol{font-size:24px;line-height:1;}
.fl-shell .atb-toolbox-body button::before,.fl-shell .atb-toolbox-body button::after{display:none!important;}
.fl-shell .atb-toolbox-body svg.atb-tool-icon:has([stroke]){fill:none;stroke:currentColor;}
.fl-shell .atb-toolbox-body [hidden]{display:none!important;}
.fl-shell .fl-tool-settings{border:0;border-radius:18px;padding:24px;background:#fff;color:#1e3a5f;min-width:240px;max-width:calc(100vw - 48px);}
.fl-shell .fl-tool-settings::backdrop{background:#142b4d88;}
.fl-shell .fl-tool-settings button{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;min-height:48px;margin:8px 0;padding:8px 16px;border:1px solid #b9cce5;border-radius:10px;background:#edf4ff;color:#1e3a5f;cursor:pointer;position:static;transform:none;}
.fl-shell .fl-tool-settings svg{width:26px;height:26px;fill:currentColor;}
.fl-shell .fl-tool-settings .fm-tool-symbol{font-size:24px;}

/* 選択中の分数を道具の上に、列数に依存しない入力欄として表示 */
.fl-shell .atb-toolbox .fl-tool-input{grid-column:1/-1;position:static!important;left:auto!important;top:auto!important;width:100%;min-width:0;max-width:none;transform:none!important;margin:0 0 4px;padding:6px;border:1px solid #bccde2;border-top:4px solid var(--flx-color,#2878c8);border-radius:12px;background:white;box-shadow:none;display:block;overflow:auto;}
.fl-shell .atb-toolbox .fl-tool-input[hidden]{display:none!important;}
.fl-shell .fl-tool-input .fm-drag-handle,.fl-shell .fl-tool-input .flx-handle{height:28px;min-height:28px;justify-content:center;touch-action:auto;cursor:default;font-size:15px;}
.fl-shell .fl-tool-input .flx-head{justify-content:center;}
.fl-shell .fl-tool-input .fm-fraction-editor,.fl-shell .fl-tool-input .flx-body{display:grid;grid-template-columns:34px 36px minmax(42px,1fr) 36px;grid-template-rows:42px 3px 42px;gap:4px;min-width:160px;width:100%;margin:0;}
.fl-shell .fl-tool-input .fm-editor-label,.fl-shell .fl-tool-input .flx-label{font-size:13px;padding:0;align-self:center;}
.fl-shell .fl-tool-input .fm-value,.fl-shell .fl-tool-input .flx-value{font-size:30px;line-height:1;text-align:center;min-width:0;}
.fl-shell .atb-toolbox .fl-tool-input button{display:flex;flex-direction:row;width:36px!important;height:40px!important;min-height:40px!important;border-radius:9px!important;margin:0;padding:0;font-size:24px;line-height:1;background:#e8f0fb;color:#1e3a5f;justify-self:center;}
.fl-shell .atb-toolbox .fl-tool-input button.plus,.fl-shell .atb-toolbox .fl-tool-input button.flx-plus{background:#dceee3;color:#1d6342;}
.fl-shell .atb-toolbox .fl-tool-input button[hidden]{display:none!important;}
.fl-shell .fl-tool-input .fm-frac-line,.fl-shell .fl-tool-input .flx-line{margin:0;align-self:center;width:100%;height:3px;}

/* 3桁の分子・分母と±操作が収まる最小幅 */
.fl-shell .atb-toolbox{min-width:220px;}
.fl-shell .fl-tool-input .fm-fraction-editor,.fl-shell .fl-tool-input .flx-body{grid-template-columns:30px 34px minmax(54px,1fr) 34px;column-gap:3px;min-width:161px;}
.fl-shell .fl-tool-input .fm-value,.fl-shell .fl-tool-input .flx-value{font-size:28px;}
.fl-shell .atb-toolbox .fl-tool-input button{width:34px!important;}
.fl-shell .atb-toolbox .fl-tool-input img.atb-tool-icon{width:22px!important;height:22px!important;}
.fl-shell .atb-toolbox-head .atb-toolbox-grip{font-size:13px!important;padding:0 7px;}
.fl-shell .atb-toolbox-fold img,.fl-shell .atb-toolbox-resize img{width:22px;height:22px;}
.fl-shell .atb-toolbox-resize{display:grid;place-items:center;}
.fl-shell .fl-tool-settings img.atb-tool-icon{width:24px;height:24px;}
.fl-shell .atb-toolbox-compact .atb-toolbox .fl-tool-input{padding:6px;}
.fl-shell .atb-toolbox-body button[aria-pressed=true] img.atb-tool-icon{filter:brightness(0) invert(1);}

/* 数字入力をスクロールする道具一覧から独立させて固定 */
.fl-shell .atb-toolbox.fl-has-input > .fl-tool-input{flex:0 0 auto;width:calc(100% - 12px);margin:6px;box-sizing:border-box;overflow:hidden;}
.fl-shell .atb-toolbox.fl-has-input > .fl-tool-input .fm-fraction-editor,.fl-shell .atb-toolbox.fl-has-input > .fl-tool-input .flx-body{box-sizing:border-box;}
.fl-shell .atb-toolbox.fl-has-input .atb-toolbox-body{flex:1 1 auto;min-height:0;overflow:auto;}
.fl-shell .atb-toolbox.fl-has-input.atb-toolbox-closed{height:208px!important;min-height:208px!important;}
.fl-shell .atb-toolbox-head img.atb-tool-icon{filter:brightness(0) invert(1);}
.fl-shell .atb-toolbox-head svg{color:white!important;fill:white!important;}

/* 最小化時はタイトル・設定・展開のみ表示 */
.fl-shell .atb-toolbox.fl-has-input.atb-toolbox-closed{height:44px!important;min-height:44px!important;}
.fl-shell .atb-toolbox.atb-toolbox-closed > .fl-tool-input{display:none!important;}
