/* Notespice app: plain light and dark, with a highlight colour to pick. */

/* Trindle Sans, self-hosted under the SIL Open Font Licence (fonts/OFL.txt
   and fonts/OFL-RadioCanada.txt travel with it because the licence asks
   for that). No font CDN, no external request of any kind. */
@font-face {
  font-family: "Trindle Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/TrindleSans-Variable.latin.woff2") format("woff2");
}
@font-face {
  font-family: "Trindle Sans";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/TrindleSans-Italic-Variable.latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: #efeff1;
  --card: #ffffff;
  --field: #f5f5f7;
  --fg: #1c1c1f;
  --muted-fg: #5a5a63;
  --line: #e1e1e5;
  --field-edge: #84848d;
  --hover: rgba(0, 0, 0, 0.05);
  --link: #1d5fa8;
  --danger: #b3261e;
  --on-danger: #ffffff;
  --info: #1d5fa8;
  --success: #2e6b33;
  --warning: #8a5a00;
  --caution: #a84300;
  --important: #6b3fa0;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.07);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.10), 0 18px 44px rgba(0, 0, 0, 0.18);
  --shadow-seg: 0 1px 2px rgba(0, 0, 0, 0.16);
  --r-card: 18px;
  --r: 12px;
  --r-small: 9px;
  --gap: 14px;
  --measure: 46rem;
  --accent-tint: color-mix(in srgb, var(--accent) 15%, var(--card));
  --accent-strong: color-mix(in srgb, var(--accent) 86%, var(--fg));
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --card: #1e1e1e;
  --field: #171717;
  --fg: #ececec;
  --muted-fg: #a8a8a8;
  --line: #333333;
  --field-edge: #7a7a7a;
  --hover: rgba(255, 255, 255, 0.07);
  --link: #80c2f9;
  --danger: #ffa39b;
  --on-danger: #350f0c;
  --info: #80c2f9;
  --success: #80cf83;
  --warning: #ffc107;
  --caution: #ff8c42;
  --important: #c79be6;
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-pop: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 44px rgba(0, 0, 0, 0.6);
  --shadow-seg: none;
}
[data-accent] { --on-accent: #ffffff; --accent-line: var(--accent); }
[data-accent="yellow"] { --accent: #ffc107; --on-accent: #1c1c1f; --accent-line: #8a6500; }
[data-accent="blue"] { --accent: #1d5fa8; }
[data-accent="green"] { --accent: #2e6b33; }
[data-accent="purple"] { --accent: #6b3fa0; }
[data-accent="orange"] { --accent: #b4530a; }
[data-accent="pink"] { --accent: #b02a5e; }
[data-theme="dark"][data-accent], [data-theme="dark"] [data-accent] { --on-accent: #161616; --accent-line: var(--accent); }
[data-theme="dark"][data-accent="yellow"], [data-theme="dark"] [data-accent="yellow"] { --accent: #ffc107; }
[data-theme="dark"][data-accent="blue"], [data-theme="dark"] [data-accent="blue"] { --accent: #7fb6f0; }
[data-theme="dark"][data-accent="green"], [data-theme="dark"] [data-accent="green"] { --accent: #7fd39a; }
[data-theme="dark"][data-accent="purple"], [data-theme="dark"] [data-accent="purple"] { --accent: #c79be6; }
[data-theme="dark"][data-accent="orange"], [data-theme="dark"] [data-accent="orange"] { --accent: #f7a865; }
[data-theme="dark"][data-accent="pink"], [data-theme="dark"] [data-accent="pink"] { --accent: #f59bc1; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Trindle Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  height: 100vh;
  height: 100dvh;
  height: var(--visible-height, 100dvh);
  overflow: hidden;
  padding: var(--gap);
}

* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; }

:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

.screen { height: 100%; width: 100%; max-width: 1500px; margin: 0 auto; }
[hidden] { display: none !important; }

.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: none; border-radius: var(--r);
  background: var(--accent); color: var(--on-accent);
  font-size: 15px; font-weight: 650;
}
.primary-btn:hover { background: var(--accent-strong); }
.primary-btn svg { width: 17px; height: 17px; }

.icon-btn {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: none; border-radius: var(--r-small);
  background: transparent; color: var(--muted-fg);
}
.icon-btn::after { content: ""; position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn[aria-pressed="true"], .icon-btn[aria-expanded="true"] { background: var(--accent-tint); color: var(--fg); }

.text-btn {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 40px; padding: 0 12px;
  border: none; border-radius: var(--r-small);
  background: transparent; color: var(--muted-fg);
  font-size: 14px; font-weight: 550;
}
.text-btn:hover, .text-btn[aria-expanded="true"] { background: var(--hover); color: var(--fg); }
.text-btn svg { width: 17px; height: 17px; }

.segmented { display: flex; gap: 3px; padding: 3px; border-radius: var(--r); background: var(--field); }
.segmented button {
  min-height: 30px; padding: 0 14px;
  border: none; border-radius: var(--r-small);
  background: transparent; color: var(--muted-fg);
  font-size: 13.5px; font-weight: 550; white-space: nowrap;
}
.segmented button:hover { color: var(--fg); }
.segmented button.active { background: var(--card); color: var(--fg); box-shadow: var(--shadow-seg); }
:root[data-theme="dark"] .segmented button.active { background: var(--accent-tint); }

.menu-wrap { position: relative; }
.menu {
  position: absolute; z-index: 30; top: calc(100% + 8px); left: 0;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 232px; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-pop);
}
.menu-right { left: auto; right: 0; }
.menu-up { top: auto; bottom: calc(100% + 8px); }
.menu-item {
  display: flex; align-items: center; gap: 11px;
  min-height: 40px; padding: 0 11px;
  border: none; border-radius: var(--r-small);
  background: transparent; color: var(--fg);
  font-size: 14px; font-weight: 500; text-align: left; white-space: nowrap;
}
.menu-item:hover { background: var(--hover); }
.menu-item svg { width: 17px; height: 17px; flex: none; color: var(--muted-fg); }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.menu-item.danger.confirming { background: var(--danger); color: var(--on-danger); font-weight: 650; }
.menu-item.danger.confirming svg { color: var(--on-danger); }
.menu-rule { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-group { display: grid; gap: 8px; padding: 6px 4px 8px; }
.small-label { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-fg); }
.menu-group .segmented button { flex: 1; }
.swatches { display: flex; gap: 10px; }
.swatches button {
  width: 30px; height: 30px; padding: 0;
  border: 3px solid var(--card); border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 1px var(--line);
}
.swatches button.active { box-shadow: 0 0 0 2px var(--fg); }

#login-screen { display: grid; place-items: center; }
.login-card {
  width: min(360px, 100%); padding: 36px 32px;
  display: flex; flex-direction: column; gap: 18px;
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-card);
}
.brand-lockup { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 6px; }
.brand-lockup img { border-radius: 9px; }
.brand-lockup h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.login-card label { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--muted-fg); }
.login-card input, #search-box, .ask-field input {
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--field-edge); border-radius: var(--r);
  background: var(--field); color: var(--fg); font-size: 15px;
}
.login-card input:focus-visible, #search-box:focus-visible, .ask-field input:focus-visible { outline-offset: -1px; border-color: transparent; }
.login-card .primary-btn { margin-top: 6px; }
.error { margin: 0; color: var(--danger); font-size: 13.5px; font-weight: 550; }
.login-step { display: flex; flex-direction: column; gap: 18px; }
.hint { margin: 0; color: var(--muted-fg); font-size: 13.5px; line-height: 1.5; }
.step-divider { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--muted-fg); font-size: 13px; }
.step-divider::before, .step-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.qr { align-self: center; width: 200px; height: 200px; padding: 8px; border-radius: var(--r); background: #fff; }
.secret-key { overflow-wrap: anywhere; font-size: 13px; }
.recovery-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; margin: 0; padding-left: 24px; font-family: ui-monospace, monospace; font-size: 14px; }

#signin-settings-screen { overflow-y: auto; padding: 24px 16px; }
.settings-card {
  width: min(560px, 100%); margin: 0 auto; padding: 32px;
  display: flex; flex-direction: column; gap: 28px;
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-card);
}
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.settings-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
#signin-sections { display: flex; flex-direction: column; gap: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.settings-section { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.settings-section + .settings-section { padding-top: 28px; border-top: 1px solid var(--line); }
.settings-section h2 { margin: 0; font-size: 16px; font-weight: 650; }
.settings-section label, #totp-form label { display: flex; flex-direction: column; gap: 7px; width: 100%; font-size: 13.5px; font-weight: 600; color: var(--muted-fg); }
.settings-section input {
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--field-edge); border-radius: var(--r);
  background: var(--field); color: var(--fg); font-size: 15px;
}
#totp-form { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.passkey-list { display: flex; flex-direction: column; gap: 8px; width: 100%; margin: 0; padding: 0; list-style: none; }
.passkey-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.danger-btn {
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--danger); border-radius: var(--r-small);
  background: transparent; color: var(--danger); font-size: 14px; font-weight: 600;
}
.danger-btn:hover:not(:disabled) { background: var(--danger); color: var(--card); }
button:disabled, input:disabled { opacity: 0.55; cursor: not-allowed; }

#app-screen { display: flex; gap: var(--gap); position: relative; }

.sidebar {
  width: 290px; flex: none;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 14px 12px;
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: width 0.16s ease, opacity 0.16s ease, padding 0.16s ease, margin 0.16s ease;
}
.sidebar.collapsed { width: 0; padding-left: 0; padding-right: 0; margin-right: calc(-1 * var(--gap)); opacity: 0; visibility: hidden; }
.sidebar > * { min-width: 262px; }
#sidebar-backdrop { display: none; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.sidebar-brand img { border-radius: 7px; }
.pin-btn { margin-left: auto; }
.pin-btn.active { color: var(--accent-line); }
.pin-btn.active svg { fill: currentColor; }
#search-box::placeholder { color: var(--muted-fg); }

.sort-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px; }
select {
  min-height: 34px; padding: 0 10px;
  border: 1px solid var(--field-edge); border-radius: var(--r-small);
  background: var(--field); color: var(--fg);
  font-size: 13.5px; font-weight: 550;
}

#note-list { list-style: none; margin: 0 -4px; padding: 0 4px; overflow-y: auto; flex: 1; }
.note-list-heading { padding: 14px 10px 6px; }
.note-list-heading:first-child { padding-top: 2px; }
.note-list-item {
  display: flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 6px 0 0; margin-bottom: 3px;
  border-radius: var(--r);
}
.note-list-item:hover { background: var(--hover); }
.note-list-item.active { background: var(--accent-tint); }
.note-list-open, .search-popup .result-item {
  border: none; background: none; color: inherit; font: inherit; text-align: left;
}
.note-list-open {
  flex: 1; min-width: 0; align-self: stretch;
  display: grid; align-content: center; gap: 1px;
  padding: 7px 0 7px 12px; border-radius: var(--r);
}
.note-list-title { font-size: 14.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-list-item.active .note-list-title { font-weight: 650; }
.note-list-date { font-size: 12.5px; color: var(--muted-fg); }
.note-pin-btn { width: 30px; height: 30px; opacity: 0; }
.note-pin-btn svg { width: 15px; height: 15px; }
.note-list-item:hover .note-pin-btn, .note-list-item:focus-within .note-pin-btn, .note-pin-btn.active { opacity: 1; }
.note-pin-btn.active { color: var(--accent-line); }
.note-pin-btn.active svg { fill: currentColor; }
@media (hover: none) { .note-pin-btn { opacity: 1; } }

.sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.version-link { padding: 0 8px; font-size: 12.5px; font-weight: 550; color: var(--muted-fg); text-decoration: none; }
.version-link:hover { color: var(--fg); }

.editor-pane {
  container: editor / inline-size;
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  overflow: hidden;
}
.empty-state { display: grid; justify-items: start; gap: 14px; padding: 28px; color: var(--muted-fg); }
.empty-state p { margin: 0; }
.editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.editor-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; }
#title-input {
  flex: 1; min-width: 0;
  border: none; border-radius: var(--r-small); background: transparent; color: var(--fg);
  font-size: 21px; font-weight: 700; letter-spacing: -0.015em;
}
.toolbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; flex: none; }
.undo-redo-group { display: flex; align-items: center; gap: 2px; }
.narrow-only { display: none; }

