@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Manrope:wght@500;600;700;800&family=Merriweather:wght@400;700&family=Playfair+Display:wght@500;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  --bg: #07080b;
  --bg-2: #0a0c11;
  --surface: rgba(255, 255, 255, 0.022);
  --surface-2: rgba(255, 255, 255, 0.04);
  --surface-3: rgba(255, 255, 255, 0.06);
  --panel: rgba(12, 14, 19, 0.72);

  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);

  --text: #f3f5f9;
  --muted: #9aa3b2;
  --dim: #626b7b;

  --accent: #5fe3ff;
  --accent-soft: rgba(95, 227, 255, 0.14);
  --accent-line: rgba(95, 227, 255, 0.4);
  --accent-ink: #04141b;
  --danger: #ff7a93;
  --warning: #f4c66a;

  --shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --font-display: "Space Grotesk", Inter, system-ui, sans-serif;
  --font-ui: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(120rem 60rem at 78% -22%, rgba(95, 227, 255, 0.06), transparent 60%),
    var(--bg);
}

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

:focus-visible {
  outline: none;
  border-color: var(--accent-line) !important;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.noscript {
  padding: var(--space-3);
  background: var(--danger);
  color: #160409;
  text-align: center;
  font-weight: 600;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 332px;
  grid-template-rows: 64px minmax(0, 1fr);
  height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 11, 0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-accent {
  color: var(--accent);
}

.brand p {
  margin: 1px 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-group + .topbar-group {
  padding-left: var(--space-3);
  border-left: 1px solid var(--line);
}

.panel {
  overflow: auto;
  background: var(--bg-2);
}

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

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

.tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: var(--space-3) var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  min-height: 38px;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0 6px 10px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.tab:hover {
  color: var(--muted);
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
  padding: var(--space-5) var(--space-4);
}

.tab-panel.active {
  display: block;
}

.panel-head {
  margin-bottom: var(--space-4);
}

.panel-head h2,
.right-panel > .panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-head p,
.right-panel > .panel-head p,
.muted {
  margin: 5px 0 0;
  color: var(--dim);
  font-size: 0.76rem;
  line-height: 1.5;
}

h3 {
  margin: 0 0 var(--space-3);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

hr {
  margin: var(--space-4) 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.workspace {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.status-pill.warning {
  color: var(--warning);
  border-color: rgba(244, 198, 106, 0.32);
  background: rgba(244, 198, 106, 0.08);
  font-family: var(--font-ui);
}

.view-toggles {
  display: flex;
  align-items: center;
  gap: 4px;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.view-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.view-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-toggle:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.view-toggle:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.view-toggle:has(input:focus-visible) {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.stage-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  display: grid;
  place-items: center;
}

#editorCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}

.stage-wrap.tool-draw #editorCanvas {
  cursor: crosshair;
}

.stage-wrap.tool-hand #editorCanvas {
  cursor: grab;
}

.stage-wrap.panning #editorCanvas {
  cursor: grabbing;
}

.drop-hint {
  position: absolute;
  inset: var(--space-4);
  display: none;
  place-items: center;
  border: 1.5px dashed var(--accent-line);
  border-radius: var(--radius-lg);
  background: rgba(7, 8, 11, 0.78);
  backdrop-filter: blur(4px);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: clamp(1rem, 3.4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stage-wrap.dragging .drop-hint {
  display: grid;
}

.canvas-tools {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: rgba(12, 14, 19, 0.82);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
}

.canvas-tools.dragging {
  cursor: grabbing;
}

.ctool-grip {
  display: grid;
  place-items: center;
  width: 20px;
  height: 38px;
  color: var(--dim);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.ctool-grip:hover {
  color: var(--muted);
}

.ctool-grip:active {
  cursor: grabbing;
}

.ctool-grip svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.ctool {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.ctool-key {
  position: absolute;
  right: 2px;
  bottom: 1px;
  padding: 0 1px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  pointer-events: none;
}

.ctool:hover .ctool-key {
  color: var(--muted);
}

.ctool.active .ctool-key {
  color: var(--accent);
}

.ctool svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctool:hover {
  background: var(--surface-3);
  color: var(--text);
}

.ctool.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.ctool-sep {
  width: 1px;
  height: 22px;
  margin: 0 4px;
  background: var(--line-2);
}

.pen-popover {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  width: 196px;
  padding: var(--space-3) var(--space-3) 4px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: rgba(12, 14, 19, 0.92);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
}

.zoom-widget {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(12, 14, 19, 0.82);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
}

.zoom-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background 0.16s ease, color 0.16s ease;
}

.zoom-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.zoom-pct {
  min-width: 50px;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  transition: background 0.16s ease;
}

.zoom-pct:hover {
  background: var(--surface-3);
}

.btn,
.upload-box {
  border: 1px solid var(--line-2);
  color: var(--text);
  background: var(--surface-2);
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn:hover,
.upload-box:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.btn.primary:hover {
  background: #7eeaff;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn.ghost:hover {
  color: var(--text);
  border-color: var(--line-2);
  background: var(--surface);
}

.btn.danger {
  border-color: rgba(255, 122, 147, 0.4);
  color: #ffb6c4;
  background: transparent;
}

.btn.danger:hover {
  background: rgba(255, 122, 147, 0.1);
  border-color: rgba(255, 122, 147, 0.6);
}

.btn.wide {
  width: 100%;
}

.button-row,
.button-stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.button-stack {
  flex-direction: column;
}

.panel-collapse {
  margin-top: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-collapse summary {
  padding: 11px 13px;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 600;
}

.panel-collapse[open] summary {
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.panel-collapse summary::-webkit-details-marker,
.inspector-subsection summary::-webkit-details-marker,
.help-card summary::-webkit-details-marker {
  display: none;
}

.panel-collapse summary::after,
.inspector-subsection summary::after,
.help-card summary::after {
  content: "+";
  float: right;
  color: var(--dim);
  font-family: var(--mono);
}

.panel-collapse[open] summary::after,
.inspector-subsection details[open] summary::after,
.help-card[open] summary::after {
  content: "–";
}

.panel-collapse-body {
  padding: var(--space-3) 13px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: var(--space-3);
  color: var(--muted);
  font-size: 0.74rem;
}

.field.compact {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 0;
}

.field.compact > span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.field.compact select {
  min-width: 196px;
}

.field.compact input[type="number"] {
  width: 70px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.stepper:hover {
  border-color: var(--line-strong);
}

.field.compact .stepper input[type="number"] {
  width: 40px;
  min-height: 34px;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stepper input[type="number"]::-webkit-outer-spin-button,
.stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper input:hover {
  border: 0;
}

.stepper-btn {
  width: 30px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background 0.16s ease, color 0.16s ease;
}

.stepper-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.stepper-btn:active {
  background: var(--accent-soft);
  color: var(--accent);
}

.field span {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.16s ease, background 0.16s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

select option {
  background: #0d1016;
  color: var(--text);
}

input[type="color"] {
  padding: 4px;
  min-height: 38px;
  cursor: pointer;
}

input[type="range"] {
  padding: 0;
  min-height: 0;
  background: transparent;
  border: 0;
  accent-color: var(--accent);
}

input[type="range"]:hover {
  border: 0;
}

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

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

.check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 9px 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.check input {
  width: auto;
  min-height: auto;
  accent-color: var(--accent);
}

.template-grid {
  display: grid;
  gap: var(--space-2);
}

.template-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}

.template-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.template-mini {
  position: relative;
  height: 56px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line-2);
}

.tpl-block {
  position: absolute;
  border-radius: 2.5px;
}

.tpl-media {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.tpl-text {
  background: rgba(255, 255, 255, 0.52);
  border-radius: 1.5px;
}

.tpl-accent {
  background: var(--template-accent, var(--accent));
  opacity: 0.9;
}

.tpl-frame {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.template-card:hover .template-mini {
  border-color: var(--accent-line);
}

.template-card strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
}

.template-card span {
  color: var(--dim);
  font-size: 0.72rem;
  line-height: 1.4;
}

.upload-box {
  display: grid;
  place-items: center;
  gap: var(--space-1);
  width: 100%;
  min-height: 104px;
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border-style: dashed;
  border-color: var(--line-2);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.upload-box span {
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 400;
}

.upload-plus {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 2px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 1;
}

.upload-box:hover .upload-plus {
  background: var(--accent);
  color: var(--accent-ink);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.media-card {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.media-card:hover {
  border-color: var(--accent-line);
}

.media-card img,
.media-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-card span {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.66);
  font-family: var(--mono);
  font-size: 0.56rem;
}

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

.layer-empty {
  padding: var(--space-4);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  color: var(--dim);
  text-align: center;
  font-size: 0.76rem;
}

.layer-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.layer-item:hover {
  border-color: var(--line-2);
  background: var(--surface-2);
}

.layer-item.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.layer-item.dragging {
  opacity: 0.45;
}

.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-item.is-hidden .layer-icon,
.layer-item.is-hidden .layer-meta {
  opacity: 0.45;
}

.layer-handle {
  display: grid;
  place-items: center;
  width: 16px;
  color: var(--dim);
  cursor: grab;
  line-height: 0.7;
  font-size: 0.7rem;
  letter-spacing: 1px;
}

.layer-handle:active {
  cursor: grabbing;
}

.layer-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
}

.layer-item.active .layer-icon {
  color: var(--accent);
}

.layer-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.layer-meta {
  min-width: 0;
}

.layer-meta strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 600;
  font-size: 0.78rem;
}

.layer-meta small {
  display: block;
  margin-top: 1px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.layer-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.layer-item:hover .layer-actions,
.layer-item.active .layer-actions,
.layer-item.is-hidden .layer-actions,
.layer-item.is-locked .layer-actions {
  opacity: 1;
}

.mini-btn {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.68rem;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.mini-btn:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.mini-btn.icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-color: transparent;
}

.mini-btn.icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-btn.icon:hover {
  background: var(--surface-3);
}

.mini-btn.icon.on {
  color: var(--accent);
}

.mini-btn.icon.danger:hover {
  color: var(--danger);
  background: rgba(255, 122, 147, 0.12);
}

.inspector-section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

.inspector-section > h3 {
  margin-bottom: var(--space-4);
}

.button-row {
  margin-bottom: var(--space-2);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-3) 0 var(--space-2);
}

.toggle-row .check {
  margin: 0;
}

.inspector-subsection {
  margin-top: var(--space-3);
}

.inspector-subsection details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.inspector-subsection summary {
  padding: 10px 12px;
  list-style: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.inspector-subsection details[open] summary {
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.inspector-subsection-body {
  padding: var(--space-3) 12px;
}

.notice,
.help-card {
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--dim);
  font-size: 0.74rem;
  line-height: 1.55;
}

.notice strong {
  color: var(--muted);
}

.help-card {
  margin-top: var(--space-4);
}

.help-card summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-family: var(--font-ui);
  font-weight: 600;
}

.help-card[open] summary {
  color: var(--text);
  margin-bottom: var(--space-2);
}

.help-card ul {
  margin: 0;
  padding-left: 16px;
}

.help-card li {
  margin-bottom: 4px;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(4, 5, 8, 0.72);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: var(--space-5);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  box-shadow: var(--shadow);
}

.modal-card.wide {
  width: min(940px, calc(100vw - 32px));
}

.modal-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.modal-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-2);
}

.preview-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
}

#previewCanvas {
  width: 100%;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #06070a;
  object-fit: contain;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.modal-card.chooser header {
  align-items: flex-start;
}

.modal-card.chooser header .muted {
  margin-top: 4px;
}

.chooser-format {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.chooser-format > span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.chooser-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.chooser-grid .template-mini {
  height: 76px;
}

.blank-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.blank-card:hover {
  border-color: var(--accent-line);
  background: var(--surface-2);
}

.blank-mark {
  display: grid;
  place-items: center;
  height: 52px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 300;
}

.blank-card strong {
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
}

.blank-card span span {
  color: var(--dim);
  font-size: 0.72rem;
}

@media (max-width: 720px) {
  .chooser-grid {
    grid-template-columns: 1fr;
  }
}

progress {
  width: 100%;
  height: 6px;
  margin: var(--space-4) 0;
  border: 0;
  border-radius: 999px;
  accent-color: var(--accent);
}

progress::-webkit-progress-bar {
  background: var(--surface-3);
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  max-width: min(600px, calc(100vw - 32px));
  padding: 11px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(12, 14, 19, 0.96);
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  font-size: 0.8rem;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 1280px) {
  .field.compact select {
    min-width: 160px;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 288px minmax(0, 1fr);
  }

  .right-panel {
    position: fixed;
    top: 80px;
    right: 12px;
    bottom: 12px;
    width: min(332px, calc(100vw - 24px));
    z-index: 30;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--bg-2);
    box-shadow: var(--shadow);
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px var(--space-4);
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-group + .topbar-group {
    padding-left: 0;
    border-left: 0;
  }

  .field.compact {
    flex: 1;
  }

  .field.compact select {
    min-width: 0;
  }

  .left-panel,
  .right-panel {
    position: static;
    width: auto;
    max-height: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }

  .workspace {
    min-height: 80vh;
    grid-template-rows: auto 72vh;
  }

  .canvas-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand p,
  .status-pill.warning {
    display: none;
  }

  .export-grid,
  .two-col {
    grid-template-columns: 1fr;
  }
}
