:root {
  color-scheme: light dark;
  --bg: #fbfbfd;
  --panel: #ffffff;
  --panel-raised: #ffffff;
  --panel-soft: #f6f8fa;
  --ink: #1b1f24;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0969da;
  --accent-ink: #ffffff;
  --ok: #1a7f37;
  --warn: #bf8700;
  --bad: #cf222e;
  --code-bg: #f6f8fa;
  --radius: 8px;
  --shadow: 0 16px 40px rgba(15, 23, 42, .14);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
  /* iA Writer-inspired duotone syntax: mostly ink, grey comments, one cool
     accent for keywords and one warm accent for values. Low saturation. */
  --syn-comment: #9aa1a9;
  --syn-key: #3f6e8c;
  --syn-val: #8a6d3b;
  --syn-fn: #2f6f6a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --panel: #161b22; --panel-raised: #1c2129; --panel-soft: #111820;
    --ink: #e6edf3; --muted: #8b949e;
    --line: #30363d; --accent: #2f81f7; --warn: #d29922; --code-bg: #161b22;
    --shadow: 0 18px 44px rgba(0, 0, 0, .4);
    --syn-comment: #6e7681; --syn-key: #8fb3cc; --syn-val: #d6b884; --syn-fn: #7ec9c0;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 1rem; min-height: 3.25rem;
  padding: .55rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 600; display: flex; align-items: baseline; gap: .5rem; }
.brand .logo { color: var(--accent); }
.tagline { font-weight: 400; color: var(--muted); font-size: .82rem; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: .45rem; flex-wrap: wrap; }
.tools-status { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin-left: .3rem; }
.tool-pill {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 1.55rem;
  padding: .15rem .45rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-soft); color: var(--muted); font-size: .72rem; white-space: nowrap;
}
.tool-pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, var(--line)); }
.tool-pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 28%, var(--line)); }
.tool-dot {
  width: .45rem; height: .45rem; border-radius: 999px; background: currentColor;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 14%, transparent);
}

/* ---- main split ---- */
/* --editor-w drives the editor column; the drag handle (.resizer) sets it to a
   px value at runtime. Default is proportional. */
.layout {
  --editor-w: minmax(18rem, .95fr);
  flex: 1; display: grid;
  grid-template-columns: var(--editor-w) minmax(24rem, 1.25fr) minmax(17rem, .65fr);
  min-height: 0;
}
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.editor-pane, .preview-pane { border-right: 1px solid var(--line); }
.editor-pane { position: relative; }  /* anchors the resize handle */

/* Inspector collapsed (default): drop the third column and its divider. */
.layout.inspector-closed {
  grid-template-columns: var(--editor-w) minmax(24rem, 1.6fr);
}
.layout.inspector-closed .inspector-pane { display: none; }
.layout.inspector-closed .preview-pane { border-right: 0; }

/* Drag handle straddling the editor/preview border. */
.resizer {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
  cursor: col-resize; z-index: 20; touch-action: none;
}
.resizer::after {
  content: ""; position: absolute; inset: 0 3px; background: transparent;
  transition: background .12s;
}
.resizer:hover::after, .resizer.dragging::after { background: var(--accent); }

#inspector-toggle.active, #latex-toggle.active { border-color: var(--accent); color: var(--accent); }
.pane-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: .4rem .85rem; font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.pane-head .hint { font-weight: 400; text-transform: none; letter-spacing: 0; }

