/* ═══ Editor shell (shared by both editors) + image editor specifics ═══ */

.editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.ed-top {
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 10px;
  background: var(--glass); border-bottom: 1px solid var(--stroke-soft); flex: none;
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
.ed-top .title-input {
  border: 1px solid transparent; background: transparent; color: var(--text-1);
  font-weight: 600; font-size: 14px; padding: 6px 9px; border-radius: var(--radius-s);
  width: 200px; outline: none;
}
.ed-top .title-input:hover { border-color: var(--stroke); }
.ed-top .title-input:focus { border-color: var(--accent); background: var(--bg-2); }
.ed-top .zoom-lbl { font-size: 12px; color: var(--text-2); min-width: 42px; text-align: center; cursor: pointer; }

.ed-main { flex: 1; display: flex; min-height: 0; }

/* left icon rail */
.ed-rail {
  width: 64px; flex: none; background: var(--bg-1); border-right: 1px solid var(--stroke-soft);
  display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 2px; overflow-y: auto;
}
.ed-rail button {
  width: 56px; padding: 8px 0 6px; border: 0; background: transparent; color: var(--text-2);
  border-radius: var(--radius-m); cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 3px; font-size: 10px; line-height: 1.1;
}
.ed-rail button svg { width: 19px; height: 19px; }
.ed-rail button:hover { color: var(--text-1); background: var(--bg-2); }
.ed-rail button.on { color: var(--accent); background: var(--accent-soft); }

/* slide-out panel */
.ed-panel {
  width: 300px; flex: none; background: var(--bg-1); border-right: 1px solid var(--stroke-soft);
  overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.ed-panel h4 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); margin: 4px 0 2px; }
.panel-sec-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); margin: 4px 0 2px; }

.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.tpl-thumb {
  border-radius: var(--radius-m); overflow: hidden; cursor: pointer; border: 1.5px solid var(--stroke);
  background: var(--thumb-bg); transition: all var(--dur-fast); position: relative;
}
.tpl-thumb:hover { border-color: var(--accent); transform: translateY(-1px); }
.tpl-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.tpl-thumb canvas { width: 100%; height: auto; display: block; }
.tpl-thumb .nm {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 7px; font-size: 10.5px;
  background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.style-chip {
  width: 100%; text-align: center; padding: 10px 8px; border-radius: var(--radius-m);
  border: 1px solid var(--stroke); background: var(--bg-2); color: var(--text-1); cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; transition: border-color var(--dur-fast);
}
.style-chip:hover { border-color: var(--accent); }

.emoji-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.emoji-grid button {
  font-size: 24px; padding: 6px 0; background: transparent; border: 0; border-radius: var(--radius-s);
  cursor: pointer; transition: background var(--dur-fast), transform var(--dur-fast);
}
.emoji-grid button:hover { background: var(--bg-2); transform: scale(1.2); }

.shape-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shape-grid button {
  aspect-ratio: 1.4; border-radius: var(--radius-m); border: 1px solid var(--stroke); background: var(--bg-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2);
}
.shape-grid button:hover { border-color: var(--accent); color: var(--text-1); }
.shape-grid .shp { background: currentColor; }

.media-mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.media-mini-grid .cell {
  aspect-ratio: 1; border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--stroke);
  background: var(--thumb-bg); cursor: pointer; padding: 0;
}
.media-mini-grid .cell img { width: 100%; height: 100%; object-fit: cover; }
.media-mini-grid .cell:hover { border-color: var(--accent); }

.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filter-item { cursor: pointer; text-align: center; }
.filter-item canvas { width: 100%; border-radius: var(--radius-s); border: 1.5px solid var(--stroke); display: block; }
.filter-item.on canvas { border-color: var(--accent); }
.filter-item span { font-size: 10.5px; color: var(--text-2); display: block; margin-top: 3px; }

/* center stage */
.ed-stage {
  flex: 1; min-width: 0; position: relative; overflow: hidden; background: var(--bg-canvas);
  display: flex; align-items: center; justify-content: center;
}
/* flex: none + max-width: none — the base reset's max-width would clamp the
   zoomed width while the zoomed height stays, which reads as vertical stretch */
.ed-stage canvas.stage-canvas { box-shadow: var(--shadow-2); border-radius: 2px; touch-action: none; flex: none; max-width: none; }
.ed-stage .stage-hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--text-3); background: var(--bg-1); border: 1px solid var(--stroke-soft);
  padding: 5px 12px; border-radius: 999px; pointer-events: none; white-space: nowrap;
}

/* right props */
.ed-props {
  width: 280px; flex: none; background: var(--bg-1); border-left: 1px solid var(--stroke-soft);
  overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.ed-props h4 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); margin: 6px 0 2px; }
.props-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.props-row > label { font-size: 12.5px; color: var(--text-2); flex: none; }

.bg-swatch-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bg-swatch-grid .gsw { aspect-ratio: 1.5; border-radius: var(--radius-s); border: 1.5px solid var(--stroke); cursor: pointer; }
.bg-swatch-grid .gsw:hover, .bg-swatch-grid .gsw.on { border-color: var(--accent); }
.bg-swatch-grid .gsw-none {
  background:
    linear-gradient(45deg, var(--bg-3) 25%, transparent 25%, transparent 75%, var(--bg-3) 75%),
    linear-gradient(45deg, var(--bg-3) 25%, var(--bg-1) 25%, var(--bg-1) 75%, var(--bg-3) 75%);
  background-size: 12px 12px; background-position: 0 0, 6px 6px;
}

/* layers list */
.layer-list { display: flex; flex-direction: column; gap: 3px; }
.layer-row {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 7px 9px; border-radius: var(--radius-s); border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer; font-size: 12.5px;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.layer-row:hover { background: var(--bg-2); color: var(--text-1); }
.layer-row.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text-1); }
.layer-row svg { flex: none; color: var(--text-3); }
.layer-row.on svg { color: var(--accent); }
.layer-row .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row { touch-action: none; }
.layer-row.dragging { opacity: .5; }
.layer-drop { height: 3px; border-radius: 2px; background: var(--accent-2); box-shadow: 0 0 6px var(--accent-2); margin: 1px 4px; }
.layer-x {
  flex: none; border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  padding: 3px; border-radius: 5px; display: inline-flex;
}
.layer-x:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, transparent); }

/* draggable panel splitters (size remembered per browser) */
.splitter { flex: none; position: relative; z-index: 5; transition: background var(--dur-fast); }
.splitter.sp-v { width: 5px; margin: 0 -2px; cursor: col-resize; }
.splitter.sp-h { height: 5px; margin: -2px 0; cursor: row-resize; }
.splitter:hover, .splitter.dragging { background: var(--accent); }

@media (max-width: 1100px) { .ed-props { width: 240px; } .ed-panel { width: 264px; } }
