:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --surface-3: #eef2f0;
  --text: #17211c;
  --text-2: #536159;
  --text-3: #78847e;
  --border: #d7deda;
  --border-strong: #bbc7c0;
  --accent: #167a4b;
  --accent-strong: #0f603a;
  --accent-soft: #e7f4ec;
  --coral: #e45f52;
  --coral-soft: #fff0ed;
  --blue: #2269b5;
  --blue-soft: #eaf3fc;
  --amber: #a96713;
  --amber-soft: #fff6e6;
  --danger: #b63b35;
  --danger-soft: #fff0ef;
  --shadow: 0 12px 32px rgba(27, 42, 34, 0.07);
  --radius: 8px;
  --header-height: 64px;
  --checker: linear-gradient(45deg, #e3e8e5 25%, transparent 25%), linear-gradient(-45deg, #e3e8e5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e3e8e5 75%), linear-gradient(-45deg, transparent 75%, #e3e8e5 75%);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151817;
  --surface: #1c201e;
  --surface-2: #222724;
  --surface-3: #2a302d;
  --text: #edf2ef;
  --text-2: #b4c0b9;
  --text-3: #8e9b94;
  --border: #343c38;
  --border-strong: #4a5650;
  --accent: #4bc081;
  --accent-strong: #6ed49a;
  --accent-soft: #173829;
  --coral: #ff8579;
  --coral-soft: #442522;
  --blue: #74aef0;
  --blue-soft: #1d3249;
  --amber: #e7ac54;
  --amber-soft: #3e3120;
  --danger: #ff8b84;
  --danger-soft: #432421;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.22);
  --checker: linear-gradient(45deg, #353b38 25%, transparent 25%), linear-gradient(-45deg, #353b38 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #353b38 75%), linear-gradient(-45deg, transparent 75%, #353b38 75%);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}
button, input, select, textarea { color: inherit; font: inherit; letter-spacing: 0; }
button, select, input[type="range"], input[type="color"], .file-btn { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(22, 122, 75, 0.24); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .48; }
[hidden] { display: none !important; }
.mono, code, pre, kbd { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-height); background: color-mix(in srgb, var(--surface) 94%, transparent); border-bottom: 1px solid var(--border); backdrop-filter: blur(16px); }
.header-inner { width: min(1440px, calc(100% - 32px)); height: 100%; margin: 0 auto; display: flex; align-items: center; gap: 24px; }
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand img { width: 108px; height: auto; display: block; filter: var(--logo-filter, none); }
html[data-theme="dark"] .brand img { --logo-filter: invert(1) grayscale(1) brightness(1.6); }
.product-name { padding-left: 12px; border-left: 1px solid var(--border); color: var(--text-2); font-size: 13px; font-weight: 700; white-space: nowrap; }
.header-status { margin-left: auto; display: flex; align-items: center; gap: 18px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.header-status span { display: inline-flex; align-items: center; gap: 6px; }
.header-status svg { width: 15px; height: 15px; color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 6px; }
.language-switch { width: 78px; height: 40px; padding: 3px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.language-switch button { min-width: 0; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--text-3); font-size: 10px; font-weight: 800; }
.language-switch button.active { background: var(--text); color: var(--surface); }

.license-banner { width: min(1440px, calc(100% - 32px)); min-height: 56px; margin: 14px auto -4px; padding: 10px 13px; display: flex; align-items: center; gap: 11px; border: 1px solid #e5b8b3; border-radius: 7px; background: var(--danger-soft); color: var(--danger); }
.license-banner > svg { width: 20px; height: 20px; flex: 0 0 auto; }
.license-banner > div { min-width: 0; display: grid; }
.license-banner strong { font-size: 12px; }
.license-banner span { color: var(--text-2); font-size: 11px; }
.license-banner a { margin-left: auto; color: inherit; font-size: 11px; font-weight: 800; white-space: nowrap; }
body.is-restricted .tool-workspace { background: var(--surface-2); }
body.is-restricted .tool-workspace button,
body.is-restricted .tool-workspace input,
body.is-restricted .tool-workspace select,
body.is-restricted .current-color button,
body.is-restricted .history-block button { cursor: not-allowed; }
body.is-restricted #imageCanvas { cursor: not-allowed; }

.icon-btn { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text-2); text-decoration: none; }
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.compact { width: 32px; height: 32px; border: 0; background: transparent; }
.icon-btn.compact svg { width: 16px; height: 16px; }

.app-container { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.page-heading { min-height: 72px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.page-heading h1 { margin: 0; font-size: 31px; line-height: 1.18; font-weight: 800; letter-spacing: 0; }
.page-heading p { margin: 5px 0 0; color: var(--text-2); font-size: 14px; }
.current-color { min-width: 196px; height: 56px; padding: 7px 8px 7px 10px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 14px rgba(27, 42, 34, 0.04); }
.current-dot { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 6px; background: #2596be; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.current-color > span:nth-child(2) { min-width: 0; display: grid; line-height: 1.2; }
.current-color small { color: var(--text-3); font-size: 10px; font-weight: 700; }
.current-color strong { margin-top: 3px; font-size: 14px; }
.current-color .icon-btn { margin-left: auto; }

.studio-shell { min-height: 720px; display: grid; grid-template-columns: 204px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.tool-nav { min-width: 0; padding: 14px 12px; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--surface-2); }
.tool-nav-list { display: grid; gap: 5px; }
.tool-nav-btn { width: 100%; min-height: 45px; padding: 8px 9px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text-2); text-align: left; font-size: 13px; font-weight: 700; }
.tool-nav-btn svg { width: 18px; height: 18px; }
.tool-nav-btn:hover { background: var(--surface); color: var(--text); }
.tool-nav-btn.active { border-color: #c2ddce; background: var(--accent-soft); color: var(--accent-strong); }
html[data-theme="dark"] .tool-nav-btn.active { border-color: #26563d; }
.tool-nav-btn kbd { display: none; }
.history-block { margin-top: auto; padding-top: 20px; }
.nav-label, .section-label { min-height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 11px; font-weight: 800; }
.nav-label button, .section-label button { padding: 2px 0; border: 0; background: transparent; color: var(--text-3); font-size: 11px; }
.nav-label button:hover, .section-label button:hover { color: var(--accent); }
.history-list { margin-top: 8px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.history-swatch { aspect-ratio: 1; border: 1px solid var(--border); border-radius: 5px; background: var(--swatch); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }

.tool-workspace { min-width: 0; background: var(--surface); }
.tool-view { display: none; min-width: 0; }
.tool-view.active { display: block; animation: view-in .18s ease-out; }
@keyframes view-in { from { opacity: .6; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.tool-header { min-height: 83px; padding: 17px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--border); }
.tool-header h2 { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 800; letter-spacing: 0; }
.tool-header p { margin: 5px 0 0; color: var(--text-2); font-size: 12px; }
.toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.btn { min-height: 38px; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 6px; white-space: nowrap; font-size: 12px; font-weight: 800; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.secondary { border-color: var(--border); background: var(--surface); color: var(--text); }
.btn.secondary:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.dashed { width: 100%; border: 1px dashed var(--border-strong); background: var(--surface-2); color: var(--text-2); }
.btn.full { width: 100%; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.split-action { display: flex; align-items: stretch; }
.split-action .btn { border-radius: 6px 0 0 6px; }
.split-action select { width: 66px; padding: 0 6px; border: 0; border-left: 1px solid rgba(255,255,255,.24); border-radius: 0 6px 6px 0; background: var(--accent); color: white; font-size: 11px; font-weight: 800; }

.source-bar { min-height: 57px; padding: 9px 18px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.url-field { min-width: 240px; flex: 1; height: 38px; display: flex; align-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.url-field > svg { width: 16px; margin-left: 10px; color: var(--text-3); }
.url-field input { min-width: 0; flex: 1; height: 100%; padding: 0 9px; border: 0; outline: 0; background: transparent; font-size: 12px; }
.url-field .btn { min-height: 32px; margin-right: 3px; padding: 6px 11px; }
.compact-field { height: 38px; padding-left: 10px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-2); font-size: 11px; font-weight: 700; white-space: nowrap; }
.compact-field select { height: 100%; padding: 0 8px; border: 0; background: transparent; color: var(--text); font-size: 12px; font-weight: 700; }

.picker-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(310px, .75fr); min-height: 580px; }
.image-pane { min-width: 0; padding: 18px; border-right: 1px solid var(--border); background: var(--surface-2); }
.canvas-wrap { position: relative; width: 100%; aspect-ratio: 16 / 10; min-height: 390px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background-color: var(--surface); background-image: var(--checker); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
#imageCanvas { display: block; width: 100%; height: 100%; object-fit: cover; cursor: crosshair; }
.canvas-upload-prompt { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; background: rgba(12, 20, 16, .38); transition: opacity .18s ease; }
.canvas-upload-prompt > div { width: min(330px, calc(100% - 28px)); min-height: 190px; padding: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.66); border-radius: 7px; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: 0 12px 30px rgba(0,0,0,.18); text-align: center; }
.canvas-upload-prompt > div > svg { width: 34px; height: 34px; margin-bottom: 10px; color: var(--accent); }
.canvas-upload-prompt strong { font-size: 16px; }
.canvas-upload-prompt span:not(.btn span) { margin-top: 3px; color: var(--text-2); font-size: 11px; }
.canvas-upload-prompt .btn { margin-top: 16px; }
.canvas-wrap.dragging .canvas-upload-prompt { opacity: 0; pointer-events: none; }
.drop-overlay { position: absolute; inset: 16px; z-index: 6; display: none; place-items: center; align-content: center; gap: 8px; border: 2px dashed var(--accent); border-radius: 6px; background: color-mix(in srgb, var(--accent-soft) 94%, transparent); color: var(--accent-strong); pointer-events: none; }
.drop-overlay svg { width: 34px; height: 34px; }
.canvas-wrap.dragging .drop-overlay { display: grid; }
.sample-loupe { position: absolute; z-index: 5; width: 86px; height: 104px; transform: translate(16px, -118px); overflow: hidden; border: 2px solid var(--surface); border-radius: 7px; background: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,.24); pointer-events: none; }
.sample-loupe span { display: block; height: 72px; background: var(--loupe-color, #2596be); }
.sample-loupe b { height: 28px; display: grid; place-items: center; font-size: 11px; }
.canvas-footer { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-3); font-size: 11px; }
.canvas-footer span { display: inline-flex; align-items: center; gap: 6px; }
.canvas-footer svg { width: 14px; height: 14px; }
.color-inspector { min-width: 0; padding: 18px; }
.selected-color-block { min-height: 82px; padding-bottom: 16px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--border); }
.large-swatch { width: 64px; height: 64px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,.12); border-radius: 7px; background: #2596be; }
.selected-color-block > div { min-width: 0; display: grid; }
.selected-color-block small { color: var(--text-3); font-size: 10px; font-weight: 800; }
.selected-color-block strong { margin-top: 2px; font-size: 23px; line-height: 1.25; }
.selected-color-block div span { color: var(--text-2); font-size: 11px; }
.format-list { display: grid; }
.format-row { min-width: 0; min-height: 45px; display: grid; grid-template-columns: 64px minmax(0, 1fr) 32px; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.format-label { color: var(--text-3); font-size: 10px; font-weight: 800; }
.format-value { min-width: 0; overflow: hidden; color: var(--text); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.format-row .icon-btn { opacity: .62; }
.format-row:hover .icon-btn { opacity: 1; }
.color-inspector .section-label { margin-top: 14px; }
.palette-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.palette-swatch { min-width: 0; aspect-ratio: 1; padding: 0; display: grid; place-items: end center; overflow: hidden; border: 1px solid rgba(0,0,0,.14); border-radius: 6px; background: var(--swatch); }
.palette-swatch span { width: 100%; padding: 3px 2px; background: rgba(0,0,0,.52); color: white; font-size: 8px; text-align: center; }

.converter-layout, .hex-layout, .contrast-layout, .code-layout { display: grid; min-height: 620px; }
.converter-layout { grid-template-columns: minmax(310px, .72fr) minmax(0, 1.28fr); }
.control-pane, .results-pane, .hex-picker-pane, .scale-pane, .contrast-controls, .preview-pane, .palette-builder, .token-output-pane { min-width: 0; padding: 22px; }
.control-pane, .hex-picker-pane, .contrast-controls, .palette-builder { border-right: 1px solid var(--border); }
.field-label, .field > span, .range-field > span { display: block; margin-bottom: 7px; color: var(--text-2); font-size: 11px; font-weight: 800; }
.text-input, .field select, .field input[type="number"], .number-suffix { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); outline: 0; }
.text-input:focus, .field select:focus, .field input[type="number"]:focus { border-color: var(--accent); }
.color-input-row { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 8px; }
.format-support { min-height: 28px; display: flex; align-items: center; flex-wrap: wrap; color: var(--text-3); font-size: 9px; font-weight: 700; }
.format-support span + span::before { content: "/"; margin: 0 6px; color: var(--border-strong); }
input[type="color"] { width: 50px; min-width: 50px; height: 42px; padding: 3px; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.color-preview-panel { height: 178px; margin-top: 16px; padding: 18px; display: flex; align-items: flex-end; justify-content: space-between; border-radius: 7px; background: #2596be; color: #fff; }
.color-preview-panel span { font-size: 54px; line-height: 1; font-weight: 800; }
.color-preview-panel strong { padding: 5px 8px; border-radius: 5px; background: rgba(0,0,0,.36); font-size: 12px; }
.channel-controls { margin-top: 18px; display: grid; gap: 11px; }
.channel-row { display: grid; grid-template-columns: 20px minmax(0,1fr) 54px; align-items: center; gap: 9px; }
.channel-row label { color: var(--text-2); font-size: 11px; font-weight: 800; }
.channel-row input[type="number"] { width: 54px; height: 32px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); text-align: right; font-size: 11px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-field { display: block; margin-top: 18px; }
.range-field > span { display: flex; justify-content: space-between; }
.results-pane .section-label { margin-bottom: 4px; }
.format-list.two-column { grid-template-columns: repeat(2, minmax(0,1fr)); column-gap: 18px; }
.format-list.two-column .format-row { grid-template-columns: 60px minmax(0,1fr) 32px; }
.usage-heading { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; }
.color-usage-table { display: grid; border-top: 1px solid var(--border); }
.color-usage-table > div { min-height: 54px; display: grid; grid-template-columns: 62px minmax(0,1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.color-usage-table b { color: var(--text-3); font-size: 10px; }
.color-usage-table span { min-width: 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.color-usage-table small { color: var(--text-3); font-size: 9px; white-space: nowrap; }

.gradient-preview { height: 260px; margin: 22px 22px 0; display: grid; place-items: center; border-radius: 7px; background: linear-gradient(120deg, #0d4f4b, #41c985 48%, #ffd36a); color: rgba(255,255,255,.9); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.gradient-preview span { font-size: 34px; font-weight: 800; mix-blend-mode: overlay; }
.gradient-controls { display: grid; grid-template-columns: minmax(220px, .55fr) minmax(0, 1.45fr); gap: 22px; padding: 22px; }
.gradient-settings { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; align-content: start; }
.field { min-width: 0; }
.number-suffix { padding: 0 9px 0 0; display: flex; align-items: center; }
.number-suffix input { min-width: 0; flex: 1; min-height: 40px; padding: 9px 11px; border: 0; background: transparent; outline: 0; }
.number-suffix b { color: var(--text-3); }
.stops-pane { min-width: 0; }
.stops-pane .section-label div { display: flex; gap: 12px; }
.stop-rail { position: relative; height: 36px; margin: 5px 0 12px; border-radius: 6px; background: var(--gradient); box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); }
.stop-marker { position: absolute; top: 24px; width: 14px; height: 14px; padding: 0; transform: translateX(-50%) rotate(45deg); border: 2px solid var(--surface); border-radius: 3px; background: var(--stop); box-shadow: 0 2px 5px rgba(0,0,0,.28); }
.stop-list { display: grid; gap: 7px; }
.stop-row { min-width: 0; display: grid; grid-template-columns: 42px minmax(100px, .7fr) minmax(90px, 1fr) 72px 32px; align-items: center; gap: 7px; }
.stop-row input[type="color"] { width: 42px; min-width: 42px; height: 36px; }
.stop-row .text-input { min-height: 36px; padding: 6px 8px; font-size: 11px; }
.stop-row input[type="number"] { width: 100%; height: 36px; padding: 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); font-size: 11px; }
.stops-pane .btn.dashed { margin-top: 10px; }
.code-bar { min-height: 56px; margin: 0 22px 22px; padding: 8px 10px 8px 14px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.code-bar code { min-width: 0; flex: 1; overflow: hidden; color: var(--text-2); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.hex-layout { grid-template-columns: minmax(300px, .7fr) minmax(0, 1.3fr); }
.hex-color-stage { height: 230px; padding: 20px; display: flex; align-items: flex-end; justify-content: space-between; border-radius: 7px; background: #2596be; color: white; }
.hex-color-stage input { width: 42px; min-width: 42px; height: 42px; border-color: rgba(255,255,255,.56); background: rgba(255,255,255,.92); }
.hex-color-stage span { padding: 5px 8px; border-radius: 5px; background: rgba(0,0,0,.38); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; font-weight: 700; }
.hex-picker-pane > .field { display: block; margin-top: 16px; }
.scale-pane .section-label { margin-bottom: 12px; }
.color-scale { display: grid; gap: 4px; }
.scale-row { min-height: 45px; padding: 6px 9px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 10px; border-radius: 5px; background: var(--swatch); color: var(--on-swatch); }
.scale-row strong { font-size: 11px; }
.scale-row span { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.scale-row button { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 5px; background: rgba(255,255,255,.18); color: inherit; }
.scale-row button svg { width: 14px; }

.contrast-layout { grid-template-columns: minmax(360px, .72fr) minmax(0, 1.28fr); }
.paired-colors { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.color-text-field { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 7px; }
.color-text-field input[type="color"] { width: 48px; min-width: 48px; }
.contrast-score { margin: 20px 0 15px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.contrast-score > div { min-height: 90px; display: grid; place-content: center; text-align: center; }
.contrast-score > div + div { border-left: 1px solid var(--border); }
.contrast-score strong { font-size: 29px; line-height: 1.1; }
.contrast-score span { margin-top: 3px; color: var(--text-3); font-size: 10px; font-weight: 700; }
.wcag-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.wcag-result { min-height: 44px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 11px; font-weight: 700; }
.wcag-result b { min-width: 42px; padding: 4px 6px; border-radius: 4px; text-align: center; font-size: 9px; }
.wcag-result.pass b { background: var(--accent-soft); color: var(--accent-strong); }
.wcag-result.fail b { background: var(--danger-soft); color: var(--danger); }
.contrast-controls .section-label { margin-top: 18px; }
.suggestions { margin-top: 7px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; }
.suggestion { min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); text-align: left; }
.suggestion span { display: block; height: 34px; margin-bottom: 6px; border-radius: 4px; background: var(--swatch); }
.suggestion b, .suggestion small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion b { font-size: 10px; }
.suggestion small { color: var(--text-3); font-size: 9px; }
.preview-pane { background: var(--surface-2); }
.preview-toolbar { min-height: 43px; display: flex; align-items: flex-start; gap: 10px; }
.preview-toolbar > label { height: 38px; padding-left: 9px; display: flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-3); font-size: 10px; font-weight: 700; }
.preview-toolbar input, .preview-toolbar select { height: 36px; border: 0; background: transparent; outline: 0; color: var(--text); font-size: 11px; font-weight: 700; }
.preview-toolbar input { width: 48px; padding-left: 8px; }
.preview-toolbar select { padding: 0 8px; }
.segmented { margin-left: auto; padding: 3px; display: inline-flex; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.segmented button, .token-tabs button { min-width: 36px; min-height: 30px; padding: 5px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--text-2); font-size: 10px; font-weight: 800; }
.segmented button.active, .token-tabs button.active { background: var(--text); color: var(--surface); }
.contrast-preview { min-height: 485px; margin-top: 14px; padding: 46px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: #17211c; }
.contrast-preview input { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; outline: 0; font-size: 34px; line-height: 1.2; font-weight: 700; }
.contrast-preview p { max-width: 600px; margin: 16px 0 24px; font-size: 18px; }
.contrast-preview button { width: max-content; min-height: 42px; padding: 9px 15px; border: 0; border-radius: 6px; background: currentColor; color: inherit; box-shadow: inset 0 0 0 100px rgba(255,255,255,.92); font-weight: 800; }
.contrast-preview small { margin-top: 28px; opacity: .66; }

.code-layout { grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); }
.palette-builder .color-input-row { grid-template-columns: 50px minmax(0,1fr) auto; }
.palette-builder .section-label { margin-top: 20px; }
.token-scale { margin-top: 8px; display: grid; grid-template-columns: repeat(11, minmax(0,1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: 6px; }
.token-swatch { min-width: 0; height: 98px; padding: 7px 3px; display: flex; flex-direction: column; justify-content: flex-end; border: 0; border-right: 1px solid rgba(255,255,255,.16); background: var(--swatch); color: var(--on-swatch); text-align: center; }
.token-swatch b { font-size: 10px; }
.token-swatch span { margin-top: 2px; overflow: hidden; font-family: "SFMono-Regular", Consolas, monospace; font-size: 7px; text-overflow: ellipsis; }
.harmony-groups { margin-top: 8px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.harmony-group { min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: 6px; }
.harmony-group h3 { margin: 0 0 7px; font-size: 10px; }
.harmony-swatches { display: flex; height: 48px; overflow: hidden; border-radius: 5px; }
.harmony-swatches button { min-width: 0; flex: 1; border: 0; background: var(--swatch); }
.token-output-pane { background: var(--surface-2); }
.token-tabs { width: max-content; padding: 3px; display: flex; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.token-output-pane pre { height: 340px; margin: 12px 0; padding: 16px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; background: #151a17; color: #dff5e7; font-size: 11px; line-height: 1.7; }
.semantic-preview { min-height: 112px; padding: 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 14px; border: 1px solid var(--semantic-border); border-radius: 6px; background: var(--semantic-soft); color: var(--semantic-strong); }
.semantic-preview > span { font-size: 18px; font-weight: 800; }
.semantic-preview button { grid-row: span 2; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 5px; background: var(--semantic-base); color: var(--semantic-on); font-weight: 800; }
.semantic-preview small { opacity: .72; }
.token-output-pane .btn.full { margin-top: 12px; }

.print-workbench { border-top: 1px solid var(--border); background: var(--surface-2); }
.print-workbench-header { min-height: 76px; padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--border); }
.print-workbench-header h3 { margin: 0; font-size: 17px; }
.print-workbench-header p { margin: 4px 0 0; color: var(--text-2); font-size: 11px; }
.print-actions { display: flex; gap: 8px; }
.print-toolbar { padding: 16px 22px; display: grid; grid-template-columns: minmax(150px,.8fr) minmax(190px,1fr) minmax(128px,.55fr) minmax(190px,.9fr); align-items: end; gap: 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.print-toolbar .range-field { margin: 0; }
.print-metric { min-height: 42px; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px; }
.print-metric span { color: var(--text-3); font-size: 9px; font-weight: 800; }
.print-metric strong { grid-row: span 2; font-size: 17px; }
.print-metric small { color: var(--accent-strong); font-size: 9px; font-weight: 700; }
.print-metric small.over-limit { color: var(--danger); }
.print-sheet { position: relative; width: calc(100% - 44px); min-height: 520px; margin: 22px; padding: 32px; overflow: hidden; border: 1px solid #cfd3d1; border-radius: 4px; background: #fff; color: #171a18; box-shadow: 0 7px 22px rgba(24,32,28,.08); }
.print-sheet-heading { padding-bottom: 15px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 2px solid #171a18; }
.print-sheet-heading > div { display: grid; }
.print-sheet-heading strong { font-size: 17px; }
.print-sheet-heading span { color: #59615d; font-size: 9px; }
.print-sheet-base { text-align: right; }
.print-sheet-base span:first-child { color: #171a18; font-family: "SFMono-Regular", Consolas, monospace; font-size: 14px; font-weight: 800; }
.print-section-title { min-height: 44px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.print-section-title strong { font-size: 11px; }
.print-section-title span { color: #707873; font-size: 8px; }
.print-tints { display: grid; grid-template-columns: repeat(5, minmax(98px,1fr)); border: 1px solid #d5d8d6; }
.print-tint { min-width: 0; border-right: 1px solid #d5d8d6; }
.print-tint:last-child { border-right: 0; }
.print-tint-swatch { height: 92px; background: var(--swatch); }
.print-tint-info { min-height: 50px; padding: 7px 8px; display: grid; background: #fff; }
.print-tint-info strong { font-size: 10px; }
.print-tint-info span { overflow: hidden; color: #5c6560; font-family: "SFMono-Regular", Consolas, monospace; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.process-bars { display: grid; grid-template-columns: repeat(7, minmax(76px,1fr)); min-height: 86px; border: 1px solid #d5d8d6; }
.process-patch { min-width: 0; display: grid; grid-template-rows: 1fr auto; border-right: 1px solid #d5d8d6; }
.process-patch:last-child { border-right: 0; }
.process-patch-color { min-height: 58px; background: var(--swatch); }
.process-patch span { padding: 6px 4px; overflow: hidden; background: #fff; color: #323835; font-size: 8px; font-weight: 800; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.registration-target { position: relative; min-height: 58px; background: #111; }
.registration-target::before, .registration-target::after { content: ""; position: absolute; left: 50%; top: 50%; background: white; transform: translate(-50%,-50%); }
.registration-target::before { width: 38px; height: 1px; }
.registration-target::after { width: 1px; height: 38px; }
.print-proof-footer { min-height: 54px; padding-top: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; color: #6a726d; font-size: 8px; }
.print-proof-footer span:last-child { max-width: 520px; text-align: right; }
.crop-mark { position: absolute; width: 18px; height: 18px; }
.crop-mark::before, .crop-mark::after { content: ""; position: absolute; background: #151816; }
.crop-mark::before { width: 18px; height: 1px; top: 9px; }
.crop-mark::after { width: 1px; height: 18px; left: 9px; }
.crop-mark.top-left { left: 8px; top: 8px; }
.crop-mark.top-right { right: 8px; top: 8px; }
.crop-mark.bottom-left { left: 8px; bottom: 8px; }
.crop-mark.bottom-right { right: 8px; bottom: 8px; }

footer { width: min(1440px, calc(100% - 32px)); min-height: 64px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--text-3); font-size: 11px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; min-width: 140px; min-height: 42px; padding: 9px 13px; display: flex; align-items: center; gap: 8px; border: 1px solid #b8ddc7; border-radius: 7px; background: #edf9f2; color: #0e6036; box-shadow: var(--shadow); font-size: 12px; font-weight: 800; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: #ecc0bc; background: #fff1ef; color: #9f302b; }
.toast svg { width: 16px; height: 16px; }

@media (max-width: 1120px) {
  .studio-shell { grid-template-columns: 176px minmax(0,1fr); }
  .picker-layout { grid-template-columns: minmax(0,1.35fr) minmax(285px,.65fr); }
  .source-bar { flex-wrap: wrap; }
  .url-field { flex-basis: 100%; }
  .format-list.two-column { grid-template-columns: 1fr; }
  .token-scale { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .token-swatch:nth-child(6) { border-right: 0; }
  .token-swatch { height: 76px; }
  .preview-toolbar { flex-wrap: wrap; }
  .segmented { margin-left: 0; }
  .print-toolbar { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 860px) {
  .header-status { display: none; }
  .app-container { width: min(100% - 20px, 760px); padding-top: 18px; }
  .page-heading h1 { font-size: 26px; }
  .studio-shell { display: block; min-height: 0; overflow: visible; }
  .tool-nav { position: sticky; top: var(--header-height); z-index: 30; padding: 7px; display: block; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .tool-nav { scrollbar-width: none; }
  .tool-nav::-webkit-scrollbar { display: none; }
  .tool-nav-list { width: max-content; display: flex; }
  .tool-nav-btn { width: auto; min-width: 120px; grid-template-columns: 18px auto; }
  .tool-nav-btn kbd, .history-block { display: none; }
  .tool-header { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .picker-layout, .converter-layout, .hex-layout, .contrast-layout, .code-layout { grid-template-columns: 1fr; }
  .image-pane, .control-pane, .hex-picker-pane, .contrast-controls, .palette-builder { border-right: 0; border-bottom: 1px solid var(--border); }
  .canvas-wrap { min-height: 320px; }
  .gradient-controls { grid-template-columns: 1fr; }
  .contrast-preview { min-height: 360px; padding: 30px; }
  .token-scale { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .print-tints, .process-bars { overflow-x: auto; }
  .print-tints { grid-template-columns: repeat(5, minmax(116px,1fr)); }
  .process-bars { grid-template-columns: repeat(7, minmax(92px,1fr)); }
}

@media (max-width: 600px) {
  :root { --header-height: 58px; }
  .header-inner { width: calc(100% - 20px); gap: 10px; }
  .brand img { width: 92px; }
  .product-name { display: none; }
  .header-actions { margin-left: auto; }
  .language-switch { width: 66px; height: 36px; }
  .icon-btn { width: 36px; height: 36px; }
  .license-banner { width: calc(100% - 20px); align-items: flex-start; }
  .license-banner a { display: none; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 23px; }
  .page-heading p { font-size: 12px; }
  .current-color { min-width: 130px; height: 50px; }
  .current-color .current-dot { width: 30px; height: 30px; }
  .current-color .icon-btn { display: none; }
  .tool-nav-btn { min-width: 106px; padding: 7px; font-size: 12px; }
  .tool-header, .control-pane, .results-pane, .hex-picker-pane, .scale-pane, .contrast-controls, .preview-pane, .palette-builder, .token-output-pane { padding: 16px; }
  .tool-header h2 { font-size: 18px; }
  .source-bar { padding: 8px; }
  .source-bar .btn.ghost { flex: 1; }
  .compact-field { flex: 1; }
  .picker-layout { min-height: 0; }
  .image-pane, .color-inspector { padding: 12px; }
  .canvas-wrap { min-height: 240px; aspect-ratio: 4 / 3; }
  .palette-grid { grid-template-columns: repeat(5, 1fr); }
  .format-list.two-column { grid-template-columns: 1fr; }
  .gradient-preview { height: 210px; margin: 14px 14px 0; }
  .gradient-controls { padding: 14px; }
  .gradient-settings { grid-template-columns: 1fr 1fr; }
  .stop-row { grid-template-columns: 38px minmax(92px,1fr) 56px 32px; }
  .stop-row input[type="range"] { grid-column: 1 / -1; grid-row: 2; }
  .stop-row input[type="color"] { width: 38px; min-width: 38px; }
  .code-bar { margin: 0 14px 14px; }
  .paired-colors { grid-template-columns: 1fr; }
  .suggestions { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .contrast-preview { min-height: 320px; padding: 22px; }
  .contrast-preview input { font-size: 26px; }
  .contrast-preview p { font-size: 15px; }
  .token-scale { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .token-swatch { height: 68px; }
  .harmony-groups { grid-template-columns: 1fr; }
  .token-output-pane pre { height: 280px; }
  .format-support span + span::before { margin: 0 4px; }
  .color-usage-table > div { grid-template-columns: 52px minmax(0,1fr); }
  .color-usage-table small { grid-column: 2; margin-top: -8px; padding-bottom: 8px; }
  .print-workbench-header { padding: 16px; align-items: flex-start; flex-direction: column; }
  .print-actions { width: 100%; }
  .print-actions .btn { flex: 1; }
  .print-toolbar { padding: 14px 16px; grid-template-columns: 1fr; }
  .print-sheet { width: calc(100% - 24px); margin: 12px; padding: 26px 20px; }
  .print-sheet-heading { align-items: flex-start; flex-direction: column; }
  .print-sheet-base { text-align: left; }
  .print-section-title { align-items: flex-start; flex-direction: column; justify-content: flex-end; padding: 10px 0 6px; }
  .print-proof-footer { flex-direction: column; }
  .print-proof-footer span:last-child { text-align: left; }
  footer { width: calc(100% - 20px); align-items: flex-start; flex-direction: column; justify-content: center; }
}

@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: #fff; }
  body * { visibility: hidden !important; }
  #printSheet, #printSheet * { visibility: visible !important; }
  #printSheet { position: absolute; left: 0; top: 0; width: 100%; min-height: 190mm; margin: 0; padding: 12mm; border: 0; box-shadow: none; color-adjust: exact; print-color-adjust: exact; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
