:root {
  --bg: #f4f1ec;
  --panel: #ffffff;
  --panel-2: #faf8f5;
  --ink: #1d1913;
  --muted: #6e655a;
  --line: #e5ded3;
  --accent: #b5761b;
  --accent-strong: #9a6113;
  --accent-ink: #ffffff;
  --accent-soft: #f6e8cf;
  --melody: #d9982b;
  --bass: #23998a;
  --inner: #7b6bd8;
  --drop: #d44a4a;
  --orig: #b4aca1;
  --ok: #2f9a5a;
  --warn-bg: #fff4dd;
  --warn-ink: #7a4f06;
  --roll-bg: #fbfaf8;
  --roll-key: #f1ede7;
  --roll-band: rgba(217, 152, 43, 0.13);
  --roll-grid: rgba(0, 0, 0, 0.06);
  --roll-grid-strong: rgba(0, 0, 0, 0.14);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 30, 10, 0.06), 0 6px 20px rgba(40, 30, 10, 0.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --panel: #1d1a16;
    --panel-2: #24201b;
    --ink: #f1ebe2;
    --muted: #a69c8e;
    --line: #36312a;
    --accent: #e0a24a;
    --accent-strong: #f0b45c;
    --accent-ink: #1d1406;
    --accent-soft: #3a2d18;
    --orig: #5f584f;
    --warn-bg: #3a2d14;
    --warn-ink: #f3cf8a;
    --roll-bg: #191713;
    --roll-key: #201d18;
    --roll-band: rgba(224, 162, 74, 0.12);
    --roll-grid: rgba(255, 255, 255, 0.05);
    --roll-grid-strong: rgba(255, 255, 255, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 40px; height: 40px; }
.logo-high { fill: #f0c27a; }
.logo-low { fill: var(--melody); }
.brand h1 { font-size: 19px; letter-spacing: -0.01em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.pill {
  padding: 5px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45vw;
}
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.pill.busy { color: var(--accent); }

/* ---------------------------------------------------------------- layout */
.layout {
  display: grid; grid-template-columns: 370px minmax(0, 1fr); gap: 20px;
  padding: 20px 24px 40px; max-width: 1680px; margin: 0 auto;
}
.sidebar { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.workspace { min-width: 0; }

/* full screen (the Full screen button): the settings scroll in their own column, the piano roll
   and the 3D view as tall as the screen allows */
body.full .layout { max-width: none; padding: 10px 14px 14px; gap: 14px; grid-template-columns: 400px minmax(0, 1fr); }
body.full .sidebar { position: sticky; top: 10px; align-self: start; max-height: calc(100vh - 80px); overflow-y: auto;
  padding-right: 4px; }
body.full .viewer { height: calc(100vh - 250px); min-height: 420px; }
body.full canvas.roll { height: calc(100vh - 380px); min-height: 360px; }
body.full .topbar { padding-top: 6px; padding-bottom: 6px; }
#full-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin-bottom: 0; }
details.card[open] > summary h2 { margin-bottom: 12px; }
details.card > summary h2::after {
  content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s;
}
details.card[open] > summary h2::after { transform: rotate(-135deg); }
.step {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; font-weight: 700; flex: none;
}
.needs-song.disabled { opacity: .55; pointer-events: none; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
/* fields side by side line up their boxes even when one label takes two lines */
.grid2 > .field > input:last-child, .grid2 > .field > select:last-child,
.grid3 > .field > input:last-child, .grid3 > .field > select:last-child { margin-top: auto; }
.field input, .field select {
  width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel-2); min-width: 0;
}
.field input:focus, .field select:focus, .dropzone:focus-visible, .btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px;
}
.field input:disabled { opacity: .5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 2px 0 10px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check.inline { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { width: 100%; padding: 13px 16px; font-size: 15px; border-radius: 12px; }
.btn-lg svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- song card */
.dropzone {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 20px 14px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer;
  background: var(--panel-2); transition: border-color .15s, background .15s; margin-bottom: 12px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone span { color: var(--muted); font-size: 12.5px; }
.dz-icon { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.addon { margin: 0 0 8px; }
.addon .check { margin-bottom: 4px; }
.addon .hint { margin: 0 0 8px 24px; }
.addon-install { margin: 0 0 10px 24px; }
.addon-install .progress { margin-top: 4px; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.samples button {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 4px 11px;
  cursor: pointer; font-size: 12.5px;
}
.samples button:hover { border-color: var(--accent); color: var(--accent-strong); }
.progress { margin-top: 12px; }
.bar { height: 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--melody)); transition: width .3s; }
.progress-msg { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.dropzone.adding { border-color: var(--accent); background: var(--accent-soft); }
.box-songs { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.box-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13.5px; }
.box-count { color: var(--muted); font-size: 12px; }
.box-drum { margin: 8px 0 4px; }
.box-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.box-list li { display: flex; align-items: stretch; gap: 4px; }
.box-song {
  flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; text-align: left;
  padding: 6px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); cursor: pointer;
}
.box-song:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.box-list li.current .box-song { border-color: var(--accent); background: var(--accent-soft); }
.box-song .num {
  grid-row: span 2; align-self: center; width: 20px; height: 20px; border-radius: 99px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line);
}
.box-list li.current .num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.box-song .name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.box-song .meta { color: var(--muted); font-size: 12px; }
.box-remove {
  flex: none; width: 28px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  cursor: pointer; font-size: 16px; line-height: 1;
}
.box-remove:hover { color: var(--drop); border-color: var(--drop); }
.box-actions { display: flex; gap: 6px; margin-bottom: 6px; }
.box-songs .hint { margin: 0; }
.song-info { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.song-info .title { font-weight: 700; word-break: break-word; }
.song-info .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tracks { display: flex; flex-direction: column; gap: 2px; max-height: 180px; overflow: auto; }
.tracks .check { margin: 0; padding: 4px 0; }
.tracks .count { color: var(--muted); font-size: 12px; margin-left: auto; }
.generate { position: sticky; bottom: 0; padding: 10px 0 4px; background: linear-gradient(transparent, var(--bg) 30%); }
.generate .hint { text-align: center; margin: 8px 0 0; }

/* ---------------------------------------------------------------- empty state */
.empty-state {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 40px 32px; text-align: center; min-height: 520px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.hero-drum svg { width: min(420px, 90%); height: auto; }
.empty-state h2 { font-size: 22px; margin: 18px 0 14px; letter-spacing: -0.01em; }
.how { text-align: left; max-width: 520px; color: var(--muted); padding-left: 22px; margin: 0; }
.how li { margin: 6px 0; }
.how strong { color: var(--ink); }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); min-width: 0;
}
.stat .label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 21px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.good .value { color: var(--ok); }
.stat.meh .value { color: var(--accent); }
.warnings { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.warnings li { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 8px 12px; font-size: 13px; }

/* ---------------------------------------------------------------- transport */
.transport {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.speed { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-left: 6px; }
.speed input { accent-color: var(--accent); width: 120px; }
.speed output { font-variant-numeric: tabular-nums; color: var(--ink); min-width: 44px; white-space: nowrap; }
.time { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button {
  border: none; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.tab-panel h3 { font-size: 14px; margin: 4px 0 10px; }

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 5px 11px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; }
.seg button.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.drum-picker { flex-wrap: wrap; }
.drum-picker button { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- piano roll */
.roll-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-orig { background: var(--orig); }
.sw-mel { background: var(--melody); }
.sw-bass { background: var(--bass); }
.sw-inner { background: var(--inner); }
.sw-drop { border: 2px solid var(--drop); }
.sw-added { border: 2px solid var(--melody); border-radius: 99px; }
.lock-ico { width: 12px; height: 12px; fill: var(--ink); stroke: var(--ink); }
.zoom button { min-width: 30px; }
#edit-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.edit-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -2px 0 10px;
  padding: 8px 10px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.inline-field select { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.edit-sep { flex: 1; }
.edit-help { flex-basis: 100%; margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.edit-help strong { color: var(--ink); font-weight: 600; }
canvas.roll.editing { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: -1px; }
canvas.overview { width: 100%; height: 64px; display: block; border-radius: 10px; border: 1px solid var(--line); cursor: grab; margin-bottom: 8px; touch-action: none; }
canvas.roll { width: 100%; height: 460px; display: block; border-radius: 10px; border: 1px solid var(--line); }
canvas.roll.editing { touch-action: none; }
.roll-hint { margin: 8px 0 0; }

/* ---------------------------------------------------------------- viewer */
.viewer-wrap { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--roll-bg); }
.viewer { width: 100%; height: 540px; }
.viewer canvas { display: block; }
.viewer-overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px; pointer-events: none; }
.viewer-controls { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.viewer-controls > * { pointer-events: auto; }
/* the view's choices on the left, its buttons together on the right (Fit view, Cut open, Share in Discover …) */
.viewer-controls { justify-content: flex-start; }
.viewer-controls > .seg { order: 0; }
.viewer-controls::after { content: ""; flex: 1 1 0; order: 1; }
.viewer-controls > .btn, .viewer-controls > .view-preset { order: 2; }
.pictures-auto { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; font-size: 13px;
  color: var(--muted); }
.pictures-auto select { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px;
  padding: 4px 8px; font: inherit; font-size: 12.5px; margin-left: 6px; }
.pictures-auto .hint { margin: 0; }
.view-preset { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px;
  padding: 4px 8px; font: inherit; font-size: 12.5px; }
.part-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 12px; }
.part {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--panel-2);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.part header { display: flex; align-items: center; gap: 8px; }
.part .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.15); }
.part .name { font-weight: 700; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part .meta { font-size: 12px; color: var(--muted); }
.part .links { display: flex; gap: 6px; flex-wrap: wrap; }
.part .links a { font-size: 12px; padding: 3px 9px; }

/* ---------------------------------------------------------------- comb tab */
.comb-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
.table-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--line); border-radius: 10px; }
table.teeth { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.teeth th, table.teeth td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.teeth th { position: sticky; top: 0; background: var(--panel-2); font-size: 12px; color: var(--muted); }
table.teeth td:nth-child(2), table.teeth th:nth-child(2) { text-align: left; font-weight: 700; }
table.teeth .lenbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--melody); vertical-align: middle; margin-right: 6px; }
table.teeth tr.dup td:nth-child(2) { color: var(--muted); }
.card-inner { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.cal-result { font-size: 13px; min-height: 20px; margin: 10px 0; }
.cal-current { margin: 0; align-self: center; }
.tune-steps { display: flex; flex-direction: column; gap: 18px; }
.tune-steps h3 { display: flex; align-items: center; gap: 8px; }
table.teeth td.fix { cursor: help; }
.tuner-bar {
  display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 8px 14px; margin-bottom: 14px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2);
}
.tuner-bar.on { border-color: var(--accent); background: var(--accent-soft); }
.tuner-readout { display: flex; align-items: baseline; gap: 8px; min-width: 190px; font-variant-numeric: tabular-nums; }
.tuner-hz { font-size: 22px; font-weight: 700; }
.tuner-note { font-size: 14px; color: var(--muted); }
.tuner-meter { height: 8px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.tuner-meter div { height: 100%; width: 0; background: var(--ok); transition: width .08s; }
.tuner-status { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--muted); }
.tuner-status strong { color: var(--ink); }
table.teeth input.meas {
  width: 78px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel);
  text-align: right; font: inherit; font-variant-numeric: tabular-nums;
}
table.teeth .mic {
  border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 2px 5px; cursor: pointer;
  vertical-align: middle; margin-left: 4px; line-height: 0;
}
table.teeth .mic svg { width: 14px; height: 14px; fill: var(--muted); }
table.teeth tr.listening td { background: var(--accent-soft); }
table.teeth tr.listening .mic { border-color: var(--accent); }
table.teeth tr.listening .mic svg { fill: var(--accent-strong); }
table.teeth td.fix { text-align: left; font-size: 12.5px; }
.cents-ok { color: var(--ok); font-weight: 600; }
.cents-off { color: var(--drop); font-weight: 600; }
.cents-meh { color: var(--accent-strong); font-weight: 600; }
.comb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 560px) { .tuner-bar { grid-template-columns: 1fr; } }
.steel-tune .comb-actions { margin: 0 0 10px; }
.steel-tune .table-wrap { max-height: 460px; overflow: auto; }
table.teeth select.steel-note {
  padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel);
  font: inherit; font-weight: 700; color: inherit;
}

/* ---------------------------------------------------------------- print tab */
.downloads { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 16px; }
.dl {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); text-decoration: none; color: var(--ink); transition: border-color .15s;
}
.dl:hover { border-color: var(--accent); }
.dl strong { font-size: 14px; }
.dl span { font-size: 12px; color: var(--muted); }
.dl.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dl.primary span { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
.guide {
  white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow: auto; max-height: 620px; margin: 0;
}

/* ---------------------------------------------------------------- toast & busy */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: min(560px, 90vw);
}
.toast.error { background: var(--drop); color: #fff; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .comb-grid { grid-template-columns: 1fr; }
  .generate { position: static; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  .brand p { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: 1fr 1fr; }
  canvas.roll { height: 380px; }
  .viewer { height: 420px; }
  .time { margin-left: 0; }
}

/* ---------------------------------------------------------------- lettering */
.lettering { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.lettering h3 { font-size: 13px; margin: 0 0 4px; }
.text-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px 8px; align-items: end;
  padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.text-row .field { margin-bottom: 0; }
.text-row .t-text-field { grid-column: 1 / -1; }
.text-row .t-text { font-size: 18px; padding: 6px 10px; }
.text-row .t-remove { align-self: end; padding: 6px 10px; }
.text-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 520px) { .text-row { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- surface pattern */
.pattern { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.pattern h3 { font-size: 13px; margin: 0 0 4px; }
.pattern-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; margin: 6px 0 10px;
}
.pattern-tile {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px 5px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--accent-strong);
  cursor: pointer; font: inherit; font-size: 11px; line-height: 1.2; min-width: 0;
}
.pattern-tile .pic { width: 100%; height: 42px; display: flex; align-items: center; justify-content: center; }
.pattern-tile .pic svg, .pattern-tile .pic canvas { max-width: 100%; max-height: 42px; }
.pattern-tile .pic .none { font-size: 22px; color: var(--muted); }
.pattern-tile .name { color: var(--ink); text-align: center; overflow-wrap: anywhere; }
.pattern-tile:hover { border-color: var(--accent); }
.pattern-tile[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.pattern-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pattern-image {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.pattern-image canvas {
  box-sizing: content-box; max-width: 120px; max-height: 120px; flex: none; padding: 4px; border-radius: 8px; background: var(--panel);
  border: 1px solid var(--line); image-rendering: pixelated;
}
.pattern-image-controls { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pattern-image-controls .field { width: 100%; margin-bottom: 0; }
.pattern-image-controls input[type="range"] { width: 100%; }
.pattern-image-controls input[type="range"]:disabled { opacity: .45; }
.pattern-from { margin: 0; font-size: 12.5px; }
.pattern-keep { display: flex; gap: 6px; width: 100%; flex-wrap: wrap; }
.pattern-keep .pattern-name { flex: 1 1 120px; min-width: 0; }
@media (max-width: 520px) { .pattern-image { flex-direction: column; } }
/* My patterns and Discover: under the built-in ones, scrolling once they are many */
.pattern-shelf h4 { font-size: 12.5px; margin: 4px 0 0; }
.pattern-shelf h4 .muted { color: var(--muted); font-weight: 400; }
.pattern-shelf .hint { margin: 2px 0 0; }
.pattern-shelf .pattern-grid { max-height: 232px; overflow-y: auto; padding: 2px; }
.pattern-tile.shared { position: relative; }
.pattern-tile.shared::after {
  content: "★"; position: absolute; top: 3px; right: 5px; font-size: 10px; color: var(--accent);
}
.pattern-field .pattern-picker { margin-top: 2px; }
.pattern-field > small.hint { display: block; margin-top: -4px; }

/* ---------------------------------------------------------------- estimates & test-print kit */
.card h3.sub { font-size: 13px; margin: 12px 0 4px; }
.estimate { margin: 0 0 10px; }
.kit {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center;
  padding: 12px; margin-bottom: 12px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--accent-soft);
}
.kit > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.kit > div:first-child span { color: var(--muted); font-size: 12.5px; }
#kit-out { grid-column: 1 / -1; }
.kit-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin: 4px 0 8px; }
.kit-guide { max-height: 320px; overflow: auto; }
@media (max-width: 520px) { .kit { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- projects */
.project-actions, .reset-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }

/* ---------------------------------------------------------------- print plates */
.plates { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 0 0 12px; }
.plates > strong { flex-basis: 100%; font-size: 13px; }
.plates .hint { flex-basis: 100%; margin: 2px 0 0; }
.plate-link {
  display: flex; flex-direction: column; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13px;
}
.plate-link span { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.plate-link:hover { border-color: var(--accent); }

/* ---------------------------------------------------------------- start page: what to make */
a.brand { color: inherit; text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.makers-page { max-width: 1180px; margin: 0 auto; padding: 36px 24px 56px; }
.makers-title { font-size: 26px; letter-spacing: -0.01em; text-align: center; }
.makers-sub { text-align: center; color: var(--muted); margin: 8px auto 26px; max-width: 620px; }
.makers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }   /* eight makers: two rows of four */
.maker {
  display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); text-decoration: none;
  transition: transform .15s, border-color .15s;
}
.maker:hover { transform: translateY(-2px); border-color: var(--accent); }
/* every picture as tall as the duet box's (its bow reaches higher): the cards line up */
.maker-art { width: 100%; height: auto; aspect-ratio: 240 / 176; border-radius: 10px; background: var(--panel-2); }
.maker h3 { font-size: 18px; margin-top: 4px; }
.maker p { margin: 0; color: var(--muted); flex: 1; }
.maker .btn { align-self: flex-start; margin-top: 6px; }

/* ---------------------------------------------------------------- box makers (duet box, gift box) */
.box-form { display: flex; flex-direction: column; gap: 14px; }
.box-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.box-grid .wide { grid-column: 1 / -1; }
.box-grid .field small.hint { margin: 0; font-size: 11.5px; }
.box-grid input[type="color"] { width: 100%; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.unit { font-style: normal; color: var(--muted); font-weight: 400; }
.reset-btn { align-self: flex-start; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.chip i { width: 10px; height: 10px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .15); display: inline-block; }
.guide-card { margin-top: 14px; }
.workspace .viewer-wrap { margin-bottom: 14px; }

/* ---------------------------------------------------------------- waiting in line (the queue) */
.queue-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 2px 0;
  font-size: 13px; color: var(--muted); }
.progress #progress-cancel { margin-top: 6px; }
.keep-note { margin: 6px 0 10px; }

/* ---------------------------------------------------------------- the shape picker (box makers) */
.shape-field { position: relative; }
.shape-current { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; min-height: 46px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit;
  text-align: left; cursor: pointer; }
.shape-current:hover { border-color: var(--accent); }
.shape-current b { flex: 1; font-weight: 600; }
.shape-current .chev { font-style: normal; color: var(--muted); }
.shape-box { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; }
.shape-icon { width: min(36px, calc(36px * var(--shape-aspect, 1))); aspect-ratio: var(--shape-aspect, 1); height: auto;
  fill: var(--melody); stroke: var(--accent-strong); stroke-width: 2.5; vector-effect: non-scaling-stroke;
  overflow: visible; }
.shape-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; margin-top: 6px;
  padding: 6px; max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2); }
.shape-grid[hidden] { display: none; }
.shape-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 7px;
  border: 1px solid transparent; border-radius: 10px; background: var(--panel); color: var(--ink);
  font: inherit; font-size: 11.5px; line-height: 1.2; text-align: center; cursor: pointer; }
.shape-tile .shape-box { width: 48px; height: 48px; }
.shape-tile .shape-icon { width: min(44px, calc(44px * var(--shape-aspect, 1))); }
.shape-tile:hover { border-color: var(--line); }
.shape-tile.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }

/* ---------------------------------------------------------------- SVG artwork and the drawer planner */
.svg-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.model-name { font-style: normal; font-size: 13px; color: var(--muted, #667); flex: 1 1 100%; }
.svg-preview { width: 64px; height: 48px; object-fit: contain; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 3px; }
.planner { display: grid; gap: 4px; margin-top: 4px; }
.planner-back, .planner-front { font-size: 11px; color: var(--muted); text-align: center; letter-spacing: .08em;
  text-transform: uppercase; }
.planner-grid { display: grid; grid-template-columns: repeat(var(--nx), minmax(0, 1fr));
  grid-auto-rows: auto; gap: 2px; padding: 4px; border-radius: 10px; background: var(--panel-2);
  border: 1px solid var(--line); touch-action: none; user-select: none; }
.planner-grid .cell { aspect-ratio: 1; border-radius: 4px; background: var(--panel); border: 1px dashed var(--line); }
.planner-grid .cell.drag { background: var(--accent-soft); border-color: var(--accent); }
.planner-grid .bin { z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; margin: 0; border: 2px solid var(--accent-strong); border-radius: 6px; background: var(--melody);
  color: #fff; font: inherit; font-size: 11px; line-height: 1.1; cursor: pointer; min-width: 0; overflow: hidden; }
.planner-grid .bin small { font-size: 9.5px; opacity: .9; }
.planner-grid .bin.on { outline: 3px solid var(--accent); outline-offset: 1px; }
.planner-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 6px; padding: 8px 10px;
  border-radius: 10px; background: var(--panel-2); font-size: 13px; }
.planner-edit[hidden] { display: none; }
.planner-edit input[type=number] { width: 56px; }

.makers-headline { font-size: clamp(26px, 4vw, 38px); }
/* the public preview (before the crowdfunding) */
.preview-tag { text-align: center; margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-strong); }
.preview-banner { max-width: 640px; margin: 8px auto 26px; text-align: center; }
.preview-lead { font-size: 16px; color: var(--muted); margin: 0 0 14px; }
.preview-soon { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px 18px;
  text-align: left; box-shadow: var(--shadow); }
.preview-soon p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.preview-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.preview-actions .btn { justify-content: center; }
@media (max-width: 520px) { .preview-actions { grid-template-columns: 1fr; } }
.free-samples { margin-top: 44px; }
.free-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 14px; }
.free-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel); }
.free-card p { margin: 0; font-size: 13px; color: var(--muted); flex: 1; }
.free-card .btn { align-self: flex-start; }
.free-maker { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-strong); }
.free-wait { margin: 0; font-size: 12px; }
.wait-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.wait-head .hint { margin: 0; }
@media (max-width: 1060px) { .makers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .makers { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- accounts (a server that sells its files) */
.account-slot { display: flex; align-items: center; }
.account-link { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; }
.account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--muted); }
.plan-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-strong); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}
.plan-badge.free { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.account-dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0; width: min(420px, calc(100vw - 32px));
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow);
}
.account-dialog::backdrop { background: rgba(20, 16, 10, 0.45); }
.account-form { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px 16px; }
.account-form header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.account-form h2 { font-size: 17px; }
.account-form .btn-primary { margin-top: 4px; }
.account-switch { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.account-switch a { color: var(--accent-strong); }
.account-error { color: var(--drop); font-size: 13px; margin: 8px 0 0; }
.licence-card {
  grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
}
.licence-card > div:first-child { display: flex; flex-direction: column; gap: 4px; flex: 1 1 320px; }
.licence-card span { font-size: 13px; color: var(--muted); }
.licence-card ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.licence-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.account-page { max-width: 760px; margin: 0 auto; padding: 32px 24px 56px; display: flex; flex-direction: column; gap: 16px; }
.account-page .card h2 { margin-bottom: 8px; }
.account-note { padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); margin: 0; }
.account-note.error { background: color-mix(in srgb, var(--drop) 15%, var(--panel)); color: var(--drop); }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.account-inline { display: flex; flex-direction: column; gap: 2px; max-width: 360px; }
.account-inline .btn { align-self: flex-start; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.plan.current { border-color: var(--accent); }
.plan h3 { font-size: 16px; }
.plan p { margin: 0; color: var(--muted); font-size: 13.5px; flex: 1; }
.plan .btn { align-self: flex-start; }
.plan .plan-badge { align-self: flex-start; }

/* ---------------------------------------------------------------- the preview (browser) and the files (server) */
.build-hint { margin: 8px 2px 0; text-align: center; }
.files-note { grid-column: 1 / -1; margin: 0; }
.files-note.stale { color: var(--warn-ink); background: var(--warn-bg); padding: 8px 12px; border-radius: 10px; }

/* ---------------------------------------------------------------- the admin panel (admin.html) */
.admin-page { max-width: 1240px; margin: 0 auto; padding: 24px 24px 56px; }
.admin-page .stats.admin-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.admin-page h3 { font-size: 13px; margin: 16px 0 6px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; }
.admin-chart { width: 100%; height: auto; display: block; margin: 4px 0 8px; }
.admin-chart rect { fill: var(--accent); }
.admin-chart rect.neg { fill: var(--drop); }
.admin-chart text { fill: var(--muted); font-size: 11px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 4px 8px 6px 0; }
.admin-table td { padding: 6px 8px 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
.admin-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-table .neg, .admin-page .neg { color: var(--drop); }
.admin-page .muted, .admin-table tr.muted td { color: var(--muted); }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.admin-page input[type="search"], .admin-page input[type="text"], .admin-page input[type="date"],
.admin-page select, .admin-page textarea {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 9px; color: var(--ink);
}
.admin-page input[type="search"] { min-width: 260px; flex: 1 1 260px; max-width: 420px; }
.admin-page textarea { width: 100%; resize: vertical; margin-top: 12px; font: inherit; }
.admin-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; align-items: start; }
.admin-list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.admin-row {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer; width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0;
}
.admin-row:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.admin-row.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.admin-row .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.admin-row .what, .admin-row .when { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row .what { color: var(--ink); }
.admin-detail { position: sticky; top: 12px; min-width: 0; overflow-wrap: anywhere; }
.admin-detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.admin-detail-head h2 { margin: 0; overflow-wrap: anywhere; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.admin-actions .inline { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.admin-mini { margin: 0; padding-left: 18px; font-size: 13px; }
.admin-mini li { margin: 2px 0; }
.admin-msg { white-space: pre-wrap; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.admin-msg.reply { background: var(--accent-soft); margin-left: 24px; }
.admin-danger { margin: 10px 0; }
.admin-danger summary { cursor: pointer; color: var(--drop); font-size: 13px; font-weight: 600; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: 4px;
  background: var(--accent-soft); color: var(--accent-strong); vertical-align: 1px;
}
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.bad { background: color-mix(in srgb, var(--drop) 18%, var(--panel)); color: var(--drop); }
/* the admin panel's patterns for Discover */
.pat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.pat-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: start; padding: 12px; margin: 0; }
.pat-card canvas { box-sizing: content-box; max-width: 96px; max-height: 96px; padding: 4px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); image-rendering: pixelated; grid-row: span 2; }
.pat-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.pat-info .muted { color: var(--muted); font-size: 12px; }
.pat-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs .count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
.btn-danger { color: var(--drop); border-color: color-mix(in srgb, var(--drop) 45%, var(--line)); }
.btn.armed { background: var(--drop); border-color: var(--drop); color: #fff; }
@media (max-width: 980px) {
  .admin-page .stats.admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid, .admin-split { grid-template-columns: 1fr; }
  .admin-detail { position: static; }
}
@media (max-width: 560px) {
  .admin-page { padding: 16px 16px 40px; }
  .admin-page input[type="search"] { min-width: 0; }
}

/* the support form and messages on the account page */
.account-page textarea { width: 100%; resize: vertical; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--ink); }
.support-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 10px; }
.support-list li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.support-list .msg { white-space: pre-wrap; margin: 4px 0 0; }
.support-list .answer { white-space: pre-wrap; background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.account-inline.support-form { max-width: 560px; }
.admin-page a:not(.btn), .support-list a { color: var(--accent-strong); }
#log-list, .admin-grid .card { overflow-x: auto; }
#log-list .admin-table td:first-child { white-space: nowrap; }
@media (max-width: 720px) {
  .admin-topbar #admin-who, .admin-topbar .topbar-right a[href="./"] { display: none !important; }
}

/* ---------------------------------------------------------------- pictures of the real model (pictures.js) */
.pictures { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--roll-bg); z-index: 2; outline: none; }
.pictures-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: grab; user-select: none; touch-action: pan-y; }
.pictures-img:active { cursor: grabbing; }
.pictures-turn { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--panel) 85%, transparent); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px; }
.pictures-hint { font-size: 12.5px; color: var(--muted); }
.pictures-stale { position: absolute; left: 12px; right: 12px; bottom: 60px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.pictures-prompt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  text-align: center; padding: 24px; background: var(--roll-bg); z-index: 2; }
.pictures-prompt-text { max-width: 420px; color: var(--muted); margin: 0; }
.viewer-wrap .viewer-controls { z-index: 3; }