.editor-pane { --saved-edge: inset 0 0 0 2px color-mix(in srgb, var(--accent-line) 55%, transparent); }
@keyframes saved {
  0%, 100% { box-shadow: var(--shadow-card), inset 0 0 0 0 transparent; }
  25%, 60% { box-shadow: var(--shadow-card), var(--saved-edge); }
}
@keyframes saved-still {
  from { box-shadow: var(--shadow-card), var(--saved-edge); }
  to { box-shadow: var(--shadow-card); }
}
.editor-pane.just-saved { animation: saved 1.6s ease; }

.save-indicator { font-size: 12.5px; font-weight: 600; color: var(--danger); }
.save-indicator:empty { display: none; }
.spoken-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.format-bar {
  position: relative;
  display: flex; align-items: center; gap: 3px;
  margin: 0 14px; padding: 5px 6px;
  border-radius: var(--r); background: var(--field);
}
.format-bar button { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: none; border-radius: var(--r-small); background: transparent; color: var(--fg); }
.format-bar button:hover, .format-bar button[aria-expanded="true"] { background: var(--hover); }
.format-bar button svg { width: 17px; height: 17px; }
.format-bar select { background: var(--card); }
.format-bar .sep { width: 1px; height: 18px; flex: none; background: var(--line); margin: 0 5px; }
.format-bar .more-btn { width: auto; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 550; }
.more-panel { left: 6px; min-width: 0; width: min(430px, calc(100cqw - 40px)); max-height: 62vh; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.more-panel .menu-item { width: auto; height: auto; min-height: 40px; display: flex; justify-content: flex-start; place-items: initial; align-items: center; padding: 0 11px; }
.more-panel select { grid-column: 1 / -1; min-height: 40px; margin-top: 4px; }

.wysiwyg-container, .raw-textarea {
  flex: 1; overflow-y: auto; outline: none;
  padding: 26px max(28px, calc((100% - var(--measure)) / 2)) 80px;
  font-size: 16px; line-height: 1.65;
}
.raw-textarea { border: none; resize: none; background: transparent; color: var(--fg); }

.wysiwyg-container h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin: 0.6em 0 0.35em; }
.wysiwyg-container h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; margin: 0.7em 0 0.35em; }
.wysiwyg-container h3 { font-size: 18px; font-weight: 700; margin: 0.7em 0 0.3em; }
.wysiwyg-container h4,
.wysiwyg-container h5,
.wysiwyg-container h6 { font-size: 15px; font-weight: 700; margin: 0.7em 0 0.3em; color: var(--muted-fg); }
.wysiwyg-container > :first-child { margin-top: 0; }
.wysiwyg-container p { margin: 0.6em 0; white-space: pre-line; }
.wysiwyg-container p:empty { min-height: 1.65em; }
.wysiwyg-container ul,
.wysiwyg-container ol { padding-left: 26px; margin: 0.5em 0; }
.wysiwyg-container li { margin: 0.15em 0; }
.wysiwyg-container li::marker { color: var(--muted-fg); }
.wysiwyg-container ul.task-list { list-style: none; padding-left: 2px; }
.wysiwyg-container ul.task-list li { display: flex; align-items: baseline; gap: 10px; }
.wysiwyg-container ul.task-list input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex: none; translate: 0 2px; accent-color: var(--accent-line); }
.wysiwyg-container blockquote { margin: 0.7em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--line); color: var(--muted-fg); }
.wysiwyg-container a { color: var(--link); font-weight: 600; text-decoration: none; }
.wysiwyg-container img { max-width: 100%; border-radius: var(--r); }
.wysiwyg-container hr { border: none; border-top: 1px solid var(--line); margin: 1.4em 0; }
.wysiwyg-container code { padding: 2px 7px; border-radius: 6px; background: var(--field); border: 1px solid var(--line); font-family: inherit; font-weight: 600; font-size: 0.92em; }
.wysiwyg-container pre {
  margin: 0.7em 0; padding: 14px 18px;
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r);
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; font-family: inherit;
}
.wysiwyg-container pre code { display: block; min-height: 1.8em; padding: 0; border: none; border-radius: 0; background: none; font-weight: 500; }
.wysiwyg-container table { width: 100%; margin: 0.8em 0; border-collapse: collapse; font-size: 0.95em; }
.wysiwyg-container th,
.wysiwyg-container td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.wysiwyg-container th { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-fg); }
.wysiwyg-container sup.footnote-ref { color: var(--link); font-size: 0.75em; }
.wysiwyg-container .footnotes { margin-top: 1.4em; font-size: 13.5px; color: var(--muted-fg); }
.wysiwyg-container .footnotes ol { padding-left: 20px; }