.editor-toolbar {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  padding: .4rem .85rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.btn.small { font-size: .76rem; padding: .22rem .55rem; min-height: 1.75rem; }

/* ---- document tabs ---- */
.tabbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 3px;
  background: linear-gradient(to bottom, var(--panel-soft), var(--bg));
  border-bottom: 1px solid var(--line);
  padding: .3rem .45rem 0; min-height: 2.15rem;
}
.tab {
  display: flex; align-items: center; gap: .35rem; max-width: 15rem; min-height: 1.85rem;
  padding: .3rem .35rem .3rem .65rem; font-size: .78rem; color: var(--muted);
  cursor: pointer; white-space: nowrap; align-self: flex-end;
  border: 1px solid transparent; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
}
.tab:hover { background: color-mix(in srgb, var(--panel) 72%, var(--accent) 4%); color: var(--ink); }
.tab:focus-visible, .tab-add:focus-visible, .tab-close:focus-visible {
  outline: none; box-shadow: var(--focus);
}
.tab.active {
  background: var(--panel); color: var(--ink); border-color: var(--line);
  box-shadow: inset 0 2px 0 var(--accent);
}
.tab-name { overflow: hidden; text-overflow: ellipsis; }
.tab-close {
  width: 1.15rem; height: 1.15rem; border: 0; background: none; color: inherit;
  display: inline-grid; place-items: center; cursor: pointer; line-height: 1;
  font-size: .95rem; padding: 0; border-radius: 4px; opacity: .45;
}
.tab-close:hover { opacity: 1; background: var(--line); }
.tab-add {
  width: 1.85rem; height: 1.85rem; border: 1px solid transparent; border-radius: var(--radius);
  background: none; color: var(--muted); cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 0; align-self: center;
}
.tab-add:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--panel); }

/* mermaid diagrams in the preview */
.markdown-body .mermaid { text-align: center; margin: 1.2rem 0; }

#md-form { flex: 1; display: flex; min-height: 0; }

/* Syntax-highlight overlay: a styled <div> mirrors the text behind a
   transparent textarea. The two MUST share identical box/font metrics so the
   caret stays aligned (monospace bold has the same advance width). */
.editor-wrap { position: relative; flex: 1; min-height: 0; }
#source, .editor-highlight {
  position: absolute; inset: 0; margin: 0; border: 0;
  padding: 1rem 1.1rem; box-sizing: border-box;
  font: 13.5px/1.6 ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  tab-size: 2; white-space: pre-wrap; overflow-wrap: break-word;
  scrollbar-gutter: stable;
}
.editor-highlight {
  overflow: hidden; pointer-events: none; z-index: 0;
  color: var(--ink); background: var(--panel);
}
.editor-highlight .hl-h { font-weight: 700; }
#source {
  overflow: auto; resize: none; outline: none; z-index: 1;
  background: transparent; color: transparent; caret-color: var(--ink);
}
#source::placeholder { color: var(--muted); }
#source::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
#source.line-jump { animation: line-jump-flash .9s ease-out; }
@keyframes line-jump-flash {
  0%, 35% { box-shadow: inset 4px 0 0 var(--accent); }
  100% { box-shadow: inset 4px 0 0 transparent; }
}

.preview-pane #preview { flex: 1; overflow: auto; padding: 1.25rem 1.6rem; }

/* ---- action bar ---- */
.actionbar {
  display: flex; flex-wrap: wrap; gap: .75rem 1.4rem; align-items: center;
  padding: .65rem 1rem; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, var(--bg));
  position: relative; box-shadow: 0 -1px 0 color-mix(in srgb, var(--line) 70%, transparent);
}
.group { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; min-width: 0; }
.group + .group { padding-left: .65rem; border-left: 1px solid var(--line); }
.group-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin-right: .15rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 2rem; text-decoration: none; white-space: nowrap;
  font-size: .82rem; padding: .35rem .7rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel-soft); color: var(--ink);
  cursor: pointer; transition: background .12s, border-color .12s, color .12s, transform .05s, box-shadow .12s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); background: color-mix(in srgb, var(--panel-soft) 82%, var(--accent) 8%); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .48; cursor: not-allowed; filter: saturate(.75); }
