@font-face { font-family: 'Archivo'; src: url('assets/fonts/archivo-var.woff2') format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('assets/fonts/plexmono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
/* Fonts used by the printable text, loaded only for the previews in the font picker. */
@font-face { font-family: mw-sniglet; src: url('vendor/fonts/Sniglet-ExtraBold.ttf'); font-display: swap; }
@font-face { font-family: mw-lilita; src: url('vendor/fonts/LilitaOne-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-titan; src: url('vendor/fonts/TitanOne-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-chewy; src: url('vendor/fonts/Chewy-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-luckiest; src: url('vendor/fonts/LuckiestGuy-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-bungee; src: url('vendor/fonts/Bungee-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-archivoblack; src: url('vendor/fonts/ArchivoBlack-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-alfa; src: url('vendor/fonts/AlfaSlabOne-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-silk; src: url('vendor/fonts/Silkscreen-Bold.ttf'); font-display: swap; }
@font-face { font-family: mw-leckerli; src: url('vendor/fonts/LeckerliOne-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-pacifico; src: url('vendor/fonts/Pacifico-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-lobster; src: url('vendor/fonts/Lobster-Regular.ttf'); font-display: swap; }
@font-face { font-family: mw-kaushan; src: url('vendor/fonts/KaushanScript-Regular.ttf'); font-display: swap; }

:root {
  --ink: #183443; --ink-2: #21485a; --red: #c41e33; --red-dark: #9e1628; --red-tint: #fbe8ea;
  --paper: #f1f0ec; --paper-2: #e7e5de; --line: #d9d6cc; --line-soft: #e6e3db; --white: #fff;
  --muted: #5d6a70; --soft: #86918f; --ok: #2c7a58;
  --sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif; --mono: 'Plex Mono', ui-monospace, Menlo, monospace;
  --bar: 60px; --rail: 236px; --panel: 404px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button, label.bar-btn { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #e7909c; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Header ---------------------------------------------------------------------------------- */
.bar { position: sticky; top: 0; z-index: 20; height: var(--bar); display: flex; align-items: center; gap: 14px; padding: 0 18px; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { border-radius: 8px; display: block; }
.brand-name { font-weight: 800; font-stretch: 118%; font-size: 15px; letter-spacing: -.01em; }
.product { font-weight: 500; font-stretch: 100%; font-size: 15px; color: #c8d6dd; padding-left: 14px; border-left: 1px solid #ffffff2e; }
.bar-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.bar-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid #ffffff26; background: transparent; color: #e9f0f3; font-size: 13px; font-weight: 600; }
.bar-btn:hover { background: #ffffff14; }
.account { background: #ffffff; color: var(--ink); border-color: #fff; }
.account:hover { background: #eef3f5; }
.avatar { display: none; width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; align-items: center; justify-content: center; }
.account.signed .avatar { display: inline-flex; }
.only-mobile { display: none; }

/* Layout ---------------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr) var(--panel); height: calc(100dvh - var(--bar)); min-height: 0; }
/* Desktop: the page itself never scrolls, so each column scrolls on its own. */
@media (min-width: 901px) {
  #studio:not([hidden]) { height: 100dvh; overflow: hidden; }
  /* Fixed row height: content (the 3D canvas) can never make the columns grow. */
  #studio .app { height: calc(100dvh - var(--bar)); grid-template-rows: minmax(0, 1fr); }
  #studio .app > * { min-height: 0; }
  body.in-studio { overflow: hidden; }
}
.rail { overflow-y: auto; padding: 18px 14px 30px; border-right: 1px solid var(--line); }
.rail-intro { margin: 0 4px 14px; color: var(--muted); font-size: 12.5px; }
.rail h2 { margin: 18px 4px 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.rail h2:first-child { margin-top: 0; }
.tpl { width: 100%; display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: center; padding: 6px; margin-bottom: 4px; border: 1px solid transparent; border-radius: 12px; background: none; text-align: left; }
.tpl:hover { background: #fff8; border-color: var(--line-soft); }
.tpl[aria-pressed=true] { background: #fff; border-color: var(--ink); box-shadow: 0 1px 0 var(--line); }
.tpl .thumb { width: 72px; height: 54px; border-radius: 9px; background: var(--paper-2); object-fit: contain; padding: 3px; display: block; }
.tpl strong { display: block; font-size: 13px; font-weight: 700; line-height: 1.25; }
.tpl small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.tpl .badge { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 6px; background: var(--paper-2); font-size: 10px; font-weight: 600; color: var(--muted); vertical-align: 1px; }

.stage { position: relative; min-width: 0; padding: 14px; }
#viewer { position: relative; height: 100%; border-radius: 18px; overflow: hidden; contain: strict; background: radial-gradient(120% 90% at 30% 10%, #2a5264 0%, #183443 55%, #10232d 100%); }
#viewer canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.view-tools { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 6px; z-index: 2; }
.view-tools button { min-height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid #ffffff2a; background: #0f222cb3; backdrop-filter: blur(6px); color: #e8f0f3; font-size: 12px; font-weight: 600; }
.view-tools button:hover { background: #183443; }
.view-tools button[aria-pressed=true] { background: #fff; color: var(--ink); border-color: #fff; }
.readout { position: absolute; left: 16px; bottom: 14px; right: 16px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; color: #d7e3e8; font-size: 12px; pointer-events: none; }
.readout .dims { font-family: var(--mono); font-size: 12px; color: #fff; }
.filaments { position: absolute; right: 16px; top: 58px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.filaments span { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px 4px 5px; border-radius: 20px; background: #0f222cb3; color: #e8f0f3; font-size: 11.5px; backdrop-filter: blur(6px); }
.filaments i { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px #0003; display: block; }
.filaments .weight { font-family: var(--mono); }
.toast { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); z-index: 3; width: min(460px, calc(100% - 28px)); margin: 0; padding: 12px 14px; border-radius: 12px; background: #fff; color: var(--red-dark); border-left: 4px solid var(--red); font-size: 13px; box-shadow: 0 10px 30px #0006; }

/* Panel ----------------------------------------------------------------------------------- */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--white); border-left: 1px solid var(--line); }
.panel-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 20px 22px 12px; }
.panel-head h1 { margin: 0; font-size: 23px; line-height: 1.1; font-weight: 800; font-stretch: 122%; letter-spacing: -.02em; }
.panel-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; max-width: 34ch; }
.link { border: 0; background: none; color: var(--red); font-weight: 600; font-size: 12.5px; padding: 6px 0; white-space: nowrap; }
.link:hover { color: var(--red-dark); text-decoration: underline; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 14px 12px; background: var(--paper); border-bottom: 1px solid var(--line); position: relative; }
.steps button { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; text-align: left; font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.steps button:hover { border-color: #9aa7ac; }
.steps button span { display: grid; line-height: 1.2; }
.steps small { font-size: 10.5px; font-weight: 500; color: var(--muted); }
.steps b { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--paper-2); font-size: 12px; color: var(--ink); }
.steps [aria-selected=true] { border-color: var(--red); box-shadow: 0 0 0 3px #c41e3322; color: var(--ink); }
.steps [aria-selected=true] b { background: var(--red); color: #fff; }
.next-step { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 0 6px; }
.next-step .btn { gap: 10px; }
@media (max-width: 1180px) { .steps small { display: none; } }
.panes { flex: 1; overflow-y: auto; padding: 6px 22px 26px; scrollbar-gutter: stable; }
.group { padding: 16px 0 6px; border-bottom: 1px solid var(--line-soft); }
.group:last-child { border-bottom: 0; }
.group > h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; font-stretch: 110%; }
details.group > summary { cursor: pointer; list-style: none; font-size: 14px; font-weight: 700; font-stretch: 110%; display: flex; justify-content: space-between; margin-bottom: 4px; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::after { content: '+'; font-weight: 500; color: var(--muted); }
details.group[open] > summary::after { content: '–'; }
.group-note { font-size: 12px; color: var(--muted); margin: 6px 0 12px; }
.field { margin-bottom: 16px; }
.field > .label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.hint { margin: 6px 0 0; font-size: 11.5px; color: var(--soft); }
.text-input { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fbfaf7; font-size: 17px; font-weight: 600; }
.text-input:focus { border-color: var(--ink); background: #fff; outline: none; box-shadow: 0 0 0 3px #18344318; }
.symbols { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.symbols button { width: 31px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 15px; line-height: 1; }
.symbols button:hover { border-color: var(--ink); }

/* Sliders: number input for precision, range for feel. */
.range { display: grid; grid-template-columns: 1fr 76px; gap: 10px; align-items: center; }
.range input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 0; }
.range input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--red) var(--p, 50%), var(--paper-2) var(--p, 50%)); }
.range input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--paper-2); }
.range input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--red); }
.range input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; border: 2px solid var(--red); box-shadow: 0 1px 3px #0003; }
.range input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--red); }
.num { position: relative; }
.num input { width: 100%; min-height: 34px; padding: 4px 26px 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fbfaf7; font-family: var(--mono); font-size: 12.5px; text-align: right; -moz-appearance: textfield; }
.num input::-webkit-inner-spin-button { -webkit-appearance: none; }
.num span { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 10.5px; color: var(--soft); pointer-events: none; font-family: var(--mono); }
.num input:invalid { border-color: var(--red); color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.chips button:hover { border-color: #9aa7ac; }
.chips button[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: #fff; }

.fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fonts button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px 7px; border: 1px solid var(--line); border-radius: 11px; background: #fff; text-align: left; overflow: hidden; }
.fonts button span { font-size: 21px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fonts button small { font-size: 11px; color: var(--muted); }
.fonts button[aria-pressed=true] { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: var(--red-tint); }

.shapes h4 { margin: 12px 0 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.shapes h4:first-child { margin-top: 0; }
.shape-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 5px; }
.shape-grid button { aspect-ratio: 1; display: grid; place-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.shape-grid button:hover { border-color: #9aa7ac; }
.shape-grid button[aria-pressed=true] { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: var(--red-tint); }
.shape-grid svg { width: 100%; height: 100%; }
.shape-grid .none { font-size: 10.5px; font-weight: 600; color: var(--muted); line-height: 1.1; text-align: center; }
.shape-name { font-weight: 500; color: var(--muted); }

.dropzone { display: grid; gap: 8px; padding: 16px; border: 1.5px dashed #b9b5aa; border-radius: 14px; background: #fbfaf7; text-align: center; }
.dropzone.over { border-color: var(--red); background: var(--red-tint); }
.dropzone p { margin: 0; font-size: 12px; color: var(--muted); }
.dropzone .file { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: #9aa7ac; }
.btn.primary, .primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover, .primary:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }
.row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#crop-canvas { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: repeating-conic-gradient(#e8e6df 0 25%, #fff 0 50%) 0 0/16px 16px; touch-action: none; cursor: crosshair; display: block; }
.crop-bar { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 14px; font-size: 12px; color: var(--muted); }

.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }

/* Colours */
.palettes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.palettes button { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 11.5px; font-weight: 600; text-align: left; }
.palettes button:hover { border-color: #9aa7ac; }
.palettes .dots { display: flex; }
.palettes .dots i { width: 18px; height: 18px; border-radius: 50%; margin-right: -4px; border: 2px solid #fff; box-shadow: 0 0 0 1px #0002; }
.color-row { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: #fff; }
.color-row > button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: none; text-align: left; font-weight: 600; font-size: 13px; }
.color-row > button i { width: 28px; height: 28px; border-radius: 8px; box-shadow: inset 0 0 0 1px #0002; }
.color-row > button small { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 12px; }
.swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; padding: 2px 12px 12px; }
.swatches button { aspect-ratio: 1; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px #0002; padding: 0; }
.swatches button[aria-pressed=true] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--red); }
.swatches label { position: relative; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(#f44, #fd4, #4d6, #4bf, #84f, #f4a, #f44); cursor: pointer; }
.swatches label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Rings */
.ring-hint { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: 10px; margin: 0; padding: 7px 8px 7px 12px; border-radius: 999px; background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 600; box-shadow: 0 8px 24px #0005; white-space: nowrap; }
.ring-hint .dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--red); }
.ring-hint button { border: 0; border-radius: 999px; background: var(--paper-2); padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer; }
.ring-tip { margin: 2px 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--red-tint); color: var(--red-dark); font-size: 12.5px; line-height: 1.45; }
.ring-row { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.ring-row.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ring-name { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 0; background: none; font-size: 12.5px; font-weight: 600; text-align: left; cursor: pointer; }
.ring-name i { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--red); flex: none; }
.ring-name small { margin-left: auto; color: var(--muted); font-weight: 500; }
.ring-x { width: 40px; border: 0; border-left: 1px solid var(--line-soft); background: none; font-size: 18px; color: var(--muted); cursor: pointer; border-radius: 0 10px 10px 0; }
.ring-x:hover { color: var(--red); background: var(--red-tint); }
details.exact { margin-top: 12px; }
details.exact summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 0; }
details.exact[open] summary { margin-bottom: 8px; }
.ring-list { display: grid; gap: 6px; margin: 10px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.select { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf7; }

.export { padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
.export-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.export-row button { min-height: 46px; padding: 0 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-weight: 700; font-size: 13.5px; }
.export-row .primary { font-size: 15px; background: var(--red); border-color: var(--red); color: #fff; }
.export-row .primary:hover:not(:disabled) { background: var(--red-dark); }
.export-row button:disabled { opacity: .45; cursor: progress; }
#print-note { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }

/* Projects sheet */
.sheet { width: min(560px, calc(100% - 24px)); max-height: 86svh; padding: 0; border: 0; border-radius: 20px; color: var(--ink); box-shadow: 0 30px 80px #0f222c66; }
.sheet::backdrop { background: #18344388; backdrop-filter: blur(4px); }
.sheet header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; background: var(--ink); color: #fff; }
.sheet h2 { margin: 0; font-size: 20px; font-weight: 800; font-stretch: 120%; }
.sheet .close { width: 40px; height: 40px; border: 0; border-radius: 10px; background: #ffffff1c; color: #fff; font-size: 24px; }
.sheet-body { padding: 18px 22px 22px; overflow: auto; max-height: calc(86svh - 76px); }
.save-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.save-row input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.save-row button { min-height: 44px; padding: 0 16px; border-radius: 10px; font-weight: 700; border: 0; }
.sheet-status { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.project-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.project-list li { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.project-list img, .project-list .ph { width: 76px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--paper-2); }
.project-list strong { display: block; font-size: 14px; }
.project-list small { color: var(--muted); font-size: 12px; }
.project-list .acts { display: flex; gap: 6px; }
.project-list .acts button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-weight: 600; font-size: 12.5px; }

/* Responsive ------------------------------------------------------------------------------ */
@media (max-width: 1180px) { :root { --rail: 200px; --panel: 370px; } .tpl { grid-template-columns: 1fr; } .tpl .thumb { width: 100%; height: 76px; } }
@media (max-width: 900px) {
  .app { display: block; height: auto; }
  .only-mobile { display: inline-flex; }
  .product { display: none; }
  .bar { padding: 0 10px; gap: 8px; }
  .bar-btn.tools { font-size: 0; gap: 0; padding: 0 10px; } .bar-btn.tools span[aria-hidden] { font-size: 16px; }
  .rail { position: fixed; z-index: 30; inset: var(--bar) 0 0 0; background: var(--paper); border: 0; transform: translateX(-100%); transition: transform .22s ease; }
  .rail.open { transform: none; }
  .rail #templates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .rail #templates h2 { grid-column: 1 / -1; }
  .stage { padding: 8px; }
  #viewer { height: 56svh; min-height: 330px; }
  .panel { border: 0; }
  .panes { overflow: visible; padding: 0 16px 24px; }
  .panel-head { padding: 16px 16px 10px; }
  .steps { position: sticky; top: var(--bar); z-index: 5; padding: 8px 10px; }
  .export { position: sticky; bottom: 0; z-index: 6; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 20px #18344314; }
  .filaments { top: auto; bottom: 44px; }
}
@media (max-width: 420px) { .brand-name { display: none; } .bar-btn { padding: 0 10px; } .palettes { grid-template-columns: 1fr 1fr; } .swatches { grid-template-columns: repeat(8, 1fr); } }
.cloud-out { display: grid; gap: 10px; justify-items: start; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.cloud-out p, .local p { margin: 0; font-size: 13px; color: var(--muted); }
.local { display: grid; gap: 10px; padding-top: 16px; }
.local h3 { margin: 0; font-size: 14px; font-weight: 700; font-stretch: 110%; }
.local .row { justify-content: flex-start; }
#cloud-in { padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }

/* Boot and welcome ---------------------------------------------------------------------- */
.boot { display: none; }
body.checking .boot { display: grid; place-items: center; position: fixed; inset: 0; background: var(--ink); z-index: 50; }
body.checking .boot img { border-radius: 14px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.94); } }
body.rail-open { overflow: hidden; }
.welcome { min-height: 100dvh; background: var(--paper); }
.w-bar { display: flex; align-items: center; gap: 14px; height: var(--bar); padding: 0 clamp(16px, 4vw, 48px); background: var(--ink); color: #fff; }
.w-bar .account { margin-left: auto; }
.w-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: center; padding: clamp(28px, 6vw, 72px) clamp(16px, 4vw, 48px) clamp(24px, 4vw, 48px); background: var(--ink); color: #fff; }
.w-eyebrow { margin: 0 0 16px; font-size: 12px; font-weight: 600; color: #c8d6dd; }
.w-hero h1 { margin: 0; font-size: clamp(32px, 4.6vw, 58px); line-height: 1.02; font-weight: 800; font-stretch: 118%; letter-spacing: -.03em; max-width: 13ch; }
.w-lead { margin: 20px 0 0; font-size: clamp(15px, 1.4vw, 17px); line-height: 1.55; color: #d7e3e8; max-width: 46ch; }
.w-cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 28px; }
.btn.big { min-height: 50px; padding: 0 22px; font-size: 15px; font-weight: 700; border-radius: 12px; }
.w-cta .btn:not(.primary) { background: transparent; color: #fff; border-color: #ffffff55; }
.w-cta .btn:not(.primary):hover { background: #ffffff14; }
.w-cta .link { color: #fff; }
.w-note { margin: 14px 0 0; font-size: 12.5px; color: #aebfc7; }
.w-show { position: relative; }
.plate { position: relative; aspect-ratio: 5 / 4; border-radius: 22px; background: #b39462 url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2280%22 height=%2280%22><filter id=%22n%22><feTurbulence baseFrequency=%221.6%22 numOctaves=%222%22/><feColorMatrix values=%220 0 0 0 .95 0 0 0 0 .87 0 0 0 0 .7 0 0 0 .55 -.2%22/></filter><rect width=%2280%22 height=%2280%22 filter=%22url(%23n)%22/></svg>'); box-shadow: inset 0 0 0 6px #3b3f44, 0 30px 60px #0007; overflow: hidden; }
.plate img { position: absolute; width: 46%; filter: drop-shadow(0 10px 10px #0005); }
.plate .s1 { left: 4%; top: 6%; transform: rotate(-6deg); }
.plate .s2 { right: 4%; top: 4%; width: 40%; }
.plate .s3 { left: 6%; bottom: 8%; transform: rotate(4deg); }
.plate .s4 { right: 2%; bottom: 22%; width: 48%; transform: rotate(-3deg); }
.plate .s5 { left: 30%; top: 40%; width: 34%; }
.w-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.w-facts div { background: var(--paper); padding: 22px clamp(16px, 2vw, 28px); display: grid; gap: 6px; }
.w-facts b { font-size: 26px; font-weight: 800; font-stretch: 118%; color: var(--red); letter-spacing: -.02em; }
.w-facts span { font-size: 13px; color: var(--muted); line-height: 1.45; }
.w-steps { padding: clamp(28px, 4vw, 48px) clamp(16px, 4vw, 48px); }
.w-steps h2 { margin: 0 0 16px; font-size: 22px; font-weight: 800; font-stretch: 118%; }
.w-steps ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: s; }
.w-steps li { counter-increment: s; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; font-size: 14px; color: var(--ink-2); }
.w-steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: 13px; margin-right: 10px; }
.w-foot { display: flex; justify-content: space-between; padding: 18px clamp(16px, 4vw, 48px) 28px; font-size: 13px; color: var(--muted); }
.w-foot a { color: var(--red); font-weight: 600; }
#status[data-kind=busy]::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #f7d154; animation: pulse 1s infinite; }
#status[data-kind=error] { color: #ffb4bd; }
@media (max-width: 900px) {
  .w-hero { grid-template-columns: 1fr; }
  .w-show { order: -1; }
  .w-facts { grid-template-columns: 1fr 1fr; }
  .w-steps ol { grid-template-columns: 1fr; }
  .w-bar .product { display: none; }
}

.loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; background: #0f222ccc; color: #fff; font-size: 13px; font-weight: 600; backdrop-filter: blur(6px); }
.loading span { width: 16px; height: 16px; border-radius: 50%; border: 3px solid #ffffff44; border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ring-strength { margin: 14px 0 4px; padding: 12px 12px 2px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf7; }
.ring-strength h4 { margin: 0 0 10px; font-size: 12.5px; font-weight: 700; }
.field.mini { margin-bottom: 12px; }
.mini-val { font-family: var(--mono); font-size: 11.5px; color: var(--muted); font-weight: 500; }
.range.one { grid-template-columns: 1fr; }
.export-sub { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }
.export-sub .link { font-size: 11.5px; padding: 0; }
.export-sub .link:disabled { opacity: .45; }
.objects { display: grid; gap: 10px; }
.obj-row { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf7; }
.obj-row strong { font-size: 13px; }
.obj-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.obj-color { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 11.5px; cursor: pointer; }
.obj-color input { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.hinge-list .field { margin-bottom: 8px; }
.hinge-list .field > .label { font-family: var(--mono); font-size: 12px; }
.brush-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin: 8px 0 4px; font-size: 12px; color: var(--muted); }
.brush-row input { accent-color: var(--red); }
#crop-canvas { margin-top: 8px; }

/* Drawing editor */
.painter { width: min(1180px, 96vw); height: min(860px, 94dvh); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 18px; color: var(--ink); display: none; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px #0f222c88; }
.painter[open] { display: flex; }
.painter::backdrop { background: #10232dcc; backdrop-filter: blur(3px); }
.pt-head { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 20px; background: var(--ink); color: #fff; flex-wrap: wrap; }
.pt-head h2 { margin: 0; font-size: 18px; font-weight: 800; font-stretch: 118%; }
.pt-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }
.pt-tools button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid #ffffff33; background: #ffffff12; color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pt-tools button[aria-pressed=true] { background: #fff; color: var(--ink); }
.pt-tools button:disabled { opacity: .4; cursor: default; }
.pt-tools button i { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 1.5px #00000066, 0 0 0 3px #ffffffaa; }
.pt-size { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; margin-left: 6px; }
.pt-size input { width: 130px; accent-color: var(--red); }
.pt-size output { font-family: var(--mono); font-size: 11.5px; min-width: 44px; }
.pt-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.pt-check input { width: 16px; height: 16px; accent-color: var(--red); }
.pt-sep { flex: 1; }
.pt-head .close { width: 38px; height: 38px; border: 0; border-radius: 10px; background: #ffffff1c; color: #fff; font-size: 22px; cursor: pointer; }
.pt-stage { position: relative; flex: 1; overflow: auto; display: flex; padding: 12px; scrollbar-gutter: stable; background: repeating-conic-gradient(#e8e6df 0 25%, #f6f5f1 0 50%) 0 0/18px 18px; }
.pt-view { display: block; margin: auto; flex: none; image-rendering: auto; touch-action: none; cursor: none; box-shadow: 0 6px 24px #18344333; }
.pt-cursor { position: fixed; z-index: 10; pointer-events: none; border-radius: 50%; border: 2px solid #c41e33; box-shadow: 0 0 0 1px #fff, inset 0 0 0 1px #fff; transform: translate(-50%, -50%); }
.pt-cursor.soft::after { content: ''; position: absolute; left: 50%; top: 50%; width: var(--core); height: var(--core); transform: translate(-50%, -50%); border-radius: 50%; border: 1.5px dashed #c41e33; }
.pt-badge { position: fixed; z-index: 11; left: 50%; bottom: 90px; transform: translateX(-50%); padding: 7px 12px; border-radius: 999px; background: #183443; color: #fff; font: 600 12.5px var(--sans); box-shadow: 0 6px 18px #0005; pointer-events: none; }
.pt-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fff; }
.pt-foot p { margin: 0; flex: 1; font-size: 12px; color: var(--muted); }
@media (max-width: 700px) { .pt-foot p { display: none; } .pt-size input { width: 90px; } }
.edit-drawing { width: 100%; margin: 4px 0 14px; }
.mini-frame { position: absolute; right: 14px; bottom: 44px; width: 200px; height: 150px; z-index: 2; pointer-events: none; border-radius: 3px; box-shadow: 0 0 0 2px #fff, 0 8px 22px #0006; }
.mini-frame span { position: absolute; left: 8px; top: 6px; font-size: 10.5px; font-weight: 700; color: var(--ink); background: #ffffffcc; padding: 1px 6px; border-radius: 6px; }
.tpl .thumb.missing { background: var(--paper-2) url('assets/makerwolf-logo.svg') center/28px no-repeat; opacity: .6; }
.zones { margin: 6px 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf7; }
.zones h4 { margin: 0 0 4px; font-size: 13px; font-weight: 700; }
.zone-list { display: grid; gap: 6px; margin: 8px 0; }
.zone-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding-left: 8px; }
.zone-row b { font-family: var(--mono); font-size: 12px; }
.zone-row input { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.zone-row span { flex: 1; font-size: 12.5px; font-weight: 600; }
.zones .btn[aria-pressed=true] { border-color: var(--red); color: var(--red); background: var(--red-tint); }
.sheet-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px 22px 0; }
.sheet-tabs button { min-height: 40px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-weight: 700; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.sheet-tabs [aria-selected=true] { border-color: var(--red); background: var(--red-tint); color: var(--ink); }
.history-list li { grid-template-columns: 76px 1fr; }
.history-list .acts { grid-column: 1 / -1; flex-wrap: wrap; }
.fmt { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 6px; background: var(--ink); color: #fff; font: 600 10.5px var(--mono); vertical-align: 1px; }
.history-list .acts .again { border-color: var(--red); color: var(--red); }

/* Feedback box */
.bar-btn { position: relative; }
.bar-badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font: 700 10.5px/18px var(--mono); text-align: center; }
.fb-intro { margin: 0 0 14px; font-size: 13.5px; color: var(--ink-2); }
.fb-field { display: grid; gap: 6px; margin: 14px 0 10px; font-size: 13px; font-weight: 700; }
.fb-field textarea { width: 100%; box-sizing: border-box; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: 14px/1.45 var(--sans); color: var(--ink); resize: vertical; min-height: 120px; }
.fb-field textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.fb-field small { justify-self: end; font: 500 11px var(--mono); color: var(--muted); }
.fb-check { display: flex; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.fb-check input { width: 16px; height: 16px; accent-color: var(--red); }
#fb-filter { margin-bottom: 10px; }
.fb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fb-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; background: #fff; }
.fb-item.is-new { border-color: var(--red); box-shadow: 0 0 0 2px #c41e3318; }
.fb-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--muted); }
.fb-type { padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 11.5px; color: #fff; background: var(--ink); }
.fb-type.bug { background: var(--red); } .fb-type.idea { background: #2462c9; }
.fb-msg { margin: 0; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.fb-item img { max-width: 160px; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.fb-item img.big { max-width: 100%; cursor: zoom-out; }
.fb-ctx { font: 11px/1.4 var(--mono); color: var(--muted); }
.fb-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fb-acts select, .fb-note { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: 12.5px var(--sans); background: #fff; }
.fb-note { width: 100%; box-sizing: border-box; }
.fb-acts button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: 600 12px var(--sans); cursor: pointer; }
.fb-acts button.danger { color: var(--red); border-color: #c41e3355; }
.bar-btn.suggest { border: 1.5px solid #f7d154; color: #fff4c8; background: #f7d1541c; }
.bar-btn.suggest:hover { background: #f7d15433; border-color: #ffe27a; color: #fff; }
@media (max-width: 560px) { .bar-btn.suggest { padding: 0 10px; font-size: 0; gap: 0; } .bar-btn.suggest span[aria-hidden] { font-size: 16px; } }
.field.mini .straighten { justify-self: start; margin: 4px 0 0; font-size: 12.5px; }
a.bar-btn { text-decoration: none; }
@media (max-width: 520px) { .bar-actions { gap: 4px; } .bar-btn { padding: 0 9px; white-space: nowrap; } .bar-btn.account .account-label { display: none; } }
