/* Image Editor: full screen (no site header; the help text stays below for anyone who scrolls), and a calm,
   neutral dark workspace like pro photo editors, whatever the site's theme. */
body.tool-image-editor .site-header { display: none; }
body.tool-image-editor .tool-hero { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.tool-image-editor .tool-app { max-width: none; padding: 0; margin: 0; }
.ie {
  --ie-bg: #1b1d21; --ie-panel: #24262b; --ie-panel-2: #2d3036; --ie-line: #34373e; --ie-text: #d6d9de; --ie-faint: #8d929b; --ie-accent: #4a8cff;
  position: relative; display: flex; flex-direction: column; width: 100vw; margin-left: calc(50% - 50vw); height: 100vh; height: 100dvh; min-height: 480px;
  background: var(--ie-bg); color: var(--ie-text); font-size: 13px; user-select: none; -webkit-user-select: none;
}
.ie .icon { width: 17px; height: 17px; }
.ie-menubar { display: flex; align-items: center; gap: 4px; padding: 3px 6px; background: var(--ie-panel); border-bottom: 1px solid var(--ie-line); flex: none; }
.ie-home { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; margin-right: 4px; border-right: 1px solid var(--ie-line); color: var(--ie-text); text-decoration: none; font-weight: 650; white-space: nowrap; }
.ie-home:hover { color: #fff; }
.ie-logo { width: 20px; height: 20px; }
.ie-menus { display: flex; gap: 1px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ie-menu-btn { padding: 5px 10px; border: 0; border-radius: 4px; background: none; color: var(--ie-text); font: inherit; cursor: pointer; white-space: nowrap; }
.ie-menu-btn:hover, .ie-menu-btn[aria-expanded="true"] { background: var(--ie-panel-2); }
.ie-panels-btn { display: none; }
.ie-drop { position: fixed; z-index: 1000; min-width: 230px; max-height: calc(100vh - 20px); overflow-y: auto; padding: 4px; background: #2a2d33; border: 1px solid #3a3e45; border-radius: 6px; box-shadow: 0 12px 32px rgb(0 0 0 / .45); color: var(--ie-text); font-size: 13px; }
.ie-drop button { display: flex; justify-content: space-between; gap: 24px; width: 100%; padding: 6px 10px; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ie-drop button:hover:not(:disabled) { background: var(--ie-accent); color: #fff; }
.ie-drop button:disabled { opacity: .4; cursor: default; }
.ie-drop .ie-check::before { content: "✓"; margin-right: 6px; visibility: hidden; }
.ie-drop .ie-check.is-on::before { visibility: visible; }
.ie-drop kbd { font: inherit; color: var(--ie-faint); }
.ie-drop button:hover kbd { color: #e6eeff; }
.ie-drop hr { margin: 4px 6px; border: 0; border-top: 1px solid var(--ie-line); }
.ie-drop-title { padding: 4px 10px 2px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ie-faint); }
.ie-drop .ie-quick { display: grid; gap: 8px; padding: 6px 10px 8px; }
.ie-options { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 4px 12px; background: var(--ie-panel); border-bottom: 1px solid var(--ie-line); flex: none; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.ie-options label, .ie-quick label { display: inline-flex; align-items: center; gap: 6px; color: var(--ie-faint); }
.ie input[type=range], .ie-drop input[type=range] { width: 100px; height: 16px; --r: 7px; }
.ie input[type=range]::-webkit-slider-runnable-track, .ie-drop input[type=range]::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(to right, var(--ie-accent) calc(var(--r) + (100% - 2 * var(--r)) * var(--f, .5)), #4a4e56 0); }
.ie input[type=range]::-webkit-slider-thumb, .ie-drop input[type=range]::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -5.5px; border: 0; background: #e8eaee; box-shadow: none; }
.ie-options output, .ie-quick output { min-width: 3.5ch; color: var(--ie-text); }
.ie-optname { font-weight: 650; color: var(--ie-text); }
.ie-seg { display: inline-flex; border: 1px solid #3d414a; border-radius: 5px; overflow: hidden; }
.ie-seg button { padding: 4px 9px; border: 0; background: #1d1f23; color: var(--ie-faint); font: inherit; cursor: pointer; }
.ie-seg button + button { border-left: 1px solid #3d414a; }
.ie-seg button[aria-pressed="true"] { background: #3a3f48; color: #fff; }
.ie-color { width: 26px; height: 22px; padding: 0; border: 1px solid #50555e; border-radius: 4px; background: none; cursor: pointer; }
.ie-main { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.ie-tools { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; background: var(--ie-panel); border-right: 1px solid var(--ie-line); flex: none; overflow-y: auto; scrollbar-width: none; }
.ie-tool, .ie-ibtn { display: grid; place-items: center; width: 34px; height: 32px; flex: none; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--ie-text); cursor: pointer; font: 600 12px/1 inherit; }
.ie-tool, .ie-ibtn, .ie-menu-btn, .ie-btn, .ie-seg button, .ie-hist button, .ie-layer, .ie-eye, .ie-swatches button, .ie-sw, .ie-home { transition: background-color .12s, color .12s, border-color .12s, transform .12s; }
.ie-tool:hover, .ie-ibtn:hover { background: #33363d; color: #fff; }
.ie-tool:active, .ie-ibtn:active, .ie-btn:active { transform: scale(.94); }
.ie-tool[aria-pressed="true"], .ie-ibtn[aria-pressed="true"] { background: #3a3f48; color: #fff; box-shadow: inset 0 0 0 1px #4c525d; }
.ie-work { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ie-tabs { display: flex; min-height: 31px; background: #1f2125; border-bottom: 1px solid var(--ie-line); overflow-x: auto; scrollbar-width: none; flex: none; }
.ie-tabs:empty { display: none; }
.ie-tab { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; height: 31px; padding: 0 6px 0 12px; border: 0; border-right: 1px solid var(--ie-line); background: #24262b; color: var(--ie-faint); font: inherit; cursor: pointer; white-space: nowrap; transition: background-color .12s, color .12s; }
.ie-tab-name { overflow: hidden; text-overflow: ellipsis; }
.ie-tab:hover { background: #2b2e34; color: var(--ie-text); }
.ie-tab.is-active { background: var(--ie-bg); color: #fff; box-shadow: inset 0 2px 0 var(--ie-accent); }
.ie-tab.is-drop { background: #33435e; color: #fff; }
.ie-tab-x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; color: var(--ie-faint); }
.ie-tab-x .icon { width: 13px; height: 13px; }
.ie-tab-x:hover { background: #3a3f48; color: #fff; }
.ie-panes { flex: 1; display: flex; gap: 2px; min-height: 0; background: #0e0f11; }
.ie-stage { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #16181b; }
.ie-panes.is-split .ie-stage.is-active { box-shadow: inset 0 0 0 1px var(--ie-accent); }
.ie-view { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.ie-textedit { position: absolute; z-index: 5; min-width: 40px; padding: 0; margin: 0; border: 1px dashed #7aa7ff; background: transparent; outline: none; resize: none; overflow: hidden; white-space: pre; transform-origin: 0 0; }
.ie-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; padding: 16px; }
.ie-empty-title { margin: 0; font-size: 18px; font-weight: 600; color: #eef0f3; }
.ie-empty-sub { margin: 0 0 8px; color: var(--ie-faint); }
.ie-empty-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ie-btn { padding: 6px 14px; border: 1px solid #454a53; border-radius: 6px; background: #2e3137; color: var(--ie-text); font: 600 13px/1.2 inherit; cursor: pointer; white-space: nowrap; }
.ie-btn:hover { background: #363a41; }
.ie-btn-primary { background: var(--ie-accent); border-color: var(--ie-accent); color: #fff; }
.ie-btn-primary:hover { background: #3b7ef0; }
.ie-side { display: flex; flex-direction: column; width: 270px; flex: none; background: var(--ie-panel); border-left: 1px solid var(--ie-line); min-height: 0; }
.ie-panel { padding: 8px 10px 10px; border-bottom: 1px solid var(--ie-line); }
.ie-ph { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ie-faint); }
.ie-colors { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ie-sw { position: relative; width: 30px; height: 30px; border-radius: 4px; border: 2px solid #5a5f68; overflow: hidden; cursor: pointer; }
.ie-sw input { position: absolute; inset: -6px; width: 44px; height: 44px; border: 0; padding: 0; cursor: pointer; }
.ie-swatches { display: flex; flex-wrap: wrap; gap: 3px; width: 100%; margin-top: 4px; }
.ie-swatches button { width: 16px; height: 16px; padding: 0; border: 1px solid #50555e; border-radius: 3px; cursor: pointer; }
.ie-layers-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ie-lopts { display: flex; gap: 6px; margin-bottom: 6px; }
.ie-select, .ie-options select, .ie-op input, .ie-options input[type=number], .ie-quick select { height: 26px; padding: 0 6px; border: 1px solid #3d414a; border-radius: 4px; background: #1d1f23; color: var(--ie-text); font: inherit; }
.ie-options input[type=number] { width: 64px; }
.ie-select { flex: 1; min-width: 0; }
.ie-op { display: inline-flex; align-items: center; gap: 4px; color: var(--ie-faint); }
.ie-op input { width: 64px; }
.ie-layers { flex: 1; overflow-y: auto; min-height: 60px; border: 1px solid var(--ie-line); border-radius: 4px; background: #1f2125; }
.ie-layer { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-bottom: 1px solid #2a2d33; cursor: pointer; }
.ie-layer.is-active { background: #33435e; }
.ie-layer canvas { width: 34px; height: 26px; flex: none; border: 1px solid #3c4048; background: repeating-conic-gradient(#555 0 25%, #777 0 50%) 0 0 / 8px 8px; }
.ie-layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ie-layer-tag { color: var(--ie-faint); font-size: 11px; }
.ie-eye { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; background: none; color: var(--ie-faint); cursor: pointer; }
.ie-eye .icon { width: 15px; height: 15px; }
.ie-lbtns { display: flex; justify-content: flex-end; gap: 1px; margin-top: 6px; flex-wrap: wrap; }
.ie-lbtns .ie-ibtn { width: 28px; height: 28px; }
.ie-hist-panel { height: 140px; display: flex; flex-direction: column; border-bottom: 0; }
.ie-hist { flex: 1; overflow-y: auto; }
.ie-hist button { display: block; width: 100%; padding: 4px 6px; border: 0; background: none; color: var(--ie-text); font: inherit; text-align: left; cursor: pointer; border-radius: 3px; }
.ie-hist button.is-current { background: #33435e; }
.ie-hist button.is-future { color: #6c717a; }
.ie-status { display: flex; gap: 18px; padding: 4px 12px; background: var(--ie-panel); border-top: 1px solid var(--ie-line); color: var(--ie-faint); font-size: 12px; flex: none; white-space: nowrap; overflow: hidden; }
.ie-dialog-grid { display: grid; gap: 12px; min-width: min(380px, 80vw); }
.ie-dialog-grid label { display: grid; gap: 4px; font-size: .9rem; font-weight: 600; }
.ie-dialog-grid fieldset { display: grid; gap: 8px; margin: 0; padding: 8px 10px 10px; border: 1px solid var(--border); border-radius: 8px; }
.ie-dialog-grid legend { padding: 0 4px; font-weight: 700; }
.ie-dialog-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ie-curves { width: 256px; height: 256px; border: 1px solid var(--border); border-radius: 4px; background: #111; touch-action: none; cursor: crosshair; }
@media (max-width: 900px) { .ie-side { width: 220px; } .ie-hist-panel { display: none; } .ie-home span { display: none; } }
/* Phones: tools along the bottom, layers & colours in a panel that slides over the picture. */
@media (max-width: 700px) {
  .ie-main { flex-direction: column-reverse; position: relative; }
  .ie-tools { flex-direction: row; overflow-x: auto; border-right: 0; border-top: 1px solid var(--ie-line); padding: 4px; }
  .ie-tool { width: 40px; height: 40px; }
  .ie-panels-btn { display: grid; }
  .ie-side { position: absolute; right: 0; top: 0; bottom: 49px; z-index: 6; width: min(300px, 86vw); transform: translateX(100%); transition: transform .2s, visibility .2s; visibility: hidden; }
  .ie-side.is-open { transform: none; visibility: visible; box-shadow: -12px 0 30px rgb(0 0 0 / .4); }
  .ie-hist-panel { display: flex; }
  .ie-status { display: none; }
}

/* hover states */
.ie-seg button:hover:not([aria-pressed="true"]) { background: #2a2d33; color: var(--ie-text); }
.ie-layer:hover:not(.is-active) { background: #282b31; }
.ie-layer.is-drop { box-shadow: inset 0 2px 0 var(--ie-accent); }
.ie-hist button:hover:not(.is-current) { background: #2a2d33; }
.ie-eye:hover { color: #fff; }
.ie-swatches button:hover { transform: scale(1.18); }
.ie-sw:hover { border-color: #8a8f98; }
.ie-options input[type=checkbox], .ie-color { cursor: pointer; }
.ie-color:hover { border-color: #8a8f98; }
@media (max-width: 700px) { .ie-panes { flex-direction: column; } }
