:root {
  --accent: #0067c0;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
  --bg: #f3f3f3;
  --bg2: #eeeeee;
  --panel: #fbfbfb;
  --menu-bg: #f9f9f9;
  --border: #e0e0e0;
  --border-strong: #c8c8c8;
  --text: #1b1b1b;
  --text-dim: #5f5f5f;
  --text-disabled: #a5a5a5;
  --hover: rgba(0, 0, 0, 0.055);
  --pressed: rgba(0, 0, 0, 0.09);
  --selected: color-mix(in srgb, var(--accent) 14%, transparent);
  --workspace: #d9d9d9;
  --ruler-bg: #f5f5f5;
  --ruler-sel: rgba(0, 103, 192, 0.22);
  --input-bg: #ffffff;
  --input-border: #d4d4d4;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.08);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #202020;
  --bg2: #272727;
  --panel: #2b2b2b;
  --menu-bg: #2c2c2c;
  --border: #3a3a3a;
  --border-strong: #4a4a4a;
  --text: #f1f1f1;
  --text-dim: #b0b0b0;
  --text-disabled: #6d6d6d;
  --hover: rgba(255, 255, 255, 0.065);
  --pressed: rgba(255, 255, 255, 0.1);
  --selected: color-mix(in srgb, var(--accent) 35%, transparent);
  --workspace: #191919;
  --ruler-bg: #262626;
  --ruler-sel: rgba(96, 165, 250, 0.3);
  --input-bg: #1f1f1f;
  --input-border: #464646;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font: 12px/1.35 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
body.busy, body.busy * { cursor: progress !important; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--text); }
.icon { display: inline-flex; width: 16px; height: 16px; flex: none; align-items: center; justify-content: center; }
.icon svg { display: block; overflow: visible; }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* ---------- title / menu row ---------- */
.titlebar { display: flex; align-items: center; height: 34px; padding: 0 4px 0 6px; background: var(--bg); flex: none; gap: 2px; }
.app-logo { display: flex; align-items: center; padding: 0 6px 0 2px; }
.app-logo .icon, .app-logo .icon svg { width: 18px; height: 18px; }
.menubar { display: flex; height: 100%; align-items: center; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.menubar::-webkit-scrollbar { display: none; }
.menu-top { background: none; border: 0; height: 28px; padding: 0 10px; border-radius: 5px; cursor: default; }
.menu-top:hover, .menu-top.open { background: var(--hover); }
.doc-title { flex: 1; text-align: center; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 12px; min-width: 0; }
.titlebar-right { display: flex; align-items: center; gap: 2px; flex: none; }

/* ---------- toolbars ---------- */
.toolbar { display: flex; align-items: center; height: 40px; padding: 0 6px; background: var(--bg); gap: 2px; flex: none; }
.toolbar-left { overflow-x: auto; scrollbar-width: none; min-width: 0; }
.toolbar-left { display: flex; align-items: center; gap: 2px; flex: 0 1 auto; }
.tb-btn, .opt-btn, .fw-btn, .sb-zbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 30px; height: 30px; padding: 0 6px; border: 1px solid transparent; border-radius: 5px; background: none; cursor: default;
}
.tb-btn:hover:not(:disabled), .opt-btn:hover, .fw-btn:hover:not(:disabled), .sb-zbtn:hover { background: var(--hover); }
.tb-btn:active:not(:disabled), .opt-btn:active, .fw-btn:active:not(:disabled) { background: var(--pressed); }
.tb-btn:disabled, .fw-btn:disabled { opacity: 0.38; }
.tb-btn.toggle.active, .opt-btn.toggle.active { background: var(--selected); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tb-btn.open, .opt-btn.open, .combo-drop.open { background: var(--pressed); }
.tb-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 5px; flex: none; }

