/* =========================================================
   PICMILE STUDIO — gradient generator & editor (/generate)
   ========================================================= */
.gm-body {
  margin: 0;
  background: #0b0816;
  color: #ece9f6;
  overflow: hidden;
}

.gm-app {
  --bg: #0b0816;
  --panel: #120e20;
  --panel-2: #191429;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #ece9f6;
  --muted: #9a94b2;
  --accent: #8b5cf6;
  --accent-2: #ff5fa2;
  --ok: #4ade80;
  --danger: #fb7185;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 320px;
  grid-template-rows: 56px minmax(0, 1fr);
  grid-template-areas: "top top top" "left stage right";
  height: calc(100vh - 68px);
  height: calc(100dvh - 68px);
  font: 14px/1.4 var(--font-body, system-ui, sans-serif);
  color: var(--text);
}
.gm-app * { box-sizing: border-box; }
.gm-app button { font: inherit; color: inherit; cursor: pointer; }
.gm-app button:disabled { opacity: 0.35; cursor: default; }
.gm-app :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.gm-topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.gm-top-left, .gm-top-center, .gm-top-right { display: flex; align-items: center; gap: 10px; }
.gm-top-left { flex: 1; min-width: 0; }
.gm-top-right { flex: 1; justify-content: flex-end; }
.gm-name {
  width: min(240px, 100%);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: 600 14px var(--font-body, sans-serif);
}
.gm-name:hover { background: var(--panel-2); }
.gm-name:focus { outline: none; border-color: var(--accent); background: var(--panel-2); }
.gm-btn-group { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.gm-icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.gm-icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: #fff; }
.gm-icon-btn.gm-danger:hover { background: rgba(251, 113, 133, 0.15); color: var(--danger); }
.gm-zoom { min-width: 56px; height: 34px; border: 0; border-radius: 9px; background: transparent; font-weight: 700 !important; font-size: 13px !important; font-variant-numeric: tabular-nums; }
.gm-zoom:hover { background: rgba(255, 255, 255, 0.08); }
.gm-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: 11px; border: 1px solid var(--line-2);
  font-weight: 700 !important; white-space: nowrap;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.gm-btn-ghost { background: var(--panel-2); }
.gm-btn-ghost:hover { background: #231c38; }
.gm-btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 8px 20px -10px var(--accent);
}
.gm-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -10px var(--accent); }