/* ---------------------------------------------------------------- Discover (discover.html, share.js) */
.topbar .btn.active { background: var(--accent-soft); color: var(--accent-strong); }
.discover-filter { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 auto 22px; }
.discover-filter button {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 6px 14px;
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.discover-filter button:hover { border-color: var(--accent); color: var(--ink); }
.discover-filter button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.discover-filter .count { font-weight: 500; opacity: .75; margin-left: 2px; }
.discover-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.discover-empty { grid-column: 1 / -1; text-align: center; padding: 40px 0; }
.discover-card {
  display: flex; flex-direction: column; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none; overflow: hidden; transition: transform .15s, border-color .15s;
}
.discover-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.discover-pic { aspect-ratio: 4 / 3; background: var(--roll-bg); border-bottom: 1px solid var(--line); }
.discover-pic img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; }
.discover-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: baseline; padding: 10px 14px 12px; }
.discover-info h3 { font-size: 15.5px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.discover-by { grid-column: 1; margin: 0; font-size: 13px; color: var(--accent-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.discover-maker { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 11.5px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
@media (max-width: 1060px) { .discover-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .discover-grid { grid-template-columns: 1fr; } }
.from-discover {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px;
  padding: 8px 8px 8px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  font-size: 13.5px;
}
.from-discover a:not(.btn) { color: var(--accent-strong); }
.share-picture { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--roll-bg); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; }
.share-by { margin: 2px 0 6px; font-size: 13.5px; }
.share-by a { color: var(--accent-strong); margin-left: 4px; }
.handle-input, .field > .handle-input { display: flex; align-items: center; gap: 0; font-size: inherit; color: inherit; font-weight: inherit; letter-spacing: normal; }
.handle-input > span { padding: 0 8px; color: var(--muted); font-weight: 600; }
.handle-input input { flex: 1; min-width: 0; }
.my-models { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.my-models li { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.my-models img { width: 80px; aspect-ratio: 4 / 3; object-fit: contain; background: var(--roll-bg); border-radius: 8px; flex: none; }
.my-model-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.my-model-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.model-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.model-card { display: grid; grid-template-columns: 132px 1fr; gap: 6px 12px; align-items: start; padding: 12px; margin: 0; }
.model-card .pat-actions { grid-column: 1 / -1; }
.model-pic { display: block; border: 1px solid var(--line); border-radius: 8px; background: var(--roll-bg); overflow: hidden; }
.model-pic img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
/* narrow screens: the top bar's buttons (account, All makers, Discover, the status) fit or wrap */
.brand, .topbar-right { min-width: 0; }
@media (max-width: 640px) {
  .account-email { display: none; }
  .topbar-right { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
}
.link-btn { border: none; background: none; padding: 0; margin-left: 6px; font: inherit; color: var(--accent-strong);
  text-decoration: underline; cursor: pointer; }

/* ---------------------------------------------------------------- Quick and Advanced (the music box) */
body.quick .advanced-only, body:not(.quick) .quick-only { display: none !important; }
.ui-mode { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ui-mode .seg { display: flex; }
.ui-mode .seg button { flex: 1; padding: 7px 11px; font-size: 14px; }
.ui-mode .hint { margin: 0 2px; }
.colours { margin-top: 6px; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px 10px; }
.color-field input[type="color"] { height: 36px; padding: 2px 4px; cursor: pointer; }
.strip-card { margin-bottom: 14px; }
.strip-card h3 { margin: 0 0 6px; }
.strip-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.notation { flex: 1 1 100%; margin: 4px 0; }
.notation > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.notation textarea { width: 100%; box-sizing: border-box; margin-top: 6px; resize: vertical; font: 13px/1.5 ui-monospace,
  SFMono-Regular, Menlo, Consolas, monospace; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: var(--panel); color: var(--ink); }
.notation textarea.bad { border-color: #c0392b; }
.notation-msg { color: #c0392b; }
.notation code { font-size: 12px; }
.compose-form { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: var(--panel-2); }
.compose-form .hint { margin: 0 0 8px; }
.compose-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.plate-stl { display: inline-flex; align-items: center; gap: 5px; margin: 0 6px 6px 0; padding: 3px 9px; font-size: 12px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none; background: var(--panel); }
.plate-stl:hover { border-color: var(--accent); }
.plate-stl i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); display: inline-block; }
#sample-pick { flex: 1 1 auto; min-width: 0; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; }
.strip-card textarea { width: 100%; resize: vertical; border: 1px solid var(--line); background: var(--panel);
  border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--ink); box-sizing: border-box; }
.strip-more { margin: 4px 0 6px; }
.strip-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.strip-more[open] > summary { margin-bottom: 6px; }
.print-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 8px; }
.print-table th, .print-table td { text-align: left; padding: 3px 4px; }
.print-table thead th { font-size: 12px; color: var(--muted); font-weight: 600; }
.print-table tbody th { font-weight: 600; white-space: nowrap; }
.print-table select { width: 100%; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px; }
.print-table select.changed { border-color: var(--accent); background: var(--accent-soft); }