.image-tabs { display: flex; align-items: center; gap: 4px; margin-left: auto; overflow-x: auto; overflow-y: hidden; height: 100%; padding: 0 2px; scrollbar-width: thin; min-width: 0; }
.image-tab { position: relative; flex: none; width: 54px; height: 36px; border-radius: 5px; border: 1px solid transparent; display: flex; align-items: center; justify-content: center; cursor: default; }
.image-tab:hover { background: var(--hover); }
.image-tab.active { background: var(--selected); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.tab-thumb-wrap { width: 46px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 8px 8px; background-clip: content-box; }
.tab-thumb { max-width: 46px; max-height: 30px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); }
.tab-thumb-wrap { background: none; }
.image-tab.dirty::after { content: "*"; position: absolute; left: 3px; top: -2px; font-weight: 700; color: var(--accent); }
.tab-close { position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--panel); display: none; align-items: center; justify-content: center; }
.tab-close .icon, .tab-close svg { width: 10px; height: 10px; }
.image-tab:hover .tab-close { display: flex; }
.tab-close:hover { background: #e81123; color: #fff; border-color: #e81123; }

.tooloptions { display: flex; align-items: center; height: 38px; padding: 0 8px; background: var(--bg2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); flex: none; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tooloptions-items { display: flex; align-items: center; gap: 2px; }
.opt-caption { color: var(--text); margin: 0 4px 0 2px; white-space: nowrap; }
.opt-group { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.opt-btn { height: 28px; min-width: 28px; }
.opt-btn .opt-chev, .opt-chev svg { width: 10px; height: 10px; opacity: 0.7; }
.opt-label { white-space: nowrap; }
.txt-icon { font: 700 13px/16px Georgia, "Times New Roman", serif; }
.dash-icon { width: 32px; }
.combo { display: inline-flex; align-items: stretch; height: 26px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); overflow: hidden; }
.combo-input { border: 0; background: none; padding: 0 6px; outline: none; min-width: 0; }
.combo-drop { border: 0; background: none; width: 20px; display: flex; align-items: center; justify-content: center; padding: 0; }
.combo-drop:hover { background: var(--hover); }
.combo-drop .icon, .combo-drop svg { width: 10px; height: 10px; }
.combo:focus-within { border-color: var(--accent); }

.bar-slider { position: relative; width: 150px; height: 24px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); overflow: hidden; cursor: ew-resize; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 35%, transparent); }
.bar-text { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 8px; white-space: nowrap; }

select.select, input.text, input.num {
  height: 26px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); padding: 0 6px; outline: none;
}
select.select:focus, input.text:focus, input.num:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
input.num { padding-right: 2px; }
.font-select { width: 150px; }

/* ---------- workspace ---------- */
.workspace { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--workspace); }
.workspace.dragging::after { content: "Drop images to open them"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; background: color-mix(in srgb, var(--accent) 8%, transparent); pointer-events: none; z-index: 50; }
.canvas-area { position: absolute; inset: 0; display: grid; grid-template-rows: 0 1fr; grid-template-columns: 0 1fr; }
.canvas-area.with-rulers { grid-template-rows: 18px 1fr; grid-template-columns: 18px 1fr; }
.ruler-corner { grid-area: 1 / 1; background: var(--ruler-bg); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ruler { display: block; }
.ruler-h { grid-area: 1 / 2; height: 18px; }
.ruler-v { grid-area: 2 / 1; width: 18px; }
.canvas-area:not(.with-rulers) .ruler, .canvas-area:not(.with-rulers) .ruler-corner { display: none; }
.viewport { grid-area: 2 / 2; position: relative; overflow: hidden; min-width: 0; min-height: 0; }
.scroller { position: absolute; inset: 0; overflow: auto; }
.spacer { width: 1px; height: 1px; }
canvas.display { position: absolute; left: 0; top: 0; touch-action: none; outline: none; }
.empty-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-dim); font-size: 14px; pointer-events: none; }
.empty-msg .btn, .empty-msg .empty-actions { pointer-events: auto; }
.empty-actions { display: flex; gap: 8px; }