/* ---------- side panels ---------- */
.gm-left, .gm-right {
  background: var(--panel);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2c2442 transparent;
}
.gm-left { grid-area: left; border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.gm-right { grid-area: right; border-left: 1px solid var(--line); padding: 4px 16px 24px; }

.gm-tools { display: grid; gap: 2px; padding: 4px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.gm-tools button { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: #cfc8ea; font-size: 13px !important; font-weight: 600 !important; text-align: left; }
.gm-tools button svg { flex: none; color: var(--muted); }
.gm-tool-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-tools kbd { flex: none; min-width: 20px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); font: 700 10px var(--font-body, sans-serif); color: var(--muted); text-align: center; }
.gm-tools button:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.gm-tools button.is-on { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; }
.gm-tools button.is-on svg, .gm-tools button.is-on kbd { color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.gm-overlay[data-cursor="brush"], .gm-overlay[data-cursor="eraser"], .gm-overlay[data-cursor="line"] { cursor: none; }
.gm-overlay[data-cursor="picker"] { cursor: crosshair; }
.gm-brush-cursor { position: absolute; left: 0; top: 0; display: none; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.35); pointer-events: none; }
.gm-brush-cursor.is-eraser { border-style: dashed; }
.gm-brush-swatch.is-on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px #fff; }
.gm-add { display: grid; gap: 6px; }
.gm-add-wrap { position: relative; }
.gm-add-btn {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 600 !important;
  transition: border-color 0.15s, background 0.15s;
}
.gm-add-btn svg { color: var(--accent-2); }
.gm-add-btn:hover { border-color: var(--line-2); background: #201a33; }
.gm-popover {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding: 10px; border-radius: 14px;
  background: #1d1730; border: 1px solid var(--line-2);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6);
}
.gm-popover[hidden] { display: none; }
.gm-popover button { aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.05); color: #d9d2f5; }
.gm-popover button:hover { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; }

.gm-layers-head { margin: 10px 4px 0; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.gm-layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.gm-layer {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 6px 7px 10px;
  border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; user-select: none;
}
.gm-layer:hover { background: rgba(255, 255, 255, 0.04); }
.gm-layer.is-active { background: rgba(139, 92, 246, 0.16); border-color: rgba(139, 92, 246, 0.45); }
.gm-layer.is-hidden .gm-layer-name { opacity: 0.45; }
.gm-layer.is-over { border-top: 2px solid var(--accent); }
.gm-layer-icon { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); color: #cfc6f2; }
.gm-layer-swatch { border: 1px solid var(--line-2); }
.gm-layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13px; }
.gm-layer .gm-icon-btn { width: 28px; height: 28px; }
.gm-layer-bg { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; padding-top: 10px; }
.gm-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.gm-tip { margin: auto 4px 0; padding-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ---------- stage ---------- */
.gm-stage {
  grid-area: stage;
  position: relative;
  display: flex;
  overflow: auto;
  background-color: #08060f;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
}
.gm-stage.is-drop { box-shadow: inset 0 0 0 3px var(--accent); }
/* auto margins centre the canvas but, unlike grid centring, keep it scrollable when zoomed in */
.gm-canvas-wrap { position: relative; flex: none; margin: auto; }
#gm-canvas { display: block; border-radius: 4px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.06); }
.gm-overlay { position: absolute; inset: 0; touch-action: none; }

.gm-sel {
  position: absolute; left: 0; top: 0;
  display: none;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.9);
  pointer-events: none;
}
.gm-sel.is-editing { border-style: dashed; }
.gm-sel.is-editing .gm-h, .gm-sel.is-editing .gm-rot, .gm-sel.is-locked .gm-h, .gm-sel.is-locked .gm-rot { display: none; }
.gm-sel.is-locked { border-style: dotted; }
.gm-h {
  position: absolute; width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 4px; background: #fff;
  box-shadow: 0 0 0 1.5px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}
.gm-h-nw { left: 0; top: 0; cursor: nwse-resize; } .gm-h-n { left: 50%; top: 0; cursor: ns-resize; }
.gm-h-ne { left: 100%; top: 0; cursor: nesw-resize; } .gm-h-e { left: 100%; top: 50%; cursor: ew-resize; }
.gm-h-se { left: 100%; top: 100%; cursor: nwse-resize; } .gm-h-s { left: 50%; top: 100%; cursor: ns-resize; }
.gm-h-sw { left: 0; top: 100%; cursor: nesw-resize; } .gm-h-w { left: 0; top: 50%; cursor: ew-resize; }
.gm-sel.is-text .gm-h-n, .gm-sel.is-text .gm-h-s { display: none; }
.gm-rot {
  position: absolute; left: 50%; top: -34px;
  width: 18px; height: 18px; margin-left: -9px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 1.5px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: grab; pointer-events: auto;
}
.gm-rot::after { content: ''; position: absolute; left: 50%; top: 18px; width: 1.5px; height: 16px; background: #fff; transform: translateX(-50%); }
.gm-guide { position: absolute; display: none; background: var(--accent-2); pointer-events: none; }
.gm-guide-v { left: 50%; top: 0; bottom: 0; width: 1px; }
.gm-guide-h { top: 50%; left: 0; right: 0; height: 1px; }
.gm-editor {
  position: absolute; left: 0; top: 0;
  margin: 0; padding: 0;
  border: 0; outline: none;
  background: transparent;
  resize: none; overflow: hidden;
  caret-color: var(--accent-2);
  white-space: pre-wrap;
  word-break: normal;
}

/* ---------- properties ---------- */
.gm-panel-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0 12px; background: var(--panel); }
.gm-panel-head h2 { margin: 0; font: 800 16px var(--font-display, sans-serif); letter-spacing: -0.01em; color: #fff; }
.gm-head-actions { display: flex; gap: 2px; }
.gm-section { border-top: 1px solid var(--line); }
.gm-section > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.gm-section > summary::-webkit-details-marker { display: none; }
.gm-section > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform 0.2s; }
.gm-section[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.gm-section-body { display: grid; gap: 14px; padding-bottom: 18px; }

.gm-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.gm-field { display: grid; gap: 8px; }
.gm-field-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: #c9c3df; }
.gm-field-top output { color: var(--muted); font-variant-numeric: tabular-nums; }
.gm-grow { flex: 1; }
.gm-app input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; background: transparent; cursor: pointer;
}
.gm-app input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: #2a2340; }
.gm-app input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #2a2340; }
.gm-app input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.5); }
.gm-app input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px var(--accent); }
.gm-app select, .gm-app input[type="number"], .gm-textarea {
  width: 100%; padding: 9px 11px;
  border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text);
  font: 500 13px var(--font-body, sans-serif);
}
.gm-app select:focus, .gm-app input[type="number"]:focus, .gm-textarea:focus { outline: none; border-color: var(--accent); }
.gm-textarea { resize: vertical; min-height: 70px; font-size: 14px; }
.gm-hint, .gm-note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.gm-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); margin-bottom: 10px; }
.gm-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.gm-sub { display: grid; gap: 12px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.gm-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gm-grid4 label { display: grid; gap: 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.gm-grid4 input { padding: 7px 8px; font-variant-numeric: tabular-nums; }

.gm-color { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #c9c3df; cursor: pointer; }
.gm-color input, .gm-swatch input {
  -webkit-appearance: none; appearance: none;
  width: 34px; height: 34px; padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.18); border-radius: 10px;
  background: none; cursor: pointer;
}
.gm-color input::-webkit-color-swatch-wrapper, .gm-swatch input::-webkit-color-swatch-wrapper { padding: 0; }
.gm-color input::-webkit-color-swatch, .gm-swatch input::-webkit-color-swatch { border: 0; border-radius: 7px; }
.gm-color input::-moz-color-swatch, .gm-swatch input::-moz-color-swatch { border: 0; border-radius: 7px; }

.gm-toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: #c9c3df; cursor: pointer; }
.gm-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.gm-switch { position: relative; width: 34px; height: 20px; border-radius: 20px; background: #2c2442; transition: background 0.2s; }
.gm-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.gm-toggle input:checked + .gm-switch { background: var(--accent); }
.gm-toggle input:checked + .gm-switch::after { transform: translateX(14px); }
.gm-toggle input:focus-visible + .gm-switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.gm-seg { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line); }
.gm-seg button { flex: 1; min-height: 32px; padding: 0 10px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px !important; font-weight: 700 !important; }
.gm-seg button:hover { color: #fff; }
.gm-seg button.is-on { background: #fff; color: #1a1430; }

.gm-chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 12px !important; font-weight: 700 !important; color: #ddd6f7; }
.gm-chip-btn:hover { border-color: var(--accent); color: #fff; }

/* background panel */
.gm-styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gm-style { display: grid; gap: 6px; padding: 4px 4px 7px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); font-size: 11px !important; font-weight: 700 !important; color: #c9c3df; }
.gm-style canvas { width: 100%; aspect-ratio: 1; border-radius: 8px; display: block; background: #1d1730; }
.gm-style:hover { border-color: var(--line-2); }
.gm-style.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: #fff; }
.gm-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.gm-cats button { flex: none; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px !important; font-weight: 700 !important; }
.gm-cats button:hover { color: #fff; border-color: var(--line-2); }
.gm-cats button.is-on { background: #fff; border-color: #fff; color: #1a1430; }
.gm-looks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gm-look { display: grid; gap: 7px; padding: 0; border: 0; background: none; text-align: left; font-size: 12px !important; font-weight: 600 !important; color: #c9c3df; }
.gm-look canvas { width: 100%; aspect-ratio: 1; display: block; border-radius: 12px; background: #1d1730; box-shadow: 0 0 0 1px var(--line); transition: transform 0.18s, box-shadow 0.18s; }
.gm-look:hover canvas { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line-2), 0 12px 24px -12px #000; }
.gm-look:hover { color: #fff; }
.gm-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.gm-swatch { position: relative; }
.gm-swatch input { width: 42px; height: 42px; border-radius: 12px; }
.gm-swatch button { position: absolute; top: -6px; right: -6px; display: none; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: #2c2442; color: #fff; }
.gm-swatch:hover button, .gm-swatch:focus-within button { display: grid; }
.gm-swatch-add { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; border: 1.5px dashed var(--line-2); background: transparent; color: var(--muted); }
.gm-swatch-add:hover { border-color: var(--accent); color: #fff; }
.gm-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.gm-preset { height: 26px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 8px; padding: 0; transition: transform 0.15s; }
.gm-preset:hover { transform: scale(1.08); }
.gm-aspects { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gm-aspects button { display: grid; justify-items: center; gap: 6px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: 11px !important; font-weight: 700 !important; color: var(--muted); }
.gm-aspects button i { display: block; height: 18px; max-width: 30px; border: 1.5px solid currentColor; border-radius: 3px; }
.gm-aspects button.is-on { border-color: var(--accent); color: #fff; }
.gm-dims { align-items: center; }
.gm-dims label { display: grid; gap: 4px; flex: 1; font-size: 11px; font-weight: 700; color: var(--muted); }
.gm-shape-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.gm-shape-pick button { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: #c9c3df; }
.gm-shape-pick button.is-on { border-color: var(--accent); color: #fff; background: rgba(139, 92, 246, 0.2); }

/* ---------- export modal ---------- */
.gm-modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px; background: rgba(5, 3, 12, 0.7); backdrop-filter: blur(6px); }
.gm-modal[hidden] { display: none; }
.gm-modal-card { width: min(620px, 100%); border-radius: 20px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 40px 100px -30px #000; }
.gm-modal-head, .gm-modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; }
.gm-modal-head { border-bottom: 1px solid var(--line); }
.gm-modal-head h2 { margin: 0; font: 800 17px var(--font-display, sans-serif); color: #fff; }
.gm-modal-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.gm-modal-body { display: flex; gap: 22px; padding: 20px; align-items: flex-start; flex-wrap: wrap; }
.gm-export-preview { flex: none; border-radius: 10px; box-shadow: 0 10px 30px -10px #000; background: #1d1730; }
.gm-export-opts { flex: 1; min-width: 220px; display: grid; gap: 10px; }
.gm-output { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.gm-output strong { color: #fff; }
.gm-export-status { margin: 0; min-height: 18px; font-size: 13px; font-weight: 600; color: var(--ok); }
.gm-export-status.is-error { color: var(--danger); }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .gm-app { grid-template-columns: 220px minmax(0, 1fr) 290px; }
  .gm-btn-ghost span { display: none; }
}
@media (max-width: 860px) {
  .gm-body { overflow: auto; }
  .gm-app {
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto 62vh auto auto;
    grid-template-areas: "top" "stage" "right" "left";
  }
  .gm-topbar { flex-wrap: wrap; height: auto; padding: 8px 10px; }
  .gm-top-left { order: 1; flex-basis: 100%; }
  .gm-top-center { order: 2; }
  .gm-top-right { order: 3; flex: 1; }
  .gm-btn-primary span { display: none; }
  .gm-left, .gm-right { border: 0; border-top: 1px solid var(--line); overflow: visible; }
  .gm-left { padding-bottom: 30px; }
  .gm-add { grid-template-columns: repeat(3, 1fr); }
  .gm-tools { grid-template-columns: repeat(5, 1fr); }
  .gm-tools button { flex-direction: column; justify-content: center; gap: 3px; height: 54px; padding: 0 2px; font-size: 10px !important; text-align: center; }
  .gm-tools kbd { display: none; }
  .gm-add-btn { flex-direction: column; gap: 6px; font-size: 12px; }
  .gm-popover { left: auto; right: 0; width: 220px; }
}

/* ---------- photo tools: upload screen ---------- */
.gm-empty-state { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 24px; background: rgba(8, 6, 15, 0.92); }
.gm-empty-state[hidden] { display: none; }
.gm-drop { width: min(460px, 100%); display: grid; justify-items: center; gap: 12px; padding: 40px 28px; border-radius: 22px; border: 2px dashed rgba(255, 255, 255, 0.18); background: var(--panel); text-align: center; }
.gm-stage.is-drop .gm-drop { border-color: var(--accent); background: #1a1430; }
.gm-drop svg { color: var(--accent-2); }
.gm-drop h2 { margin: 4px 0 0; font: 800 22px var(--font-display, sans-serif); color: #fff; }
.gm-drop p { margin: 0; color: var(--muted); line-height: 1.5; }
.gm-drop .gm-btn { margin-top: 8px; height: 46px; padding: 0 26px; font-size: 15px !important; }
.gm-drop-hint { font-size: 12px; }
.gm-link { border: 0; background: none; color: #cfc8ea; text-decoration: underline; text-underline-offset: 3px; font-size: 13px !important; }
.gm-link:hover { color: #fff; }

/* ---------- crop tool ---------- */
.gm-crop { position: absolute; left: 0; top: 0; display: none; box-shadow: 0 0 0 9999px rgba(5, 3, 12, 0.62); outline: 1.5px solid #fff; cursor: move; touch-action: none; }
.gm-overlay.is-cropping { overflow: hidden; }
.gm-crop-grid { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.35) 1px, transparent 1px);
  background-size: 33.333% 33.333%; background-position: -1px -1px; }
.gm-ch { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.gm-ch::after { content: ''; position: absolute; inset: 4px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1.5px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.4); }
.gm-ch-nw { left: 0; top: 0; cursor: nwse-resize; } .gm-ch-n { left: 50%; top: 0; cursor: ns-resize; }
.gm-ch-ne { left: 100%; top: 0; cursor: nesw-resize; } .gm-ch-e { left: 100%; top: 50%; cursor: ew-resize; }
.gm-ch-se { left: 100%; top: 100%; cursor: nwse-resize; } .gm-ch-s { left: 50%; top: 100%; cursor: ns-resize; }
.gm-ch-sw { left: 0; top: 100%; cursor: nesw-resize; } .gm-ch-w { left: 0; top: 50%; cursor: ew-resize; }
.gm-crop-actions { position: sticky; bottom: 0; justify-content: flex-end; padding: 14px 0; background: var(--panel); border-top: 1px solid var(--line); }
.gm-crop-actions .gm-btn { flex: 1; justify-content: center; }

/* ---------- formats ---------- */
.gm-socials { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.gm-social { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); text-align: left; }
.gm-social b { font-size: 12px; font-weight: 700; color: #e4def8; }
.gm-social small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gm-social:hover { border-color: var(--line-2); }
.gm-social.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.gm-socials-sm { grid-template-columns: repeat(2, 1fr); max-height: 210px; overflow: auto; }
.gm-photo-actions { display: grid; gap: 8px; margin-bottom: 6px; }
.gm-photo-actions strong { color: #fff; }
.gm-remove-photo { margin: 18px 0 6px; }
.gm-icon-btn.is-on { color: #fff; background: rgba(139, 92, 246, 0.25); }

/* ---------- letters & word art ---------- */
.gm-letters { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); max-height: 180px; overflow: auto; }
.gm-letter { min-width: 30px; height: 34px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 17px !important; font-weight: 700 !important; color: #fff; }
.gm-letter:hover { border-color: var(--accent); }
.gm-letter.is-styled { border-color: rgba(255, 95, 162, 0.6); }
.gm-letter.is-on { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; }
.gm-chip-br { flex-basis: 100%; height: 0; }
.gm-wa-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gm-wa { display: grid; gap: 5px; padding: 0; border: 0; background: none; font-size: 11px !important; font-weight: 700 !important; color: #c9c3df; }
.gm-wa canvas { width: 100%; aspect-ratio: 132 / 72; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); background: #1d1730; }
.gm-wa:hover canvas { box-shadow: 0 0 0 1px var(--accent); }

/* ---------- rotation dial ---------- */
.gm-angle-row { display: flex; align-items: center; gap: 10px; }
.gm-dial { position: relative; flex: none; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #241d38 55%, #2f2648 56%); box-shadow: inset 0 0 0 1px var(--line-2); cursor: grab; touch-action: none; }
.gm-dial:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gm-dial i { position: absolute; left: 50%; top: 8px; bottom: 50%; width: 2px; margin-left: -1px; background: linear-gradient(var(--accent-2), var(--accent)); transform-origin: 50% 100%; border-radius: 2px; }
.gm-dial b { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.5); }
.gm-angle-row input { width: 76px; }
.gm-unit { margin-left: -6px; color: var(--muted); }

/* ---------- zones ---------- */
.gm-zone-outline { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; display: none; }
.gm-zone-outline path { fill: rgba(139, 92, 246, 0.08); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.gm-ants-a { stroke: #000; }
.gm-ants-b { stroke: #fff; stroke-dasharray: 6 6; animation: gm-ants 0.6s linear infinite; fill: none !important; }
@keyframes gm-ants { to { stroke-dashoffset: -12; } }
.gm-overlay[data-cursor^="zone"], .gm-overlay[data-cursor="rect"], .gm-overlay[data-cursor="ellipse"] { cursor: crosshair; }
.gm-surfaces { display: flex; flex-wrap: wrap; gap: 6px; }
.gm-surface { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: rgba(139, 92, 246, 0.16); border: 1px solid rgba(139, 92, 246, 0.4); font-size: 12px; font-weight: 700; color: #e4def8; }
.gm-surface button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.gm-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.gm-tools [data-zone-act] { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: #cfc8ea; font-size: 13px !important; font-weight: 600 !important; text-align: left; }
.gm-tools [data-zone-act]:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.gm-tools [data-zone-act] svg { flex: none; color: var(--muted); }

/* ---------- transparent canvas (word art) ---------- */
.gm-canvas-wrap.is-transparent #gm-canvas {
  background-color: #fff;
  background-image: linear-gradient(45deg, #e6e6ee 25%, transparent 25%), linear-gradient(-45deg, #e6e6ee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e6e6ee 75%), linear-gradient(-45deg, transparent 75%, #e6e6ee 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

/* ---------- word art page: only text tools ---------- */
.gm-app[data-mode="wordart"] .gm-tools,
.gm-app[data-mode="wordart"] .gm-left > .gm-layers-head:first-child,
.gm-app[data-mode="wordart"] [data-action="add-image"],
.gm-app[data-mode="wordart"] .gm-add-wrap { display: none; }

.gm-layer-swatch.is-transparent { background: repeating-conic-gradient(#e6e6ee 0 25%, #ffffff 0 50%) 0 0 / 10px 10px !important; }
.gm-poly-pts circle { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.gm-poly-pts circle.is-first { fill: var(--accent-2); stroke: #fff; }
.gm-overlay[data-cursor="zone-poly"] { cursor: crosshair; }

/* editing styled text: invisible textarea, caret & selection drawn on top */
.gm-editor.is-ghost { opacity: 0; pointer-events: none; caret-color: transparent; }
.gm-caret-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.gm-caret { stroke: #fff; stroke-width: 2.5; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.9)); animation: gm-blink 1.05s steps(1) infinite; }
.gm-sel-box { fill: rgba(139, 92, 246, 0.42); stroke: rgba(255, 255, 255, 0.7); stroke-width: 1; vector-effect: non-scaling-stroke; }
@keyframes gm-blink { 50% { opacity: 0; } }

.gm-scope { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border-radius: 10px; background: rgba(139, 92, 246, 0.14); border: 1px solid rgba(139, 92, 246, 0.35); font-size: 12px; color: var(--muted); }
.gm-scope strong { color: #fff; font-weight: 700; }
.gm-fmt-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 16px !important; color: #ddd6f7; align-self: flex-end; }
.gm-fmt-btn.is-on { background: #fff; color: #1a1430; border-color: #fff; }
.gm-scope-sm { padding: 6px 10px; margin-bottom: 4px; }
.gm-switch.is-mixed { background: linear-gradient(90deg, var(--accent) 50%, #2c2442 50%); }
[data-fmt-block="effects"] > .gm-toggle { display: flex; margin-top: 12px; }
[data-fmt-block="effects"] > .gm-toggle:first-child { margin-top: 0; }
.gm-back { text-decoration: none; color: inherit; flex: none; }
