.editor {
  width: min(96vw, 1360px); height: min(94vh, 900px);
  border-radius: 22px;
}
.editor__head { padding: 18px 26px 14px; border-bottom: 0; }
.editor__titles h2 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.editor__titles p { font-size: 14.5px; margin-top: 2px; }

.ed-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 0; padding: 12px 26px 14px;
  border-block: 1px solid var(--border);
}
.ed-group { display: grid; gap: 7px; padding-inline: 14px; border-inline-start: 1px solid var(--border); }
.ed-group:first-child { padding-inline-start: 0; border-inline-start: 0; }
.ed-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.ed-row { display: flex; gap: 5px; }

.ed-btn {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 12px; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--border); transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
.ed-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ed-btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); transform: translateY(-1px); }
.ed-btn.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.ed-btn:disabled { opacity: .38; cursor: not-allowed; }

.editor .editor__body { gap: 14px; padding: 14px 26px 10px; }
.ed-palette { display: flex; flex-direction: column; gap: 7px; flex: none; width: 56px; overflow: visible; }
.ed-el {
  position: relative; display: grid; place-items: center; height: 44px; border-radius: 11px; font-size: 18px; font-weight: 700; color: var(--el, var(--text));
  background: var(--bg); border: 1.5px solid var(--border); transition: border-color .15s, background .15s;
}
.ed-el:hover { border-color: color-mix(in srgb, var(--el, var(--accent)) 70%, var(--border)); }
.ed-el.is-active { border-color: var(--el, var(--accent)); background: color-mix(in srgb, var(--el, var(--accent)) 14%, var(--bg)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--el, var(--accent)) 22%, transparent); }
.ed-el--more { --el: var(--text); display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 600; }
.ed-el--more svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ed-more { position: relative; }
.ed-popover {
  position: absolute; inset-inline-start: calc(100% + 8px); bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 44px); gap: 6px; padding: 10px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.ed-popover[hidden] { display: none; }

.ed-stage { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--bg); }
.ed-canvas { position: relative; flex: 1; min-height: 0; background: #fff; color: #444; }
.ed-svg { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; }
.ed-svg:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -3px; border-radius: 0; }
.ed-svg .atom-label { font-family: "Vazirmatn", Arial, Helvetica, sans-serif; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.ed-empty, .ed-tip { position: absolute; margin: 0; pointer-events: none; color: #8a8579; }
.ed-empty { inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; font-size: 17px; }
.ed-empty[hidden] { display: none; }
.ed-tip { inset-inline: 14px; bottom: 8px; font-size: 12px; opacity: .85; }

.ed-info {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.2fr); align-items: center;
  padding: 12px 6px; border-top: 1px solid var(--border); background: var(--surface);
}
.ed-field { display: grid; gap: 6px; min-width: 0; padding-inline: 18px; border-inline-start: 1px solid var(--border); }
.ed-field:first-child { border-inline-start: 0; }
.ed-field .ed-label { color: var(--muted); font-weight: 500; }
.ed-copy { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: var(--muted); }
.ed-copy:hover { color: var(--text); background: var(--hover); }
.ed-copy svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ed-copy.is-done { color: var(--ok); }
#edSmiles {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; font: inherit; font-family: ui-monospace, Consolas, monospace; font-size: 14px;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); text-overflow: ellipsis;
}
.ed-value { min-height: 38px; display: flex; align-items: center; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ed-status { display: flex; align-items: center; justify-content: center; gap: 10px; padding-inline: 14px; border-inline-start: 1px solid var(--border); font-weight: 600; min-height: 38px; }
.ed-status svg { flex: none; width: 30px; height: 30px; padding: 5px; border-radius: 50%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ed-status[data-state="valid"] { color: var(--ok); }
.ed-status[data-state="valid"] svg { color: #fff; background: var(--ok); }
.ed-status[data-state="invalid"] { color: var(--bad); font-size: 13.5px; line-height: 1.4; }
.ed-status[data-state="invalid"] svg { color: #fff; background: var(--bad); }
.ed-status .muted { font-weight: 500; }

.editor__foot { padding-inline: 26px; }
.editor__foot .btn--primary { min-width: 190px; }
.editor__foot .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.editor .field-error { padding-inline: 26px; }

@media (max-width: 860px) {
  .editor { width: 100vw; height: 100dvh; border-radius: 0; }
  .editor__head { padding: 12px 14px 8px; }
  .editor__titles h2 { font-size: 19px; }
  .editor__titles p { display: none; }
  .ed-toolbar { flex-wrap: nowrap; overflow-x: auto; padding: 10px 14px; scrollbar-width: thin; }
  .ed-group { flex: none; padding-inline: 12px; }
  .ed-btn { width: 42px; height: 42px; }
  .editor .editor__body { flex-direction: column; gap: 8px; padding: 10px 14px 6px; }
  .ed-palette { flex-direction: row; width: auto; overflow-x: auto; padding-bottom: 2px; }
  .ed-el { flex: none; width: 44px; height: 40px; }
  .ed-popover { inset-inline-start: auto; inset-inline-end: 0; bottom: calc(100% + 8px); }
  .ed-info { grid-template-columns: 1fr 1fr; gap: 10px 0; }
  .ed-field--wide { grid-column: 1 / -1; padding-inline: 12px; }
  .ed-status { grid-column: 1 / -1; border-inline-start: 0; justify-content: flex-start; }
  .ed-tip { display: none; }
  .editor__foot { padding: 10px 14px; flex-wrap: wrap; }
  .editor__foot .btn--primary { min-width: 0; flex: 1; }
}
