:root {
  --ink: #192022;
  --paper: #f5f0e6;
  --canvas: #e8e1d5;
  --lime: #c9ff3b;
  --coral: #fb704f;
  --line: #c9c0b1;
  --muted: #6d716d;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: linear-gradient(135deg, #f9f5ed 0%, #eee6d8 100%); }
button, input, select, textarea { font: inherit; }
button, select, input, textarea { accent-color: var(--ink); }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 10; transform: translateY(-160%); padding: .75rem 1rem; color: var(--paper); background: var(--ink); border-radius: 8px; }
.skip-link:focus { transform: none; }
.studio-shell { max-width: 1680px; margin: 0 auto; padding: 18px clamp(16px, 3vw, 44px) 36px; }
.studio-header { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding: 0 0 17px; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--ink); font-size: 1.05rem; font-weight: 950; letter-spacing: .18em; text-decoration: none; }
.wordmark span { color: var(--coral); font-size: .54em; vertical-align: top; letter-spacing: 0; }
.crumbs { display: flex; gap: .55rem; align-items: center; color: var(--muted); font-size: .86rem; }
.crumbs b { color: var(--line); font-weight: 500; }
.crumbs strong { color: var(--ink); font-weight: 700; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .65rem; }
.header-actions select { min-height: 44px; max-width: 150px; padding: .5rem; color: var(--ink); background: #fffdf8; border: 1px solid var(--line); border-radius: 9px; font-size: .76rem; font-weight: 800; }
.draft-state { color: var(--muted); font: 700 .74rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: .4rem; border: 1px solid transparent; border-radius: 9px; padding: .6rem .9rem; font-size: .86rem; font-weight: 800; }
.button-primary { color: var(--ink); background: var(--lime); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.button-primary:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.button-quiet { color: var(--ink); background: transparent; border-color: var(--line); }
.button-quiet:hover { background: #ede5d8; border-color: var(--ink); }
.studio-titlebar { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: clamp(30px, 5vw, 58px) 0 26px; }
.eyebrow, .panel-kicker { margin: 0; color: var(--muted); font: 800 .67rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .13em; text-transform: uppercase; }
h1 { max-width: 780px; margin: .65rem 0 0; font: 900 clamp(2rem, 4vw, 4.6rem)/.91 Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif; letter-spacing: -.045em; text-transform: uppercase; }
.title-meta { display: flex; align-items: center; gap: .45rem; padding-bottom: .45rem; color: var(--muted); font-size: .82rem; font-weight: 750; white-space: nowrap; }
.method-dot { display: inline-block; width: .65rem; height: .65rem; background: var(--lime); border: 1px solid var(--ink); border-radius: 50%; }
.studio-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr) 292px; gap: 16px; align-items: start; }
.left-rail, .right-rail { display: grid; gap: 16px; }
.panel { overflow: hidden; background: color-mix(in srgb, var(--paper) 86%, white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 0 rgba(25, 32, 34, .04); }
.tool-panel, .layer-panel, .inspector, .zone-panel, .zone-import, .designable-product, .store-content { padding: 16px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 13px; }
.panel-heading > span { color: var(--muted); font: 700 .7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.tool-stack { display: grid; gap: 8px; margin-top: 12px; }
.tool-button { display: flex; min-height: 52px; align-items: center; gap: .7rem; padding: .55rem .7rem; color: var(--ink); text-align: left; background: transparent; border: 1px solid var(--line); border-radius: 10px; font-weight: 800; }
.tool-button:hover { background: var(--lime); border-color: var(--ink); }
.tool-button:disabled { cursor: not-allowed; opacity: .55; }
.tool-mark { display: grid; width: 28px; height: 28px; place-items: center; color: var(--paper); background: var(--ink); border-radius: 6px; font: 900 1rem/1 Georgia, serif; }
.layer-list { display: grid; gap: 5px; max-height: 275px; overflow: auto; }
.layer-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 32px; align-items: center; gap: 7px; width: 100%; min-height: 48px; padding: 6px; color: var(--ink); text-align: left; background: transparent; border: 1px solid transparent; border-radius: 9px; }
.layer-row:hover, .layer-row.is-active { background: #e8e1d4; border-color: var(--ink); }
.layer-icon { display: grid; width: 25px; height: 25px; place-items: center; color: var(--paper); background: var(--ink); border-radius: 5px; font: 800 .75rem/1 Georgia, serif; }
.layer-copy { min-width: 0; display: grid; gap: 2px; }
.layer-copy strong, .layer-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-copy strong { font-size: .75rem; }
.layer-copy small { color: var(--muted); font-size: .65rem; }
.layer-lock { color: var(--muted); text-align: center; font-size: .84rem; }
.layer-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.icon-button { min-height: 42px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 8px; font-weight: 900; }
.icon-button:hover { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.icon-button.danger:hover { color: var(--ink); background: var(--coral); }
.history-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; padding: 0; background: var(--line); }
.history-panel .button { border: 0; border-radius: 0; background: var(--paper); }
.history-panel .button:disabled { color: #a9a9a2; cursor: not-allowed; }
.workbench { min-width: 0; overflow: hidden; background: var(--ink); border: 1px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 rgba(25, 32, 34, .14); }
.canvas-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; background: var(--ink); }
.view-tabs { display: flex; gap: 4px; }
.view-tab { min-height: 38px; padding: .45rem .7rem; color: #bfc1ba; background: transparent; border: 1px solid transparent; border-radius: 7px; font-size: .74rem; font-weight: 800; }
.view-tab:hover, .view-tab.is-active { color: var(--ink); background: var(--paper); }
.canvas-toolbar .button { min-height: 38px; color: var(--paper); border-color: #485052; }
.canvas-toolbar .button:hover { color: var(--ink); background: var(--lime); border-color: var(--lime); }
.canvas-stage { position: relative; display: grid; min-height: 590px; place-items: center; overflow: auto; background-color: var(--canvas); background-image: linear-gradient(45deg, rgba(25, 32, 34, .03) 25%, transparent 25%), linear-gradient(-45deg, rgba(25, 32, 34, .03) 25%, transparent 25%); background-size: 18px 18px; }
.canvas-stage canvas { max-width: 100%; }
.canvas-hint { position: absolute; right: 14px; bottom: 12px; margin: 0; padding: .42rem .6rem; color: var(--paper); background: rgba(25, 32, 34, .88); border-radius: 6px; font-size: .68rem; pointer-events: none; }
.canvas-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 18px; padding: .75rem 13px; color: #c8c9c2; background: var(--ink); font-size: .7rem; }
.canvas-footer b { color: var(--paper); }
.schematic-note { color: var(--lime); font-weight: 800; }
.safe-key { display: inline-flex; gap: .35rem; align-items: center; }
.safe-key i { width: 16px; height: 10px; border: 1px dashed var(--lime); }
.empty-selection { margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.5; }
.selection-controls[hidden], .empty-selection[hidden], .text-only[hidden] { display: none; }
.selection-controls { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: .68rem; font-weight: 800; }
.field > span { letter-spacing: .04em; text-transform: uppercase; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: .5rem .55rem; color: var(--ink); background: #fffdf8; border: 1px solid var(--line); border-radius: 7px; font-size: .86rem; font-weight: 650; }
.field textarea { resize: vertical; }
.field input[type="color"] { min-height: 40px; padding: 3px; cursor: pointer; }
.field input[type="range"] { min-height: auto; padding: 0; }
.field output { color: var(--ink); font: 700 .67rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.switch-row { display: grid; grid-template-columns: auto 1fr; gap: 3px 9px; align-items: center; padding: 9px; background: #ece5d9; border-radius: 8px; font-size: .81rem; font-weight: 800; }
.switch-row input { width: 18px; height: 18px; margin: 0; grid-row: span 2; }
.switch-row small { color: var(--muted); font-size: .65rem; font-weight: 600; }
.slot-box { display: grid; gap: 9px; padding-top: 2px; border-top: 1px dashed var(--line); }
.slot-controls { opacity: .45; pointer-events: none; }
.slot-box.is-enabled .slot-controls { opacity: 1; pointer-events: auto; }
.text-button { padding: 0; color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--ink); font-size: .73rem; font-weight: 800; }
.text-button[aria-pressed="true"] { color: var(--coral); border-color: var(--coral); }
.zone-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.zone-actions .button { min-height: 42px; font-size: .73rem; }
.zone-note { margin: 12px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.45; }
.zone-import form { display: grid; gap: 10px; }
.zone-import textarea { min-height: 152px; font: .72rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.zone-import-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.zone-import-actions .button { min-height: 42px; font-size: .73rem; }
.zone-set-editor { display: grid; gap: 10px; margin: 12px 0 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.zone-set-editor legend { padding: 0 4px; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.designable-product form { display: grid; gap: 10px; }
.store-content form { display: grid; gap: 10px; }
.size-helper { display: grid; gap: 9px; margin: 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.size-helper legend { padding: 0 4px; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.size-helper-context { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.size-helper-ranges { display: grid; gap: 8px; }
.size-helper-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 8px; background: #ece5d9; border-radius: 8px; }
.size-helper-row-label { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .7rem; font-weight: 800; }
.size-helper-row .button { min-height: 40px; padding: .45rem .65rem; font-size: .72rem; }
.field-note { display: block; min-height: 1em; color: var(--coral); font-size: .72rem; font-weight: 700; }
.method-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.method-options legend { padding: 0 4px; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.method-options label { min-height: 32px; display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 800; }
.method-options input { width: 18px; height: 18px; margin: 0; }
.toast { position: fixed; z-index: 20; right: 18px; bottom: 18px; max-width: min(360px, calc(100vw - 36px)); padding: .78rem .9rem; color: var(--paper); background: var(--ink); border: 1px solid #455052; border-radius: 9px; box-shadow: 4px 4px 0 var(--coral); font-size: .78rem; font-weight: 700; transform: translateY(150%); transition: transform .2s ease; }
.toast.is-visible { transform: none; }

@media (max-width: 1160px) {
  .studio-grid { grid-template-columns: 188px minmax(0, 1fr); }
  .right-rail { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .studio-shell { padding: 13px 12px 24px; }
  .studio-header { grid-template-columns: 1fr auto; gap: 10px; }
  .crumbs { display: none; }
  .header-actions { grid-column: 1 / -1; justify-content: stretch; }
  .header-actions .draft-state { margin-right: auto; }
  .studio-titlebar { align-items: start; flex-direction: column; padding: 30px 0 20px; }
  h1 { font-size: clamp(2.25rem, 13vw, 4rem); }
  .studio-grid { grid-template-columns: 1fr; }
  .left-rail { grid-template-columns: 1fr 1fr; }
  .tool-panel { grid-column: 1 / -1; }
  .tool-stack { grid-template-columns: 1fr 1fr; }
  .history-panel { align-self: stretch; }
  .canvas-stage { min-height: 480px; justify-content: start; }
  .right-rail { grid-column: auto; grid-template-columns: 1fr; }
  .canvas-toolbar { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .button-primary:hover { transform: none; box-shadow: 3px 3px 0 var(--ink); } .toast { transition: none; } }