.md-alert { --tone: var(--info); margin: 0.9em 0; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent); border-radius: var(--r); background: color-mix(in srgb, var(--tone) 10%, transparent); }
.md-alert p { margin: 0.3em 0; }
.md-alert-title { font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--tone); }
.md-alert-tip { --tone: var(--success); }
.md-alert-important { --tone: var(--important); }
.md-alert-warning { --tone: var(--warning); }
.md-alert-caution { --tone: var(--caution); }

.search-wrap { position: relative; }
.search-popup {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
  max-height: min(60vh, 440px); overflow-y: auto; padding: 6px;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow-pop);
}
.search-popup .result-item { display: block; width: 100%; padding: 10px 12px; border-radius: var(--r-small); font-size: 14.5px; font-weight: 550; overflow-wrap: anywhere; }
.search-popup .result-item:hover, .search-popup .result-item:focus-visible { background: var(--hover); }
.search-popup .result-rule { height: 1px; margin: 6px 10px; background: var(--line); }
.search-popup .result-none { margin: 0; padding: 10px 12px; color: var(--muted-fg); font-size: 14px; }

.hover-label {
  position: fixed; z-index: 60; pointer-events: none; white-space: nowrap;
  padding: 6px 10px; border-radius: var(--r-small);
  background: var(--fg); color: var(--card);
  font-size: 12.5px; font-weight: 600; line-height: 1;
}
.ask-panel {
  position: fixed; z-index: 70;
  display: flex; flex-direction: column; gap: 12px;
  min-width: 260px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop);
}
.ask-field { display: flex; flex-direction: column; gap: 6px; }
.ask-field span { font-size: 13.5px; font-weight: 600; color: var(--muted-fg); }
.ask-go { align-self: flex-end; min-height: 40px; padding: 0 18px; border: none; border-radius: var(--r); background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 650; }
.ask-go:hover { background: var(--accent-strong); }

