:root {
  --ink: #171714;
  --muted: #6c6a62;
  --paper: #f3f0e8;
  --panel: #fbfaf5;
  --line: #c9c4b8;
  --accent: #ef6648;
  --yellow: #f2ce55;
  --shadow: 5px 5px 0 #171714;
}

* { box-sizing: border-box; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 4%, rgba(242, 206, 85, .23), transparent 26rem),
    linear-gradient(rgba(23, 23, 20, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 23, 20, .035) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 28px 28px, 28px 28px, auto;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
.topbar {
  height: 70px;
  padding: 0 max(28px, calc((100vw - 1420px) / 2));
  border-bottom: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(243, 240, 232, .92);
  backdrop-filter: blur(10px);
}
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; font-weight: 900; letter-spacing: .04em; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 8px); gap: 2px; transform: rotate(-8deg); }
.brand-mark i { width: 8px; height: 8px; background: var(--ink); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { background: var(--accent); }
.local-note { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
main { max-width: 1420px; margin: 0 auto; padding: 58px 28px 64px; }
.hero { position: relative; margin-bottom: 42px; }
.hero::after { content: ""; position: absolute; width: 92px; height: 13px; background: var(--yellow); bottom: 7px; left: 445px; transform: rotate(-3deg); z-index: -1; }
.eyebrow { margin: 0 0 15px; color: var(--accent); font: 800 12px/1.2 ui-monospace, monospace; letter-spacing: .25em; }
h1 { margin: 0; font-size: clamp(42px, 5vw, 72px); line-height: 1.04; letter-spacing: -.065em; font-weight: 950; }
h1 em { font-style: normal; color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.inline-title { white-space: nowrap; }
.intro { max-width: 570px; margin: 22px 0 0; font-size: 16px; line-height: 1.8; color: var(--muted); }
.workspace { display: grid; grid-template-columns: 1.05fr .95fr 1.15fr; gap: 18px; align-items: stretch; }
.panel {
  background: var(--panel); border: 2px solid var(--ink);
  box-shadow: var(--shadow); padding: 24px; min-width: 0;
}
.panel-heading { display: flex; align-items: center; gap: 13px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.step { display: grid; place-items: center; width: 38px; height: 38px; background: var(--ink); color: #fff; font: 800 12px/1 ui-monospace, monospace; }
.panel-heading h2 { margin: 0 0 3px; font-size: 18px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.dropzone {
  min-height: 334px; border: 2px dashed #9c988e; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; cursor: pointer;
  background: #f7f4ec; transition: .18s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: #fff5ef; transform: translateY(-2px); }
.upload-icon { width: 54px; height: 54px; display: grid; place-items: center; background: var(--yellow); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font-size: 28px; margin-bottom: 20px; }
.dropzone strong { font-size: 16px; margin-bottom: 6px; }
.dropzone span:not(.upload-icon) { color: var(--muted); font-size: 13px; }
.dropzone small { margin-top: 18px; padding: 5px 9px; background: #e9e5db; font: 700 10px/1 ui-monospace, monospace; }
.hidden { display: none !important; }
.image-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; font: 700 11px/1.2 ui-monospace, monospace; color: var(--muted); margin-bottom: 10px; }
.text-button { border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 800; padding: 5px; }
.canvas-frame { min-height: 280px; max-height: 350px; display: grid; place-items: center; overflow: auto; background-color: #e4e1d9; background-image: linear-gradient(45deg,#d2cec5 25%,transparent 25%),linear-gradient(-45deg,#d2cec5 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d2cec5 75%),linear-gradient(-45deg,transparent 75%,#d2cec5 75%); background-size: 16px 16px; background-position: 0 0,0 8px,8px -8px,-8px 0; border: 1px solid var(--line); }
#sourceCanvas { image-rendering: pixelated; cursor: crosshair; max-width: none; }
.hint { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.pipette { color: var(--accent); font-size: 18px; }
.direct-color { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.direct-color > div { display: grid; gap: 3px; }
.direct-color strong { font-size: 13px; }
.direct-color > div span { color: var(--muted); font-size: 10px; }
.native-color-wrap { min-width: 136px; height: 48px; padding: 5px 10px 5px 5px; border: 1.5px solid var(--ink); display: flex; align-items: center; gap: 9px; cursor: pointer; }
.native-color-wrap input { width: 40px; height: 34px; border: 0; padding: 0; background: none; cursor: pointer; }
.native-color-wrap #directColorValue { color: var(--ink); font: 800 11px/1 ui-monospace, monospace; }
.picked-color { display: flex; gap: 15px; align-items: center; padding: 16px; background: #eeeae0; margin-bottom: 22px; }
.picked-swatch { width: 64px; height: 64px; background: #d85c45; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); flex: none; }
.picked-color > div:last-child { display: grid; gap: 3px; }
.field-label { color: var(--muted); font-size: 11px; }
.copy-hex { border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; font: 900 21px/1.2 ui-monospace, monospace; text-align: left; }
.copy-hex:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
#pickedHsb { color: var(--muted); font: 600 10px/1.3 ui-monospace, monospace; }
fieldset { border: 0; padding: 0; margin: 0 0 21px; min-width: 0; }
legend { width: 100%; margin-bottom: 9px; font-size: 12px; font-weight: 800; }
.segmented { display: grid; border: 1.5px solid var(--ink); }
.segmented.three { grid-template-columns: 1.5fr .75fr .85fr; }
.segmented.two { grid-template-columns: 1fr 1fr; }
.segmented label, .scale-options label { cursor: pointer; min-width: 0; }
.segmented input, .scale-options input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 48px; display: grid; place-items: center; padding: 8px; text-align: center; font-size: 12px; font-weight: 800; border-right: 1px solid var(--ink); }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--ink); color: #fff; }
.mode-hint { margin: 9px 2px 0; color: var(--accent); font-size: 11px; line-height: 1.5; font-weight: 700; }
.formula-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.formula-picker label { cursor: pointer; }
.formula-picker input { position: absolute; opacity: 0; pointer-events: none; }
.formula-picker span { min-height: 52px; border: 1.5px solid var(--ink); display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; font-size: 12px; }
.formula-picker .auto-option { grid-column: 1 / -1; }
.formula-picker .auto-option span { display: grid; gap: 2px; text-align: center; }
.formula-picker small { color: var(--muted); font-size: 9px; }
.formula-picker input:checked + span { color: #fff; background: var(--ink); box-shadow: 3px 3px 0 var(--accent); }
.formula-picker input:checked + span small { color: #ddd; }
.formula-dot { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(0,0,0,.35); }
.formula-dot.red { background: #ff6357; }.formula-dot.green { background: #52ffb7; }
.formula-dot.blue { background: #4bafff; }.formula-dot.yellow { background: #fffc88; }
.formula-dot.light { background: #ff9e87; }
.extension-controls { padding-top: 18px; border-top: 1px solid var(--line); }
.extension-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.extension-row > div:first-child { display: grid; gap: 2px; }
.extension-row b { font-size: 11px; }.extension-row small { color: var(--muted); font-size: 9px; }
.mini-segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--ink); }
.mini-segmented label { cursor: pointer; }
.mini-segmented input { position: absolute; opacity: 0; pointer-events: none; }
.mini-segmented span { min-height: 42px; display: grid; place-items: center; border-right: 1px solid var(--ink); font: 800 10px/1 ui-monospace, monospace; }
.mini-segmented label:last-child span { border: 0; }
.mini-segmented input:checked + span { background: var(--ink); color: #fff; }
.total-count { margin: 10px 0 0; padding: 8px; background: #eeeae0; text-align: center; font-size: 11px; }
.total-count strong { color: var(--accent); font: 900 16px/1 ui-monospace, monospace; }
.segmented input:focus-visible + span, .scale-options input:focus-visible + span { outline: 3px solid var(--yellow); outline-offset: -3px; }
.preview-stage { min-height: 112px; display: grid; place-items: center; overflow: auto; border: 1px solid var(--line); margin-bottom: 17px; }
.checker { background-color: #eeeae1; background-image: linear-gradient(45deg,#d7d3ca 25%,transparent 25%),linear-gradient(-45deg,#d7d3ca 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d7d3ca 75%),linear-gradient(-45deg,transparent 75%,#d7d3ca 75%); background-size: 14px 14px; background-position: 0 0,0 7px,7px -7px,-7px 0; }
#previewCanvas { image-rendering: pixelated; width: auto; height: auto; }
.palette-list { display: grid; gap: 7px; margin-bottom: 20px; }
.palette-item { display: grid; grid-template-columns: 30px 36px 72px minmax(160px, 1fr) auto; align-items: center; gap: 9px; padding: 7px 9px; background: #f0ede5; font: 700 10px/1.2 ui-monospace, monospace; }
.palette-item b { font-size: 12px; }
.mini-swatch { position: relative; display: grid; place-items: end; width: 36px; height: 36px; border: 1px solid rgba(0,0,0,.5); }
.mini-swatch i, .record-cell label i { width: 17px; height: 17px; display: grid; place-items: center; background: rgba(255,255,255,.88); color: var(--ink); font: 900 10px/1 sans-serif; border: 1px solid var(--ink); font-style: normal; }
.editable-swatch { display: block; width: 36px; height: 36px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.editable-swatch.active { outline: 3px solid var(--accent); outline-offset: 2px; }
.reset-color, .reset-active { min-height: 34px; padding: 6px 10px; border: 1px solid var(--ink); background: white; color: var(--ink); font: 800 10px/1 sans-serif; cursor: pointer; }
.reset-color:hover, .reset-active:hover { background: var(--accent); color: white; }
.reset-active:disabled { opacity: .38; cursor: default; }
.adjust-panel { margin: 14px 0; padding: 14px; border: 1px solid var(--line); background: #e9e4d9; }
.adjust-head, .adjust-selected { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.adjust-selected { justify-content: flex-start; }
#adjustSwatch { width: 46px; height: 46px; flex: none; border: 1px solid var(--ink); }
.adjust-selected div { display: grid; gap: 4px; }
.adjust-selected strong { font-size: 12px; }
#adjustHex { padding: 0; border: 0; background: transparent; font: 800 10px/1 ui-monospace, monospace; text-align: left; cursor: pointer; }
.adjust-sliders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 15px; }
.adjust-sliders label > span { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
.adjust-sliders input[type="number"] { width: 64px; height: 30px; padding: 3px 6px; border: 1px solid var(--ink); background: white; color: var(--ink); font: 800 11px/1 ui-monospace, monospace; }
.adjust-sliders input[type="range"], #contrastShift {
  width: 100%;
  height: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
}
.adjust-sliders input[type="range"]::-webkit-slider-runnable-track, #contrastShift::-webkit-slider-runnable-track {
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: #c9c3b8;
  box-shadow: inset 0 1px 2px rgba(31, 30, 27, .18);
}
.adjust-sliders input[type="range"]::-webkit-slider-thumb, #contrastShift::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6.5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--ink), 0 2px 5px rgba(31, 30, 27, .22);
  -webkit-appearance: none;
  appearance: none;
}
.adjust-sliders input[type="range"]:focus-visible::-webkit-slider-thumb, #contrastShift:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px var(--ink), 0 0 0 5px rgba(239, 102, 72, .2);
}
.adjust-sliders input[type="range"]::-moz-range-track, #contrastShift::-moz-range-track {
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: #c9c3b8;
}
.adjust-sliders input[type="range"]::-moz-range-thumb, #contrastShift::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--ink), 0 2px 5px rgba(31, 30, 27, .22);
}
.palette-hex { font-size: 10px; }
.contrast-control { margin: 14px 0; padding: 13px; border: 1px solid var(--line); background: #eeeae0; display: flex; align-items: center; gap: 18px; }
.contrast-toggle { min-height: 44px; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 12px; font-weight: 900; }
.contrast-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.contrast-options { display: grid; grid-template-columns: auto minmax(150px, 1fr); gap: 8px 12px; align-items: center; flex: 1; }
.contrast-options > span { font-size: 10px; color: var(--muted); }
.contrast-options.disabled { opacity: .4; pointer-events: none; }
.range-heading { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.range-heading span { color: var(--muted); font-size: 10px; }
.range-heading strong { color: var(--accent); font: 900 13px/1 ui-monospace, monospace; }
.range-control { position: relative; display: grid; grid-template-columns: 30px 1fr 30px; gap: 8px; align-items: center; }
.range-control::after { content: ""; position: absolute; left: 50%; bottom: 1px; width: 2px; height: 5px; background: #8f897f; border-radius: 2px; pointer-events: none; transform: translateX(-1px); }
.range-control datalist { display: none; }
.range-control span { text-align: center; color: var(--muted); font: 700 9px/1 ui-monospace, monospace; }
.range-control input { width: 100%; height: 28px; accent-color: var(--accent); cursor: pointer; }
.contrast-palette { padding-top: 10px; border-top: 2px solid var(--accent); }
.contrast-label { margin-bottom: 8px; color: var(--accent); font-size: 11px; font-weight: 900; }
.contrast-add { background: #e9d8ec; margin-top: 10px; }
.hsb { color: var(--muted); white-space: nowrap; }
.palette-item.is-origin > b { color: var(--accent); font-size: 15px; font-weight: 1000; }
.export-row { display: grid; grid-template-columns: 1fr auto; gap: 15px; align-items: end; margin-bottom: 17px; }
.export-row fieldset { margin: 0; }
.scale-options { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.scale-options span { height: 34px; display: grid; place-items: center; font: 800 10px/1 ui-monospace, monospace; border-right: 1px solid var(--line); }
.scale-options label:last-child span { border: 0; }
.scale-options input:checked + span { background: var(--yellow); color: var(--ink); }
.dimensions { display: grid; gap: 5px; text-align: right; }
.dimensions span { font-size: 10px; color: var(--muted); }
.dimensions strong { font: 800 11px/1.2 ui-monospace, monospace; white-space: nowrap; }
.download-button { width: 100%; height: 51px; border: 2px solid var(--ink); background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; font-weight: 900; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: .12s; }
.download-button:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--ink); }
.download-button:active { transform: translate(3px,3px); box-shadow: none; }
.add-record-button { width: 100%; min-height: 55px; margin: 0 0 20px; border: 1.5px solid var(--ink); background: var(--yellow); color: var(--ink); cursor: pointer; display: grid; place-items: center; gap: 2px; padding: 8px; font-weight: 900; }
.add-record-button small { font-size: 9px; font-weight: 600; color: #544c30; }
.records-section { margin-top: 36px; border: 2px solid var(--ink); background: var(--panel); box-shadow: var(--shadow); padding: 24px; }
.records-heading, .records-heading > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.records-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.records-heading h2 { margin: 0 0 3px; font-size: 18px; }
.records-heading p { margin: 0; color: var(--muted); font-size: 11px; }
#recordCount { flex: none; padding: 7px 10px; background: var(--ink); color: #fff; font: 800 11px/1 ui-monospace, monospace; }
.empty-records { padding: 36px; color: var(--muted); text-align: center; font-size: 12px; }
.records-body { display: grid; grid-template-columns: minmax(290px, .85fr) minmax(0, 1.35fr); gap: 22px; align-items: start; margin-top: 18px; }
.records-left, .records-right { min-width: 0; }
.saved-preview-wrap { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: center; padding: 0 0 16px; border-bottom: 1px solid var(--line); }
.saved-preview-wrap > div:first-child { display: grid; gap: 5px; }
.saved-preview-wrap span { font-size: 11px; color: var(--muted); }
.saved-preview-wrap strong { font-size: 13px; }
.saved-preview { min-height: 86px; padding: 18px; display: grid; place-items: center; overflow: auto; border: 1px solid var(--line); }
#savedPreviewCanvas { image-rendering: pixelated; }
.records-export { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: end; padding: 16px 0 0; }
.records-export fieldset { margin: 0; }
.records-export .download-button { height: 51px; }
.records-list { display: grid; gap: 12px; margin-top: 18px; }
.record-card { display: grid; grid-template-columns: 72px 118px 1fr; border: 1px solid var(--line); background: #f0ede5; }
.record-meta { padding: 12px; display: flex; justify-content: space-between; align-items: center; border-right: 1px solid var(--line); }
.record-meta > div { display: grid; gap: 3px; }
.record-meta b { color: var(--accent); font: 900 12px/1 ui-monospace, monospace; }
.record-meta span { font-size: 12px; font-weight: 900; }
.record-meta small { color: var(--muted); font: 600 9px/1 ui-monospace, monospace; }
.delete-record { border: 0; border-right: 1px solid var(--ink); background: #f4a18d; color: var(--ink); cursor: pointer; display: grid; place-items: center; align-content: center; gap: 3px; font-weight: 900; }
.delete-record span { font-size: 27px; line-height: .8; }
.delete-record small { font-size: 10px; }
.delete-record:hover { background: var(--accent); color: #fff; }
.record-palette-wrap { min-width: 0; overflow-x: auto; }
.record-row-label { padding: 5px 10px; background: #ddd8cd; color: var(--muted); font-size: 9px; font-weight: 900; }
.record-row-label.contrast { background: #ded4df; color: #784a7c; }
.record-colors { display: flex; min-width: max-content; }
.contrast-record { background: #f0e8f1; border-top: 1px solid var(--line); }
.record-cell { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px; border-right: 1px solid var(--line); }
.record-cell { min-width: 112px; }
.record-cell:last-child { border: 0; }
.record-cell .record-swatch { flex: none; width: 38px; height: 38px; border: 1px solid var(--ink); }
.record-hex { font-size: 10px; overflow: hidden; }
.formula { margin-top: 36px; border: 1px solid var(--line); display: grid; grid-template-columns: 1.1fr repeat(4, 1fr); background: rgba(251,250,245,.65); }
.formula-title { display: grid; place-items: center start; align-content: center; gap: 4px; padding: 16px; font-size: 12px; font-weight: 900; }
.formula-title small { color: var(--accent); font: 700 9px/1.3 ui-monospace, monospace; }
.formula div { min-height: 64px; padding: 10px 12px; border-left: 1px solid var(--line); display: grid; gap: 2px; }
.formula b { font: 900 13px/1 ui-monospace, monospace; color: var(--accent); }
.formula span:not(.formula-title) { font: 600 9px/1.2 ui-monospace, monospace; color: var(--muted); }
.formula .origin { background: var(--yellow); }
.image-area { position: relative; }
.image-area.dragover-image::after { content: "放開以更換圖片"; position: absolute; inset: 38px 0 28px; z-index: 3; display: grid; place-items: center; background: rgba(239,102,72,.92); color: #fff; border: 2px dashed #fff; font-size: 20px; font-weight: 900; pointer-events: none; }
footer { border-top: 1px solid var(--line); min-height: 68px; display: flex; justify-content: center; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
footer span { color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; font-size: 12px; font-weight: 800; opacity: 0; pointer-events: none; transition: .2s; z-index: 5; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 1400px) {
  .workspace { grid-template-columns: 1fr 1fr; }
  .output-panel { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  main { max-width: 820px; }
  .workspace { grid-template-columns: 1fr; }
  .output-panel { grid-column: auto; }
  .panel { padding: 28px; }
  .dropzone { min-height: 390px; }
  .canvas-frame { min-height: 390px; max-height: 520px; }
  .download-button { min-height: 58px; font-size: 16px; }
  .scale-options span { min-height: 48px; font-size: 12px; }
    .records-export { grid-template-columns: 1fr; }
    .records-export .download-button { grid-column: auto; }
  .record-card { grid-template-columns: 64px 112px 1fr; }
  .record-colors { grid-template-columns: repeat(3, 1fr); }
  .record-cell:nth-child(3) { border-right: 0; }
  .record-cell:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 700px) {
  .topbar { padding: 0 18px; }
  .local-note { display: none; }
  main { padding: 38px 16px 48px; }
  h1 { font-size: 42px; }
  .inline-title { font-size: clamp(34px, 11vw, 42px); }
  .hero::after { display: none; }
  .panel { padding: 19px; box-shadow: 4px 4px 0 var(--ink); }
  .formula { grid-template-columns: repeat(5, 1fr); overflow: hidden; }
  .formula-title { grid-column: 1 / -1; }
  .formula div { border-top: 1px solid var(--line); padding: 8px 5px; }
  .formula span:not(.formula-title) { font-size: 7px; }
    .palette-item { grid-template-columns: 26px 36px 65px 1fr auto; gap: 6px; padding: 6px; font-size: 9px; }
    .palette-item .hsb { grid-column: 2 / -1; }
    .adjust-sliders, .records-body { grid-template-columns: 1fr; }
  .records-section { padding: 18px; }
  .records-heading p { display: none; }
  .saved-preview-wrap { grid-template-columns: 1fr; }
  .records-export { grid-template-columns: 1fr; }
  .records-export .download-button { grid-column: auto; }
  .record-card { grid-template-columns: 58px 1fr; }
  .delete-record { grid-row: 1 / 3; }
  .record-meta { border-right: 0; border-bottom: 1px solid var(--line); }
  .record-palette-wrap { grid-column: 2; }
  .record-colors { grid-column: 2; grid-template-columns: repeat(2, 1fr); }
  .record-cell:nth-child(2n) { border-right: 0; }
  .record-cell:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
}
