.notepad { width: 100%; max-width: 1180px; margin: 36px auto; padding: 0 16px; }
.notepad .intro { max-width: 820px; }
.notepad kbd { padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--head); font: 12px var(--mono); }

.np-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 18px 0 10px; }
.np-bar label { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; cursor: pointer; }
.np-bar [hidden] { display: none; }
/* "Show as": toggle buttons drawn as one segmented control; the pressed one has its pane open. */
.np-view { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.np-view-label { font-weight: 600; }
.np-seg { display: inline-flex; flex-wrap: wrap; row-gap: 4px; }
.np-seg button { margin: 0; padding: 5px 12px; border: 1px solid var(--line); border-radius: 0; background: var(--panel); color: var(--muted); font-family: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.4; cursor: pointer; }
.np-seg button + button { margin-left: -1px; }
.np-seg button:first-of-type { border-radius: 8px 0 0 8px; }
.np-seg button:last-of-type { border-radius: 0 8px 8px 0; }
.np-seg button:hover:not(:disabled) { color: var(--text); }
.np-as button[aria-pressed="true"] { position: relative; background: var(--c); border-color: var(--c); color: #fff; }
.np-as button[aria-pressed="true"] + button[aria-pressed="true"] { box-shadow: inset 1px 0 rgba(255, 255, 255, .55); }
.np-seg button:focus-visible { position: relative; outline: 2px solid var(--accent); outline-offset: 2px; }
.np-seg button:disabled { opacity: .45; cursor: not-allowed; }
.np-size button { padding: 5px 10px; font-variant-numeric: tabular-nums; }
.np-size small { font-size: 10.5px; }
.np-html-note { margin: 8px 0 0; font-size: 12.5px; }
.np-html-note[hidden] { display: none; }
.np-cols select { padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; font-weight: 400; }
.np-count { font-size: 13px; font-variant-numeric: tabular-nums; }
/* Row 1: Show as, then Columns, text size, Monospace and Line numbers on the right; row 2: the counts
   on the left, the actions on the right (user). */
/* One group, so the four wrap together (as a block under Show as, still right) rather than one by one. */
.np-opts { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px; margin-left: auto; }
.np-opts label { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; cursor: pointer; }
.np-break { flex-basis: 100%; height: 0; margin-bottom: -8px; } /* its own flex line: cancel the second row gap */
.np-acts { display: flex; gap: 8px; margin-left: auto; }
.np-acts .act:disabled { opacity: .5; cursor: default; }

.np-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
/* The note and its open panes side by side; --np-cols (app.js) is the open boxes, capped by "Columns". */
.np-form.is-split .np-panes { grid-template-columns: repeat(var(--np-cols, 2), minmax(0, 1fr)); }
.np-paper, .np-out { display: block; width: 100%; height: 62vh; min-height: 280px; border: 1.5px solid var(--edge); border-radius: 10px; }
.np-paper {
  resize: vertical; padding: 16px 20px; background: var(--panel); color: var(--text);
  /* Inter (loaded by site.css) with open line spacing; --np-size (13px by default) is the A-/A+ text size. */
  font: var(--np-size, 13px)/1.7 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere;
}
/* The note, its no-JS textarea and the line-number gutter (app.js) laid over the note's left padding. */
.np-note { position: relative; min-width: 0; }
.np-rich { padding-left: var(--np-pl, 20px); }
.np-gutter { position: absolute; top: 1.5px; left: 1.5px; bottom: 1.5px; overflow: hidden; border-right: 1px solid #e4e7ec; border-radius: 8.5px 0 0 8.5px; background: #f5f6f8; color: #7a828f; font: calc(var(--np-size, 13px) * .85) "Inter", system-ui, sans-serif; font-variant-numeric: tabular-nums; text-align: right; pointer-events: none; user-select: none; }
.np-gutter[hidden] { display: none; }
.np-gutter-in { position: relative; will-change: transform; }
.np-gutter-in span { position: absolute; right: 9px; white-space: nowrap; }
.np-paper:focus { outline: 2px solid var(--c); outline-offset: 1px; }
.np-paper[hidden] { display: none; }
/* Formatted text: a white sheet in either theme, since pasted text often brings its own dark colours. */
.np-rich { position: relative; overflow: auto; background: #fff; color: #1b2230; color-scheme: light; cursor: text; }
/* Pasted pages bring inline layout (a header with position: fixed, a 100vh sticky column, 1900px
   widths) that would break out of the box: everything pasted flows inside it, no wider than it. */
.np-rich { contain: paint; }
.np-rich * { position: static !important; max-width: 100%; }
.np-rich.is-empty::before { content: attr(data-placeholder); position: absolute; top: 16px; left: var(--np-pl, 20px); color: #8a92a0; pointer-events: none; }
.np-rich img { max-width: 100%; height: auto; }
.np-rich table { border-collapse: collapse; }
.np-rich :is(td, th) { padding: 2px 6px; border: 1px solid #c9ced8; }
.np-rich a { color: #1d4ed8; }
.np-mono-on .np-paper { font: var(--np-size, 13px)/1.55 var(--mono); }
/* A pane: the note rendered as HTML, or converted (JSON, YAML, … or Symfony's dump() in its own frame). */
.np-out { display: flex; flex-direction: column; overflow: hidden; background: var(--panel); }
.np-out[hidden] { display: none; }
.np-out-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; min-height: 40px; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.np-out-label { font-weight: 600; color: var(--muted); }
.np-out-acts { display: flex; gap: 6px; }
.np-out-head .act { padding: 3px 10px; font-size: 13px; }
.np-out-head [hidden], .np-out-error[hidden], .np-out-text[hidden], .np-out-dump[hidden], .np-render[hidden] { display: none; }
/* The rendered HTML is a page of its own: browser defaults, white, whatever the site's theme. */
.np-render { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; color-scheme: light; }
.np-out-error { margin: 0; padding: 12px 14px; background: var(--err-bg); color: var(--err); font-size: 14px; }
.np-out-text { flex: 1; min-height: 0; margin: 0; padding: 12px 14px; overflow: auto; font: 13.5px/1.5 var(--mono); white-space: pre; tab-size: 2; }
.np-out-dump { flex: 1; min-height: 0; width: 100%; border: 0; background: #18171b; }
.np-hint { margin: 8px 0 0; font-size: 12.5px; }
/* Before a formatted paste: keep the formatting, or paste the plain text (app.js). */
.np-ask { width: min(440px, calc(100vw - 32px)); padding: 20px 22px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 18px 50px rgba(15, 23, 42, .28); }
.np-ask::backdrop { background: rgba(15, 23, 42, .35); }
.np-ask-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.np-ask-text { margin: 0 0 18px; font-size: 14.5px; line-height: 1.5; }
.np-ask-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.np-ask-tip { margin: 14px 0 0; font-size: 12.5px; }

@media (max-width: 760px) {
  .np-form.is-split .np-paper, .np-form.is-split .np-out { height: 42vh; }
}

/* Full window: the notepad (and its bar) covers the page, like a bare editor tab. Esc leaves. */
.np-locked, .np-locked body { overflow: hidden; }
.np-fullwin { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; padding: 8px 12px 12px; background: var(--bg); }
.np-fullwin .np-bar { margin: 0 0 8px; }
.np-fullwin .np-panes { flex: 1; min-height: 0; grid-auto-rows: minmax(0, 1fr); }
.np-fullwin .np-note { min-height: 0; }
.np-fullwin .np-paper, .np-fullwin .np-out { height: 100%; min-height: 0; resize: none; }
.np-fullwin .np-hint { display: none; }
@media (max-width: 760px) {
  .np-fullwin.is-split .np-paper, .np-fullwin.is-split .np-out { height: 100%; }
}
