:root {
  color-scheme: dark;
  --bg: #0c0e13;
  --chrome: #11131a;
  --panel: #161922;
  --panel-2: #1b1f2a;
  --line: #2a2f3d;
  --line-soft: #232735;
  --text: #f4f5f8;
  --muted: #939bad;
  --faint: #626a7c;
  --accent: #8065ff;
  --accent-2: #2dd4bf;
  --accent-soft: rgba(128, 101, 255, .18);
  --danger: #f26d79;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: fixed; width: 0; height: 0; overflow: hidden; }
.hidden { display: none !important; }

.app-shell { height: 100%; display: grid; grid-template-rows: 54px minmax(0, 1fr) 27px; }

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto auto minmax(140px, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 12px;
  background: rgba(17, 19, 26, .96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 16px rgba(0,0,0,.2);
}

.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; margin-right: 8px; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--accent), #6749ee); border-radius: 8px; box-shadow: 0 5px 18px rgba(128,101,255,.28); }
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { margin: 0; font-weight: 750; letter-spacing: -.025em; font-size: 17px; }
.brand-by { color: var(--faint); font-size: 12px; padding-left: 2px; }

.file-actions, .history-actions { display: flex; align-items: center; gap: 2px; }
.top-button, .icon-button, .tool-button, .subtle-button, .layer-actions button, .zoom-controls button {
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease, transform .14s ease;
}
.top-button { height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 9px; border-radius: 7px; color: #cbd0dc; }
.top-button:hover, .icon-button:hover { background: var(--panel-2); color: #fff; }
.top-button svg { width: 16px; height: 16px; }
.top-button .chevron { width: 13px; height: 13px; }

.file-menu { position: relative; }
.file-menu summary { list-style: none; cursor: pointer; }
.file-menu summary::-webkit-details-marker { display: none; }
.menu-popover { position: absolute; top: 41px; left: 0; width: 190px; padding: 6px; background: #1a1e28; border: 1px solid #33394a; border-radius: 9px; box-shadow: 0 16px 44px rgba(0,0,0,.42); }
.menu-popover button { width: 100%; height: 35px; display: flex; align-items: center; justify-content: space-between; border: 0; color: #d9dce5; padding: 0 9px; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; }
.menu-popover button:hover { background: #242936; }
kbd { color: var(--faint); font-size: 11px; font-family: inherit; }

.document-title { justify-self: center; min-width: 0; display: flex; align-items: baseline; gap: 9px; color: #dfe2e9; white-space: nowrap; overflow: hidden; }
.document-title > span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.dimension-label { color: var(--faint); font-size: 12px; }
.history-actions { border-left: 1px solid var(--line-soft); padding-left: 9px; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 7px; color: var(--muted); }
.icon-button:disabled { opacity: .32; cursor: not-allowed; }
.icon-button svg { width: 17px; height: 17px; }

.privacy-pill { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; color: #aeb4c2; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; white-space: nowrap; }
.privacy-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 3px rgba(45,212,191,.1); }
.privacy-pill b { font-weight: 500; }
.privacy-pill.saving span { background: #f6c85f; box-shadow: 0 0 0 3px rgba(246,200,95,.1); }
.export-button, .primary-button { border: 0; color: #fff; background: linear-gradient(135deg, #8166ff, #6b4fe5); box-shadow: 0 5px 16px rgba(128,101,255,.2); cursor: pointer; font-weight: 700; }
.export-button { height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 14px; border-radius: 7px; }
.export-button:hover, .primary-button:hover { filter: brightness(1.1); transform: translateY(-1px); }
.export-button svg { width: 16px; height: 16px; }

.workspace { min-height: 0; display: grid; grid-template-columns: 52px minmax(0, 1fr) 292px; }
.mobile-inspector-tabs { display: none; }

.tool-rail { z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 6px; background: var(--chrome); border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: none; }
.tool-rail::-webkit-scrollbar { display: none; }
.tool-button { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 7px; color: #9ba3b5; }
.tool-button:hover { color: #fff; background: var(--panel-2); }
.tool-button.active { color: #fff; background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(128,101,255,.45); }
.tool-button.active::before { content: ""; position: absolute; left: -6px; height: 20px; width: 2px; border-radius: 2px; background: var(--accent); }
.tool-button svg { width: 20px; height: 20px; }
.tool-separator { width: 24px; height: 1px; background: var(--line-soft); margin: 4px 0; }

.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #090b10; user-select: none; touch-action: none; }
.stage-grid { position: absolute; inset: 0; opacity: .7; background-image: linear-gradient(#151823 1px, transparent 1px), linear-gradient(90deg, #151823 1px, transparent 1px); background-size: 24px 24px; mask-image: radial-gradient(circle at center, black, transparent 78%); pointer-events: none; }
.stage.dragging { box-shadow: inset 0 0 0 2px var(--accent-2); }
.ruler { position: absolute; z-index: 4; background: rgba(17,19,26,.96); pointer-events: auto; }
.ruler-horizontal { left: 22px; right: 0; top: 0; width: calc(100% - 22px); height: 22px; border-bottom: 1px solid var(--line); cursor: row-resize; }
.ruler-vertical { left: 0; top: 22px; bottom: 0; width: 22px; height: calc(100% - 22px); border-right: 1px solid var(--line); cursor: col-resize; }
.ruler-corner { position: absolute; z-index: 5; left: 0; top: 0; width: 22px; height: 22px; background: #12141b; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stage.rulers-hidden .ruler, .stage.rulers-hidden .ruler-corner { display: none; }
.guide-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.guide { position: absolute; pointer-events: none; background: #35d9ff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.guide.horizontal { left: 0; right: 0; height: 1px; }
.guide.vertical { top: 0; bottom: 0; width: 1px; }
.guide.draft { background: #ff69ce; }
.guide.smart { background: #ffca5c; box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 0 7px rgba(255,202,92,.38); }
.artboard-wrap { position: absolute; left: 50%; top: 50%; transform-origin: center; background-color: #fff; background-image: linear-gradient(45deg, #d8dbe1 25%, transparent 25%), linear-gradient(-45deg, #d8dbe1 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d8dbe1 75%), linear-gradient(-45deg, transparent 75%, #d8dbe1 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; box-shadow: 0 24px 80px rgba(0,0,0,.44), 0 0 0 1px rgba(255,255,255,.12); will-change: transform; }
#artboard, #overlay { display: block; position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; touch-action: none; }
#overlay { pointer-events: none; }
.drop-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none; flex-direction: column; align-items: center; gap: 7px; padding: 24px 34px; color: #cfd3dd; background: rgba(17,19,26,.9); border: 1px dashed #525b70; border-radius: 12px; backdrop-filter: blur(10px); pointer-events: none; }
.stage.dragging .drop-hint { display: flex; }
.drop-hint svg { width: 28px; height: 28px; color: var(--accent-2); }
.drop-hint span { color: var(--muted); font-size: 12px; }
.zoom-controls { position: absolute; z-index: 2; right: 14px; bottom: 14px; height: 34px; display: flex; align-items: center; background: rgba(22,25,34,.94); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 7px 20px rgba(0,0,0,.25); }
.zoom-controls button { min-width: 33px; height: 100%; color: #bdc2ce; }
.zoom-controls button:hover { background: #252a36; color: #fff; }
.zoom-controls #zoomLabel { min-width: 58px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); font-size: 12px; }
.crop-floating { position: absolute; z-index: 3; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 12px; color: #c9ced9; background: rgba(22,25,34,.96); border: 1px solid #3d4455; border-radius: 9px; box-shadow: 0 10px 30px rgba(0,0,0,.36); backdrop-filter: blur(10px); }
.crop-floating span { min-width: 92px; font-size: 11px; font-variant-numeric: tabular-nums; }
.crop-floating button { min-height: 32px; padding: 0 12px; border-radius: 6px; }
.crop-floating .primary-button:disabled { opacity: .4; cursor: not-allowed; filter: none; transform: none; }

.inspector { position: relative; min-height: 0; display: flex; flex-direction: column; background: var(--chrome); border-left: 1px solid var(--line); overflow-y: auto; }
.panel { padding: 15px; }
.properties-panel { border-bottom: 1px solid var(--line); }
.layers-panel { flex: 1; min-height: 225px; display: flex; flex-direction: column; padding-bottom: 0; }
.canvas-ad-panel { display: none; }
.canvas-ad-label { color: var(--faint); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.canvas-ad-slot { width: 300px; height: 250px; overflow: hidden; background: #0c0e13; border: 1px solid #242938; border-radius: 7px; }
.canvas-ad-slot:empty { display: none; }
.canvas-ad-panel:not(:has(.canvas-ad-slot:not(:empty))) { display: none; }
.canvas-ad-close { position: absolute; z-index: 1; top: 5px; right: 5px; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; color: #d7dbe5; background: rgba(12,14,19,.88); border: 1px solid #343a49; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; }
.canvas-ad-close:hover { color: #fff; background: #262b37; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-heading h2 { margin: 1px 0 0; font-size: 15px; letter-spacing: -.01em; }
.eyebrow { display: block; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.layer-count { color: var(--faint); font-size: 11px; }
.property-group { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.property-group:first-of-type { border-top: 0; padding-top: 0; }
.property-label { display: block; margin-bottom: 8px; color: #c8cdd8; font-size: 12px; font-weight: 650; }

input[type="text"], input[type="number"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  color: #e8eaf0;
  background: #101219;
  border: 1px solid #303647;
  border-radius: 6px;
  padding: 7px 9px;
}
textarea { resize: vertical; min-height: 58px; }
.text-options { margin-top: 8px; }
.text-check { align-content: center; align-items: center; grid-template-columns: auto 1fr !important; margin-top: 17px; }
.text-color-label input { width: 100%; height: 34px; }
.property-hint { margin: 9px 0 0; color: var(--faint); font-size: 10px; line-height: 1.45; }
input[type="text"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus, textarea:focus { border-color: #6951d7; }

.color-row { display: grid; grid-template-columns: 42px 1fr; gap: 8px; }
input[type="color"] { width: 42px; height: 35px; border: 1px solid #303647; border-radius: 6px; background: #101219; padding: 3px; cursor: pointer; }
.range-label { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 5px; color: var(--muted); font-size: 12px; }
.range-label output { color: #c8cdd8; font-variant-numeric: tabular-nums; }
.range { appearance: none; width: 100%; height: 3px; border-radius: 4px; background: #34394a; accent-color: var(--accent); cursor: pointer; }
.range::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border: 2px solid #b7aaff; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px #171922; }
.range::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #b7aaff; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px #171922; }
.split-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.split-row label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.button-row { display: flex; gap: 7px; margin-top: 9px; }
.subtle-button { min-width: 36px; height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #acb2c0; background: #1c202b; border: 1px solid #303647; border-radius: 6px; }
.subtle-button:hover { color: #fff; border-color: #4a5266; background: #242935; }
.subtle-button:disabled, .align-grid button:disabled { opacity: .42; cursor: not-allowed; }
.subtle-button.wide { flex: 1; }
.subtle-button svg { width: 16px; height: 16px; }
.wrap-buttons { flex-wrap: wrap; }
.wrap-buttons .wide { flex: 1 1 calc(50% - 4px); }
.selection-readout { margin: 6px 0 9px; padding: 8px 9px; color: var(--muted); background: #101219; border: 1px solid #2b3040; border-radius: 6px; font-size: 11px; font-variant-numeric: tabular-nums; }
.selection-edge-label { margin-top: 13px; }
.selection-amount-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: center; }
.selection-amount-row span { color: var(--muted); font-size: 11px; }
.selection-edge-actions .wide { min-width: 0; padding: 0 7px; }
.crop-apply { min-height: 32px; padding: 0 10px; border-radius: 6px; }
.crop-apply:disabled { opacity: .4; cursor: not-allowed; filter: none; transform: none; }
.group-title-row { display: flex; align-items: center; justify-content: space-between; }
.group-title-row .property-label { margin: 0; }
.group-title-row button { border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 11px; }
.group-title-row button:hover { color: var(--accent-2); }
.adjustment-layer-note { margin: 7px 0 10px; padding: 8px 9px; color: #d5cffc; background: rgba(128,101,255,.12); border: 1px solid rgba(128,101,255,.28); border-radius: 6px; font-size: 11px; line-height: 1.4; }
.align-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.align-grid button { height: 30px; color: #aeb5c3; background: #1c202b; border: 1px solid #303647; border-radius: 5px; cursor: pointer; font-size: 11px; }
.align-grid button:hover { color: #fff; border-color: #5a647b; background: #252a37; }
.distribution-actions { margin-top: 6px; }
.filter-actions { margin-top: 13px; }
.histogram { display: block; width: 100%; height: 70px; margin: 12px 0 7px; border: 1px solid #2e3443; border-radius: 5px; background: #11141b; }
.levels-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.levels-grid label { min-width: 0; color: #888fa0; font-size: 10px; }
.levels-grid input { width: 100%; margin-top: 4px; }
.levels-apply { width: 100%; margin-top: 7px; }
.tone-curve { display: block; width: 100%; height: 150px; margin-top: 12px; border: 1px solid #303647; border-radius: 6px; background: #101219; cursor: crosshair; touch-action: none; }
.curve-actions { margin-top: 7px; }
.mask-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 11px 0 2px; }
.mask-controls .subtle-button { font-size: 11px; }
.mask-controls .active { color: #dcd7ff; border-color: #7157e7; background: rgba(128,101,255,.16); }
.mask-controls #toggleClipButton, .mask-controls #alphaLockButton { grid-column: 1 / -1; }
.transform-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 7px; }
.transform-values label { min-width: 0; color: var(--muted); font-size: 11px; }
.transform-values input { width: 100%; margin-top: 4px; }
.transform-values button { align-self: end; min-height: 31px; }
.layer-group-actions { display: flex; gap: 6px; margin: 8px 0; }
.layer-group-actions button { flex: 1; font-size: 10px; }
.layer-merge-actions { display: flex; gap: 6px; margin: 6px 0 8px; }
.layer-merge-actions button { flex: 1; font-size: 10px; }
.layer-export-button { width: 100%; font-size: 10px; }

.layer-controls-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.layer-controls-row select { padding: 6px 8px; }
.opacity-label { margin-top: 9px; }
.layer-effects { margin-top: 10px; border: 1px solid #2d3342; border-radius: 7px; background: #12151d; }
.layer-effects summary { padding: 8px 10px; color: #bfc5d1; cursor: pointer; font-size: 11px; font-weight: 700; }
.layer-effects-body { display: grid; gap: 5px; padding: 3px 10px 10px; border-top: 1px solid #292f3d; }
.layer-effects-body .check-row { display: flex; align-items: center; gap: 7px; margin: 5px 0 2px; color: #c7ccd7; font-size: 11px; }
.effect-color-row { display: grid; grid-template-columns: 1fr 42px; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.effect-color-row input { width: 42px; height: 28px; padding: 2px; border-radius: 6px; }
.layer-effects-body input:disabled, .layer-effects-body button:disabled { opacity: .42; cursor: not-allowed; }
.layer-search { display: block; margin-top: 11px; }
.layer-search input { width: 100%; min-height: 32px; padding: 6px 9px; color: #dfe3ec; background: #11141c; border: 1px solid #303646; border-radius: 6px; font-size: 11px; }
.layer-search input:focus { border-color: var(--accent); outline: 0; }
.layer-list { flex: 1; min-height: 90px; margin: 13px -5px 8px; overflow-y: auto; }
.layer-list-empty { display: grid; place-items: center; min-height: 74px; color: var(--faint); font-size: 11px; }
.layer-item { display: grid; grid-template-columns: 28px 36px minmax(0, 1fr) 25px; align-items: center; gap: 6px; min-height: 46px; padding: 4px 6px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; }
.layer-item:hover { background: #191c25; }
.layer-item.active { background: var(--accent-soft); border-color: rgba(128,101,255,.3); }
.layer-item.multi-selected { background: rgba(128,101,255,.10); border-color: rgba(128,101,255,.23); }
.layer-item.grouped { box-shadow: inset 2px 0 0 #6552c7; }
.layer-item.active.multi-selected { background: var(--accent-soft); border-color: rgba(128,101,255,.45); }
.layer-item.dragging { opacity: .42; }
.layer-item.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.layer-item.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.layer-visibility, .layer-lock { width: 26px; height: 30px; display: grid; place-items: center; padding: 0; color: #8f97a8; border: 0; background: transparent; cursor: pointer; }
.layer-visibility.off, .layer-lock.off { color: #4f5667; }
.layer-visibility svg, .layer-lock svg { width: 15px; height: 15px; }
.layer-thumbnail { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; color: #757d8e; background-color: #e7e8eb; background-image: linear-gradient(45deg,#c9cbd1 25%,transparent 25%),linear-gradient(-45deg,#c9cbd1 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#c9cbd1 75%),linear-gradient(-45deg,transparent 75%,#c9cbd1 75%); background-size: 8px 8px; background-position: 0 0,0 4px,4px -4px,-4px 0; border: 1px solid #3a4050; border-radius: 4px; }
.layer-thumbnail canvas { max-width: 100%; max-height: 100%; display: block; }
.layer-name { min-width: 0; overflow: hidden; color: #d5d8e0; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.layer-name[contenteditable="true"] { outline: 1px solid var(--accent); background: #11131a; padding: 4px; border-radius: 3px; }
.layer-actions { display: grid; grid-template-columns: 34px 34px 34px 1fr 34px 34px 34px; gap: 3px; margin: 0 -15px; padding: 8px 12px; border-top: 1px solid var(--line-soft); background: #101219; }
.layer-actions button { width: 32px; height: 32px; display: grid; place-items: center; color: #929aab; border-radius: 5px; }
.layer-actions button:hover { color: #fff; background: #242936; }
.layer-actions button.danger:hover { color: var(--danger); background: rgba(242,109,121,.09); }
.layer-actions svg { width: 16px; height: 16px; }
.layer-actions .fx-button, .adjustment-thumbnail { color: #cfc7ff; font: 700 italic 13px Georgia, serif; }
.layer-thumbnail.adjustment-thumbnail { background: linear-gradient(145deg, #292242, #171923); }

.statusbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 14px; padding: 0 11px; color: #6f7789; background: #0f1117; border-top: 1px solid var(--line); font-size: 11px; }
.statusbar > :last-child { justify-self: end; }
.statusbar a { color: #8d80db; text-decoration: none; }
.statusbar a:hover { color: #b8aff2; }
.memory-status { color: #858da0; white-space: nowrap; }
.cloud-status { color: #8c94a7; font-weight: 600; }
.cloud-status.online { color: var(--accent-2); }
.cloud-status.live { color: #ffca5c; }

dialog { width: min(520px, calc(100vw - 28px)); color: var(--text); background: transparent; border: 0; padding: 0; }
dialog::backdrop { background: rgba(5,6,10,.72); backdrop-filter: blur(5px); }
.dialog-card { margin: 0; padding: 20px; background: #181b24; border: 1px solid #343a4a; border-radius: 12px; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.dialog-heading h2 { margin: 2px 0 0; font-size: 21px; letter-spacing: -.03em; }
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 18px; }
.preset-grid button { display: grid; gap: 2px; min-height: 66px; padding: 9px; color: #c9ced9; background: #11131a; border: 1px solid #303647; border-radius: 8px; cursor: pointer; text-align: left; }
.preset-grid button:hover, .preset-grid button.active { border-color: var(--accent); background: var(--accent-soft); }
.preset-grid button strong { font-size: 12px; }
.preset-grid button span { color: var(--faint); font-size: 10px; }
.dialog-fields { display: grid; gap: 12px; }
.dialog-fields > label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.dialog-fields > label.check-row { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; color: #c6cbd6; font-size: 12px; }
.check-row input { width: 15px; height: 15px; accent-color: var(--accent); }
.path-fill-row { display: grid; grid-template-columns: 1fr 42px; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; }
.path-fill-row input[type="color"] { width: 42px; height: 28px; padding: 2px; border-radius: 6px; }
.path-fill-row input:disabled { opacity: .45; }
.shape-geometry { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shape-geometry label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.shape-geometry input { min-width: 0; }
.shape-geometry input:disabled { opacity: .45; }
.resize-summary { display: flex; align-items: center; gap: 10px; margin: -3px 0 16px; padding: 11px 12px; color: #bfc5d1; background: #101219; border: 1px solid #2e3443; border-radius: 8px; }
.resize-summary svg { color: var(--accent-2); }
.resize-summary span { font-variant-numeric: tabular-nums; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.cancel-button, .primary-button { min-height: 38px; padding: 0 15px; border-radius: 7px; }
.cancel-button { color: #bdc3cf; background: #232733; border: 1px solid #363c4c; cursor: pointer; }
.primary-button { display: inline-flex; align-items: center; gap: 7px; }
.primary-button svg { width: 16px; height: 16px; }
.export-card { width: 480px; max-width: 100%; max-height: calc(100vh - 28px); overflow: auto; }
.versions-card { width: 480px; max-width: 100%; }
.command-card { width: 520px; max-width: 100%; }
.command-heading { margin-bottom: 12px; }
.command-search-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.command-search { width: 100%; min-height: 42px; padding: 8px 11px; color: #eef0f6; background: #101219; border: 1px solid #343a4a; border-radius: 7px; font-size: 14px; }
.command-list { display: grid; gap: 4px; max-height: min(420px, 55vh); margin-top: 10px; overflow: auto; }
.command-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; min-height: 40px; padding: 7px 10px; color: #d9dce5; background: #11141c; border: 1px solid transparent; border-radius: 7px; cursor: pointer; text-align: left; }
.command-item:hover, .command-item.active, .command-item:focus-visible { color: #fff; background: var(--accent-soft); border-color: rgba(128,101,255,.38); }
.command-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-item kbd { color: var(--faint); }
.command-empty { padding: 24px 10px; color: var(--muted); text-align: center; font-size: 12px; }
.command-help { margin: 10px 0 0; color: var(--faint); font-size: 11px; text-align: center; }
.help-card { width: 520px; max-width: 100%; max-height: calc(100vh - 28px); overflow: auto; }
.help-steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: help-step; }
.help-steps li { position: relative; display: grid; gap: 2px; min-height: 54px; padding: 9px 10px 9px 46px; color: #e6e8ef; background: #11141c; border: 1px solid #303646; border-radius: 8px; counter-increment: help-step; }
.help-steps li::before { content: counter(help-step); position: absolute; left: 11px; top: 11px; width: 25px; height: 25px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: 50%; font-size: 11px; font-weight: 800; }
.help-steps span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.help-subheading { margin: 17px 0 8px; font-size: 12px; }
.shortcut-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 6px 8px; align-items: center; padding: 10px; background: #11141c; border: 1px solid #303646; border-radius: 8px; color: #bfc5d1; font-size: 11px; }
.shortcut-grid kbd { min-width: 40px; padding: 3px 6px; color: #dfe3ec; background: #242936; border: 1px solid #3b4253; border-radius: 5px; text-align: center; }
.help-note { margin: 12px 0 0; color: var(--faint); font-size: 11px; line-height: 1.5; }
.help-link { display: inline-flex; align-items: center; text-decoration: none; }
.cloud-card { width: 620px; max-width: 100%; max-height: calc(100vh - 28px); overflow: auto; }
.cloud-auth { display: grid; gap: 10px; }
.cloud-auth-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cloud-account-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 9px 10px; background: #11141c; border: 1px solid #303646; border-radius: 8px; }
.cloud-account-bar span { min-width: 0; overflow: hidden; color: #dfe3ec; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.cloud-account-bar button { flex: none; }
.cloud-account-actions { display: flex; gap: 6px; }
.cloud-account-actions .cloud-delete-account { color: #f8a6ad; }
.cloud-primary-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.cloud-project-list { display: grid; gap: 8px; }
.cloud-project { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 10px; background: #11141c; border: 1px solid #303646; border-radius: 8px; }
.cloud-project.current { border-color: rgba(128,101,255,.68); background: var(--accent-soft); }
.cloud-project-meta { min-width: 0; }
.cloud-project-meta strong, .cloud-project-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-project-meta strong { color: #edf0f7; font-size: 12px; }
.cloud-project-meta span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.cloud-project-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.cloud-project-actions button { min-height: 29px; padding: 0 8px; color: #dfe3ec; background: #222735; border: 1px solid #3b4253; border-radius: 5px; cursor: pointer; font-size: 10px; }
.cloud-project-actions button:hover { border-color: var(--accent); }
.cloud-project-actions .danger { color: #f8a6ad; }
.cloud-empty { padding: 22px 12px; color: var(--muted); border: 1px dashed #363c4c; border-radius: 8px; text-align: center; font-size: 12px; }
.cloud-live-note { margin: 0 0 12px; padding: 8px 10px; color: #f3dda2; background: rgba(255,202,92,.08); border: 1px solid rgba(255,202,92,.25); border-radius: 7px; font-size: 11px; }
.feedback-card { width: 500px; max-width: 100%; }
.feedback-card textarea { width: 100%; resize: vertical; }
.feedback-privacy { margin-top: 12px; }
.dialog-note { margin: -4px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.version-list { display: grid; gap: 8px; min-height: 88px; max-height: min(420px, 55vh); overflow: auto; }
.version-empty { display: grid; place-items: center; min-height: 88px; color: var(--muted); border: 1px dashed #363c4c; border-radius: 8px; font-size: 12px; }
.version-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 10px; background: #11141c; border: 1px solid #303646; border-radius: 8px; }
.version-meta { min-width: 0; }
.version-meta strong, .version-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-meta strong { color: #edf0f7; font-size: 12px; }
.version-meta span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.version-item button { min-height: 30px; padding: 0 10px; border: 1px solid #3b4253; border-radius: 6px; color: #dfe3ec; background: #222735; font-size: 11px; }
.version-item .version-delete { width: 30px; padding: 0; color: #f8a6ad; }
.export-preview { height: 190px; display: grid; place-items: center; overflow: hidden; margin-bottom: 16px; border: 1px solid #323848; border-radius: 8px; }
.export-preview canvas { max-width: 100%; max-height: 100%; box-shadow: 0 7px 24px rgba(0,0,0,.3); }
.checker { background-color: #dfe1e6; background-image: linear-gradient(45deg,#c9ccd3 25%,transparent 25%),linear-gradient(-45deg,#c9ccd3 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#c9ccd3 75%),linear-gradient(-45deg,transparent 75%,#c9ccd3 75%); background-size: 18px 18px; background-position: 0 0,0 9px,9px -9px,-9px 0; }
.export-summary { margin: 12px 0 0; color: #c9ced9; font-size: 11px; font-variant-numeric: tabular-nums; }
.export-note { margin: 12px 0 0; color: var(--faint); font-size: 11px; }
.export-summary + .export-note { margin-top: 4px; }
.export-copy { display: inline-flex; align-items: center; gap: 7px; }
.export-copy svg { width: 16px; height: 16px; }
.export-copy:disabled { opacity: .45; cursor: not-allowed; }
.export-card .dialog-actions { flex-wrap: wrap; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 45px; transform: translate(-50%, 12px); min-width: 180px; padding: 9px 14px; color: #f3f4f8; background: #222733; border: 1px solid #3d4557; border-radius: 8px; box-shadow: 0 14px 36px rgba(0,0,0,.38); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 1181px) and (min-height: 600px) {
  .workspace { grid-template-columns: 52px minmax(0, 1fr) 320px; }
  .workspace:has(.canvas-ad-panel:not(.hidden) .canvas-ad-slot:not(:empty)) .inspector { padding-top: 300px; }
  .canvas-ad-panel { position: absolute; z-index: 18; top: 4px; right: 4px; width: 312px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px 6px; background: rgba(15,17,23,.98); border: 1px solid #292e3b; border-radius: 8px; box-shadow: 0 14px 34px rgba(0,0,0,.45); overflow: hidden; }
}

@media (max-width: 980px) {
  .workspace { grid-template-columns: 48px minmax(0, 1fr) 248px; }
  .inspector { font-size: 13px; }
  .brand-by, .privacy-pill { display: none; }
  .topbar { grid-template-columns: auto auto minmax(90px, 1fr) auto auto; }
}

@media (max-width: 720px) {
  .app-shell { grid-template-rows: 50px minmax(0, 1fr) 25px; }
  .topbar { height: 50px; grid-template-columns: auto 1fr auto; padding: 0 8px; }
  .file-actions .top-button span, .file-menu, .history-actions, .dimension-label { display: none; }
  .file-actions { justify-self: start; }
  .document-title { justify-self: start; }
  .brand-name { font-size: 16px; }
  .workspace { grid-template-columns: 46px minmax(0,1fr); grid-template-rows: minmax(0,1fr) 214px; }
  .tool-rail { grid-row: 1 / 3; }
  .inspector { grid-column: 2; grid-row: 2; display: grid; grid-template-rows: 38px minmax(0, 1fr); border-left: 0; border-top: 1px solid var(--line); }
  .mobile-inspector-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: #101219; border-bottom: 1px solid var(--line-soft); }
  .mobile-inspector-tabs button { color: var(--muted); background: transparent; border: 0; border-radius: 5px; font-size: 11px; font-weight: 700; }
  .mobile-inspector-tabs button[aria-selected="true"] { color: #fff; background: var(--accent-soft); }
  .inspector .panel { display: none; grid-row: 2; }
  .inspector[data-mobile-panel="properties"] .properties-panel { display: block; }
  .inspector[data-mobile-panel="layers"] .layers-panel { display: flex; }
  .layers-panel { min-height: 0; }
  .layer-list { min-height: 70px; }
  .statusbar { grid-template-columns: 1fr auto; }
  .status-center, .memory-status { display: none; }
  .statusbar > :last-child { display: none; }
  .preset-grid { grid-template-columns: 1fr 1fr; }
  .tool-button { width: 42px; min-height: 42px; }
  .cloud-project { grid-template-columns: 1fr; }
  .cloud-project-actions { justify-content: flex-start; }
}

@media (max-width: 460px) {
  .export-button { padding: 0 10px; }
  .document-title { display: none; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .file-actions { justify-self: center; }
  .preset-grid { grid-template-columns: 1fr 1fr; }
}

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