.title-error { margin: 0 18px 10px; }
.app-error { margin: 10px 14px 0; padding: 10px 14px; border-radius: var(--r); color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); font-size: 13.5px; font-weight: 600; }

.demo [data-demo-hide] { display: none; }

@media (max-width: 700px) {
  body { padding: 0; }
  #app-screen { gap: 0; }
  .editor-pane, .login-card { border-radius: 0; box-shadow: none; }
  #login-screen { background: var(--card); }
  .sidebar {
    position: absolute; z-index: 20; top: 0; left: 0; height: 100%;
    width: 86%; max-width: 330px;
    border-radius: 0 var(--r-card) var(--r-card) 0; box-shadow: var(--shadow-pop);
    transition: transform 0.2s ease, visibility 0.2s;
  }
  .sidebar.collapsed { width: 86%; max-width: 330px; padding: 16px 14px 12px; margin-right: 0; opacity: 1; transform: translateX(-102%); }
  .sidebar > * { min-width: 0; }
  #sidebar-backdrop.visible { display: block; position: absolute; inset: 0; z-index: 15; background: rgba(0, 0, 0, 0.4); }
  .pin-btn { display: none; }
  .narrow-only { display: grid; }
  .editor-toolbar { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px 8px; }
  .toolbar-right { width: 100%; justify-content: space-between; gap: 8px; }
  .format-bar { margin: 0 10px; }
  .wysiwyg-container, .raw-textarea { padding: 18px 18px 60px; }
}
.more-panel .narrow-only { display: none; }
@container editor (max-width: 540px) {
  .format-bar .wide-only { display: none; }
  .format-bar .more-btn span { display: none; }
  .format-bar .more-btn { padding: 0 9px; }
  .format-bar .sep { margin: 0 2px; }
  #heading-select { max-width: 112px; }
  .more-panel .narrow-only { display: flex; }
}
@container editor (max-width: 380px) {
  .more-panel { grid-template-columns: minmax(0, 1fr); }
}
@container editor (max-width: 350px) {
  .format-bar { gap: 1px; }
  .format-bar button { width: 30px; }
  #heading-select { max-width: 100px; padding: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .editor-pane.just-saved { animation: saved-still 1.6s step-end !important; }
}

.print-only { display: none; }
@media print {
  :root, :root[data-theme="dark"] { --fg: #000; --muted-fg: #444; --line: #ccc; --field: #f2f2f2; --link: #1d5fa8; }
  body { height: auto; overflow: visible; padding: 0; background: #fff; }
  .sidebar, #sidebar-backdrop, .editor-toolbar, .format-bar, .app-error,
  #wysiwyg-editor, #raw-textarea { display: none !important; }
  .print-only { display: block !important; }
  .editor-pane { overflow: visible; box-shadow: none; background: #fff; }
  .wysiwyg-container { padding: 0; overflow: visible; }
}