/* ---------- floating windows ---------- */
.window-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.floatwin {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); min-width: 60px; overflow: hidden;
  transition: opacity 0.18s;
}
.translucent .floatwin:not(:hover) { opacity: 0.82; }
.fw-title { display: flex; align-items: center; height: 26px; padding: 0 2px 0 9px; cursor: default; flex: none; touch-action: none; }
.fw-title-text { flex: 1; font-weight: 600; font-size: 12px; }
.fw-close { width: 26px; height: 22px; border: 0; background: none; border-radius: 4px; display: flex; align-items: center; justify-content: center; padding: 0; }
.fw-close:hover { background: #e81123; color: #fff; }
.fw-close .icon, .fw-close svg { width: 11px; height: 11px; }
.fw-body { flex: 1; min-height: 0; overflow: auto; }
.fw-footer { flex: none; border-top: 1px solid var(--border); padding: 3px; }
.fw-buttons { display: flex; gap: 1px; flex-wrap: wrap; }
.fw-btn { min-width: 26px; height: 26px; padding: 0 4px; }
.fw-grip { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--border-strong) 50%, var(--border-strong) 58%, transparent 58%, transparent 70%, var(--border-strong) 70%, var(--border-strong) 78%, transparent 78%); }

.tools-grid { display: grid; grid-template-columns: repeat(2, 32px); gap: 2px; padding: 4px 6px 6px; }
.tool-btn { width: 32px; height: 32px; border: 1px solid transparent; border-radius: 5px; background: none; display: flex; align-items: center; justify-content: center; padding: 0; }
.tool-btn:hover { background: var(--hover); }
.tool-btn.active { background: var(--selected); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.tool-btn .icon, .tool-btn svg { width: 20px; height: 20px; }

.history-list { padding: 2px 0; }
.history-item { display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; white-space: nowrap; cursor: default; }
.history-item:hover { background: var(--hover); }
.history-item.current { background: var(--selected); }
.history-item.redo { color: var(--text-disabled); }
.history-item.redo .icon { opacity: 0.45; filter: grayscale(1); }

.layers-list { padding: 2px 0; }
.layer-item { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 6px; cursor: default; border-bottom: 1px solid var(--border); }
.layer-item:hover { background: var(--hover); }
.layer-item.active { background: var(--selected); }
.layer-item.drop { box-shadow: inset 0 2px 0 var(--accent); }
.layer-thumb { flex: none; width: 48px; height: 36px; }
.layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-vis { flex: none; width: 15px; height: 15px; accent-color: var(--accent); }

.colors-win { padding: 6px 8px 8px; width: 232px; }
.colors-top { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.swatches { position: relative; width: 66px; height: 58px; flex: none; }
.swatch { position: absolute; width: 38px; height: 38px; border: 1px solid #000; border-radius: 3px; padding: 0; box-shadow: 0 0 0 1px #fff inset;
  background: linear-gradient(var(--c), var(--c)), repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.swatch.primary { left: 0; top: 0; z-index: 2; }
.swatch.secondary { left: 18px; top: 18px; z-index: 1; }
.swatch-swap { position: absolute; left: 42px; top: 0; width: 18px; height: 18px; border: 0; padding: 0; background: none; display: flex; align-items: center; justify-content: center; }
.swatch-swap .icon, .swatch-swap svg { width: 13px; height: 13px; }
.swatch-reset { position: absolute; left: 0; top: 42px; width: 16px; height: 16px; border: 0; padding: 2px; background: none; }
.swatch-swap:hover, .swatch-reset:hover { background: var(--hover); border-radius: 3px; }
.colors-info { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.color-hex { font-family: Consolas, "Cascadia Mono", monospace; color: var(--text-dim); }
.palette { display: grid; grid-template-columns: repeat(16, 12px); gap: 1px; }
.pal-swatch { width: 12px; height: 12px; padding: 0; border: 0; border-radius: 1px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  background: linear-gradient(var(--c), var(--c)), repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 6px 6px; }
.pal-swatch:hover { outline: 1px solid var(--text); z-index: 1; }

/* ---------- status bar ---------- */
.statusbar { display: flex; align-items: center; height: 28px; padding: 0 8px; background: var(--bg); border-top: 1px solid var(--border); flex: none; gap: 8px; }
.sb-left { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.sb-hint-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); }
.sb-right { display: flex; align-items: center; gap: 12px; flex: none; }
.sb-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; min-width: 84px; color: var(--text); }
.sb-item .icon { opacity: 0.75; }
.sb-units { display: inline-flex; align-items: center; gap: 4px; height: 22px; border: 0; background: none; border-radius: 4px; padding: 0 6px; }
.sb-units:hover { background: var(--hover); }
.sb-zoom { display: inline-flex; align-items: center; gap: 2px; }
.sb-zbtn { min-width: 22px; height: 22px; padding: 0; }
.sb-zoom-slider { width: 110px; accent-color: var(--accent); }
.sb-zoom .combo { height: 22px; }
.sb-zoom-input { width: 50px; text-align: right; }

/* ---------- menus ---------- */
.menu-popup {
  position: fixed; z-index: 2000; min-width: 230px; max-height: calc(100vh - 8px); overflow-y: auto; padding: 4px; background: var(--menu-bg);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); animation: menuIn 0.08s ease-out;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-3px); } }
