@import url('/fonts.css');

:root {
  --bg: #f4f4f1;
  --panel: #ffffff;
  --panel-2: #f8f8f6;
  --line: #e4e3df;
  --line-strong: #cfcdc7;
  --text: #1c1b19;
  --muted: #6f6d67;
  --accent: #5a1e96;
  --accent-ink: #ffffff;
  --accent-soft: #f3ecfa;
  --brand: #55168f;
  --brand-2: #6b2bb0;
  --brand-soft: #f1e8f8;
  --brand-ink: #4a1380;
  --canvas-bg: #f8f7fb;
  --select: #2563eb;
  --danger: #c62828;
  --stage: #e9e8e4;
  --checker: #dddcd7;
  --shadow: 0 1px 2px rgba(20, 20, 15, .06), 0 8px 24px rgba(20, 20, 15, .08);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514; --panel: #1d1d1b; --panel-2: #232321; --line: #2f2f2c; --line-strong: #44443f;
    --text: #ecebe6; --muted: #9b9a93; --accent: #b48ce6; --accent-soft: #2c2240; --brand-soft: #2a2238; --brand-ink: #d6bff5; --canvas-bg: #121116; --select: #60a5fa;
    --stage: #111110; --checker: #1b1b19; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
a { color: inherit; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px;
  cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { color: var(--danger); }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 16px; height: 16px; }

input[type=text], input[type=number], input[type=password], input[type=url], select, textarea {
  width: 100%; height: 32px; padding: 0 9px; border: 1px solid var(--line-strong);
  background: var(--panel); border-radius: 7px; outline: none;
}
textarea { height: auto; min-height: 76px; padding: 7px 9px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--select); box-shadow: 0 0 0 3px color-mix(in srgb, var(--select) 20%, transparent); }
input[type=color] { width: 32px; height: 32px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* ---------- modal / toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 15, 12, .45); display: grid; place-items: center;
  z-index: 100; padding: 16px; backdrop-filter: blur(2px);
}
.modal {
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 22px;
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto;
}
.modal.wide { width: min(980px, 100%); }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal.login input { margin-top: 10px; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 8px; box-shadow: var(--shadow); transition: opacity .3s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; }

/* ---------- dashboard ---------- */
.top {
  display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 60px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; font-size: 16px; text-decoration: none; }
