/* BadgerTech theme, shared with Lithophane Studio, the House Number Generator and friends. */
:root {
  --bg: #121416; --panel: #1a1d20; --sunk: #24282c; --fg: #e8eaeb; --muted: #9aa3a9; --line: #2d3236;
  --accent: #f0b45a; --accent-ink: #1a1d20; --accent-text: #f0b45a; --warn-bg: #3a2a12; --warn-fg: #f6d39a;
  --stage: #0c0d0f; --stage-ink: #e8eaeb; --stage-chip: #24282c; --glow: #f0b45a;
  --font-display: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
[hidden] { display: none !important; }
a, .link { color: var(--accent-text); }
.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--font-data); } .muted { color: var(--muted); }

.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1500px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-left)); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.top .home img { display: block; width: 32px; height: 32px; border-radius: 6px; }
.proj { display: flex; flex-direction: column; min-width: 0; }
.proj label { font: 11px var(--font-data); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.proj input { border: 0; background: transparent; padding: 0; font: 500 18px var(--font-display); width: 14em; max-width: 60vw; }
.steps { flex: 1 1 320px; display: flex; justify-content: center; gap: 4px; }
.steps button { border: 0; background: transparent; border-radius: 999px; padding: 8px 14px; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.steps button b { font: 500 12px var(--font-data); color: var(--muted); }
.steps button[aria-current="step"] { background: var(--fg); color: var(--bg); }
.steps button[aria-current="step"] b { color: var(--bg); }

.btn { border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 600; background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ghost { background: var(--sunk); color: var(--fg); border: 1px solid var(--line); font-weight: 500; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.danger { color: #f3a39a; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.iconbtn { width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--sunk); cursor: pointer; }

.cols { max-width: 1500px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-left)) 40px; display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.rail { flex: 1 1 300px; min-width: 0; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 20px; }
.rail > section { display: flex; flex-direction: column; gap: 10px; }
.legend { margin: 0; font: 500 11px var(--font-data); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gap6 { display: flex; gap: 6px; } .wrap { flex-wrap: wrap; } .end { justify-content: flex-end; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 112px; align-items: center; gap: 10px; }
.field { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); overflow: hidden; }
.field input, .field select { width: 100%; min-width: 0; border: 0; background: transparent; font: 500 13px var(--font-data); padding: 7px 4px 7px 8px; }
.field span { font: 12px var(--font-data); color: var(--muted); padding-right: 8px; }
.txt { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 15px; resize: vertical; }
.slider { display: grid; grid-template-columns: 90px minmax(0, 1fr) 52px; gap: 10px; align-items: center; }
.slider output { font: 12px var(--font-data); color: var(--muted); text-align: right; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.warn { background: var(--warn-bg); color: var(--warn-fg); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 0; }

.shapes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.shapes button { height: 52px; border-radius: 8px; border: 1px solid var(--line); background: var(--sunk); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.shapes button[aria-pressed="true"] { border: 2px solid var(--accent); color: var(--accent); }
.shapes svg { width: 28px; height: 28px; }

.seg { display: flex; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button { flex: 1; border: 0; border-radius: 6px; padding: 6px; background: transparent; cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--line); }

.layers { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.layers li { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); cursor: pointer; }
.layers li[aria-selected="true"] { background: var(--sunk); border: 2px solid var(--accent); padding: 7px 7px 7px 9px; }
.layers .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; border: 1px solid rgba(255,255,255,.15); }
.layers .nm { flex: 1; min-width: 0; }
.layers .nm b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers .nm span { font: 12px var(--font-data); color: var(--muted); }
.layers .tag { font: 11px var(--font-data); background: var(--line); border-radius: 4px; padding: 1px 6px; }
.layers .mini { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 4px; font-size: 13px; }
.layers .mini:hover { background: var(--line); color: var(--fg); }

.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.modes button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px; background: var(--bg); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; }
.modes button[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--sunk); }

.fontlist { margin: 0; padding: 0; list-style: none; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.fontlist li button[data-font] { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.fontlist li { display: flex; }
.fontlist li button[data-font] { flex: 1; min-width: 0; }
.fontlist li button[aria-pressed="true"] { background: var(--line); }
.fontlist .del { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 10px; font-size: 16px; }
.fontlist .del:hover { color: var(--fg); }
.fontlist .pv { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fontlist .fn { font: 11px var(--font-data); color: var(--muted); white-space: nowrap; }
.fontlist li button[aria-pressed="true"] .fn { color: var(--accent-text); }
.cats { display: flex; gap: 6px; flex-wrap: wrap; }
.cats button { font: 11px var(--font-data); padding: 4px 9px; border-radius: 999px; background: var(--sunk); border: 0; cursor: pointer; }
.cats button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatches button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches label { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 2px dashed var(--muted); display: grid; place-items: center; cursor: pointer; font-size: 16px; color: var(--muted); overflow: hidden; }
.swatches label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.slots label { display: flex; flex-direction: column; align-items: center; gap: 4px; font: 12px var(--font-data); color: var(--muted); }
.slots input[type="color"] { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 2px; cursor: pointer; }
.slotpick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.slotpick button { height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--sunk); font: 12px var(--font-data); display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; }
.slotpick button[aria-pressed="true"] { border: 2px solid var(--accent); }
.slotpick i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); }
#right .row:has(.slotpick) { grid-template-columns: 1fr; }

.stage { flex: 999 1 560px; min-width: 0; position: relative; background: var(--stage); border-radius: 12px; overflow: hidden; height: calc(100vh - 120px); min-height: 520px; max-height: 920px; }
#view { position: absolute; inset: 0; }
#view canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.chips { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.chip { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; background: var(--stage-chip); color: var(--stage-ink); border: 0; border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.seg2 { pointer-events: auto; display: flex; gap: 2px; background: var(--stage-chip); border-radius: 999px; padding: 3px; }
.seg2 button { border: 0; border-radius: 999px; padding: 5px 12px; background: transparent; color: var(--stage-ink); font-size: 13px; cursor: pointer; }
.seg2 button[aria-pressed="true"] { background: var(--glow); color: #1a1d20; }
.parts { position: absolute; left: 12px; bottom: 12px; background: #1a1d20; color: var(--stage-ink); border-radius: 10px; padding: 8px 12px; font: 12px var(--font-data); border-collapse: separate; }
.parts td, .parts th { padding: 2px 12px 2px 0; text-align: left; font-weight: 400; }
.parts th { color: #9aa3a9; }
.parts i, .sheet i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.dims { position: absolute; right: 12px; bottom: 12px; margin: 0; font: 12px var(--font-data); color: #9aa3a9; }
.busy { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa3a9; font-size: 13px; pointer-events: none; }

table.sheet { width: 100%; border-collapse: collapse; font-size: 13px; }
table.sheet th { text-align: left; font-weight: 400; color: var(--muted); padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); }
table.sheet td { font-family: var(--font-data); padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); }
ul.checks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
ul.checks li { display: flex; gap: 8px; align-items: baseline; }
ul.checks li::before { content: "✓"; font-weight: 600; color: #8fd19e; }
ul.checks li.bad::before { content: "!"; color: var(--warn-fg); }

dialog { border: 0; padding: 0; background: transparent; color: var(--fg); max-width: min(1040px, 96vw); width: 100%; }
dialog::backdrop { background: rgba(8,9,10,.8); }
.cv { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cv-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cv-head h2 { margin: 0; font: 500 20px var(--font-display); }
.cv-head .iconbtn { margin-left: auto; }
.cv-body { display: flex; flex-wrap: wrap; gap: 20px; padding: 18px; }
.cv-figs { flex: 999 1 460px; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cv-figs figure { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cv-figs figcaption { font: 500 11px var(--font-data); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cv-box { aspect-ratio: 1; border-radius: 10px; background: var(--sunk); display: grid; place-items: center; overflow: hidden; }
.cv-box canvas, .cv-box svg { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
.cv-box svg { width: 100%; height: 100%; }
.checker { background-color: #fff; background-image: linear-gradient(45deg, #eef0f0 25%, transparent 25%, transparent 75%, #eef0f0 75%), linear-gradient(45deg, #eef0f0 25%, transparent 25%, transparent 75%, #eef0f0 75%); background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.cv-side { flex: 1 1 280px; display: flex; flex-direction: column; gap: 14px; }
.cv-controls { display: flex; flex-direction: column; gap: 10px; }
.palette { display: flex; flex-direction: column; gap: 6px; }
.palette label { display: flex; align-items: center; gap: 8px; }
.palette i { width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 700px) { .stage { height: 70vh; min-height: 380px; } .shapes { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

kbd { font-family: var(--font-mono, "IBM Plex Mono", monospace); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--sunk); color: var(--fg); }