.menu-item { display: grid; grid-template-columns: 24px 1fr auto 14px; align-items: center; gap: 4px; height: 28px; padding: 0 6px; border-radius: 4px; cursor: default; white-space: nowrap; }
.menu-item:hover, .menu-item.sub-open { background: var(--hover); }
.menu-item.disabled { color: var(--text-disabled); }
.menu-item.disabled .icon { opacity: 0.4; filter: grayscale(1); }
.mi-icon { display: flex; align-items: center; justify-content: center; }
.mi-shortcut { color: var(--text-dim); padding-left: 24px; font-size: 11.5px; }
.mi-arrow .icon, .mi-arrow svg { width: 11px; height: 11px; }
.mi-thumb { max-width: 20px; max-height: 20px; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* ---------- dialogs ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 1500; }
.dialog { position: fixed; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); display: flex; flex-direction: column; }
.dlg-title { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 4px 0 12px; cursor: default; flex: none; touch-action: none; }
.dlg-title-text { flex: 1; font-weight: 600; }
.dlg-close { width: 34px; height: 28px; border: 0; background: none; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.dlg-close:hover { background: #e81123; color: #fff; }
.dlg-body { padding: 4px 16px 12px; overflow: auto; flex: 1; min-height: 0; }
.dlg-buttons { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 16px; background: var(--bg2); border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 84px; height: 30px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: 5px; background: var(--input-bg); cursor: default; }
.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--input-bg) 92%, var(--text)); }
.btn:active:not(:disabled) { background: color-mix(in srgb, var(--input-bg) 85%, var(--text)); }
.btn:disabled { opacity: 0.5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn.small { min-width: 0; height: 24px; padding: 0 8px; }
.fx-status { margin-right: auto; color: var(--text-dim); }
.form { display: flex; flex-direction: column; gap: 8px; }
.form fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px 10px; margin: 0; }
.form legend { padding: 0 4px; color: var(--text-dim); }
.grid2 { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.grid2 > span { display: flex; align-items: center; gap: 4px; }
.row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: default; margin: 2px 0; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.radio-group { display: flex; flex-direction: column; gap: 2px; }
.hint { color: var(--text-dim); font-size: 11.5px; }
.size-memo { color: var(--text-dim); }
.size-mode { display: flex; flex-direction: column; gap: 2px; }
.saveas-form input.text, .saveas-form select { width: 100%; }
.save-size { color: var(--text-dim); margin-top: 4px; }
.msgbox { display: flex; gap: 14px; align-items: flex-start; padding: 8px 0; }
.msgbox-icon .icon, .msgbox-icon svg { width: 32px; height: 32px; }
.msgbox-text { white-space: pre-wrap; padding-top: 6px; line-height: 1.45; user-select: text; }
.anchor-grid { display: grid; grid-template-columns: repeat(3, 34px); gap: 3px; justify-content: center; }
.anchor-cell { width: 34px; height: 34px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); font-size: 15px; padding: 0; }
.anchor-cell.sel { background: var(--accent); border-color: var(--accent); }
.anchor-cell:hover { border-color: var(--accent); }

