    :root {
      color-scheme: dark;
      /* Brand — Electric Indigo (mtips5s_motions / Linear) */
      --primary: #5E6AD2;
      --primary-hover: #6B76E5;
      --primary-dark: #9AA2F2;
      --primary-light: rgba(94, 106, 210, 0.22);
      --primary-50: rgba(94, 106, 210, 0.13);

      /* Surfaces */
      --bg: #0A0A0C;
      --background: #0A0A0C;
      --surface: #17171A;
      --surface-2: #1C1C21;
      --surface-3: #26262C;
      --panel: #17171A;
      --panel-2: #1C1C21;
      --panel-3: #26262C;

      /* Typography & Inks */
      --foreground: #F7F8F8;
      --ink: #F7F8F8;
      --ink-2: #8A8F98;
      --ink-3: #62666D;
      --muted: #8A8F98;

      /* Borders */
      --line: rgba(255, 255, 255, 0.08);
      --line-2: rgba(255, 255, 255, 0.16);
      --line-strong: rgba(255, 255, 255, 0.18);

      /* Accents & Status */
      --accent: #5E6AD2;
      --accent-hover: #6B76E5;
      --accent-glow: rgba(94, 106, 210, 0.38);
      --accent-2: #EB5757;
      --accent-3: #F2C94C;
      --color-emerald: #4CC38A;
      --color-emerald-bg: rgba(76, 195, 138, 0.13);
      --color-amber: #F2C94C;
      --color-amber-bg: rgba(242, 201, 76, 0.13);
      --color-rose: #EB5757;
      --color-rose-bg: rgba(235, 87, 87, 0.13);

      /* Glass & Shadows */
      --glass-bg: rgba(20, 20, 23, 0.72);
      --glass-bg-soft: rgba(20, 20, 23, 0.5);
      --glass-bg-solid: rgba(24, 24, 28, 0.96);
      --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.08);
      --shadow-island: 0 8px 30px rgba(0, 0, 0, 0.45);
      --shadow-island-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
      --shadow-pill: 0 4px 18px rgba(94, 106, 210, 0.38), 0 1px 2px rgba(0, 0, 0, 0.4);
      --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.3);
      --shadow-dropdown: 0 12px 40px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.5);
      --shadow-modal: 0 32px 90px rgba(0, 0, 0, 0.7);

      /* Layout & Dimensions */
      --toolbar: 46px;
      --right: 320px;
      --top: 42px;
      --context: 54px;
      --status: 30px;
      --radius: 8px;

      /* Motion & Springs */
      --spring: cubic-bezier(0.32, 0.72, 0, 1);
      --spring-bounce: cubic-bezier(0.34, 1.45, 0.64, 1);
      --studio-bg: #0A0A0C;
      --studio-surface: #17171A;
      --studio-line: rgba(255, 255, 255, 0.08);
      --studio-line-2: rgba(255, 255, 255, 0.16);
      --studio-glow: rgba(94, 106, 210, 0.28);
    }

    /* Studio keyframes */
    @keyframes studio-pop-in {
      from { opacity: 0; transform: translateY(6px) scale(0.98); }
      to   { opacity: 1; transform: translateY(0) scale(1); }
    }
    @keyframes studio-pulse-dot {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.35; transform: scale(0.85); }
    }

    * { box-sizing: border-box; }

    html, body {
      height: 100%;
      margin: 0;
      overflow: hidden;
      background:
        radial-gradient(55% 45% at 78% -8%, rgba(94, 106, 210, 0.13), transparent 62%),
        radial-gradient(45% 40% at 8% 108%, rgba(64, 143, 227, 0.07), transparent 60%),
        linear-gradient(180deg, #0B0B0E 0%, #09090B 100%);
      background-attachment: fixed;
      color: var(--ink);
      font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
      letter-spacing: 0;
      -webkit-font-smoothing: antialiased;
    }

    body.electron-shell {
      --top: 0px;
      --status: 36px;
    }

    button, input, select, textarea {
      font: inherit;
      color: inherit;
    }

    button {
      border: 1px solid var(--line);
      background: var(--panel-2);
      border-radius: var(--radius);
      min-height: 32px;
      padding: 6px 10px;
      cursor: pointer;
      transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s var(--spring), box-shadow 0.15s ease;
    }

    button:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.08); }
    button:active:not(:disabled) { transform: scale(0.97); }
    button:disabled { cursor: not-allowed; opacity: .45; }
    button.active { border-color: var(--accent); background: rgba(34, 166, 153, .22); box-shadow: 0 0 12px rgba(34, 166, 153, 0.25); }

    button.icon-label {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }

    .btn-icon {
      display: inline-grid;
      place-items: center;
      min-width: 14px;
      color: #f7f7f7;
      font-size: 13px;
      font-weight: 900;
      line-height: 1;
    }

    input[type="range"] { accent-color: var(--accent); }

    input[type="number"],
    input[type="text"],
    select,
    textarea {
      min-height: 32px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #191919;
      padding: 6px 8px;
      outline: none;
    }

    textarea {
      min-height: 86px;
      resize: vertical;
    }

    input:focus,
    select:focus,
    textarea:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(34, 166, 153, .18);
    }

    .app {
      height: 100%;
      display: grid;
      grid-template-columns: 46px minmax(360px, 1fr) var(--right);
      grid-template-rows: var(--top) var(--context) minmax(0, 1fr) var(--status);
      grid-template-areas:
        "menubar menubar menubar"
        "toolbar context right"
        "toolbar stage right"
        "status status status";
    }

    .menubar {
      grid-area: menubar;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid var(--line);
      background: #1f1f1f;
      padding: 0 12px;
      box-shadow: 0 1px 0 rgba(255, 255, 255, .03);
      min-width: 0;
    }

    body.electron-shell .menubar {
      display: none;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 9px;
      font-weight: 760;
      min-width: 196px;
    }

    .brand-mark {
      display: grid;
      place-items: center;
      width: 28px;
      height: 28px;
      border: 1px solid rgba(34, 166, 153, .55);
      border-radius: 6px;
      color: #dffdfa;
      background: linear-gradient(135deg, #11665f, #33302b);
      font-size: 12px;
      letter-spacing: 0;
    }

    .menu-actions,
    .doc-actions,
    .contextbar,
    .statusbar {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }

    .menu-actions button,
    .doc-actions button,
    .contextbar button {
      white-space: nowrap;
    }

    .hidden-input {
      position: absolute;
      inline-size: 1px;
      block-size: 1px;
      overflow: hidden;
      opacity: 0;
      pointer-events: none;
    }

    .toolbar {
      grid-area: toolbar;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      width: 46px;
      min-width: 0;
      max-width: 46px;
      justify-self: start;
      border-right: 1px solid var(--line);
      background: var(--surface);
      padding: 6px 4px;
      overflow: visible;
    }

    .tool-btn {
      width: 32px;
      height: 31px;
      padding: 0;
      display: grid;
      place-items: center;
      font-weight: 800;
      font-size: 13px;
    }

    .tool-sep {
      width: 30px;
      height: 1px;
      background: var(--line);
      margin: 3px 0;
      flex: 0 0 auto;
    }

    .contextbar {
      grid-area: context;
      border-bottom: 1px solid var(--line);
      background: #262523;
      padding: 8px 12px;
      overflow-x: auto;
      overflow-y: hidden;
    }

    .control {
      display: flex;
      align-items: center;
      gap: 7px;
      min-width: max-content;
      color: var(--muted);
      font-size: 12px;
    }

    .control strong {
      color: var(--ink);
      font-size: 13px;
      font-weight: 700;
    }

    .context-taskbar {
      display: flex;
      align-items: center;
      gap: 5px;
      min-width: max-content;
      padding-inline: 6px;
      border-inline: 1px solid rgba(255, 255, 255, .1);
    }

    .context-task-label {
      color: #eeeeee;
      font-size: 11px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0;
      white-space: nowrap;
    }

    .context-taskbar button {
      min-height: 27px;
      padding: 4px 8px;
      border-radius: 3px;
      font-size: 12px;
      font-weight: 760;
    }

    .context-taskbar input[type="range"] {
      width: 88px;
    }

    .context-taskbar select {
      width: 108px;
    }

    .context-taskbar input,
    .context-taskbar select {
      min-height: 27px;
    }

    .context-taskbar.is-hidden {
      display: none;
    }

    .context-taskbar .is-hidden {
      display: none;
    }

    .control input[type="range"] { width: 120px; }
    .control input[type="number"] { width: 74px; }
    .control select { width: 128px; }

    .brush-presets {
      display: flex;
      align-items: center;
      gap: 4px;
      min-width: max-content;
    }

    .brush-preset-btn {
      position: relative;
      width: 32px;
      height: 32px;
      min-height: 32px;
      padding: 0;
      display: grid;
      place-items: center;
      border-radius: 5px;
      background: #3f3f3f;
    }

    .brush-preset-btn.active {
      border-color: var(--accent);
      background: rgba(34, 166, 153, .24);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
    }

    .brush-preset-btn.custom::after {
      content: "";
      position: absolute;
      right: 4px;
      bottom: 4px;
      width: 5px;
      height: 5px;
      border-radius: 999px;
      background: var(--accent);
    }

    .brush-tip {
      width: var(--tip-size, 16px);
      height: var(--tip-size, 16px);
      border-radius: 999px;
      background: radial-gradient(circle, rgba(245,245,245,.95) 0 var(--hard-stop, 45%), rgba(245,245,245,.3) 72%, rgba(245,245,245,0) 100%);
      box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
    }

    .stage {
      grid-area: stage;
      position: relative;
      display: grid;
      grid-template-rows: 34px minmax(0, 1fr) auto;
      overflow: hidden;
      background: var(--studio-bg);
    }

    .canvas-shell {
      position: relative;
      grid-row: 2;
      min-height: 0;
      overflow: hidden;
      cursor: grab;
      background: var(--studio-bg);
    }

    .canvas-shell::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
      background-size: 80px 80px;
      -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 40%, black 20%, transparent 80%);
      mask-image: radial-gradient(ellipse 85% 75% at 50% 40%, black 20%, transparent 80%);
    }

    .canvas-shell::after {
      content: "";
      position: absolute;
      left: -20%;
      right: -20%;
      bottom: -15%;
      height: 60%;
      z-index: 0;
      pointer-events: none;
      background-image:
        linear-gradient(rgba(34, 166, 153, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 166, 153, 0.12) 1px, transparent 1px);
      background-size: 50px 50px;
      transform: perspective(600px) rotateX(62deg);
      transform-origin: center bottom;
      -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent 85%);
      mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent 85%);
    }

    .canvas-shell.is-drawing { cursor: crosshair; }
    .canvas-shell.is-moving { cursor: move; }
    .canvas-shell.is-panning { cursor: grab; }
    .canvas-shell.is-zooming { cursor: zoom-in; }

    .canvas-viewport {
      position: absolute;
      left: 50%;
      top: 50%;
      z-index: 1;
      transform-origin: 0 0;
      box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.09);
      border-radius: 2px;
      background-color: #fff;
      background-image:
        linear-gradient(45deg, #d7d7d7 25%, transparent 25%),
        linear-gradient(-45deg, #d7d7d7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d7d7d7 75%),
        linear-gradient(-45deg, transparent 75%, #d7d7d7 75%);
      background-size: 24px 24px;
      background-position: 0 0, 0 12px, 12px -12px, -12px 0;
    }

    #mainCanvas,
    #pathOverlay {
      display: block;
      width: 100%;
      height: 100%;
      image-rendering: auto;
    }

    #pathOverlay {
      position: absolute;
      inset: 0;
      pointer-events: none;
    }

    .canvas-precision-overlay {
      position: absolute;
      inset: 0;
      display: none;
      width: 100%;
      height: 100%;
      overflow: visible;
      pointer-events: none;
      z-index: 2;
    }

    .canvas-precision-overlay.active {
      display: block;
    }

    .canvas-precision-overlay .grid-line {
      stroke: rgba(34, 166, 153, .2);
      stroke-width: 1;
      vector-effect: non-scaling-stroke;
    }

    .canvas-precision-overlay .guide-line {
      stroke: rgba(247, 179, 43, .9);
      stroke-width: 1.25;
      vector-effect: non-scaling-stroke;
    }

    .canvas-precision-overlay .ruler-band {
      fill: rgba(21, 21, 21, .86);
      stroke: rgba(255, 255, 255, .16);
      stroke-width: 1;
      vector-effect: non-scaling-stroke;
    }

    .canvas-precision-overlay .ruler-tick {
      stroke: rgba(255, 255, 255, .42);
      stroke-width: 1;
      vector-effect: non-scaling-stroke;
    }

    .canvas-precision-overlay .ruler-label {
      fill: rgba(255, 255, 255, .75);
      font: 10px Inter, system-ui, sans-serif;
      letter-spacing: 0;
      user-select: none;
    }

    .export-target-overlay {
      position: absolute;
      inset: 0;
      display: none;
      width: 100%;
      height: 100%;
      overflow: visible;
      pointer-events: none;
      z-index: 3;
    }

    .export-target-overlay.active {
      display: block;
    }

    .export-target-overlay .target-rect {
      fill: rgba(77, 163, 255, .06);
      stroke: rgba(77, 163, 255, .95);
      stroke-width: 1.25;
      vector-effect: non-scaling-stroke;
    }

    .export-target-overlay .target-rect.slice {
      fill: rgba(247, 179, 43, .06);
      stroke: rgba(247, 179, 43, .95);
      stroke-dasharray: 7 4;
    }
