/* Canvas, quick rails and the full tool panel. */
.canvas-host { overflow: hidden; }
.canvas-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: crosshair; outline: none; -webkit-user-select: none; user-select: none; }
.canvas-viewport:focus-visible { box-shadow: inset 0 0 0 3px var(--cobalt); }
.canvas-viewport.locked { cursor: not-allowed; }
.canvas-viewport.panning { cursor: grabbing; }
.canvas-sheet { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 0 0 1px rgba(32, 35, 43, 0.08); }
.canvas-viewport.zoomed .canvas-sheet { box-shadow: 0 0 0 1px rgba(32, 35, 43, 0.25), 0 6px 22px rgba(0, 0, 0, 0.12); }
.canvas-main, .canvas-overlay { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.canvas-overlay { pointer-events: none; }
.s06-canvas { background: #fff; }
.s06-canvas .canvas-viewport.zoomed { background: #f1eee7; }
.s09-canvas .canvas-viewport.zoomed { background: #e9e3d6; }

.canvas-lock { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(247, 242, 232, 0.55); z-index: 3; pointer-events: none; }
.canvas-lock-card { background: rgba(32, 35, 43, 0.9); color: #fff; border-radius: 16px; padding: 20px 28px; display: grid; gap: 6px; text-align: center; max-width: 70%; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.canvas-lock-card strong { font: 700 38px var(--f-ui); font-stretch: 85%; letter-spacing: 0.04em; text-transform: uppercase; }
.canvas-lock-card span { font: 400 20px var(--f-body); color: #dfe2e8; }
.canvas-fit { position: absolute; right: 12px; bottom: 12px; z-index: 4; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px; border-radius: 23px; border: 2px solid var(--graphite); background: #fffcf5; font: 700 18px var(--f-ui); color: var(--graphite); }
.canvas-fit .ico { font-size: 22px; }
.sel-bar { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; border-radius: 14px; background: #fffcf5; border: 2px solid var(--graphite); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15); font: 600 17px var(--f-ui); }
.sel-bar .btn { font-size: 18px; padding: 0 16px; min-height: 42px; }
.canvas-net { position: absolute; left: 12px; bottom: 12px; z-index: 4; max-width: 70%; background: rgba(32, 35, 43, 0.88); color: #fff; font: 600 16px var(--f-ui); border-radius: 10px; padding: 8px 12px; }

/* ---------------------------------------------------------------- S06 light rail */
.rail { position: absolute; }
.rail > * { position: absolute; }
.rail-btn { display: flex; align-items: center; gap: 0; padding: 0; border-radius: 8px; border: 1.5px solid #ece8df; background: #fef9ef; color: #1f2127; text-align: left; }
.rail-btn .rail-ico { width: 90px; display: grid; place-items: center; font-size: 42px; flex: none; }
.rail-btn .rail-label { font: 700 17px var(--f-ui); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 136px; }
.rail-btn:hover { background: #fff; border-color: #d9d4c9; }
.rail-btn.on { background: #fe695c; border-color: #fe695c; color: #fff; }
.rail-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.rail-more { border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.22); color: inherit; display: grid; place-items: center; font-size: 20px; z-index: 2; opacity: 0.9; }
.rail-S06 .rail-more { color: #fff; }
.rail-S06 .rail-more:hover, .rail-S06 .rail-more[aria-expanded='true'] { background: rgba(255, 255, 255, 0.4); }
.rail-S06 .rail-btn:not(.on) ~ .rail-more { color: var(--graphite); }
.swatch { border-radius: 50%; border: 0; background: var(--c); padding: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
.swatch[data-c='#ffffff'] { box-shadow: inset 0 0 0 2px #2b2d33; }
.swatch.on { box-shadow: 0 0 0 3px #fef9ef, 0 0 0 6px #2f5cf6; }
.swatch:hover { transform: scale(1.06); }
.rail-cap { font: 700 14px var(--f-ui); letter-spacing: 0.08em; color: #22252b; white-space: nowrap; }
.rail-size-val { font: 600 13px var(--f-ui); color: #6b6d73; white-space: nowrap; }
.size-dot { border: 0; background: transparent; padding: 0; display: grid; place-items: center; }
.size-dot::before { content: ''; width: var(--r); height: var(--r); border-radius: 50%; background: #25272d; }

/* Range inputs styled like the mockup sliders. */
.rng { -webkit-appearance: none; appearance: none; background: transparent; margin: 0; height: 24px; cursor: pointer; --fill: #2f64fd; --track: #cfd3da; }
.rng::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--track); }
.rng::-moz-range-track { height: 6px; border-radius: 3px; background: var(--track); }
.rng::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--fill); }
.rng::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--fill); margin-top: -10px; border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.rng::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--fill); border: 0; }
.rail-size { height: 24px; }

/* ---------------------------------------------------------------- S09 graphite rail */
.rail-S09 .rail-btn { background: #1d2024; border: 1.5px solid #30343b; color: #f3f4f6; border-radius: 6px; }
.rail-S09 .rail-btn .rail-ico { width: 94px; font-size: 44px; }
.rail-S09 .rail-btn .rail-label { font: 400 23px var(--f-ui); letter-spacing: 0.01em; max-width: 140px; }
.rail-S09 .rail-btn:hover { background: #262a30; }
.rail-S09 .rail-btn.on { background: #fd6a5c; border-color: #fd6a5c; color: #fff; }
.rail-S09 .rail-cap { font: 400 19px var(--f-ui); letter-spacing: 0.04em; color: #c9ccd2; }
.rail-S09 .rail-size-val { color: #9ea2aa; font-size: 15px; }
.rail-S09 .rng { --fill: #ffffff; --track: #5b5f67; }
.rail-S09 .rng::-webkit-slider-runnable-track { background: linear-gradient(90deg, #fff 0 45%, #5b5f67 45%); }
.rail-S09 .rng::-webkit-slider-thumb { width: 30px; height: 30px; margin-top: -12px; background: #fff; }
.rail-S09 .swatch { box-shadow: none; }
.rail-S09 .swatch[data-c='#17191d'] { box-shadow: inset 0 0 0 2px #cfd2d8; }
.rail-S09 .swatch.on { box-shadow: 0 0 0 3px #1d2024, 0 0 0 6px #fff; }
.rail-S09 .rail-more { color: #fff; background: rgba(255, 255, 255, 0.12); }
.rail-S09 .rail-btn:not(.on) ~ .rail-more { color: #fff; }

/* ---------------------------------------------------------------- tool panel */
.tool-panel { position: absolute; z-index: 20; background: #fffcf5; border: 2px solid #20232b; border-radius: 16px; box-shadow: 0 16px 40px rgba(32, 35, 43, 0.22); display: flex; flex-direction: column; color: var(--graphite); font-family: var(--f-body); }
.tool-panel[hidden] { display: none; }
.tp-anchor-s06 { left: 298px; top: 128px; width: 520px; height: 696px; }
.tp-anchor-s09 { left: 302px; top: 112px; width: 520px; height: 800px; }
.tp-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 14px; border-bottom: 1.5px solid #e6e1d6; }
.tp-tabs { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.tp-tab { border: 1.5px solid #d9d4c9; background: #fff; border-radius: 22px; padding: 0 14px; height: 44px; font: 700 17px var(--f-ui); letter-spacing: 0.02em; color: #2b2d33; white-space: nowrap; }
.tp-tab[aria-selected='true'] { background: #20232b; border-color: #20232b; color: #fff; }
.tp-close { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid #20232b; background: #fff; display: grid; place-items: center; font-size: 20px; flex: none; }
.tp-body { flex: 1; overflow: auto; padding: 10px 16px 16px; overscroll-behavior: contain; }
.tp-grid { display: grid; gap: 14px; }
.tp-sec h3 { margin: 4px 0 8px; font: 700 15px var(--f-ui); letter-spacing: 0.1em; text-transform: uppercase; color: #6b6d73; }
.tp-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tp-tiles-2 { grid-template-columns: repeat(2, 1fr); }
.tp-tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tp-tile { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 70px; padding: 8px 4px; border-radius: 12px; border: 1.5px solid #e1dccf; background: #fff; font: 600 15px var(--f-ui); color: #2b2d33; text-align: center; line-height: 1.1; }
.tp-tile .tp-tile-ico { font-size: 28px; }
.tp-tile:hover:not(:disabled) { border-color: #9ca0a8; }
.tp-tile.on { background: #fe695c; border-color: #fe695c; color: #fff; }
.tp-tile:disabled { opacity: 0.4; cursor: not-allowed; }
.tp-row { display: grid; grid-template-columns: 110px 1fr 86px; gap: 12px; align-items: center; min-height: 44px; font: 600 16px var(--f-ui); }
.tp-row.disabled { opacity: 0.45; }
.tp-row .rng { width: 100%; }
.tp-num-wrap { display: flex; align-items: center; gap: 4px; }
.tp-num { width: 62px; height: 40px; border: 1.5px solid #cfcac0; border-radius: 8px; padding: 0 6px; font: 600 16px var(--f-ui); text-align: right; background: #fff; }
.tp-suffix { font: 600 14px var(--f-ui); color: #6b6d73; }
.tp-check { display: flex; gap: 10px; align-items: flex-start; font: 400 15px/1.35 var(--f-body); color: var(--ink-2); margin-top: 6px; }
.tp-check input { width: 22px; height: 22px; accent-color: var(--cobalt); flex: none; margin: 0; }
.tp-note { margin: 4px 0 0; font: 400 15px/1.4 var(--f-body); color: var(--ink-2); }
.tp-preview { width: 100%; height: auto; aspect-ratio: 360 / 70; border-radius: 10px; border: 1.5px solid #e1dccf; background: #fff; display: block; margin-bottom: 8px; }
.tp-palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.tp-sw { aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); padding: 0; min-width: 44px; min-height: 44px; }
.tp-sw.on { box-shadow: 0 0 0 3px #fffcf5, 0 0 0 6px #2f5cf6; }
.tp-sw.sm { min-width: 40px; min-height: 40px; width: 40px; }
.tp-recent { display: flex; gap: 8px; flex-wrap: wrap; }
.tp-custom { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: start; }
.tp-sv { width: 220px; height: 140px; border-radius: 10px; border: 1.5px solid #cfcac0; touch-action: none; cursor: crosshair; }
.tp-custom-side { display: grid; gap: 8px; }
.tp-hexrow { display: flex; gap: 8px; align-items: center; }
.tp-chip { width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid #20232b; flex: none; }
.tp-hex { width: 100%; height: 44px; border: 1.5px solid #cfcac0; border-radius: 10px; padding: 0 10px; font: 600 18px ui-monospace, Consolas, monospace; text-transform: uppercase; background: #fff; }
.tp-err { font: 600 14px var(--f-body); color: var(--danger); }
.tp-hue { width: 100%; margin-top: 10px; --fill: #20232b; }
.tp-hue::-webkit-slider-runnable-track { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.tp-hue::-webkit-slider-thumb { margin-top: -6px; background: #fff; border: 2px solid #20232b; }
.tp-hue::-moz-range-track { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.tp-seg { display: flex; gap: 8px; margin: 10px 0; }
.tp-segbtn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border-radius: 10px; border: 1.5px solid #d9d4c9; background: #fff; font: 700 16px var(--f-ui); }
.tp-segbtn.on { background: #20232b; color: #fff; border-color: #20232b; }
.tp-segbtn:disabled { opacity: 0.4; }
.tp-xform { display: grid; gap: 6px; margin-top: 8px; }
.tp-actions { display: flex; gap: 10px; justify-content: flex-end; }
.tp-actions .btn { font-size: 18px; padding: 0 18px; }
.tp-view { display: grid; grid-template-columns: 1fr auto 1fr 1fr 1fr; gap: 8px; align-items: center; }
.tp-zoom { font: 700 18px var(--f-ui); min-width: 56px; text-align: center; }
.tp-layers { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.tp-layer { display: grid; grid-template-columns: 46px 1fr; gap: 6px; }
.tp-eye { height: 46px; border-radius: 10px; border: 1.5px solid #d9d4c9; background: #fff; font-size: 22px; display: grid; place-items: center; }
.tp-layer-name { height: 46px; border-radius: 10px; border: 1.5px solid #d9d4c9; background: #fff; display: flex; justify-content: space-between; align-items: center; padding: 0 14px; font: 700 17px var(--f-ui); }
.tp-layer.on .tp-layer-name { border: 2px solid #2f5cf6; background: #eef2ff; }
.tp-layer-op { font: 600 14px var(--f-ui); color: #6b6d73; }
.tp-layer-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 6px; }
.tp-mini { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; min-height: 58px; border-radius: 10px; border: 1.5px solid #d9d4c9; background: #fff; font: 600 13px var(--f-ui); }
.tp-mini .ico { font-size: 22px; }
.tp-mini:disabled { opacity: 0.4; }

/* Dark (S09) panel variant inherits the graphite rail language. */
.tool-panel.dark { background: #1d2024; border-color: #3b3f47; color: #eceef2; }
.tool-panel.dark .tp-head { border-color: #30343b; }
.tool-panel.dark .tp-tab { background: #25292f; border-color: #3b3f47; color: #e3e5e9; }
.tool-panel.dark .tp-tab[aria-selected='true'] { background: #fd6a5c; border-color: #fd6a5c; color: #fff; }
.tool-panel.dark .tp-close { background: #25292f; border-color: #5b5f67; color: #fff; }
.tool-panel.dark .tp-sec h3, .tool-panel.dark .tp-note, .tool-panel.dark .tp-check, .tool-panel.dark .tp-suffix, .tool-panel.dark .tp-layer-op { color: #a8acb4; }
.tool-panel.dark .tp-tile, .tool-panel.dark .tp-segbtn, .tool-panel.dark .tp-eye, .tool-panel.dark .tp-layer-name, .tool-panel.dark .tp-mini, .tool-panel.dark .tp-num, .tool-panel.dark .tp-hex { background: #25292f; border-color: #3b3f47; color: #eceef2; }
.tool-panel.dark .tp-tile.on { background: #fd6a5c; border-color: #fd6a5c; }
.tool-panel.dark .tp-segbtn.on { background: #fff; color: #1d2024; }
.tool-panel.dark .tp-layer.on .tp-layer-name { border-color: #5b8cff; background: #243152; }
.tool-panel.dark .tp-preview { border-color: #3b3f47; }
.tool-panel.dark .tp-sw.on { box-shadow: 0 0 0 3px #1d2024, 0 0 0 6px #fff; }
.tool-panel.dark .rng { --track: #5b5f67; --fill: #fff; }