.btn.download { font-weight: 600; }
.btn.primary {
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 13%, var(--panel)); }
.btn.subtle { color: var(--muted); }
.btn-icon { font-size: .9em; line-height: 1; opacity: .72; }
.btn.busy { opacity: .78; pointer-events: none; }
.btn.busy::before {
  content: ""; width: .75rem; height: .75rem; border-radius: 999px;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

/* "More ▾" dropdown of overflow formats (opens upward from the bottom bar). */
.menu { position: relative; display: inline-flex; }
.menu-items {
  position: absolute; bottom: 100%; left: 0; margin-bottom: .4rem;
  display: flex; flex-direction: column; gap: 2px; min-width: 11rem;
  background: var(--panel-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .3rem; box-shadow: var(--shadow); z-index: 30;
}
.menu-items[hidden] { display: none; }
.menu-items .btn { justify-content: flex-start; border-color: transparent; text-align: left; background: transparent; }
.menu-items .btn:hover { border-color: var(--accent); }
.menu-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.chevron { display: inline-block; transition: transform .12s; }

.toast {
  margin-left: auto; max-width: min(32rem, 100%); font-size: .82rem; padding: .45rem .75rem;
  border-radius: var(--radius); background: var(--accent); color: var(--accent-ink);
  box-shadow: var(--shadow); overflow-wrap: anywhere;
}
.toast.err { background: var(--bad); }

/* ---- dropzone overlay ---- */
/* The [hidden] rule needs id-level specificity to beat `display: grid` below,
   otherwise toggling the `hidden` attribute in JS has no effect. */
#dropzone[hidden] { display: none; }
#dropzone {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  backdrop-filter: blur(3px);
}
.dropzone-inner {
  width: min(28rem, calc(100vw - 2rem)); display: grid; justify-items: center; gap: .45rem;
  color: var(--accent); border: 2px dashed color-mix(in srgb, var(--accent) 72%, var(--line));
  border-radius: var(--radius); padding: 2rem;
  background: color-mix(in srgb, var(--panel-raised) 94%, var(--accent) 4%);
  box-shadow: var(--shadow);
}
.dropzone-icon {
  width: 3rem; height: 3rem; display: grid; place-items: center;
  border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-size: 1.8rem; line-height: 1;
}
.dropzone-title { font-size: 1.35rem; font-weight: 700; letter-spacing: 0; }
.dropzone-meta { color: var(--muted); font-size: .88rem; text-align: center; overflow-wrap: anywhere; }

/* ---- validation panel ---- */
.lint {
  border-top: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 92%, var(--bg));
  max-height: 30vh; overflow: auto; flex-shrink: 0;
}
.inspector-pane .lint { flex: 1; max-height: none; min-height: 0; }
.lint:empty { display: none; }
.lint-summary {
  display: flex; gap: .4rem; align-items: center; flex-wrap: wrap;
  padding: .45rem .85rem; font-size: .78rem; position: sticky; top: 0;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.lint-clean { color: var(--ok); font-weight: 650; }
.lint-chip { padding: .1rem .5rem; border-radius: 999px; font-weight: 600; }
.lint-chip.error { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.lint-chip.warning { background: color-mix(in srgb, var(--warn) 22%, transparent); color: color-mix(in srgb, var(--warn) 82%, var(--ink)); }
.lint-chip.info { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.lint-list { list-style: none; margin: 0; padding: .25rem 0; }
.lint-item { margin: 0; }
.lint-jump {
  display: grid; grid-template-columns: 2.6rem .6rem 1fr; gap: .5rem;
  align-items: baseline; width: 100%; padding: .45rem .85rem; border: 0;
  background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer;
}
.lint-item + .lint-item { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.lint-jump:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.lint-jump:focus-visible {
  outline: none; background: color-mix(in srgb, var(--accent) 8%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.lint-line { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: .72rem; }
.lint-dot { width: .55rem; height: .55rem; border-radius: 50%; align-self: center; }
.lint-dot.error { background: var(--bad); }
.lint-dot.warning { background: var(--warn); }
.lint-dot.info { background: var(--accent); }
.lint-msg { color: var(--ink); }
.lint-snippet {
  display: block; margin-top: .2rem; color: var(--muted);
  font-size: .72rem; background: var(--code-bg); padding: .15rem .4rem;
  border-radius: 4px; max-width: 100%; overflow-wrap: anywhere;
}

/* ---- error fragment from /preview ---- */
.error {
  display: grid; gap: .25rem; color: var(--bad);
  border: 1px solid color-mix(in srgb, var(--bad) 32%, var(--line));
  background: color-mix(in srgb, var(--bad) 8%, var(--panel));
  border-radius: var(--radius); padding: .85rem;
}
.error strong { display: inline-block; }
.error span { color: color-mix(in srgb, var(--bad) 72%, var(--muted)); font-size: .88rem; }
.error pre {
  white-space: pre-wrap; background: var(--code-bg); padding: .75rem;
  border-radius: var(--radius); font-size: .8rem; margin: .35rem 0 0;
}
.empty { color: var(--muted); font-style: italic; }
.empty.tight { margin: .3rem 0 0; font-size: .82rem; }

/* ---- inspector ---- */
.inspector {
  padding: .85rem; border-bottom: 1px solid var(--line);
  background: var(--panel); overflow: auto; flex-shrink: 0; max-height: 48%;
}
.inspector:empty { display: none; }
.score-row { display: grid; grid-template-columns: 4.5rem 1fr; gap: .7rem; align-items: center; }
.score {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-soft);
}
.score strong { font-size: 1.35rem; line-height: 1; }
.score span { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.score.good { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); box-shadow: inset 0 3px 0 color-mix(in srgb, var(--ok) 70%, transparent); }
.score.review { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); box-shadow: inset 0 3px 0 color-mix(in srgb, var(--warn) 70%, transparent); }
.score.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); box-shadow: inset 0 3px 0 color-mix(in srgb, var(--bad) 70%, transparent); }
.doc-title {
  font-weight: 650; line-height: 1.25; overflow-wrap: anywhere;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem; margin-top: .75rem;
}
.stat {
  display: flex; justify-content: space-between; gap: .6rem;
  padding: .35rem .45rem; border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-soft); font-size: .78rem; min-width: 0;
}
.stat span { color: var(--muted); }
.stat strong { font-weight: 650; overflow-wrap: anywhere; }
.outline-head {
  margin-top: .8rem; padding-top: .65rem; border-top: 1px solid var(--line);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 650; color: var(--muted);
}
.outline-list { list-style: none; margin: .35rem 0 0; padding: 0; }
.outline-item {
  display: grid; grid-template-columns: 2rem 1fr 2.4rem; gap: .35rem;
  align-items: baseline; padding: .25rem 0; font-size: .8rem;
}
.outline-item + .outline-item { border-top: 1px solid color-mix(in srgb, var(--line) 58%, transparent); }
.outline-item:hover { color: var(--accent); }
.outline-level, .outline-line {
  color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: .7rem;
}
.outline-line { text-align: right; }
.outline-title { overflow-wrap: anywhere; }
.outline-title.level-2 { padding-left: .45rem; }
.outline-title.level-3 { padding-left: .9rem; }
.outline-title.level-4, .outline-title.level-5, .outline-title.level-6 { padding-left: 1.35rem; }

/* ---- rendered markdown ---- */
.markdown-body { color: var(--ink); }
.markdown-body h1, .markdown-body h2 { border-bottom: 1px solid var(--line); padding-bottom: .3em; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { line-height: 1.25; margin-top: 1.4em; }
.markdown-body code {
  background: var(--code-bg); padding: .15em .35em; border-radius: 4px;
  font-size: .9em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.markdown-body pre {
  background: var(--code-bg); padding: 1rem; border-radius: 8px; overflow: auto;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote {
  color: var(--muted); border-left: .25em solid var(--line); margin: 0; padding: 0 1em;
}
.markdown-body table { border-collapse: collapse; }
.markdown-body th, .markdown-body td { border: 1px solid var(--line); padding: .4em .8em; }
.markdown-body img { max-width: 100%; }
.markdown-body a { color: var(--accent); }

/* iA Writer-inspired duotone code highlighting (pandoc/skylighting classes).
   Restrained: base text stays ink; emphasis comes from weight, not loud color. */
.markdown-body .sourceCode { background: none; }
.markdown-body pre.sourceCode { line-height: 1.5; }
.markdown-body code span.co,            /* comments */
.markdown-body code span.do { color: var(--syn-comment); font-style: italic; }
.markdown-body code span.kw,            /* keywords / control flow / imports */
.markdown-body code span.cf,
.markdown-body code span.im { color: var(--syn-key); font-weight: 600; }
.markdown-body code span.st,            /* strings & chars */
.markdown-body code span.ch,
.markdown-body code span.vs,
.markdown-body code span.sc,
.markdown-body code span.dv,            /* numbers & constants */
.markdown-body code span.bn,
.markdown-body code span.fl,
.markdown-body code span.cn { color: var(--syn-val); }
.markdown-body code span.fu,            /* functions, types, builtins */
.markdown-body code span.dt,
.markdown-body code span.bu { color: var(--syn-fn); }
.markdown-body code span.op,            /* operators, attributes — kept quiet */
.markdown-body code span.at { color: var(--muted); }
.markdown-body code span.er { color: var(--bad); font-weight: 600; }
/* Hide pandoc's per-line anchor links so blocks read clean. */
.markdown-body pre.sourceCode a[aria-hidden="true"] { display: none; }

/* ---- "LaTeX look" preview theme ----
   Latin Modern (pandoc's default LaTeX font) + article typography, so the HTML
   preview matches the look of the exported PDF. Toggled via #latex-toggle. */
@font-face {
  font-family: "Latin Modern Roman"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/latex.css@1.11.0/fonts/LM-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Latin Modern Roman"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/latex.css@1.11.0/fonts/LM-bold.woff2") format("woff2");
}
@font-face {
  font-family: "Latin Modern Roman"; font-weight: 400; font-style: italic; font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/latex.css@1.11.0/fonts/LM-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Latin Modern Roman"; font-weight: 700; font-style: italic; font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/latex.css@1.11.0/fonts/LM-bold-italic.woff2") format("woff2");
}

#preview.latex {
  font-family: "Latin Modern Roman", Georgia, "Times New Roman", serif;
  font-size: 1.08rem; line-height: 1.45;
  text-align: justify; hyphens: auto;
}
/* Constrain/center the content column, NOT the scroll container itself —
   otherwise the scrollbar attaches to the narrowed box and lands mid-pane. */
#preview.latex > * { max-width: 42rem; margin-inline: auto; }
#preview.latex h1, #preview.latex h2, #preview.latex h3,
#preview.latex h4 { font-weight: 700; border-bottom: none; line-height: 1.2; }
#preview.latex h1 { text-align: center; font-size: 1.9rem; margin: .5rem 0 1.4rem; }
#preview.latex h2 { font-size: 1.4rem; }
#preview.latex blockquote { font-style: italic; }
#preview.latex a { color: inherit; text-decoration: underline; }
/* Keep code monospaced — LaTeX uses a typewriter face for verbatim. */
#preview.latex code, #preview.latex pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-align: left; hyphens: none;
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) 18rem; }
  .resizer { display: none; }  /* stacked layout: no horizontal split to drag */
  .preview-pane { border-right: 0; }
  .inspector-pane {
    grid-column: 1 / -1; border-top: 1px solid var(--line);
    display: grid; grid-template-columns: minmax(18rem, .8fr) minmax(20rem, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .inspector-pane .pane-head { grid-column: 1 / -1; }
  .inspector { max-height: none; border-bottom: 0; border-right: 1px solid var(--line); }
  .inspector-pane .lint { border-top: 0; }
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: minmax(22rem, 1fr) minmax(22rem, 1fr) auto; }
  .editor-pane, .preview-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .inspector-pane { display: flex; grid-column: auto; border-top: 0; }
  .inspector { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .inspector-pane .lint { border-top: 0; max-height: 16rem; }
  .topbar { align-items: flex-start; }
  .topbar-right { width: 100%; justify-content: flex-start; }
  .brand { width: 100%; }
  .tagline, .tools-status { display: none; }
  .group + .group { padding-left: 0; border-left: 0; }
  .actionbar { align-items: stretch; }
  .group { width: 100%; }
  .menu-items { left: auto; right: 0; }
}