.brand .mark { width: 34px; height: 34px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.brand .mark::after { content: ''; width: 13px; height: 13px; border: 3px solid var(--brand); border-radius: 3px; }
.top { background: var(--brand) !important; color: #fff; border-bottom: 0 !important; height: 64px !important; }
.top .brand { font: 700 19px/1 Poppins, Inter, sans-serif; }
.top .pill { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.top .btn.ghost { color: #fff; }
.top .btn.ghost:hover { background: rgba(255,255,255,.12); }
.dash-head h1 { font-family: Poppins, Inter, sans-serif; }
.top .spacer { flex: 1; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }

.dash { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.dash-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.dash-head h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.card .thumb {
  aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 14px; cursor: pointer;
  background: repeating-conic-gradient(var(--checker) 0 25%, transparent 0 50%) 0 0 / 16px 16px, var(--panel-2);
}
.card .thumb img { max-width: 100%; max-height: 100%; box-shadow: 0 2px 10px rgba(0,0,0,.15); border-radius: 2px; }
.card .meta { padding: 10px 12px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.card .meta .name { flex: 1; min-width: 0; }
.card .meta .name b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta .name span { font-size: 12px; color: var(--muted); }
.empty { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 48px 20px; text-align: center; color: var(--muted); }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 14px 0; }
.preset { border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px; background: var(--panel); cursor: pointer; text-align: left; }
.preset b { display: block; font-size: 13px; }
.preset span { font-size: 12px; color: var(--muted); }
.preset.on { border-color: var(--accent); background: var(--accent-soft); }
.starters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.starter { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px; background: var(--panel); cursor: pointer; text-align: left; display: grid; gap: 2px; align-content: start; }
.starter:hover { border-color: var(--line-strong); }
.starter.on { border-color: var(--accent); background: var(--accent-soft); }
.starter .sp { height: 130px; display: grid; place-items: center; background: var(--panel-2); border-radius: 6px; margin-bottom: 6px; overflow: hidden; }
.starter .sp canvas { max-width: 100%; max-height: 120px; box-shadow: 0 1px 6px rgba(0,0,0,.18); }
.starter .sp.blank { color: var(--muted); font-size: 13px; border: 1.5px dashed var(--line-strong); background: transparent; }
.starter b { font-size: 13px; }
.starter span { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
[hidden] { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.field { display: grid; gap: 5px; margin-bottom: 10px; }
.field > label, .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---------- editor (shared pieces) ---------- */
.layers { list-style: none; margin: 0; padding: 4px 6px 16px; }
.layers li {
  display: flex; align-items: center; gap: 7px; padding: 0 6px 0 8px; height: 34px; border-radius: 7px; cursor: pointer; user-select: none;
}
.layers li:hover { background: var(--panel-2); }
.layers li.on { background: color-mix(in srgb, var(--select) 14%, transparent); }
.layers li.dragging { opacity: .4; }
.layers li.drop-before { box-shadow: inset 0 2px 0 var(--select); }
.layers li.drop-after { box-shadow: inset 0 -2px 0 var(--select); }
.layers li .ico { width: 16px; height: 16px; color: var(--muted); flex: none; }
.layers li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.layers li.hidden .nm { opacity: .45; }
.layers li .tog { border: 0; background: none; padding: 3px; cursor: pointer; color: var(--muted); border-radius: 5px; display: grid; opacity: .35; }
.layers li .tog.on { opacity: 1; }
.layers li .tog.dyn.on { color: var(--accent); }
.layers li .tog:hover { background: var(--line); opacity: 1; }
.layers li .tog svg { width: 14px; height: 14px; }

.stage-wrap { position: relative; overflow: auto; background: var(--canvas-bg); min-width: 0; }
.stage-inner { min-width: 100%; min-height: 100%; display: grid; place-items: center; padding: 180px 220px; width: max-content; }
.stage { position: relative; box-shadow: 0 2px 20px rgba(0,0,0,.18); background: repeating-conic-gradient(var(--checker) 0 25%, transparent 0 50%) 0 0 / 20px 20px, #fff; touch-action: none; }
.stage canvas { display: block; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.hover-box, .sel-box { position: absolute; pointer-events: none; transform-origin: center; }
.hover-box { outline: 1px solid var(--select); }
.sel-box { outline: 1.5px solid var(--select); }
.sel-box .h {
  position: absolute; width: 10px; height: 10px; background: #fff; border: 1.5px solid var(--select); border-radius: 2px;
  pointer-events: auto; margin: -5px 0 0 -5px;
}
.sel-box .h.rot { border-radius: 50%; cursor: grab; }
.sel-box .tag {
  position: absolute; left: -1px; top: -22px; font-size: 11px; background: var(--select); color: #fff; padding: 1px 6px; border-radius: 4px 4px 4px 0; white-space: nowrap;
}
.guide { position: absolute; background: #ec4899; pointer-events: none; }
.guide.v { width: 1px; top: 0; bottom: 0; }
.guide.h { height: 1px; left: 0; right: 0; }

.props { padding: 0 14px 20px; }
.props .group { padding: 12px 0; border-bottom: 1px solid var(--line); }
.props .group:last-child { border-bottom: 0; }
.props .gtitle { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin-bottom: 9px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.num { position: relative; }
.num span { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); pointer-events: none; font-weight: 600; }
.num input { padding-left: 22px; }
.color { display: flex; gap: 6px; }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; height: 32px; }
.seg button { flex: 1; border: 0; background: var(--panel); cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.seg svg { width: 15px; height: 15px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 3px 0; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.dynamic-note { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-top: 4px; }
.dynamic-note code { font-weight: 600; }

/* text highlight */
.hl-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 10px 0; background: var(--panel-2); }
.hl-box code { font-size: 11.5px; }

/* picture placeholder */
.ph-preview { aspect-ratio: 16 / 10; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(var(--checker) 0 25%, transparent 0 50%) 0 0 / 14px 14px, var(--panel-2); }
.ph-preview img { width: 100%; height: 100%; object-fit: contain; }
.ph-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ph-choice { aspect-ratio: 1; border: 1.5px solid var(--line); border-radius: 8px; padding: 0; overflow: hidden; cursor: pointer; background: var(--panel-2); color: var(--muted); font-size: 20px; }
.ph-choice img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-choice.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ph-choice:hover { border-color: var(--line-strong); }

/* API modal */
.api-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 14px; }
.api-grid pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; font-size: 12px; margin: 0; max-height: 300px; }
.api-result { margin-top: 10px; background: repeating-conic-gradient(var(--checker) 0 25%, transparent 0 50%) 0 0 / 16px 16px; border-radius: 8px; border: 1px solid var(--line); min-height: 120px; display: grid; place-items: center; padding: 10px; }
.api-result img { max-width: 100%; max-height: 360px; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tabs button { border: 0; background: none; padding: 5px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; }
.tabs button.on { background: var(--panel-2); color: var(--text); }


/* ================= Editor layout ================= */
.pe-body-page { overflow: hidden; }
.pe { display: grid; grid-template-rows: 64px 56px 1fr; height: 100vh; }
.pe .spacer { flex: 1; }

/* top bar */
.pe-top { display: flex; align-items: center; gap: 10px; padding: 0 18px 0 14px; background: var(--brand); color: #fff; min-width: 0; }
.pe-logo { width: 40px; height: 40px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.pe-logo span { width: 16px; height: 16px; border: 3.5px solid var(--brand); border-radius: 4px; }
.pe-name { display: flex; align-items: center; gap: 6px; min-width: 0; cursor: text; }
.pe-name input { background: transparent; border: 1px solid transparent; color: #fff; font: 700 19px/1 Poppins, Inter, sans-serif; padding: 6px 6px; border-radius: 8px; width: auto; min-width: 4ch; max-width: 40vw; outline: none; }
.pe-name input:hover { border-color: rgba(255,255,255,.25); }
.pe-name input:focus { border-color: rgba(255,255,255,.7); background: rgba(255,255,255,.08); }
.pe-name svg { width: 17px; height: 17px; opacity: .85; flex: none; }
.pe-ico { width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; text-decoration: none; font-size: 17px; }
.pe-ico:hover { background: rgba(255,255,255,.12); }
.pe-ico:disabled { opacity: .4; cursor: default; background: transparent; }
.pe-ico svg { width: 20px; height: 20px; }
.pe-sep { width: 1px; height: 28px; background: rgba(255,255,255,.25); margin: 0 4px; }
.pe-pill { height: 42px; padding: 0 18px; border-radius: 99px; border: 2px solid #fff; background: transparent; color: #fff; display: inline-flex; align-items: center; gap: 7px;
  font: 700 15px/1 Poppins, Inter, sans-serif; text-transform: uppercase; letter-spacing: .02em; cursor: pointer; white-space: nowrap; }
.pe-pill:hover { background: rgba(255,255,255,.12); }
.pe-pill svg { width: 17px; height: 17px; }
.pe-pill.solid { background: #fff; color: var(--brand); }
.pe-pill.solid:hover { background: #f1e8f8; }
.pe-pill.solid.clean { opacity: .85; }
.pe-close { margin-left: 4px; }

/* size bar */
.pe-bar { display: flex; align-items: center; gap: 8px; padding: 0 22px; background: var(--panel); border-bottom: 1px solid var(--line); }
.pe-select, .pe-dim { height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.pe-select { width: 330px; padding: 0 12px; font-size: 15px; cursor: pointer; }
.pe-dim { display: flex; align-items: center; padding: 0 12px; width: 132px; }
.pe-dim input { border: 0 !important; box-shadow: none !important; height: 36px; padding: 0; width: 100%; font-size: 15px; background: transparent; -moz-appearance: textfield; }
.pe-dim input::-webkit-inner-spin-button { display: none; }
.pe-dim span { color: var(--muted); font-size: 14px; }
.pe-lock { width: 30px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 8px; }
.pe-lock svg { width: 19px; height: 19px; }
.pe-lock.on { color: var(--accent); }
.pe-swatch { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); display: grid; place-items: center; cursor: pointer; position: relative; padding: 0; }
.pe-swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.pe-swatch span { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line-strong); pointer-events: none; }
.pe-transparent span { border: 0; background: repeating-conic-gradient(var(--brand) 0 25%, #fff 0 50%) 0 0 / 8px 8px; }
.pe-transparent.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--brand-soft); }
.pe-panel-toggle { width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; }
.pe-panel-toggle svg { width: 22px; height: 22px; }

/* workspace */
.pe-work { display: grid; grid-template-columns: 1fr 440px; min-height: 0; }
.pe.panel-hidden .pe-work { grid-template-columns: 1fr 0; }
.pe.panel-hidden .pe-panel { display: none; }
.pe-main { position: relative; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: 40px 1fr; min-width: 0; min-height: 0; background: var(--canvas-bg); }
.pe.no-rulers .pe-main { grid-template-columns: 0 1fr; grid-template-rows: 0 1fr; }
.pe.no-rulers .pe-ruler, .pe.no-rulers .pe-corner { display: none; }
.pe-corner { background: var(--brand-soft); }
.pe-ruler { display: block; width: 100%; height: 100%; background: var(--brand-soft); }
.pe-ruler.r-top { grid-column: 2; grid-row: 1; }
.pe-ruler.r-left { grid-column: 1; grid-row: 2; }
.pe-main .stage-wrap { grid-column: 2; grid-row: 2; }
.pe .stage { box-shadow: 0 1px 3px rgba(40, 10, 70, .12); }

/* floating tools */
.pe-tools { position: absolute; left: 64px; top: 64px; display: grid; gap: 4px; padding: 12px 8px; background: var(--brand); border-radius: 99px; box-shadow: 0 6px 20px rgba(60, 10, 110, .25); z-index: 5; }
.pe.no-rulers .pe-tools { left: 24px; top: 24px; }
.pe-tools button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; position: relative; }
.pe-tools button:hover { background: rgba(255,255,255,.14); }
.pe-tools svg { width: 21px; height: 21px; }
.pe-tools button::after { content: attr(data-tip); position: absolute; left: 54px; top: 50%; transform: translateY(-50%); background: #1f1530; color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; }
.pe-tools button:hover::after { opacity: 1; }

.pe-dock { position: absolute; left: 64px; bottom: 22px; display: flex; gap: 12px; z-index: 5; }
.pe.no-rulers .pe-dock { left: 24px; }
.pe-zoom { position: relative; display: flex; align-items: center; height: 60px; padding: 0 10px; background: var(--brand); border-radius: 99px; color: #fff; box-shadow: 0 6px 20px rgba(60, 10, 110, .25); }
.pe-zoom > button { height: 44px; min-width: 44px; border: 0; background: none; color: #fff; display: grid; place-items: center; cursor: pointer; border-radius: 99px; font: 500 16px Inter, sans-serif; }
.pe-zoom > button:hover { background: rgba(255,255,255,.14); }
.pe-zoom svg { width: 21px; height: 21px; }
.pe-zoom .zl { display: flex; gap: 2px; align-items: center; padding: 0 10px; font-variant-numeric: tabular-nums; }
.pe-zoom .zl svg { width: 14px; height: 14px; }
.pe-round { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 20px rgba(60, 10, 110, .25); }
.pe-round:hover { background: var(--brand-2); }
.pe-round svg { width: 22px; height: 22px; }
.pe-round.off { opacity: .55; }
.pe-menu { position: absolute; bottom: 70px; left: 40px; background: var(--panel); color: var(--text); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 150px; border: 1px solid var(--line); }
.pe-menu button { display: flex; justify-content: space-between; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; text-align: left; }
.pe-menu button:hover { background: var(--brand-soft); }
.pe-menu kbd { color: var(--muted); font: 12px Inter, sans-serif; }

/* right panel */
.pe-panel { background: var(--panel); overflow-y: auto; padding: 0 22px 40px; border-left: 1px solid var(--line); min-height: 0; }
.pe-sec { margin-top: 0; }
.pe-sec-h { width: 100%; display: flex; align-items: center; justify-content: space-between; height: 62px; margin-top: 0; padding: 0 14px; border: 0; border-radius: 12px; background: var(--brand-soft);
  color: var(--brand-ink); font: 700 17px/1 Poppins, Inter, sans-serif; text-transform: uppercase; letter-spacing: .01em; cursor: pointer; text-align: left; }
.pe-sec + .pe-sec .pe-sec-h, .pe-sec:first-child .pe-sec-h { margin-top: 22px; }
.pe-sec-h i { width: 10px; height: 10px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.pe-sec.closed .pe-sec-h i { transform: rotate(-45deg); }
.pe-sec.closed .pe-sec-b { display: none; }
.pe-sec-b { padding: 14px 4px 4px; }
.pe-sec[hidden] { display: none; }
.pe-panel .layers { padding: 0; }
.pe-panel .layers li { height: 44px; padding: 0 8px 0 10px; font-size: 16px; gap: 10px; border-radius: 9px; }
.pe-panel .layers li .nm { font-size: 16px; }
.pe-panel .layers li .ico { width: 18px; height: 18px; color: var(--text); }
.pe-panel .layers li .tog svg { width: 18px; height: 18px; }
.pe-panel .layers li .tog.dyn.on { color: var(--accent); }
.pe-panel .layers li .tog.vis { opacity: 0; }
.pe-panel .layers li:hover .tog.vis, .pe-panel .layers li .tog.vis:not(.on) { opacity: .7; }
.pe-panel .props { padding: 0; }
.pe-settings { display: grid; gap: 4px; }
.pe-row { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px; min-height: 48px; }
.pe-row > label { font-size: 16px; }
.pe-row select, .pe-row .val { height: 42px; border-radius: 10px; border: 1px solid var(--line); padding: 0 12px; font-size: 15px; background: var(--panel); }
.pe-row .val { display: flex; align-items: center; color: var(--text); }
.pe-note { grid-column: 2; text-align: center; font: 600 12px/1.35 Poppins, Inter, sans-serif; color: var(--muted); margin: -2px 0 8px; }

/* history */
.hist-list { display: grid; gap: 6px; max-height: 60vh; overflow: auto; margin-top: 12px; }
.hist-item { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.hist-item canvas { width: 96px; height: 72px; object-fit: contain; background: repeating-conic-gradient(var(--checker) 0 25%, transparent 0 50%) 0 0 / 10px 10px; border-radius: 6px; }
.hist-item b { display: block; }
.hist-item.current { border-color: var(--accent); background: var(--accent-soft); }
.keys { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; margin-top: 12px; font-size: 14px; }
.keys kbd { justify-self: end; font: 600 12px Inter, sans-serif; background: var(--panel-2); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 2px 7px; white-space: nowrap; }

@media (max-width: 1100px) {
  .pe-work { grid-template-columns: 1fr 360px; }
  .pe-select { width: 240px; }
}
@media (max-width: 860px) {
  .pe { grid-template-rows: 56px auto minmax(0, 1fr); height: 100dvh; }
  .pe-top { gap: 4px; padding: 0 8px; }
  .pe-logo { width: 34px; height: 34px; }
  .pe-name input { font-size: 16px; max-width: 30vw; }
  .pe-name svg, .pe-sep, #download, .pe-top .hide-sm { display: none; }
  .pe-pill { height: 36px; padding: 0 12px; font-size: 12px; }
  #historyBtn { padding: 0; width: 36px; justify-content: center; }
  #historyBtn span { display: none; }
  .pe-pill:not(#historyBtn) svg { display: none; }
  .pe-bar { flex-wrap: wrap; padding: 8px 12px; gap: 6px; }
  .pe-select { width: 100%; order: -1; }
  .pe-dim { width: 100px; }
  .pe-work { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 42%; }
  .pe-panel { border-left: 0; border-top: 1px solid var(--line); padding: 0 14px 30px; }
  .pe.panel-hidden .pe-work { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 0; }
  .pe-main { grid-template-columns: 28px 1fr; grid-template-rows: 28px 1fr; }
  .pe-tools { grid-auto-flow: column; left: 40px; top: 40px; padding: 4px 10px; }
  .pe-tools button { width: 38px; height: 38px; }
  .pe-tools button::after { display: none; }
  .pe-dock { left: 40px; bottom: 12px; gap: 8px; }
  .pe-zoom { height: 48px; padding: 0 4px; }
  .pe-zoom > button { height: 40px; min-width: 40px; }
  .pe-round { width: 48px; height: 48px; }
  .pe-sec-h { height: 50px; font-size: 15px; }
  .pe-row { grid-template-columns: 110px 1fr; }
  .api-grid { grid-template-columns: 1fr; }
}
