    :root {
      /* Tinted-neutral workbench ramp, single terracotta accent (OKLCH). */
      --page: oklch(0.934 0.010 87);
      --panel: oklch(0.985 0.004 91);
      --panel-strong: oklch(1.000 0 90);
      --workbench: oklch(0.876 0.006 95);
      --board: oklch(0.973 0.008 91);
      --ink: oklch(0.253 0.006 78);
      --muted: oklch(0.517 0.014 75);
      --faint: oklch(0.643 0.017 77);
      --line: oklch(0.866 0.015 81);
      --line-strong: oklch(0.779 0.019 78);
      --accent: oklch(0.522 0.137 39);
      --accent-strong: oklch(0.440 0.119 37);
      --accent-soft: oklch(0.920 0.026 48);
      --success: oklch(0.511 0.089 161);
      --danger: oklch(0.524 0.157 24);
      --focus: oklch(0.477 0.114 251);
      --shadow: 0 18px 50px rgba(52, 45, 36, .12);
      --radius-lg: 18px;
      --radius-md: 12px;
      --radius-sm: 8px;
      --topbar-h: 64px;
      --status-h: 34px;
      --ruler-size: 28px;
      color: var(--ink);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
      font-synthesis: none;
    }

    * { box-sizing: border-box; }

    [hidden] { display: none !important; }

    html, body { height: 100%; }

    body {
      margin: 0;
      background: var(--page);
      color: var(--ink);
      overflow: hidden;
    }

    button, input, select { font: inherit; }

    button, select, input[type="number"], input[type="search"] {
      min-height: 38px;
    }

    button {
      border: 0;
      cursor: pointer;
    }

    button:disabled {
      cursor: not-allowed;
      opacity: .45;
    }

    :focus-visible {
      outline: 3px solid color-mix(in srgb, var(--focus) 78%, white);
      outline-offset: 2px;
    }

    .skip-link {
      position: fixed;
      z-index: 1000;
      top: 8px;
      left: 8px;
      padding: 10px 14px;
      color: white;
      background: var(--ink);
      border-radius: 8px;
      transform: translateY(-150%);
    }

    .skip-link:focus { transform: translateY(0); }

    .visually-hidden {
      position: absolute !important;
      width: 1px !important;
      height: 1px !important;
      padding: 0 !important;
      margin: -1px !important;
      overflow: hidden !important;
      clip: rect(0 0 0 0) !important;
      white-space: nowrap !important;
      border: 0 !important;
    }

    .app-shell {
      display: grid;
      grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--status-h);
      height: 100dvh;
      min-height: 520px;
    }

    .topbar {
      position: relative;
      z-index: 20;
      display: flex;
      align-items: center;
      gap: 18px;
      min-width: 0;
      padding: 0 18px;
      background: rgba(251, 250, 247, .96);
      border-bottom: 1px solid var(--line);
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      flex: 0 0 auto;
    }

    .brand-mark {
      display: grid;
      grid-template-columns: repeat(3, 7px);
      gap: 3px;
      padding: 8px;
      background: var(--ink);
      border-radius: 11px;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
    }

    .brand-mark i {
      display: block;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--accent-soft);
    }

    .brand-mark i:nth-child(2),
    .brand-mark i:nth-child(4),
    .brand-mark i:nth-child(6),
    .brand-mark i:nth-child(8) { background: #dc6b55; }

    .brand-copy { line-height: 1.05; }
    .brand-copy strong { display: block; margin: 0; font: inherit; font-size: 15px; font-weight: 700; letter-spacing: .04em; }
    .brand-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }

    .project-meta {
      flex: 1 1 180px;
      min-width: 0;
      max-width: min(42vw, 520px);
      padding-left: 18px;
      border-left: 1px solid var(--line);
    }

    .project-meta strong,
    .project-meta span {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .project-meta strong { font-size: 13px; }
    .project-meta span { margin-top: 3px; color: var(--muted); font-size: 11px; }

    .top-actions {
      display: flex;
      align-items: center;
      flex: 0 0 auto;
      gap: 8px;
      margin-left: auto;
    }

    .language-switcher {
      display: inline-flex;
      align-items: center;
      gap: 2px;
      padding: 3px;
      background: #eeeae3;
      border: 1px solid rgba(111,102,91,.12);
      border-radius: 10px;
    }

    .language-switcher > span { color: var(--faint); font-size: 10px; }
    .language-switcher button {
      min-width: 28px;
      min-height: 44px;
      padding: 5px 6px;
      color: var(--muted);
      background: transparent;
      border-radius: 7px;
      font-size: 10px;
      font-weight: 760;
    }
    .language-switcher button[aria-pressed="true"] {
      color: var(--ink);
      background: white;
      box-shadow: 0 2px 7px rgba(46,40,33,.08);
    }

    .button,
    .icon-button,
    .tool-button,
    .preset-button,
    .size-mode-button,
    .board-layout-button,
    .segment-button,
    .toggle-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      color: var(--ink);
      background: var(--panel-strong);
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      transition: background-color 150ms ease, border-color 150ms ease,
        color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
    }

    .button { padding: 9px 13px; font-size: 12px; font-weight: 680; }
    .button.primary { color: white; background: var(--accent); border-color: var(--accent); }
    .button.secondary { background: transparent; }
    .button.danger { color: var(--danger); }
    .button.wide { width: 100%; }
    .button.compact { padding: 7px 10px; min-height: 34px; }

    .icon-button {
      width: 38px;
      min-width: 38px;
      height: 38px;
      padding: 0;
      font-size: 17px;
    }

    .icon-button span { line-height: 1; }

    @media (hover: hover) and (pointer: fine) {
      .button:hover:not(:disabled),
      .icon-button:hover:not(:disabled),
      .tool-button:hover:not(:disabled),
      .preset-button:hover:not(:disabled),
      .size-mode-button:hover:not(:disabled),
      .board-layout-button:hover:not(:disabled),
      .segment-button:hover:not(:disabled),
      .toggle-button:hover:not(:disabled) {
        background: #f2eee7;
        border-color: var(--line-strong);
      }

      .button.primary:hover:not(:disabled) {
        color: white;
        background: var(--accent-strong);
        border-color: var(--accent-strong);
      }
    }

    .button:active:not(:disabled),
    .icon-button:active:not(:disabled),
    .tool-button:active:not(:disabled),
    .preset-button:active:not(:disabled),
    .size-mode-button:active:not(:disabled),
    .board-layout-button:active:not(:disabled),
    .segment-button:active:not(:disabled),
    .toggle-button:active:not(:disabled) { transform: translateY(1px); }

    .top-divider { width: 1px; height: 24px; margin: 0 2px; background: var(--line); }

    .zoom-control {
      display: flex;
      align-items: center;
      gap: 3px;
      padding: 3px;
      background: #eeeae3;
      border-radius: 10px;
    }

    .zoom-control .icon-button {
      width: 31px;
      min-width: 31px;
      height: 31px;
      min-height: 31px;
      border: 0;
      background: transparent;
    }

    .zoom-value { min-width: 48px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; }

    .workspace {
      display: grid;
      grid-template-columns: clamp(252px, 21vw, 304px) minmax(320px, 1fr) clamp(276px, 23vw, 336px);
      min-height: 0;
    }

    .side-panel {
      min-width: 0;
      overflow: auto;
      background: var(--panel);
      scrollbar-color: #bdb5aa transparent;
      scrollbar-width: thin;
    }

    .side-panel::-webkit-scrollbar,
    .canvas-viewport::-webkit-scrollbar { width: 10px; height: 10px; }

    .side-panel::-webkit-scrollbar-thumb,
    .canvas-viewport::-webkit-scrollbar-thumb {
      background: #bdb5aa;
      border: 3px solid transparent;
      border-radius: 999px;
      background-clip: padding-box;
    }

    .side-panel::-webkit-scrollbar-corner,
    .canvas-viewport::-webkit-scrollbar-corner { background: transparent; }

    .panel-left { border-right: 1px solid var(--line); }
    .panel-right { border-left: 1px solid var(--line); }

    .mobile-sheet-head { display: none; }

    .panel-section {
      padding: 17px 16px 18px;
      border-bottom: 1px solid var(--line);
    }

    .panel-section:last-child { border-bottom: 0; }

    .section-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 13px;
    }

    .section-head h2,
    .section-head h3 {
      margin: 0;
      font-size: 12px;
      letter-spacing: .05em;
    }

    .section-head small { color: var(--faint); font-size: 10px; }

    .dropzone {
      display: grid;
      place-items: center;
      min-height: 122px;
      padding: 18px;
      color: var(--muted);
      background:
        radial-gradient(circle at 8px 8px, rgba(36,34,31,.07) 1.4px, transparent 1.5px) 0 0 / 16px 16px,
        #f4f0e9;
      border: 1px dashed var(--line-strong);
      border-radius: var(--radius-md);
      text-align: center;
      cursor: pointer;
      transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
    }

    .dropzone.is-dragging {
      background-color: var(--accent-soft);
      border-color: var(--accent);
      transform: translateY(-1px);
    }

    .dropzone strong { display: block; color: var(--ink); font-size: 13px; }
    .dropzone span { display: block; max-width: 190px; margin-top: 7px; font-size: 11px; line-height: 1.5; }

    .drop-icon {
      display: grid;
      place-items: center;
      width: 40px;
      height: 40px;
      margin: 0 auto 10px;
      color: var(--accent);
      background: white;
      border: 1px solid var(--line);
      border-radius: 50%;
      box-shadow: 0 6px 14px rgba(60, 48, 39, .08);
      font-size: 19px;
    }

    .file-meta {
      display: flex;
      align-items: center;
      gap: 9px;
      min-width: 0;
      margin-top: 10px;
      padding: 9px 10px;
      background: #f2eee7;
      border-radius: 9px;
    }

    .file-meta .thumb {
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      width: 30px;
      height: 30px;
      color: white;
      background: var(--success);
      border-radius: 7px;
      font-size: 11px;
      font-weight: 800;
    }

    .file-meta div { min-width: 0; }
    .file-meta strong, .file-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .file-meta strong { font-size: 11px; }
    .file-meta span { margin-top: 2px; color: var(--muted); font-size: 10px; }

    .detail-advice {
      margin-top: 10px;
      padding: 12px;
      background: #fff8e8;
      border: 1px solid #e6d09b;
      border-left: 4px solid #b97824;
      border-radius: 10px;
    }

    .detail-advice[data-level="ok"] {
      background: #edf7f1;
      border-color: #b8d9c6;
      border-left-color: var(--success);
    }

    .advice-kicker {
      display: block;
      color: #8b591a;
      font-size: 9px;
      font-weight: 800;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .detail-advice[data-level="ok"] .advice-kicker { color: var(--success); }
    .detail-advice strong { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; }
    .detail-advice p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

    .smart-card {
      margin-top: 10px;
      padding: 12px;
      background: linear-gradient(145deg, #fff8f2, #f6eee7);
      border: 1px solid #e7c9bb;
      border-left: 4px solid var(--accent);
      border-radius: 10px;
    }

    .smart-card .smart-kicker { display: block; color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .08em; }
    .smart-card strong { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; }
    .smart-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
    .smart-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 9px; }
    .smart-steps span { padding: 5px 4px; color: #6d554a; background: rgba(255,255,255,.72); border: 1px solid rgba(176,77,41,.13); border-radius: 7px; text-align: center; font-size: 9px; }
    .smart-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
    .smart-actions #smartGenerateBtn { grid-column: 1 / -1; }
    .smart-actions #restoreFullImageBtn { grid-column: 1 / -1; }
    .smart-actions .button { min-width: 0; padding-inline: 7px; font-size: 10px; }

    .advanced-settings { margin-top: 12px; border-top: 1px solid var(--line); }
    .advanced-settings > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 750; list-style: none; }
    .advanced-settings > summary::-webkit-details-marker { display: none; }
    .advanced-settings > summary::after { content: "+"; color: var(--accent); font-size: 15px; font-weight: 500; }
    .advanced-settings[open] > summary::after { content: "−"; }
    .advanced-settings > summary span { color: var(--faint); font-size: 9px; font-weight: 500; }
    .advanced-body { padding-bottom: 2px; }
    .check-row { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; padding: 9px 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
    .check-row input { flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--accent); }
    .check-row b, .check-row small { display: block; }
    .check-row b { color: var(--ink); font-size: 10px; }
    .check-row small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.45; }

    .advice-metrics {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
      margin-top: 9px;
    }

    .advice-metrics span {
      padding: 7px 8px;
      color: var(--muted);
      background: rgba(255,255,255,.72);
      border: 1px solid rgba(143,104,42,.15);
      border-radius: 7px;
      font-size: 9px;
      line-height: 1.35;
    }

    .advice-metrics b { display: block; margin-bottom: 2px; color: var(--ink); font-size: 10px; }
    .advice-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
    .advice-actions .button { min-width: 0; padding-inline: 7px; font-size: 10px; }

    .field { margin-top: 12px; }
    .field:first-child { margin-top: 0; }

    .field-label {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 7px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 650;
    }

    .field-label output { color: var(--ink); font-variant-numeric: tabular-nums; }

    .field-note {
      display: block;
      margin-top: 5px;
      color: var(--muted);
      font-size: 9px;
      line-height: 1.55;
    }

    select,
    input[type="number"],
    input[type="search"] {
      width: 100%;
      padding: 8px 10px;
      color: var(--ink);
      background: white;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
    }

    input[type="range"] {
      width: 100%;
      height: 4px;
      margin: 8px 0;
      accent-color: var(--accent);
    }

    .two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }

    .preset-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 6px;
      margin-top: 10px;
    }

    .preset-button { min-height: 33px; padding: 5px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
    .preset-grid .preset-button:last-child { grid-column: 2; }
    .preset-button[aria-pressed="true"] { color: var(--accent-strong); background: var(--accent-soft); border-color: #d8a997; }

    .size-mode-tabs {
      display: grid;
      grid-template-columns: repeat(2,minmax(0,1fr));
      gap: 6px;
      margin-bottom: 10px;
      padding: 4px;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      background: #f4f1eb;
    }

    .size-mode-button {
      min-height: 36px;
      padding: 6px 8px;
      color: var(--muted);
      font-size: 11px;
      background: transparent;
      border-color: transparent;
    }

    .size-mode-button[aria-pressed="true"] {
      color: var(--ink);
      background: #fff;
      border-color: var(--line);
      box-shadow: 0 1px 3px rgba(28,25,21,.08);
    }

    .board-config {
      display: grid;
      gap: 9px;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      background: #faf8f4;
    }

    .board-layout-grid {
      display: grid;
      grid-template-columns: repeat(3,minmax(0,1fr));
      gap: 6px;
    }

    .board-layout-button {
      min-height: 34px;
      padding: 5px;
      color: var(--muted);
      font-size: 10px;
    }

    .board-layout-button[aria-pressed="true"] {
      color: var(--accent-strong);
      background: var(--accent-soft);
      border-color: #d8a997;
    }

    .board-summary {
      padding: 9px 10px;
      border-left: 3px solid var(--accent);
      border-radius: 4px;
      color: var(--muted);
      background: #f4eee7;
      font-size: 10px;
      line-height: 1.55;
    }

    .board-summary strong { display:block; margin-bottom:2px; color:var(--ink); font-size:11px; }
    .board-config[hidden], #patternSizeControls[hidden] { display:none !important; }

    .tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }

    .tool-button {
      flex-direction: column;
      min-height: 58px;
      padding: 8px 5px;
      color: var(--muted);
      font-size: 10px;
    }

    .tool-button b { color: currentColor; font-size: 16px; font-weight: 650; line-height: 1; }
    .tool-button[aria-pressed="true"] { color: var(--accent-strong); background: var(--accent-soft); border-color: #d8a997; }

    .selected-color {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 10px;
      padding: 9px 10px;
      background: #f2eee7;
      border-radius: 9px;
    }

    .selected-color .bead {
      flex: 0 0 auto;
      width: 27px;
      height: 27px;
      border: 1px solid rgba(0,0,0,.16);
      border-radius: 50%;
      box-shadow: inset 4px 4px 6px rgba(255,255,255,.45), inset -3px -3px 5px rgba(0,0,0,.12);
    }

    .selected-color strong, .selected-color span { display: block; }
    .selected-color strong { font-size: 11px; }
    .selected-color span { margin-top: 2px; color: var(--muted); font-size: 10px; }

    .button-row { display: flex; gap: 7px; margin-top: 10px; }
    .button-row > * { flex: 1 1 0; }

    .stage-panel {
      position: relative;
      display: grid;
      grid-template-rows: 48px max-content minmax(0, 1fr) max-content max-content;
      min-width: 0;
      min-height: 0;
      background: var(--workbench);
    }

    .stage-toolbar {
      position: relative;
      z-index: 4;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      min-width: 0;
      padding: 7px 12px;
      background: rgba(236, 233, 226, .94);
      border-bottom: 1px solid rgba(103, 94, 83, .18);
      backdrop-filter: blur(10px);
    }

    .stage-quality-banner { display: none; }
    .stage-toolbar { grid-row: 1; }
    .stage-quality-banner { grid-row: 2; }
    .canvas-viewport { grid-row: 3; }
    .pattern-ready-bar, .making-assistant { grid-row: 4; }
    .legend-strip { grid-row: 5; }

    .segmented, .view-toggles {
      display: flex;
      align-items: center;
      gap: 3px;
      padding: 3px;
      background: rgba(255,255,255,.55);
      border: 1px solid rgba(111,102,91,.14);
      border-radius: 10px;
    }

    .segment-button, .toggle-button {
      min-height: 31px;
      padding: 6px 10px;
      color: var(--muted);
      background: transparent;
      border-color: transparent;
      font-size: 10px;
      font-weight: 650;
    }

    .segment-button[aria-pressed="true"],
    .toggle-button[aria-pressed="true"] {
      color: var(--ink);
      background: white;
      border-color: var(--line);
      box-shadow: 0 2px 7px rgba(46, 40, 33, .08);
    }

    .canvas-viewport {
      position: relative;
      min-width: 0;
      min-height: 0;
      overflow: auto;
      background:
        radial-gradient(circle at 10px 10px, rgba(64,61,55,.12) 1.2px, transparent 1.3px) 0 0 / 20px 20px,
        var(--workbench);
      scrollbar-color: #9f988e transparent;
      scrollbar-width: thin;
    }

    .canvas-center {
      display: flex;
      align-items: center;
      justify-content: center;
      width: max-content;
      min-width: 100%;
      height: max-content;
      min-height: 100%;
      padding: 42px;
    }

    .board-shell {
      position: relative;
      display: grid;
      grid-template-columns: var(--ruler-size) auto;
      grid-template-rows: var(--ruler-size) auto;
      flex: 0 0 auto;
      padding: 10px;
      background: #ebe7de;
      border: 1px solid rgba(80,70,60,.24);
      border-radius: 14px;
      box-shadow: 0 16px 45px rgba(54,48,41,.18), inset 0 1px 0 rgba(255,255,255,.85);
    }

    .board-shell::before {
      content: "";
      position: absolute;
      inset: 4px;
      pointer-events: none;
      border: 1px solid rgba(70,63,56,.12);
      border-radius: 10px;
    }

    .board-shell.rulers-hidden {
      grid-template-columns: 0 auto;
      grid-template-rows: 0 auto;
    }

    .board-shell.rulers-hidden .ruler,
    .board-shell.rulers-hidden .ruler-corner { display: none; }

    .ruler-corner {
      grid-column: 1;
      grid-row: 1;
      background: #ece8df;
      border-right: 1px solid var(--line-strong);
      border-bottom: 1px solid var(--line-strong);
    }

    .ruler-top { grid-column: 2; grid-row: 1; }
    .ruler-left { grid-column: 1; grid-row: 2; }

    .ruler {
      display: block;
      background: #f3efe7;
    }

    .canvas-stack {
      position: relative;
      grid-column: 2;
      grid-row: 2;
      overflow: hidden;
      background: var(--board);
      box-shadow: 0 0 0 1px var(--line-strong);
      isolation: isolate;
    }

    .canvas-stack canvas {
      position: absolute;
      inset: 0;
      display: block;
    }

    #patternCanvas {
      z-index: 2;
      cursor: crosshair;
      touch-action: none;
    }

    #referenceCanvas { z-index: 1; }

    .empty-state {
      position: absolute;
      z-index: 3;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 28px;
      pointer-events: none;
    }

    .empty-card {
      width: min(560px, calc(100% - 28px));
      padding: 25px;
      background: rgba(251, 250, 247, .94);
      border: 1px solid rgba(105,95,83,.2);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow);
      text-align: center;
      pointer-events: auto;
    }

    .empty-beads {
      display: flex;
      justify-content: center;
      gap: 6px;
      margin-bottom: 15px;
    }

    .empty-beads i {
      width: 17px;
      height: 17px;
      border-radius: 50%;
      box-shadow: inset 3px 3px 4px rgba(255,255,255,.5), inset -2px -2px 4px rgba(0,0,0,.12);
    }

    .empty-card h2 { margin: 0; font-size: clamp(20px, 3vw, 28px); letter-spacing: -.03em; }
    .empty-card p { margin: 10px auto 16px; color: var(--muted); font-size: 12px; line-height: 1.7; }
    .empty-card .privacy-note { margin-top: 12px; color: var(--faint); font-size: 10px; }

    .onboarding-card { text-align: left; }
    .onboarding-card .empty-beads { justify-content: flex-start; }
    .onboarding-card .hero-text { max-width: 46ch; margin-inline: 0; }
    .hero-flow {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 7px;
      margin: 0 0 16px;
      padding: 0;
      list-style: none;
      counter-reset: hero-step;
    }
    .hero-flow li {
      position: relative;
      min-width: 0;
      padding: 27px 7px 8px;
      color: var(--muted);
      background: #f2eee7;
      border: 1px solid var(--line);
      border-radius: 10px;
      font-size: 9px;
      font-weight: 700;
      line-height: 1.35;
      text-align: center;
      overflow-wrap: anywhere;
      counter-increment: hero-step;
    }
    .hero-flow li::before {
      content: counter(hero-step);
      position: absolute;
      top: 6px;
      left: 50%;
      display: grid;
      place-items: center;
      width: 17px;
      height: 17px;
      color: white;
      background: var(--accent);
      border-radius: 50%;
      font-size: 9px;
      transform: translateX(-50%);
    }
    .hero-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .hero-actions .button { min-width: 0; min-height: 44px; padding-inline: 8px; text-align: center; overflow-wrap: anywhere; }
    .hero-promises { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
    .hero-promises span {
      padding: 4px 7px;
      color: #3f6650;
      background: #e8f2eb;
      border-radius: 999px;
      font-size: 9px;
      font-weight: 700;
    }

    .pattern-ready-bar {
      display: grid;
      grid-template-columns: minmax(150px, .55fr) minmax(420px, 1.45fr);
      align-items: center;
      gap: 12px;
      min-width: 0;
      padding: 8px 12px;
      background: #f8f4ec;
      border-top: 1px solid rgba(103,94,83,.15);
    }
    .pattern-ready-bar[hidden] { display: none; }
    .ready-copy { min-width: 0; }
    .ready-copy strong, .ready-copy span { display: block; }
    .ready-copy strong { font-size: 11px; }
    .ready-copy span { margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.35; }
    .ready-primary-actions { display: grid; grid-template-columns: .9fr .9fr 1.55fr .65fr 1fr; min-width: 0; gap: 6px; }
    .ready-primary-actions .button { min-width: 0; padding: 7px 9px; font-size: 10px; overflow-wrap: anywhere; }
    .ready-community-links { display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 10px; white-space: nowrap; }
    .ready-community-links a { color: var(--muted); font-size: 9px; font-weight: 700; text-decoration: none; }
    .ready-community-links a:hover { color: var(--accent); text-decoration: underline; }

    .making-assistant {
      --making-progress: 0%;
      display: grid;
      grid-template-columns: minmax(150px,.75fr) minmax(110px,1fr) minmax(175px,.85fr);
      align-items: center;
      gap: 12px;
      min-width: 0;
      padding: 9px 12px;
      background: linear-gradient(90deg,#f8efe7 0%,#f6f1e9 55%,#eef4ef 100%);
      border-top: 1px solid rgba(103,94,83,.17);
      box-shadow: 0 -7px 22px rgba(72,55,38,.05);
    }
    .making-assistant[hidden] { display: none; }
    .making-progress-copy { min-width: 0; }
    .making-progress-copy > span, .making-progress-copy > strong { display: block; }
    .making-kicker { color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
    .making-progress-copy strong { margin-top: 2px; font-size: 11px; }
    #makingProgressText { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
    .making-progress-track { position: relative; height: 9px; overflow: hidden; background: rgba(61,65,58,.12); border-radius: 99px; }
    .making-progress-track i { position: absolute; inset: 0 auto 0 0; width: var(--making-progress); background: linear-gradient(90deg,var(--accent),#47775c); border-radius: inherit; transition: width 180ms ease; }
    .making-focus { display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: center; gap: 8px; min-width: 0; }
    .making-focus > span:last-child, .making-focus strong, .making-focus small { display: block; min-width: 0; }
    .making-focus strong, .making-focus small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .making-focus strong { font-size: 11px; }
    .making-focus small { margin-top: 2px; color: var(--muted); font-size: 9px; }
    .making-swatch { width: 32px; height: 32px; border: 2px solid white; border-radius: 10px; box-shadow: 0 0 0 1px rgba(51,45,39,.2),0 4px 11px rgba(44,38,32,.11); }
    .making-actions { display: flex; grid-column: 1 / -1; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; min-width: 0; }
    .making-actions .button { white-space: normal; }

    .text-button { min-height: 30px; padding: 4px 6px; color: var(--accent); background: transparent; border-color: transparent; font-size: 9px; font-weight: 800; }
    .text-button:hover { background: var(--accent-soft); }

    .legend-strip {
      display: flex;
      align-items: center;
      gap: 8px;
      min-height: 46px;
      padding: 8px 12px;
      overflow-x: auto;
      background: rgba(251,250,247,.92);
      border-top: 1px solid rgba(103,94,83,.15);
      scrollbar-width: thin;
    }

    .legend-label { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-weight: 700; }

    .legend-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      flex: 0 0 auto;
      padding: 5px 8px 5px 5px;
      color: var(--muted);
      background: white;
      border: 1px solid var(--line);
      border-radius: 999px;
      font-size: 9px;
    }

    .legend-chip i, .stat-swatch {
      display: inline-block;
      width: 17px;
      height: 17px;
      border: 1px solid rgba(0,0,0,.15);
      border-radius: 50%;
    }

    .palette-tools {
      display: flex;
      gap: 7px;
      margin-bottom: 10px;
    }

    .palette-tools input { min-width: 0; }

    .palette-mode {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 5px;
      margin-bottom: 8px;
    }

    .palette-series {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 5px;
      margin-bottom: 9px;
    }

    .palette-series button {
      min-height: 30px;
      padding: 4px 2px;
      color: var(--muted);
      background: var(--surface-soft);
      border: 1px solid var(--line);
      border-radius: 8px;
      font-size: 10px;
      font-weight: 800;
    }

    .palette-series button[aria-pressed="true"] {
      color: var(--accent-strong);
      background: var(--accent-soft);
      border-color: #d8a997;
    }

    .palette-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 6px;
    }

    .palette-color {
      position: relative;
      display: grid;
      justify-items: center;
      gap: 5px;
      min-width: 0;
      min-height: 66px;
      padding: 8px 3px 6px;
      color: var(--muted);
      background: transparent;
      border: 1px solid transparent;
      border-radius: 10px;
    }

    .palette-color .color-bead {
      position: relative;
      width: 29px;
      height: 29px;
      border: 1px solid rgba(0,0,0,.18);
      border-radius: 50%;
      box-shadow: inset 5px 5px 7px rgba(255,255,255,.42), inset -3px -3px 6px rgba(0,0,0,.14);
    }

    .palette-color .color-bead.is-transparent {
      background-color: #fff !important;
      background-image: linear-gradient(45deg,#d9d9d9 25%,transparent 25%),linear-gradient(-45deg,#d9d9d9 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d9d9d9 75%),linear-gradient(-45deg,transparent 75%,#d9d9d9 75%) !important;
      background-position: 0 0,0 5px,5px -5px,-5px 0 !important;
      background-size: 10px 10px !important;
    }

    .palette-color .color-bead::after {
      content: "";
      position: absolute;
      inset: 10px;
      background: rgba(251,250,247,.82);
      border: 1px solid rgba(0,0,0,.13);
      border-radius: 50%;
    }

    .palette-color b {
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 9px;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    .palette-color[aria-pressed="true"] {
      color: var(--accent-strong);
      background: var(--accent-soft);
      border-color: #d8a997;
    }

    .palette-color[aria-pressed="true"]::after {
      content: "✓";
      position: absolute;
      top: 4px;
      right: 5px;
      display: grid;
      place-items: center;
      width: 16px;
      height: 16px;
      color: white;
      background: var(--accent);
      border-radius: 50%;
      font-size: 9px;
      font-weight: 900;
    }

    .palette-note {
      margin: 10px 0 0;
      color: var(--faint);
      font-size: 9px;
      line-height: 1.55;
    }

    .stats-summary {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 7px;
      margin-bottom: 11px;
    }

    .summary-item {
      min-width: 0;
      padding: 10px 7px;
      background: #f2eee7;
      border-radius: 9px;
      text-align: center;
    }

    .summary-item strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-variant-numeric: tabular-nums; }
    .summary-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }

    .stats-list { display: grid; gap: 5px; }

    .stat-row {
      position: relative;
      display: grid;
      grid-template-columns: minmax(0,1fr) 30px;
      align-items: center;
      gap: 4px;
      padding: 3px 4px;
      border: 1px solid transparent;
      border-radius: 8px;
      overflow: hidden;
    }

    .stat-row:nth-child(odd) { background: #f4f1eb; }
    .stat-bar {
      position: absolute;
      inset: 0 auto 0 0;
      width: var(--share, 0%);
      background: rgba(169, 71, 38, 0.09);
      border-right: 1px solid rgba(169, 71, 38, 0.22);
      pointer-events: none;
    }
    .stat-row.is-focused { background: var(--accent-soft); border-color: rgba(181,72,39,.35); }
    .stat-row.is-complete { background: #edf3ee; }
    .stat-focus { position: relative; z-index: 1; display: grid; grid-template-columns: 24px minmax(0,1fr) auto; align-items: center; gap: 8px; min-width: 0; padding: 4px; color: inherit; background: transparent; border: 0; border-radius: 6px; text-align: left; }
    .stat-focus:hover { background: rgba(255,255,255,.6); }
    .stat-done { position: relative; z-index: 1; display: grid; place-items: center; width: 30px; min-width: 30px; height: 30px; padding: 0; color: var(--muted); background: rgba(255,255,255,.7); border: 1px solid var(--line); border-radius: 8px; font-size: 15px; font-weight: 900; }
    .stat-done[aria-pressed="true"] { color: #38644d; background: #dbeade; border-color: #92b49d; }
    .stat-copy { min-width: 0; }
    .stat-copy strong, .stat-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .stat-copy strong { font-size: 10px; }
    .stat-copy span { margin-top: 2px; color: var(--muted); font-size: 9px; }
    .stat-count { color: var(--ink); font-size: 11px; font-weight: 760; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .stat-percent { margin-left: 5px; color: var(--faint); font-size: 9px; font-style: normal; font-weight: 640; font-variant-numeric: tabular-nums; }

    .section-head-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
    .section-head-actions .head-action { margin-left: 0; }

    .head-action {
      flex: none;
      align-self: center;
      margin-left: auto;
      padding: 4px 9px;
      color: var(--ink);
      background: var(--panel-strong);
      border: 1px solid var(--line-strong);
      border-radius: 7px;
      font-size: 10px;
      font-weight: 720;
      line-height: 1.4;
      cursor: pointer;
    }
    .head-action:hover { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
    .head-action:active { transform: translateY(1px); }

    .empty-list {
      padding: 22px 12px;
      color: var(--muted);
      background: #f4f1eb;
      border-radius: 10px;
      font-size: 10px;
      line-height: 1.6;
      text-align: center;
    }

    .statusbar {
      position: relative;
      z-index: 30;
      display: flex;
      align-items: center;
      gap: 11px;
      min-width: 0;
      padding: 0 14px;
      color: var(--muted);
      background: var(--ink);
      font-size: 10px;
    }

    .statusbar span { white-space: nowrap; }
    .statusbar .status-message { min-width: 0; margin-left: auto; overflow: hidden; color: #ddd7cf; text-overflow: ellipsis; }
    .status-dot { width: 7px; height: 7px; background: #77b68f; border-radius: 50%; }

    .convert-overlay {
      position: fixed;
      z-index: 200;
      inset: 0;
      display: none;
      place-items: center;
      padding: 20px;
      background: rgba(37, 34, 30, .34);
      backdrop-filter: blur(4px);
    }

    .convert-overlay.is-visible { display: grid; }

    .progress-card {
      width: min(360px, 100%);
      padding: 23px;
      background: var(--panel);
      border: 1px solid rgba(255,255,255,.65);
      border-radius: 16px;
      box-shadow: var(--shadow);
    }

    .progress-top { display: flex; align-items: center; gap: 12px; }
    .spinner { width: 24px; height: 24px; border: 3px solid #ded7cd; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
    .progress-card strong { display: block; font-size: 13px; }
    .progress-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
    .progress-card .button { margin-top: 15px; }

    @keyframes spin { to { transform: rotate(360deg); } }

    .toast {
      position: fixed;
      z-index: 300;
      right: 18px;
      bottom: 50px;
      max-width: min(390px, calc(100vw - 36px));
      padding: 11px 14px;
      color: white;
      background: var(--ink);
      border-radius: 10px;
      box-shadow: var(--shadow);
      font-size: 11px;
      line-height: 1.5;
      opacity: 0;
      transform: translateY(12px);
      pointer-events: none;
      transition: opacity 160ms ease, transform 160ms ease;
    }

    .toast.is-visible { opacity: 1; transform: translateY(0); }
    .toast[data-type="error"] { background: var(--danger); }
    .toast[data-type="success"] { background: var(--success); }

    .share-dialog {
      width: min(820px, calc(100vw - 28px));
      max-height: min(90dvh, 820px);
      padding: 0;
      overflow: hidden;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 18px;
      box-shadow: 0 30px 90px rgba(39,34,28,.32);
    }
    .share-dialog::backdrop { background: rgba(34,31,27,.42); backdrop-filter: blur(4px); }
    .share-dialog-head, .share-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; }
    .share-dialog-head { border-bottom: 1px solid var(--line); }
    .share-dialog-head strong, .share-dialog-head span { display: block; }
    .share-dialog-head strong { margin-top: 2px; font-size: 14px; }
    .share-dialog-kicker { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
    .share-dialog-body { padding: 14px; overflow: auto; }
    .share-dialog-body > p { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.55; }
    .share-format-field { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 11px; font-weight: 700; }
    .share-format-field select { flex: 1 1 auto; min-width: 0; }
    .share-preview-frame { display: grid; place-items: center; min-height: 240px; padding: 12px; overflow: auto; background: #e8e4dc; border-radius: 12px; }
    .share-preview-frame canvas { display: block; width: auto; max-width: 100%; max-height: min(55dvh, 520px); background: white; box-shadow: 0 10px 35px rgba(43,38,32,.18); }
    .share-dialog-foot { justify-content: flex-end; border-top: 1px solid var(--line); }

    .mobile-dock, .mobile-scrim { display: none; }

    .print-sheet { display: none; }
    .print-pages canvas { display: block; width: 100%; height: auto; background: white; }

    @media (max-width: 1180px) {
      .workspace { grid-template-columns: 238px minmax(300px, 1fr) 266px; }
      .brand-copy span, .project-meta { display: none; }
      .brand-copy strong { font-size: 13px; }
      .palette-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .topbar { gap: 10px; padding-inline: 12px; }
      .pattern-ready-bar { grid-template-columns: minmax(0, 1fr); }
      .ready-copy, .ready-community-links { display: none; }
      .ready-primary-actions { grid-template-columns: 1fr 1fr; }
      .making-assistant { grid-template-columns: minmax(150px,.8fr) minmax(100px,1fr) minmax(170px,.9fr); }
      .making-actions { grid-column: 1 / -1; justify-content: flex-end; }
    }

    @media (max-width: 959px) {
      :root { --topbar-h: 58px; --status-h: 30px; }
      body { overflow: hidden; }
      .app-shell { padding-bottom: 58px; }
      .workspace { display: block; min-height: 0; }
      .stage-panel { height: 100%; grid-template-rows: max-content max-content minmax(0, 1fr) max-content max-content; }
      .stage-toolbar { grid-row: 1; }
      .stage-quality-banner { grid-row: 2; }
      .canvas-viewport { grid-row: 3; }
      .pattern-ready-bar, .making-assistant { grid-row: 4; }
      .legend-strip { grid-row: 5; }
      .stage-quality-banner:not([hidden]) {
        position: relative;
        z-index: 3;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 8px 10px;
        color: #5d3a10;
        background: #fff4d8;
        border-bottom: 1px solid #dfc481;
      }
      .stage-quality-banner div { min-width: 0; }
      .stage-quality-banner strong, .stage-quality-banner span { display: block; }
      .stage-quality-banner strong { font-size: 11px; }
      .stage-quality-banner span { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
      .stage-quality-banner .button { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; font-size: 10px; }
      .canvas-center { padding: 28px; }
      .topbar { padding-inline: 10px; }
      .brand-copy { display: none; }
      .top-actions .top-hide-mobile, .top-divider, .zoom-control { display: none; }
      .top-actions { gap: 5px; }
      .language-switcher button { min-width: 26px; min-height: 44px; padding: 0 4px; }
      .button, .button.compact, .preset-button, .size-mode-button, .board-layout-button, .tool-button, .segment-button, .toggle-button, .palette-series button { min-height: 44px; }
      .icon-button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
      .toggle-button { min-width: 44px; }
      select, input[type="number"], input[type="search"] { min-height: 44px; }
      input[type="range"] { height: 44px; margin-block: 0; }
      .product-links a { display: inline-flex; align-items: center; min-height: 44px; padding-block: 8px; }
      .statusbar .release-links { display: none; }
      .stage-quality-banner .button { min-height: 44px; }
      .crop-fields input { min-height: 44px; }
      .side-panel {
        position: fixed;
        z-index: 120;
        right: 8px;
        bottom: calc(62px + env(safe-area-inset-bottom));
        left: 8px;
        max-height: min(70dvh, 650px);
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 17px;
        box-shadow: 0 24px 70px rgba(39,34,28,.28);
        transform: translateY(calc(100% + 90px));
        transition: transform 180ms ease;
      }
      .side-panel[data-mobile-open="true"] { transform: translateY(0); }
      .mobile-sheet-head {
        position: sticky;
        z-index: 2;
        top: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 50px;
        padding: 8px 12px;
        background: rgba(251,250,247,.96);
        border-bottom: 1px solid var(--line);
        backdrop-filter: blur(10px);
      }
      .mobile-sheet-head strong { font-size: 12px; }
      .mobile-scrim {
        position: fixed;
        z-index: 110;
        inset: 0;
        display: block;
        background: rgba(36,34,31,.28);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
      }
      .mobile-scrim.is-visible { opacity: 1; pointer-events: auto; }
      .mobile-dock {
        position: fixed;
        z-index: 150;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        min-height: calc(58px + env(safe-area-inset-bottom));
        padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
        background: rgba(251,250,247,.97);
        border-top: 1px solid var(--line);
        backdrop-filter: blur(12px);
      }
      .mobile-dock button {
        display: grid;
        place-items: center;
        gap: 1px;
        min-height: 46px;
        color: var(--muted);
        background: transparent;
        border-radius: 8px;
        font-size: 9px;
      }
      .mobile-dock button b { color: var(--ink); font-size: 16px; line-height: 1; }
      .mobile-dock button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
      .statusbar { padding-inline: 10px; }
      .statusbar span:nth-child(4), .statusbar span:nth-child(5) { display: none; }
      .pattern-ready-bar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 7px 10px; }
      .ready-copy span, .ready-community-links { display: none; }
      .ready-primary-actions { justify-content: flex-end; }
      .ready-primary-actions .button { min-height: 44px; }
      .making-assistant { grid-template-columns: minmax(130px,.8fr) minmax(110px,1fr) minmax(170px,1fr); padding: 8px 10px; }
      .making-actions { display: grid; grid-template-columns: 44px minmax(130px,1fr) 44px minmax(95px,.7fr) minmax(95px,.7fr) 44px; width: 100%; }
      .making-actions .button, .making-actions .icon-button { min-height: 44px; }
      .stat-done { width: 44px; min-width: 44px; height: 44px; }
      .stat-row { grid-template-columns: minmax(0,1fr) 44px; }
      .stat-focus { min-height: 44px; }
    }

    @media (max-width: 560px) {
      .top-actions #undoBtn,
      .top-actions #redoBtn { display: none; }
      .topbar { gap: 4px; padding-inline: 6px; }
      .brand-mark { padding: 6px; gap: 2px; border-radius: 9px; }
      .brand-mark i { width: 6px; height: 6px; }
      .language-switcher { gap: 1px; padding: 2px; }
      .language-switcher > span { display: none; }
      .language-switcher button { min-width: 22px; min-height: 44px; padding: 0 2px; font-size: 9px; }
      .top-actions { gap: 4px; min-width: 0; }
      #topExportBtn { min-width: 0; padding-inline: 6px; font-size: 11px; }
      .stage-toolbar { padding-inline: 7px; }
      .view-toggles { gap: 0; }
      .segment-button, .toggle-button { padding-inline: 7px; }
      .toggle-button span { display: none; }
      .canvas-center { padding: 18px; }
      .board-shell { padding: 7px; border-radius: 10px; }
      .legend-strip { min-height: 44px; max-height: 56px; }
      .empty-state { padding: 12px; }
      .empty-card { width: min(100%, 430px); max-height: calc(100% - 4px); padding: 17px; overflow: auto; }
      .empty-card h2 { font-size: 21px; }
      .empty-card p { margin-block: 7px 11px; font-size: 11px; }
      .empty-beads { margin-bottom: 10px; }
      .hero-flow { grid-template-columns: repeat(5, minmax(48px, 1fr)); gap: 4px; margin-bottom: 11px; overflow-x: auto; }
      .hero-flow li { padding-inline: 4px; font-size: 8px; }
      .hero-actions { grid-template-columns: 1fr 1fr; }
      .hero-actions a { grid-column: 1 / -1; }
      .hero-promises { margin-top: 8px; }
      .onboarding-card .privacy-note { margin-top: 7px; }
      .pattern-ready-bar { grid-template-columns: minmax(0, 1fr); }
      .ready-copy { display: none; }
      .ready-primary-actions { display: grid; grid-template-columns: 1fr 1fr; }
      .ready-primary-actions .button { line-height: 1.25; }
      .making-assistant { grid-template-columns: minmax(0,1fr); gap: 8px; }
      .making-progress-copy { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; column-gap: 8px; }
      .making-progress-copy strong { margin: 0; }
      #makingProgressText { grid-column: 1 / -1; }
      .making-focus { grid-template-columns: 34px minmax(0,1fr); }
      .making-actions { grid-template-columns: repeat(3,minmax(0,1fr)); }
      .making-actions .icon-button { width: 100%; }
      .share-dialog { width: calc(100vw - 16px); }
      .share-dialog-body { padding: 11px; }
      .share-format-field { align-items: stretch; flex-direction: column; }
      .share-dialog-foot .button { min-height: 44px; }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
      }
    }

    @media print {
      @page { margin: 10mm; }
      body { overflow: visible; background: white; }
      .app-shell, .toast, .convert-overlay, .mobile-dock, .mobile-scrim { display: none !important; }
      .print-sheet { display: block; }
      /* 1:1 output: each tile canvas carries an inline style width in mm, so no
         percentage width here; a percent rule would rescale the sheet. */
      .print-sheet canvas {
        display: block;
        height: auto;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        break-after: page;
        page-break-after: always;
      }
      .print-sheet canvas:last-child { break-after: auto; page-break-after: auto; }
    }

    .crop-dialog {
      width: min(760px, calc(100vw - 28px));
      max-height: calc(100dvh - 28px);
      padding: 0;
      overflow: hidden;
      color: var(--ink);
      background: var(--panel);
      border: 0;
      border-radius: 16px;
      box-shadow: 0 28px 90px rgba(28, 24, 20, .28);
    }

    .crop-dialog::backdrop { background: rgba(24, 22, 19, .58); backdrop-filter: blur(3px); }

    .firstrun-dialog {
      width: min(520px, calc(100vw - 28px));
      padding: 26px 26px 22px;
      color: var(--ink);
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow);
    }
    .firstrun-dialog::backdrop { background: rgba(24, 22, 19, .58); backdrop-filter: blur(3px); }
    .firstrun-dialog h2 { margin: 0 0 14px; font-size: 21px; letter-spacing: -0.01em; text-wrap: balance; }
    .firstrun-steps { margin: 0 0 20px; padding-left: 22px; display: grid; gap: 9px; color: var(--muted); font-size: 14px; line-height: 1.5; }
    .firstrun-steps li::marker { color: var(--accent); font-weight: 800; }
    .firstrun-dialog .button { width: 100%; }

    .projects-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
    .projects-empty { margin: 4px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
    .project-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 12px;
      background: var(--panel-strong);
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
    }
    .project-info { display: grid; gap: 2px; min-width: 0; }
    .project-info strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .project-info span { color: var(--muted); font-size: 12px; }
    .project-actions { display: flex; gap: 6px; flex-shrink: 0; }
    .btn-small { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
    .btn-danger { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, var(--line)); }
    .btn-danger:hover:not(:disabled) { background: color-mix(in oklab, var(--danger) 8%, var(--panel)); }
    .crop-head, .crop-foot { display: flex; align-items: center; gap: 10px; padding: 13px 15px; }
    .crop-head { justify-content: space-between; border-bottom: 1px solid var(--line); }
    .crop-head strong { font-size: 14px; }
    .crop-body { padding: 14px 15px; overflow: auto; }
    .crop-help { margin: 0 0 10px; color: var(--muted); font-size: 11px; line-height: 1.55; }
    .crop-preview-wrap { padding: 10px; overflow: hidden; background: #292722; border-radius: 11px; }
    #cropCanvas { display: block; width: 100%; height: auto; max-height: 62dvh; background: #1f1e1b; cursor: crosshair; touch-action: none; }
    .crop-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 11px 0 0; padding: 0; border: 0; }
    .crop-fields legend { grid-column: 1 / -1; margin-bottom: -2px; color: var(--muted); font-size: 10px; }
    .crop-fields label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
    .crop-fields input { width: 100%; min-height: 36px; padding: 7px 9px; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
    .crop-fields input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .crop-foot { justify-content: flex-end; border-top: 1px solid var(--line); }
    .crop-foot .crop-reset { margin-right: auto; }

    .product-dialog { width: min(780px, calc(100vw - 28px)); }
    .product-dialog .crop-body { display: grid; gap: 14px; }
    .product-intro { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
    .product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .product-card { padding: 13px; background: #f3f0e9; border: 1px solid var(--line); border-radius: 11px; }
    .product-card h3 { margin: 0 0 7px; font-size: 13px; }
    .product-card p, .product-card li { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
    .product-card ul { margin: 0; padding-left: 18px; }
    .product-links { display: flex; flex-wrap: wrap; gap: 8px; }
    .product-links a { padding: 8px 10px; color: var(--accent-strong); background: white; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; font-weight: 700; text-decoration: none; }
    .recovery-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
    .release-badge { color: #cfc7bc; font-size: 10px; }
    .release-links { display: flex; gap: 7px; white-space: nowrap; }
    .release-links a { color: #ddd7cf; text-decoration: none; }
    .release-links a:hover, .release-links a:focus-visible { color: white; text-decoration: underline; }

    @media (max-width: 560px) {
      .crop-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
      .crop-body { padding: 12px; }
      .crop-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .crop-foot { flex-wrap: wrap; }
      .crop-foot .button { flex: 1 1 auto; }
      .product-grid { grid-template-columns: 1fr; }
    }