.prop-row { margin: 8px 0 10px; }
.prop-label { margin-bottom: 4px; }
.prop-ctl { display: flex; align-items: center; gap: 8px; }
.prop-ctl .slider { flex: 1; min-width: 80px; accent-color: var(--accent); }
.prop-ctl input.num { width: 72px; }
.reset-btn { width: 26px; height: 26px; border: 0; background: none; border-radius: 4px; display: flex; align-items: center; justify-content: center; padding: 0; }
.reset-btn:hover { background: var(--hover); }
.angle-dial, .pan-pad { cursor: crosshair; touch-action: none; color: var(--text); }
.pan-pad { border: 1px solid var(--border-strong); max-height: 120px; }
.pan-nums { display: flex; flex-direction: column; gap: 4px; }
.pan-nums label { display: flex; align-items: center; gap: 4px; }
.curves-canvas { width: 256px; height: 256px; border: 1px solid var(--border-strong); display: block; margin: 6px auto; cursor: crosshair; touch-action: none; }
.curves-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.curves-ch, .levels-ch { display: inline-flex; gap: 8px; margin-left: 8px; }
.levels-grid { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; margin: 6px 0; }
.levels-col { display: flex; flex-direction: column; gap: 6px; }
.levels-col label, .levels-gamma { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.levels-col input.num { width: 56px; }
.levels-hist { width: 256px; height: 100px; border: 1px solid var(--border-strong); display: block; }
.levels-mid { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.settings fieldset .row { margin-top: 6px; }
.about { display: flex; gap: 16px; }
.about-logo .icon, .about-logo svg { width: 56px; height: 56px; }
.about h2 { margin: 2px 0 8px; font-size: 20px; font-weight: 600; }
.about-web { color: var(--accent); font-weight: 400; }
.about a { color: var(--accent); }
.shortcuts { max-height: 60vh; overflow: auto; }
.shortcuts table { width: 100%; border-collapse: collapse; }
.shortcuts td { padding: 3px 6px; border-bottom: 1px solid var(--border); }
.shortcuts td.kbd { font-family: Consolas, monospace; color: var(--text-dim); white-space: nowrap; text-align: right; }

/* color dialog */
.color-dialog { display: flex; flex-direction: column; gap: 10px; }
.cd-top { display: flex; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--input-border); border-radius: 5px; overflow: hidden; }
.seg-btn { border: 0; background: var(--input-bg); padding: 0 14px; height: 28px; }
.seg-btn + .seg-btn { border-left: 1px solid var(--input-border); }
.seg-btn.active { background: var(--accent); color: #fff; }
.cd-compare { display: flex; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; }
.cd-sw { width: 44px; height: 28px; background: linear-gradient(var(--c), var(--c)), repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.cd-main { display: flex; gap: 16px; align-items: flex-start; }
.wheel-wrap { position: relative; width: 196px; height: 196px; flex: none; }
.color-wheel { display: block; cursor: crosshair; touch-action: none; }
.wheel-mark { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #000; pointer-events: none; }
.cd-sliders { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cd-group { display: flex; flex-direction: column; gap: 3px; }
.cd-group-title { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.cd-row { display: grid; grid-template-columns: 66px 1fr 58px; gap: 8px; align-items: center; }
.cd-row .hex-input { grid-column: 2 / 4; font-family: Consolas, monospace; text-transform: uppercase; }
.gs-track { position: relative; height: 16px; border-radius: 3px; border: 1px solid var(--border-strong); cursor: pointer; touch-action: none; }
.gs-checker, .gs-grad { position: absolute; inset: 0; border-radius: 2px; }
.gs-checker { background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 8px 8px; }
.gs-thumb { position: absolute; top: -3px; width: 8px; height: 20px; margin-left: -4px; border: 2px solid #fff; border-radius: 3px; box-shadow: 0 0 0 1px #000; pointer-events: none; }

/* text tool input (kept invisible; used for keyboard / IME input) */
.text-tool-input { position: fixed; left: 0; top: 0; width: 2px; height: 20px; opacity: 0; border: 0; padding: 0; resize: none; pointer-events: none; z-index: -1; }

#print-holder { display: none; }
@media print {
  #app, .floatwin, .menu-popup, .modal-backdrop { display: none !important; }
  #print-holder { display: block; }
  #print-holder img { max-width: 100%; max-height: 100vh; }
  html, body { overflow: visible; height: auto; }
}

@media (max-width: 720px) {
  .doc-title { display: none; }
  .menu-top { padding: 0 7px; }
  .sb-item:nth-child(3), .sb-units, .sb-zoom-slider { display: none; }
  .image-tabs { display: none; }
}
