/* ------------------------------------------------------------------ page */
html { scroll-snap-type: none; }
html, body { height: 100%; }
body { overflow: hidden; }
.ed-app { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }

/* ------------------------------------------------------------------ top bar */
.ed-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; min-height: 56px; padding: 8px 14px; border-bottom: 1px solid var(--line-strong); background: var(--paper); }
.ed-bar .brand { flex: none; }
.ed-file { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; max-width: 28ch; font-family: var(--mono); font-size: 0.86rem; color: var(--ink); }
.ed-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-dirty { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.ed-dirty[hidden] { display: none; }
.ed-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.ed-actions button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; white-space: nowrap; }
.ed-actions .lucide { width: 15px; height: 15px; }
.ed-folder { min-width: 0; }
.ed-folder[hidden] { display: none; }
.ed-folder select { max-width: 280px; }
.ed-bar .prefs { margin-left: auto; }
.ed-note { flex-basis: 100%; font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
.ed-note[hidden] { display: none; }
.ed-note.is-error { color: var(--bad); }
@media (max-width: 1180px) {
  .ed-actions button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ed-actions button { padding: 7px 9px; }
}

/* ------------------------------------------------------------------ panes */
.ed-main { min-height: 0; border: 0; border-radius: 0; box-shadow: none; grid-template-rows: minmax(0, 1fr); }
.ed-main .pane { min-height: 0; height: 100%; }
.ed-main #editor, .ed-main .mdsig-cm { min-height: 0; }
.ed-main .editor-pane .pane-head { min-height: 46px; }
.ed-main .tabs { min-height: 46px; }
@media (max-width: 980px) {
  .ed-main { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .ed-main .editor-pane { min-height: 0; }
}

/* ------------------------------------------------------------------ splitter */
.ed-main { --split: 50%; grid-template-columns: minmax(0, var(--split)) 0 minmax(0, 1fr); }
.ed-split { position: relative; z-index: 3; justify-self: center; width: 11px; cursor: col-resize; touch-action: none; }
.ed-split::after { content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 1px; background: transparent; transition: background-color 0.12s; }
.ed-split:hover::after, .ed-split.is-dragging::after { left: 4px; width: 3px; background: color-mix(in srgb, var(--ruri) 55%, transparent); }
.ed-split:focus { outline: none; }
.ed-split:focus-visible::after { left: 4px; width: 3px; background: var(--ruri); }
.is-resizing, .is-resizing * { cursor: col-resize !important; user-select: none !important; }
@media (max-width: 980px) {
  .ed-main { grid-template-columns: minmax(0, 1fr); }
  .ed-split { display: none; }
}

/* ------------------------------------------------------------------ editor pane */
.ed-main .editor-pane .pane-head { flex-wrap: nowrap; padding-right: 8px; }
.ed-main .editor-pane .pane-head h3 { flex: none; }
.ed-name.is-sample { color: var(--muted); }
.md-toolbar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 2px; min-width: 0; }
.md-toolbar[hidden] { display: none; }
.md-toolbar .md-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: var(--r-xs); background: transparent; color: var(--ink-2); }
.md-toolbar .md-btn:hover:not(:disabled) { border-color: var(--line-strong); background: var(--paper); color: var(--ink); }
.md-toolbar .md-btn:focus-visible { outline: 2px solid var(--ruri); outline-offset: -1px; }
.md-toolbar .md-btn[aria-pressed="true"] { border-color: var(--line-strong); background: var(--paper); color: var(--ruri-text); }
.md-toolbar .md-btn:disabled { opacity: 0.35; }
.md-toolbar .lucide { width: 16px; height: 16px; }
.md-sep { flex: none; width: 1px; height: 18px; margin: 0 5px; background: var(--line-strong); }

.ed-status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 18px; min-height: 28px; padding: 4px 14px; border-top: 1px solid var(--line); background: var(--paper-2); color: var(--muted); font-family: var(--mono); font-size: 11.5px; line-height: 1.4; white-space: nowrap; }
.ed-status[hidden] { display: none; }
.ed-status .st-gap { flex: 1; }
.ed-main .editor-pane { container-type: inline-size; }
@container (max-width: 700px) {
  .md-toolbar { gap: 0; }
  .md-toolbar .md-btn { width: 28px; }
  .md-sep { margin: 0 3px; }
  .editor-pane .pane-head h3 > [data-i18n="pg.document"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
