/* Achromatic ledger: the chrome holds no colour, so the artwork is the only colour on screen.
   Grid at 1440: 8 + 300 + 12 + 808 + 12 + 292 + 8 = 1440. */
:root {
  --ground: #f8f8f8;
  --surface: #ffffff;
  --raised: #eeeeee;
  --well: #f0f0f0;
  --border: #e6e6e6;
  --rule: #f0f0f0;
  --control: #d4d4d4;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --primary: #141414;
  --secondary: #e5e5e5;
  --negative: #c4242a;
  --radius-card: 8px;
  --radius-control: 6px;
  --gap: 12px;
  --control-height: 36px;
  --font: "Geist", Inter, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace; /* taste-skill-ignore: hex, OKLCH and pixel values are literal codes */
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--text);
  font: 400 14px/20px var(--font);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-rows: 44px 1fr;
  overflow: hidden;
}
.sprite { position: absolute; }
svg use { fill: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
h1, h2 { margin: 0; }
code, .val, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; } /* taste-skill-ignore: hex, OKLCH and pixel values are literal codes */

/* top bar */
.bar { display: flex; align-items: center; gap: 12px; padding: 0 8px 0 16px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.mark { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 1.5; }
.sep { width: 1px; height: 20px; background: var(--control); }
.bar h1 { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pill { flex: none; white-space: nowrap; font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 999px; background: var(--raised); color: #3d3d3d; }
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.vsep { width: 1px; height: 20px; background: var(--border); }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; border-radius: var(--radius-control); color: #3d3d3d; }
.icon-btn:hover:not(:disabled) { background: var(--raised); }
.icon-btn:disabled { color: #8a8a8a; cursor: default; }
.icon-btn svg, .btn svg, .text-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.btn { height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: var(--radius-control); border: 0; font-weight: 500; white-space: nowrap; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: #333; }
.btn.secondary { background: var(--secondary); color: var(--text); }
.btn.secondary:hover { background: #d9d9d9; }
.text-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 4px 6px; margin-right: -6px; border-radius: var(--radius-control); font-weight: 500; }
.text-btn:hover:not(:disabled) { background: var(--raised); }
.text-btn:disabled { color: #8a8a8a; cursor: default; }

/* work area */
.work { display: grid; grid-template-columns: 300px minmax(0, 1fr) 292px; gap: var(--gap); padding: 0 8px 8px; min-height: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow-y: auto; min-height: 0; padding: 4px 16px 16px; }
.group { padding: 16px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 12px; align-content: start; }
.group:last-of-type { border-bottom: 0; }
.group h2 { font-size: 14px; font-weight: 500; }
.group-head { display: flex; align-items: center; justify-content: space-between; }
.count { color: var(--muted); font-weight: 400; margin-left: 4px; font-variant-numeric: tabular-nums; }
.field { display: grid; gap: 6px; }
.field[hidden] { display: none; }
.field label, .field .label { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.val { color: var(--text); font-size: 12px; }
.field.inline { grid-template-columns: 1fr auto; align-items: center; }
.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 16px; }
.row-2 { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.row-2 > select { flex: 1; min-width: 0; }

select, input[type="number"], textarea {
  height: var(--control-height); border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); padding: 0 10px; min-width: 0;
}
select {
  appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%236b6b6b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 18px; } /* taste-skill-ignore: hex, OKLCH and pixel values are literal codes */
textarea::placeholder { color: var(--muted); }
input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; width: 100%; } /* taste-skill-ignore: hex, OKLCH and pixel values are literal codes */

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: none; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--control); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 2px; background: var(--control); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--text); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--text); }

/* segmented control */
.seg { display: flex; background: var(--raised); border-radius: var(--radius-control); padding: 2px; }
.seg button { flex: 1; height: 28px; border: 0; background: none; border-radius: 4px; color: var(--muted); font-size: 13px; padding: 0 4px; white-space: nowrap; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 500; outline: 1px solid var(--border); outline-offset: -1px; }

/* colour list */
.col-head { display: grid; grid-template-columns: 1fr 76px 60px; color: var(--muted); font-size: 12px; margin-bottom: -6px; }
.col-head span:last-child { grid-column: 2; }
.colours { list-style: none; margin: 0; padding: 0; display: grid; }
.colours li { display: grid; grid-template-columns: 28px minmax(0, 1fr) 76px 28px 28px; gap: 4px 8px; align-items: center; min-height: 48px; border-top: 1px solid var(--rule); border-radius: 4px; }
.colours li:first-child { border-top: 0; }
.colours li.sel { background: var(--raised); box-shadow: -6px 0 0 var(--raised), 6px 0 0 var(--raised); } /* taste-skill-ignore: a ring that keeps marks legible over any artwork colour, or a 1px edge */
.sw { width: 28px; height: 28px; border-radius: 6px; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); } /* taste-skill-ignore: a ring that keeps marks legible over any artwork colour, or a 1px edge */
.sw input { position: absolute; inset: -8px; width: 44px; height: 44px; opacity: 0; cursor: pointer; }
.code { display: grid; min-width: 0; }
.code input { border: 0; background: none; padding: 0; height: 20px; font-family: var(--mono); font-size: 13px; width: 100%; border-radius: 2px; } /* taste-skill-ignore: hex, OKLCH and pixel values are literal codes */
.code input:focus-visible { outline-offset: 1px; }
.code small { font-family: var(--mono); font-size: 11px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* taste-skill-ignore: hex, OKLCH and pixel values are literal codes */
.lock[aria-pressed="true"] { color: var(--text); background: var(--raised); }
.colours .icon-btn { width: 28px; height: 28px; }

/* preview well */
.well { background: var(--well); border: 1px solid var(--border); border-radius: var(--radius-card); display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
.stage-wrap { display: grid; place-items: center; padding: 32px; min-height: 0; position: relative; }
.stage { position: relative; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.06); touch-action: none; } /* taste-skill-ignore: a ring that keeps marks legible over any artwork colour, or a 1px edge */
.stage canvas { display: block; width: 100%; height: 100%; }
.handles { position: absolute; inset: 0; }
.handle { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid #fff; outline: 1px solid rgb(0 0 0 / 0.4); padding: 0; cursor: grab; touch-action: none; }
.handle:focus-visible { outline: 3px solid #0a0a0a; }
.handle:active { cursor: grabbing; }
.handle.sel { width: 22px; height: 22px; margin: -11px 0 0 -11px; outline: 2px solid #0a0a0a; }
.handle.centre { background: rgb(255 255 255 / 0.9); width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.handle.knob { background: #0a0a0a; width: 12px; height: 12px; margin: -6px 0 0 -6px; }
.spoke { position: absolute; height: 1.5px; background: rgb(255 255 255 / 0.85); transform-origin: 0 50%; box-shadow: 0 0 0 0.5px rgb(0 0 0 / 0.3); pointer-events: none; } /* taste-skill-ignore: a ring that keeps marks legible over any artwork colour, or a 1px edge */
.well-foot { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.ribbons { display: grid; gap: 4px; }
.ribbon { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.ribbon canvas { width: 100%; height: 12px; border-radius: 2px; display: block; }
.finding { margin: 0; font-size: 13px; color: var(--text); }
.finding b { font-weight: 500; font-variant-numeric: tabular-nums; }
.size-read { position: absolute; top: 12px; left: 16px; margin: 0; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; } /* taste-skill-ignore: hex, OKLCH and pixel values are literal codes */

/* right panel bits */
.wh { align-items: end; }
.wh .field { flex: 1; }
.times { color: var(--muted); padding-bottom: 8px; }
.bg-pick { display: flex; align-items: center; gap: 8px; }
.bg-pick input { width: 28px; height: 28px; border: 1px solid var(--control); border-radius: 6px; padding: 2px; background: var(--surface); }
.bg-pick code { font-size: 12px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { width: 30px; height: 18px; border-radius: 9px; background: var(--control); position: relative; flex: none; }
.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(12px); }
.switch input:focus-visible + .track { outline: 2px solid var(--text); outline-offset: 2px; }
.switch input:disabled + .track { opacity: 0.5; }
.colophon { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* export dialog */
dialog { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 0; width: min(720px, calc(100vw - 32px)); box-shadow: 0 16px 48px rgb(0 0 0 / 0.18); color: var(--text); } /* taste-skill-ignore: a ring that keeps marks legible over any artwork colour, or a 1px edge */
dialog::backdrop { background: rgb(0 0 0 / 0.3); }
.dlg { display: grid; gap: 16px; padding: 16px 20px 20px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { font-size: 16px; font-weight: 500; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); }
.tabs button { border: 0; background: none; padding: 0 0 10px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--text); }
.tab-body { display: grid; gap: 12px; }
.tab-body[hidden] { display: none; }
.tab-body textarea { height: 300px; resize: none; white-space: pre; overflow: auto; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.kv { margin: 0; display: grid; }
.kv div { display: flex; justify-content: space-between; height: 32px; align-items: center; border-bottom: 1px solid var(--rule); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 13px; } /* taste-skill-ignore: hex, OKLCH and pixel values are literal codes */
#fmt { width: 200px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 8px); background: var(--primary); color: #fff; padding: 8px 14px; border-radius: var(--radius-control); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* tablet: right panel under the left */
@media (max-width: 1180px) {
  .work { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .work > .panel:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; padding-bottom: 0; max-height: 260px; }
  .work > .panel:last-child .group { border-bottom: 0; }
  .colophon { display: none; }
}
/* phone: one column, page scrolls, preview first */
@media (max-width: 760px) {
  body { overflow: auto; height: auto; grid-template-rows: 48px auto; }
  html { height: auto; }
  .bar { padding: 0 8px 0 16px; gap: 8px; }
  .brand span, .sep, .pill, .vsep, #undo, #redo { display: none; }
  .btn.secondary#copy-link { padding: 0 10px; }
  .work { display: flex; flex-direction: column; padding: 0 8px 16px; }
  .well { order: -1; }
  .stage-wrap { padding: 28px 16px 16px; }
  .well-foot { grid-template-columns: 1fr; gap: 8px; }
  .size-read { top: 4px; left: 12px; }
  .panel { overflow: visible; }
  .work > .panel:last-child { display: block; max-height: none; padding-bottom: 16px; }
  .colophon { display: block; }
  .btn, .seg button, select, input[type="number"] { min-height: 44px; }
  .seg button { height: 40px; }
  .colours li { min-height: 52px; }
  .colours .icon-btn { width: 36px; height: 36px; }
  .colours li { grid-template-columns: 36px minmax(0, 1fr) 72px 36px 36px; }
  .col-head { grid-template-columns: 1fr 72px 80px; }
  .sw { width: 36px; height: 36px; }
  dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .tab-body textarea { height: 50vh; }
}
@media (prefers-reduced-motion: reduce) {
  .track::after, .toast { transition: none; }
}
