.itlab-launcher,.itlab-toolbox,.itlab-launcher *,.itlab-toolbox *{box-sizing:border-box}
.itlab-launcher{height:calc(100dvh - 48px);min-height:360px;padding:clamp(12px,3vw,32px);background:linear-gradient(135deg,#edf3ff,#f4efff);font-family:system-ui,sans-serif;color:#1e3a5f;display:flex;flex-direction:column;gap:16px}
.itlab-launcher h1{font-size:clamp(20px,3vw,32px);margin:0;line-height:1.3}
.itlab-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:clamp(8px,2vw,20px);flex:1;min-height:0}
.itlab-card{appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:12px;min-width:0;border:1px solid #c8d7ed;border-radius:18px;background:#fff;color:#1e3a5f;font:inherit;cursor:pointer;box-shadow:0 4px 12px #17365d10;line-height:1.3}
.itlab-card strong{display:grid;place-items:center;width:clamp(40px,7vw,82px);height:clamp(40px,7vw,82px);border-radius:16px;background:#e9efff;color:#5265a9;font-size:clamp(14px,2.3vw,24px)}
.itlab-card span{font-weight:700;font-size:clamp(12px,1.7vw,20px)}
.itlab-card small{font-size:12px;color:#65738c}
.itlab-card:disabled{opacity:.55;cursor:default}
.itlab-card[aria-current]{opacity:1;background:#e0ecff;border:2px solid #527bbd}
.itlab-card:focus-visible,.itlab-toolbox button:focus-visible{outline:3px solid #5489d7;outline-offset:2px}

/* 共通可変道具BOX v1.3.0 */
/* 移動・可変の道具BOX */
.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox-head{display:flex;flex-shrink:0;height:44px;background:var(--navy,#1e3a5f);color:white;align-items:center}
.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox-grip{flex:1;text-align:left;cursor:move;touch-action:none;user-select:none}
.itlab-host.vtb-host .atb-toolbox-fold{width:40px;font-size:24px!important;cursor:pointer}
.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox .atb-toolbar-group{display:contents;border-radius:0;box-shadow:none}
.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox-body button.mode-on{background:var(--gold,#d4af37);border-color:var(--gold,#d4af37)}
.itlab-host.vtb-host .atb-toolbox-body button:disabled{opacity:.35;cursor:default}
.itlab-host.vtb-host .atb-toolbox-body .atb-tool-icon{width:26px;height:26px;flex-shrink:0}
.itlab-host.vtb-host .atb-toolbox-body .atb-tool-label{font-size:13px;font-weight:bold;line-height:1.2;white-space:normal;text-align:center}
.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox-closed{height:44px!important;min-height:44px}
.itlab-host.vtb-host .atb-toolbox-closed .atb-toolbox-body,
.itlab-host.vtb-host .atb-toolbox-closed .atb-toolbox-resize{display:none}
.itlab-host.vtb-host .atb-toolbox button:focus-visible{outline:3px solid #4d97ff;outline-offset:-3px}


.itlab-host.vtb-host .atb-toolbox-layouts{display:flex;flex-shrink:0;gap:4px;padding:5px;background:#e7edf6}
.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox-layouts button[aria-pressed="true"]{background:var(--gold,#d4af37);border-color:var(--gold,#d4af37)}
.itlab-host.vtb-host .atb-toolbox-closed .atb-toolbox-layouts{display:none}

/* 役割ごとの固定色。文字付きの角丸ボタン。 */
.itlab-host.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)}
.itlab-host.vtb-host .atb-toolbox-body button[data-color="blue"]{--tool-bg:#e0edff;--tool-border:#9abce9;--tool-ink:#184d91;--tool-active:#245fa8}
.itlab-host.vtb-host .atb-toolbox-body button[data-color="orange"]{--tool-bg:#ffead4;--tool-border:#e6b07a;--tool-ink:#8b420c;--tool-active:#a64c10}
.itlab-host.vtb-host .atb-toolbox-body button[data-color="green"]{--tool-bg:#dcf2e5;--tool-border:#91c7a8;--tool-ink:#1d6342;--tool-active:#24734d}
.itlab-host.vtb-host .atb-toolbox-body button[data-color="purple"]{--tool-bg:#ede4fb;--tool-border:#bda2df;--tool-ink:#654091;--tool-active:#7045a1}
.itlab-host.vtb-host .atb-toolbox-body button[data-color="navy"]{--tool-bg:#e3eaf4;--tool-border:#9eafc7;--tool-ink:#1e3a5f;--tool-active:#1e3a5f}
.itlab-host.vtb-host .atb-toolbox-body button:hover:not(:disabled){box-shadow:0 0 0 2px var(--tool-border)}
.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox-body button.mode-on img.atb-tool-icon{filter:brightness(0) invert(1)}


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

.itlab-host.vtb-host .atb-toolbox [hidden]{display:none!important}
.itlab-host.vtb-host .atb-toolbox-grip{font-size:15px!important;line-height:1.2!important;min-width:0;white-space:normal}
.itlab-host.vtb-host .atb-toolbox-body>label,.itlab-host.vtb-host .atb-toolbox-body>select,.itlab-host.vtb-host .atb-toolbox-body>.tool-options,.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox-body label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:14px;color:#1e3a5f}
.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox-body .tool-options{display:flex;flex-direction:column;gap:8px}
.itlab-host.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}
.itlab-host.vtb-host .atb-toolbox-body button{border-radius:12px!important;font-size:14px;line-height:1.3!important}
.itlab-host.vtb-host .atb-toolbox-body img.atb-tool-icon,.itlab-host.vtb-host .atb-toolbox-body svg.atb-tool-icon{width:26px!important;height:26px!important;fill:currentColor;stroke:none;touch-action:auto}
.itlab-host.vtb-host .atb-toolbox-head svg{width:24px!important;height:24px!important;fill:currentColor}
.itlab-host.vtb-host .atb-toolbox-body .tool-info{font-size:13px;text-align:center;color:#1e3a5f}
.itlab-host.vtb-host .atb-toolbox-body [aria-pressed=true]{background:var(--tool-active,#245fa8);color:white}
@media print{.itlab-host.vtb-host .atb-toolbox{display:none!important}}
.itlab-host.vtb-host .atb-toolbox[data-layout="vertical"] .atb-toolbox-body{
  grid-template-columns:minmax(0,1fr);
  grid-auto-flow:row;
}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-body{
  grid-template-columns:none;
  grid-template-rows:auto;
  grid-auto-flow:column;
  grid-auto-columns:96px;
  align-content:start;
}
.itlab-host.vtb-host .atb-toolbox-body .atb-tool-label{display:block;overflow-wrap:anywhere}

/* ════ v1.2.3：横表記をコンパクトにする ════
   ・ヘッダーはBOXの左端。タイトルは横書き2行、その下に歯車と折りたたみ
   ・縦・横ボタンは、ヘッダーのとなりに縦に2つ
   ・道具ボタンは「アイコン＋文字」を横に並べて、高さ44px
   ・BOX全体の高さは60px */
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"]{flex-direction:row}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-head{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 24px;width:92px;height:auto;padding:3px 4px;gap:2px;align-items:stretch;flex-shrink:0}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-head button{width:100%;height:24px;padding:0;border-radius:6px!important}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-grip{grid-column:1/-1;height:auto!important;min-height:0;padding:0 2px!important;font-size:11px!important;line-height:1.15!important;white-space:normal;text-align:left;overflow:hidden}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-head svg{width:18px!important;height:18px!important}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-fold{font-size:18px!important;line-height:1!important}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-layouts{flex-direction:column;width:34px;padding:3px;gap:3px;flex-shrink:0}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-layouts button{flex:1;height:auto;min-height:0;padding:0;font-size:11px;border-radius:6px}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-body{grid-auto-columns:max-content;align-content:center;align-items:center;padding:5px 26px 5px 6px;gap:5px}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-body button{flex-direction:row;justify-content:flex-start;height:44px;min-height:0;width:auto;min-width:76px;padding:3px 9px;gap:5px}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-body .atb-tool-icon{width:20px!important;height:20px!important}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-body .atb-tool-label{font-size:11px;line-height:1.15!important;text-align:left;white-space:nowrap}
.itlab-host.vtb-host .atb-toolbox[data-layout="horizontal"] .atb-toolbox-resize{width:20px;height:18px;font-size:15px}
/* 横で折りたたんだときは、左端のヘッダーだけ */
.itlab-host.vtb-host .atb-toolbox-closed[data-layout="horizontal"]{width:92px!important;height:60px!important;min-height:60px}

/* ════ v1.3.0：道具BOXをよける ════
   よける側の要素（data-toolbox-avoid）の余白はJSで付ける。余白のtransitionは付けない
   （付けると、余白を読み直すときに動いている途中の値を拾ってしまうため） */
.itlab-host.vtb-host [data-toolbox-avoid]{box-sizing:border-box}

.itlab-full-area{display:block!important}
.itlab-full-area>:is(.pr-main,.pj-main,.ptf-main,.fr-main,.pc-main,.pt-main){width:100%!important;max-width:none!important;margin-left:0!important}


.itlab-host .atb-toolbox{z-index:2147483000;--navy:#1e3a5f}
.itlab-host .itlab-main-actions{display:contents}
.itlab-host .atb-toolbox-body .itlab-action,.itlab-host .atb-toolbox-body .itlab-switch{
 display:flex;width:100%;margin:0;padding:6px;border-radius:12px;text-decoration:none;font-size:13px;
}
.itlab-host .itlab-switch{--tool-bg:#ede4fb;--tool-border:#bda2df;--tool-ink:#654091}
.itlab-picker{
 position:fixed;width:min(300px,calc(100vw - 16px));max-height:calc(100dvh - 64px);
 overflow:auto;background:#f5f7fc;color:#1e3a5f;border:1px solid #c8d3e3;
 border-radius:14px;padding:10px;z-index:2147483001;
 font-family:system-ui,sans-serif;box-sizing:border-box;
}
.itlab-host [hidden]{display:none!important}
.itlab-picker-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.itlab-picker .itlab-card{padding:8px;box-shadow:none}
.itlab-picker .itlab-card strong{display:none}
.itlab-picker .itlab-card span{font-size:13px}
.itlab-back{width:100%;padding:10px;margin-bottom:8px;border:1px solid #b8c9df;border-radius:10px;background:#e4edf9;color:#1e3a5f;cursor:pointer}
@media(max-width:650px){
 .itlab-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr))}
 .itlab-launcher{gap:10px}.itlab-card{padding:6px;gap:4px}
 .itlab-card small{display:none}.itlab-card strong{width:32px;height:32px;font-size:12px}
}

/* 設定は道具箱へ直接表示。作業領域を中央の適切な幅にする。 */
.itlab-host .itlab-inline-controls{
  position:static;width:100%;min-width:0;grid-column:1/-1;
  --main:#1e3a5f;--accent:#d4af37;--accent-light:#f0d879;
}
.itlab-host .itlab-inline-controls :is(.pr-tools,.pj-tools,.ptf-tools,.fr-tools,.pc-tools,.pt-tools){
  position:static!important;width:100%!important;height:auto!important;max-height:none!important;
  overflow:visible!important;background:transparent!important;box-shadow:none!important;
}
.itlab-inline-controls :is(.pr-tools,.pj-tools,.ptf-tools,.fr-tools,.pc-tools,.pt-tools)::before{display:none!important}
.itlab-inline-controls :is(.pr-tools-body,.pj-tools-body,.ptf-tools-body,.fr-tools-body,.pc-tools-body,.pt-tools-body){
  padding:0!important;gap:8px!important;overflow:visible!important;height:auto!important;min-width:0;
}
.itlab-inline-controls :is(label,dt,dd,small,strong,span,p){color:#34516f!important;overflow-wrap:anywhere}
.itlab-inline-controls :is(.pr-spec-box,.pj-spec-box,.pt-control-card,.pt-paint-card){background:#eaf0f9!important;border-color:#c8d3e3!important;padding:8px!important}
.itlab-inline-controls input:not([type=file]):not([type=range]):not([type=color]):not([type=checkbox]),
.itlab-inline-controls select{width:100%!important;min-width:0!important;max-width:100%!important;background:#fff!important;color:#1e3a5f!important;border:1px solid #b7c8df!important;border-radius:8px!important;padding:6px!important}
.itlab-inline-controls :is(.pr-size-btns,.pj-level-btns,.ptf-quality-btns,.fr-mode-tabs,.pc-toggle-btns,.pt-mode-tabs){display:grid!important;grid-template-columns:repeat(auto-fit,minmax(56px,1fr))!important;gap:4px!important}
.itlab-host .itlab-inline-controls button{height:auto!important;min-height:38px!important;width:100%!important;min-width:0!important;font-size:12px!important;padding:5px!important;background:#e2ebf9!important;border:1px solid #afc4e1!important;color:#244b7b!important;box-shadow:none!important;overflow-wrap:anywhere!important}
.itlab-host .itlab-inline-controls :is(.pr-active,.pj-active,.ptf-qbtn-active,.fr-active,.pc-active,.pt-active){background:#ccdef8!important;border:2px solid #527bbd!important}
.itlab-inline-controls .pngwebp-settings{display:flex;flex-direction:column;gap:6px;padding:0!important}
.itlab-inline-controls :is(.pc-field-row,.fr-field-row){display:grid;grid-template-columns:repeat(auto-fit,minmax(75px,1fr));gap:5px}
.itlab-inline-controls :is(.fr-sec-label,.pc-sec-label){color:#526b8a!important}
.itlab-full-area>:is(.pr-main,.pj-main,.ptf-main,.fr-main,.pc-main,.pt-main){
  width:calc(100% - 32px)!important;max-width:1100px!important;margin:0 auto!important;
}
.itlab-host .atb-toolbox-grip{white-space:normal;overflow-wrap:anywhere}
.itlab-host .atb-toolbox-body>.itlab-main-actions{display:contents}
.itlab-host .atb-toolbox-body .itlab-action{height:auto;min-height:44px;line-height:1.35}
.itlab-host .atb-toolbox[data-layout="horizontal"] .itlab-inline-controls{width:250px;grid-column:auto;max-height:44px;overflow:auto}
@media(max-width:650px){
 .itlab-full-area>:is(.pr-main,.pj-main,.ptf-main,.fr-main,.pc-main,.pt-main){width:calc(100% - 16px)!important}
}

.itlab-host .itlab-slider-panel{
 position:fixed;width:min(300px,calc(100vw - 16px));max-height:calc(100dvh - 64px);
 overflow:auto;padding:14px;background:#f5f7fc;border:1px solid #b8c9df;
 border-radius:14px;z-index:2147483001;box-shadow:0 6px 24px #17365d30;
}
.itlab-host .itlab-slider-panel input[type=range]{width:100%;min-width:0;display:block;accent-color:#527bbd}
.itlab-host .itlab-slider-panel .pngwebp-settings{display:flex;flex-direction:column;gap:8px;padding:0}
.itlab-host .itlab-slider-panel .pt-control-card{padding:0!important;background:transparent!important;border:0!important}
.itlab-host .itlab-slider-button{height:auto;min-height:44px;font-size:13px}

.itlab-host .itlab-slider-panel > strong{display:block;margin-bottom:10px;color:#244b7b;font-size:14px}
.itlab-action{display:block;width:100%;padding:10px;border:1px solid #98c6ab;border-radius:10px;background:#dcf2e5;color:#205c40;font-size:14px;text-align:center;text-decoration:none}

.itlab-inline-controls :is(.pr-tools,.pj-tools,.ptf-tools,.fr-tools,.pc-tools,.pt-tools){display:flex;flex-direction:column;gap:8px}

/* 主要操作 → 調整 → やり直し → アプリ移動の順に統一。 */
.itlab-host .itlab-main-actions,.itlab-host .itlab-secondary-actions{display:contents}
.itlab-host .atb-toolbox-body .itlab-action{height:auto!important;min-height:44px!important;font-size:13px!important;font-weight:700!important;color:#244b7b!important;background:#e0edff!important;border:1px solid #9abce9!important;box-shadow:none!important}
.itlab-host .atb-toolbox-body .itlab-action[data-color=green]{color:#205c40!important;background:#dcf2e5!important;border-color:#91c7a8!important}
.itlab-host .atb-toolbox-body .itlab-action[data-color=orange]{color:#873e14!important;background:#fff1e4!important;border-color:#deb793!important}
.itlab-host .atb-toolbox-body button:disabled,.itlab-host .atb-toolbox-body a[aria-disabled=true]{opacity:1!important;color:#66758a!important;background:#edf0f5!important;border-color:#d2dae5!important;cursor:default}
.itlab-host .itlab-inline-controls,.itlab-host .itlab-inline-controls div{color:#34516f!important}
.itlab-host .itlab-action :is(span,small,strong){color:inherit!important}
.itlab-host .itlab-inline-controls :is(.pr-spec-box,.pj-spec-box){padding:0!important;border:0!important;background:transparent!important;margin:0!important}
.itlab-host .itlab-secondary-actions .itlab-action{min-height:38px!important}
.itlab-host .itlab-inline-controls input::placeholder{color:#63748a!important;opacity:1}
