@font-face {
  font-family: Inter;
  src: url("assets/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("assets/inter-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("assets/bricolage.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: Spectral;
  src: url("assets/spectral.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Spectral;
  src: url("assets/spectral-italic.woff2") format("woff2");
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: Spectral;
  src: url("assets/spectral-semibold.woff2") format("woff2");
  font-weight: 600 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #302c35;
  --text: #343039;
  --muted: #625d68;
  --primary: #3e6487;
  --primary-hover: #31516e;
  --on-primary: #ffffff;
  --side: #f6f8fb;
  --side-line: #d7e1ed;
  --side-muted: #546372;
  --pale: #ecf2f7;
  --active: #e3ecf5;
  --accent: #dceaf7;
  --accent-hover: #d1e1f2;
  --on-accent: #2e485f;
  --sun: #edf2f6;
  --sun-ink: #4c5d6b;
  --sun-line: #d9e1eb;
  --paper: #fffefa;
  --desk: #f6f4f3;
  --chrome: #fdfcfb;
  --line: #e6e2e7;
  --control-line: #788799;
  --error: #b52e42;
  --on-error: #ffffff;
  --status-good: #4e685b;
  --selection: #dae7f6;
  --on-selection: #273b4d;
  --shadow: #302c3516;
  --overlay: #20293699;
  --new-button-line: #c3d7e9;
  --prism-tint: 35%;
  --prism-stops:
    color-mix(in srgb, var(--side), #efcfc7 var(--prism-tint)) 0%,
    color-mix(in srgb, var(--side), #f3dfbb var(--prism-tint)) 7%,
    color-mix(in srgb, var(--side), #bce2d7 var(--prism-tint)) 15%,
    color-mix(in srgb, var(--side), #a4d7ef var(--prism-tint)) 28%,
    color-mix(in srgb, var(--side), #91bde8 var(--prism-tint)) 55%,
    color-mix(in srgb, var(--side), #abc6ee var(--prism-tint)) 80%,
    color-mix(in srgb, var(--side), #d4c6e7 var(--prism-tint)) 100%;
  --prism-night-stops:
    color-mix(in srgb, var(--side), #71525e var(--prism-tint)) 0%,
    color-mix(in srgb, var(--side), #74664a var(--prism-tint)) 7%,
    color-mix(in srgb, var(--side), #3e7166 var(--prism-tint)) 15%,
    color-mix(in srgb, var(--side), #3e7089 var(--prism-tint)) 28%,
    color-mix(in srgb, var(--side), #42668b var(--prism-tint)) 55%,
    color-mix(in srgb, var(--side), #535f8c var(--prism-tint)) 80%,
    color-mix(in srgb, var(--side), #6e587f var(--prism-tint)) 100%;
  --prism-sidebar: linear-gradient(158deg, var(--prism-stops));
  --prism-toolbar: linear-gradient(104deg, var(--prism-stops));
  --prism-line: linear-gradient(90deg, #deb6c9, #e9c6a9 10%, #ded7ac 19%, #a8cfbf 29%, #89c6dd 45%, #82b0db 69%, #a8b6df 87%, #c8b3da);
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", Inter, system-ui, sans-serif;
  --prose: var(--sans);
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --writing-font: var(--sans);
  --writing-size: clamp(1.0625rem, 1rem + .23vw, 1.1875rem);
  --writing-leading: 1.58;
  --reading-measure: 82ch;
  --page-width: 58rem;
  --manuscript-paper: var(--paper);
  --rail-width: clamp(12.5rem, 15vw, 14rem);
  font-family: var(--sans);
  font-kerning: normal;
  font-optical-sizing: auto;
  color: var(--text);
  background: var(--desk);
}
:root[data-paper="night"] {
  color-scheme: dark;
  --ink: #f2f1f4;
  --text: #e4e8ef;
  --muted: #b6c2ce;
  --primary: #a7cdef;
  --primary-hover: #c4e0fa;
  --on-primary: #172a3d;
  --side: #1d2834;
  --side-line: #3d4b5c;
  --side-muted: #c5d0da;
  --pale: #29394b;
  --active: #324457;
  --accent: #344e66;
  --accent-hover: #405e79;
  --on-accent: #e1effa;
  --sun: #293749;
  --sun-ink: #c4d5e5;
  --sun-line: #435064;
  --paper: #19212b;
  --desk: #151d26;
  --chrome: #1c2631;
  --line: #364350;
  --control-line: #8294a6;
  --error: #ffa8b4;
  --on-error: #501a29;
  --status-good: #99ceb8;
  --selection: #3d5873;
  --on-selection: #ffffff;
  --shadow: #0b101865;
  --overlay: #0a111bbb;
  --new-button-line: #50657b;
  --prism-stops: var(--prism-night-stops);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-paper]), :root[data-paper="system"] {
    color-scheme: dark;
    --ink: #f2f1f4;
    --text: #e4e8ef;
    --muted: #b6c2ce;
    --primary: #a7cdef;
    --primary-hover: #c4e0fa;
    --on-primary: #172a3d;
    --side: #1d2834;
    --side-line: #3d4b5c;
    --side-muted: #c5d0da;
    --pale: #29394b;
    --active: #324457;
    --accent: #344e66;
    --accent-hover: #405e79;
    --on-accent: #e1effa;
    --sun: #293749;
    --sun-ink: #c4d5e5;
    --sun-line: #435064;
    --paper: #19212b;
    --desk: #151d26;
    --chrome: #1c2631;
    --line: #364350;
    --control-line: #8294a6;
    --error: #ffa8b4;
    --on-error: #501a29;
    --status-good: #99ceb8;
    --selection: #3d5873;
    --on-selection: #ffffff;
    --shadow: #0b101865;
    --overlay: #0a111bbb;
    --new-button-line: #50657b;
    --prism-stops: var(--prism-night-stops);
  }
}
:root[data-paper="white"] { --manuscript-paper: #ffffff; }
:root[data-paper="cream"] { --manuscript-paper: #fff3d6; }
:root[data-paper="blue"] { --manuscript-paper: #edf5ff; }
:root[data-writing-font="serif"] { --writing-font: Spectral, "Iowan Old Style", Georgia, serif; }
:root[data-writing-font="mono"] { --writing-font: var(--mono); }
:root[data-text-size="small"] { --writing-size: 1rem; }
:root[data-text-size="large"] { --writing-size: 1.375rem; }
:root[data-page-width="standard"] { --page-width: 43rem; }
:root[data-page-width="full"] { --page-width: 100%; }
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  :root { font: -apple-system-body; font-family: var(--sans); }
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select, summary { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { border: 0; color: inherit; background: transparent; cursor: pointer; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
button:disabled { cursor: default; }
button:focus-visible, summary:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
button, summary, select { touch-action: manipulation; }
[hidden] { display: none !important; }
::selection { background: var(--selection); color: var(--on-selection); }
.shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.icon-button, .tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.15rem; height: 2.15rem; padding: 0; border-radius: .36rem;
  font-size: 1.18rem; color: var(--muted);
}
.icon-button:hover, .tool:not(:disabled):hover { color: var(--ink); background: var(--pale); }
.small-icon { font-size: .78rem; }

.sidebar {
  width: min(var(--rail-width), 31vw); flex: 0 0 min(var(--rail-width), 31vw);
  display: flex; flex-direction: column; min-height: 0; container: sidebar / inline-size;
  color: var(--ink); background: var(--side) var(--prism-sidebar); border-right: 1px solid var(--side-line);
}
.sidebar button:focus-visible { outline-color: var(--primary); }
.sidebar-top { padding: 1.3rem 1rem 0; }
.brand-row { display: flex; align-items: center; justify-content: space-between; }
.brand {
  display: inline-flex; align-items: center; gap: .83rem; padding: 0 .25rem;
  color: var(--primary); font: 750 2.2rem/.98 var(--display); letter-spacing: -.03em;
}
.sidebar .brand { color: var(--ink); font-size: min(2.1rem, 16cqi); gap: .27em; padding-inline: .08em; }
.brand-mark {
  display: block; width: .96em; height: .96em; flex: none;
  border-radius: 22%; object-fit: contain;
}
.mobile-close, .backdrop { display: none; }
.new-button, .library-new, .solid-button {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 2.75rem; font-size: .98rem; font-weight: 650; border-radius: .42rem;
}
.new-button { margin-top: 1.35rem; border: 1px solid var(--new-button-line); background: var(--accent); color: var(--on-accent); width: 100%; }
.new-button:hover { background: var(--accent-hover); }
.new-button .ph, .library-new .ph { font-size: 1rem; }
.side-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1.45rem .65rem 1rem; scrollbar-width: thin; scrollbar-color: var(--side-line) transparent; }
.side-label {
  padding: 0 .65rem; margin: 0 0 .66rem; font-size: .75rem; font-weight: 600;
  letter-spacing: .085em; text-transform: uppercase; color: var(--side-muted);
}
.workspace-nav, .recent-list, .outline-list { display: grid; gap: .16rem; }
.workspace-nav button, .recent-list button, .outline-list button {
  display: flex; align-items: center; gap: .72rem; width: 100%; min-width: 0; text-align: left;
  min-height: 2.5rem; padding: .52rem .65rem; border-radius: .35rem; font-size: .92rem;
  color: var(--ink); line-height: 1.3;
}
.workspace-nav button .ph, .recent-list button .ph { font-size: 1.13rem; flex: 0 0 auto; color: var(--side-muted); }
.workspace-nav button > span:not(.nav-count) { min-width: 0; overflow-wrap: anywhere; }
.workspace-nav button:hover, .recent-list button:hover, .outline-list button:hover, .shortcut-button:hover { background: var(--active); }
.workspace-nav button[aria-current="page"], .recent-list button[aria-current="page"] { background: var(--active); color: var(--primary); box-shadow: inset 3px 0 var(--primary); font-weight: 650; }
.recent-list button[aria-current="page"] .ph, .workspace-nav button[aria-current="page"] .ph { color: var(--primary); }
.nav-count { margin-left: auto; color: var(--side-muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.recent-section { border-top: 1px solid var(--side-line); padding-top: 1.5rem; margin-top: 1.3rem; }
.recent-list button span, .outline-list button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline-section { margin-top: 1.6rem; }
.outline-list { margin-left: .8rem; border-left: 1px solid var(--side-line); }
.outline-list button { min-height: 1.95rem; font-size: .875rem; padding: .33rem .72rem; color: var(--side-muted); }
.outline-list button.subheading { padding-left: 1.3rem; }
.side-bottom { margin-top: auto; padding: .6rem 1.4rem 1.15rem; }
.goal-card { color: var(--sun-ink); padding: .75rem .9rem .95rem; background: var(--sun); border: 1px solid var(--sun-line); border-radius: .55rem; }
.goal-heading { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; }
.goal-heading > .ph { color: var(--sun-ink); font-size: 1.05rem; }
.goal-heading .icon-button { margin-left: auto; width: 1.8rem; height: 1.8rem; font-size: .95rem; color: var(--sun-ink); }
.goal-heading .icon-button:hover { color: var(--sun-ink); background: var(--sun-line); }
.goal-value { color: var(--sun-ink); margin: .4rem 0 .55rem; font-size: .82rem; font-variant-numeric: tabular-nums; }
.goal-value strong { color: var(--sun-ink); font-weight: 600; }
progress { display: block; width: 100%; height: 4px; border: 0; background: var(--sun-line); border-radius: 9px; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--sun-line); border-radius: 9px; }
progress::-webkit-progress-value { background: var(--sun-ink); border-radius: 9px; }
progress::-moz-progress-bar { background: var(--sun-ink); border-radius: 9px; }
.set-goal { font-size: .875rem; margin: .3rem 0 0; padding: .25rem 0; color: var(--sun-ink); text-decoration: underline; text-underline-offset: .2rem; }
.shortcut-button { display: flex; align-items: center; gap: .6rem; padding: .75rem .35rem .35rem; margin-top: .45rem; color: var(--side-muted); border-radius: .3rem; font-size: .82rem; }
.shortcut-button .ph { font-size: 1.08rem; }

.workspace { min-width: 0; flex: 1; display: flex; flex-direction: column; container: workspace / inline-size; }
.topbar, .statusbar { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; background: var(--chrome); }
.topbar { position: relative; min-height: 3.25rem; gap: .25rem .55rem; flex-wrap: wrap; padding: .55rem clamp(.85rem, 2.4vw, 2.4rem); border-bottom: 1px solid var(--line); z-index: 3; }
.shell .topbar::after {
  content: ""; position: absolute; z-index: 1; inset: auto 0 -1px; height: 3px;
  pointer-events: none; background: var(--prism-line);
}
.topbar-left, .topbar-actions, .breadcrumbs, .top-button { display: flex; align-items: center; }
.topbar-left { gap: .95rem; min-width: 0; flex: 1 1 3.5rem; }
.sidebar-toggle { flex: none; }
.topbar-divider, .tool-divider { display: block; height: 1.12rem; width: 1px; background: var(--line); flex-shrink: 0; }
.breadcrumbs { gap: .65rem; min-width: 0; font-size: .9rem; white-space: nowrap; }
.breadcrumbs button { padding: .35rem 0; color: var(--muted); }
.breadcrumbs button:hover { text-decoration: underline; }
.breadcrumbs > span[aria-hidden] { color: var(--muted); }
#breadcrumb-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 550; }
.topbar-actions { gap: .55rem; flex: 0 1 auto; flex-wrap: wrap; max-width: 100%; margin-left: auto; justify-content: flex-end; }
.top-button { min-height: 2.3rem; gap: .45rem; padding: .4rem .65rem; border-radius: .37rem; color: var(--ink); font-size: .9rem; font-weight: 520; }
.top-button > .ph:first-child { font-size: 1.1rem; }
.top-button:hover, .dropdown[open] > .top-button { background: var(--pale); }
.search-button { justify-content: center; width: 2.25rem; padding: 0; color: var(--muted); }
.export-button { border: 1px solid var(--control-line); background: var(--pale); padding-inline: .82rem; }
.dropdown { position: relative; }
.menu {
  position: absolute; z-index: 8; top: calc(100% + .4rem); right: 0; min-width: min(11.75rem, 92vw); max-width: 92vw;
  border: 1px solid var(--line); padding: .32rem; border-radius: .5rem; background: var(--paper);
  box-shadow: 0 8px 28px var(--shadow);
}
.menu button { display: flex; align-items: center; gap: .65rem; width: 100%; border-radius: .3rem; text-align: left; padding: .62rem; font-size: .9rem; }
.menu button .ph { font-size: 1.05rem; color: var(--primary); }
.menu button small { margin-left: auto; color: var(--muted); font-size: .75rem; }
.menu button:hover, .menu button:focus-visible { background: var(--pale); }

.editor-scroll, .library { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable both-edges; }
.editor-scroll { padding: clamp(1.3rem, 2.7vw, 2.8rem) clamp(1.1rem, 3.4vw, 3.5rem); }
.paper {
  max-width: 53.3rem; margin-inline: auto; min-height: max(42rem, calc(100dvh - 11.3rem));
  background: var(--manuscript-paper); border: 1px solid var(--line); border-radius: .65rem;
  box-shadow: 0 6px 30px -12px var(--shadow);
}
.format-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .12rem; min-height: 3.18rem; padding: .35rem 1.1rem;
  border-bottom: 1px solid var(--line); background: var(--chrome); border-radius: .6rem .6rem 0 0;
}
.style-control { position: relative; }
.style-control select { cursor: pointer; border: 0; color: var(--text); background: transparent; appearance: none; height: 2rem; padding: 0 1.55rem 0 .45rem; font-size: .9rem; font-weight: 550; border-radius: .3rem; }
.style-control select:hover { background: var(--pale); }
.style-control > .ph { position: absolute; right: .43rem; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); }
.tool-divider { margin-inline: .4rem; }
.tool { width: 2.12rem; height: 2rem; color: var(--primary); font-size: 1.08rem; }
.tool:disabled { color: var(--muted); opacity: .45; }
.tool[aria-pressed="true"] { background: var(--active); color: var(--primary); }
.history-tools { display: flex; margin-left: auto; }
.manuscript { max-inline-size: 48rem; margin-inline: auto; padding: clamp(1.75rem, 3.4vw, 3.65rem) clamp(2rem, 4vw, 3.25rem) 4.5rem; }
.paper-heading, .draft-kind, .paper-actions, .date-line { display: flex; align-items: center; }
.paper-heading { justify-content: space-between; min-height: 1.75rem; }
.draft-kind { gap: .56rem; font-weight: 650; font-size: .78rem; letter-spacing: .085em; text-transform: uppercase; color: var(--primary); }
.ink-rule, .library-mark { display: inline-block; width: 1.65rem; height: 3px; background: var(--accent); }
.paper-actions { gap: .2rem; }
.paper-actions .icon-button { width: 1.9rem; height: 1.9rem; font-size: 1.08rem; }
.paper-actions summary.icon-button { font-size: 1.5rem; }
.is-starred, .paper-actions .is-starred, .row-actions .is-starred { color: var(--primary); }
.is-starred .ph-star::after { content: "★"; font-family: Georgia, serif; }
#draft-title {
  display: block; width: 100%; resize: none; overflow: hidden; padding: 0; margin: .5rem 0 .85rem;
  border: 0; outline: none; background: transparent; color: var(--ink);
  font: 400 clamp(3.1rem, 2.3rem + 2.8vw, 4.7rem)/1.055 var(--display); letter-spacing: -.026em;
}
#draft-title:focus-visible { box-shadow: 0 1px var(--primary); }
#draft-title::placeholder { color: var(--muted); opacity: 1; }
.date-line { gap: .45rem; color: var(--muted); font-size: .84rem; }
.date-line .ph { font-size: .94rem; }
.manuscript-rule { margin: 1.6rem 0 1.68rem; height: 1px; background: var(--line); }
#writing-area.ql-container { height: auto; border: 0; font-family: var(--writing-font); }
#writing-area .ql-editor {
  min-height: 18rem; padding: 0; height: auto; overflow: visible; outline: none;
  font: 400 var(--writing-size)/var(--writing-leading) var(--writing-font); color: var(--text);
  max-inline-size: var(--reading-measure); caret-color: var(--primary);
  tab-size: 4; word-break: normal; overflow-wrap: anywhere;
}
#writing-area .ql-editor:focus-visible { outline: 0; }
.manuscript-rule:has(+ #writing-area .ql-editor:focus-visible) { background: var(--primary); }
#writing-area .ql-editor.ql-blank::before { left: 0; right: 0; color: var(--muted); font-style: italic; }
.ql-editor p + p, .ql-editor ol + p, .ql-editor blockquote + p { margin-top: .78em; }
.ql-editor h2, .ql-editor h3 {
  font-family: var(--display); font-weight: 400; line-height: 1.2; color: var(--ink);
  margin: 1.08em 0 .42em; letter-spacing: -.018em;
}
.ql-editor h2 { font-size: 1.9em; }
.ql-editor h3 { font-size: 1.5em; }
.ql-editor > :first-child { margin-top: 0; }
.ql-editor strong { font-weight: 650; }
.ql-editor em { font-style: italic; }
.ql-editor a { color: var(--primary); text-underline-offset: .15em; }
.ql-editor :is([style*="255, 231, 151"], [style*="#ffd851" i], mark) { color: #30233b; }
.ql-editor code, .ql-editor .ql-code-block-container {
  font: 400 .85em/1.6 var(--mono); color: var(--ink); background: var(--pale); border-radius: .25em;
}
.ql-editor code { padding: .08em .24em; }
.ql-editor .ql-code-block-container { margin-block: .75em; padding: .65em .85em; }
.ql-editor blockquote { border-left: 3px solid var(--accent); padding-left: 1.1rem; margin-top: .85em; color: var(--muted); font-style: italic; }
.ql-editor li { padding-left: 1.45em; }
.ql-editor ol { margin-top: .65em; }
.statusbar { gap: .75rem; flex-wrap: wrap; min-height: 2.65rem; padding: .4rem clamp(1rem, 2.7vw, 2.5rem); border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.save-state, .stats { display: inline-flex; align-items: center; gap: .5rem; }
.save-state .ph { color: var(--status-good); font-size: 1rem; }
.save-state.error, .save-state.error .ph { color: var(--error); }
.stats { gap: .7rem; margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-dot { color: var(--muted); }

.library { padding: clamp(1.8rem, 5vw, 4.8rem) clamp(1.35rem, 5vw, 5rem); }
.library-inner { max-width: 52rem; margin: auto; }
.library-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.library-mark { display: block; margin-bottom: .65rem; }
.library h1 { margin: 0; color: var(--ink); font: 720 clamp(2.1rem, 1.7rem + 1.8vw, 3.4rem)/1.06 var(--display); letter-spacing: -.028em; }
.library-new, .solid-button { min-height: 2.5rem; background: var(--primary); color: var(--on-primary); padding: .55rem 1rem; }
.library-new:hover, .solid-button:hover { background: var(--primary-hover); }
.search-field { margin: 1.8rem 0 1.65rem; display: flex; align-items: center; gap: .7rem; border: 1px solid var(--control-line); border-radius: .45rem; background: var(--paper); padding: .72rem .9rem; }
.search-field .ph { font-size: 1.13rem; color: var(--primary); }
.search-field:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
.search-field input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 1rem; }
.results-heading { color: var(--muted); font-size: .84rem; margin-bottom: .65rem; }
.library-list { background: var(--paper); border: 1px solid var(--line); border-radius: .65rem; }
.draft-row { display: flex; align-items: center; gap: .4rem; padding: .65rem .8rem; }
.draft-row + .draft-row { border-top: 1px solid var(--line); }
.open-row { display: flex; align-items: center; gap: .95rem; flex: 1; min-width: 0; text-align: left; padding: .55rem .4rem; border-radius: .35rem; }
.open-row:hover { background: var(--pale); }
.file-icon { flex-shrink: 0; width: 2.6rem; height: 3.05rem; display: grid; place-items: center; background: var(--pale); color: var(--primary); border-radius: .3rem; font-size: 1.45rem; }
.row-copy { min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.row-copy strong { color: var(--ink); font: 600 1.12rem/1.27 var(--prose); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-copy small { color: var(--muted); font-size: .8rem; }
.row-actions { display: flex; }
.empty { text-align: center; padding: 3.5rem 1.25rem; }
.empty > .ph { display: inline-grid; place-items: center; width: 3.7rem; height: 3.7rem; border-radius: 1.1rem; background: var(--sun); font-size: 1.75rem; color: var(--sun-ink); }
.empty h2 { font: 680 1.8rem/1.12 var(--display); letter-spacing: -.018em; color: var(--ink); margin: .75rem 0 .3rem; }
.empty p { line-height: 1.55; color: var(--muted); margin: 0 auto; max-width: 24rem; font-size: .95rem; }

dialog { width: min(25rem, calc(100vw - min(2rem, 8vw))); border: 1px solid var(--line); border-radius: .7rem; padding: min(1.5rem, 6vw); background: var(--paper); color: var(--text); box-shadow: 0 15px 60px var(--shadow); overflow-wrap: anywhere; }
dialog::backdrop { background: var(--overlay); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.dialog-head h2 { font: 680 1.65rem/1.15 var(--display); letter-spacing: -.02em; margin: 0; color: var(--ink); }
.desk-preferences h2, .desk-tool-dialog h2 { font: 680 1.65rem/1.15 var(--display); letter-spacing: -.02em; color: var(--ink); }
dialog label { display: block; font-size: .9rem; font-weight: 550; margin-bottom: .45rem; }
dialog input { width: 100%; padding: .7rem .8rem; border-radius: .35rem; border: 1px solid var(--control-line); font-size: 1rem; color: var(--ink); background: var(--paper); }
.dialog-footer { margin-top: 1.35rem; display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.quiet-button { margin-right: auto; color: var(--muted); padding: .55rem 0; font-size: .875rem; }
.quiet-button:hover { text-decoration: underline; }
.shortcut-list { margin: 0; }
.shortcut-list div { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); font-size: .94rem; }
.shortcut-list dd { display: flex; gap: .25rem; margin: 0; }
kbd { font: 500 .8rem var(--sans); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: .25rem; background: var(--pale); padding: .15rem .4rem; }
.toast { position: fixed; z-index: 15; bottom: 3.35rem; left: 50%; transform: translateX(-50%); max-width: min(30rem, 90vw); background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary); border-radius: .45rem; padding: .7rem 1rem; font-size: .9rem; box-shadow: 0 4px 18px var(--shadow); }
.no-sidebar .sidebar, .focus-mode .sidebar, .focus-mode .topbar, .focus-mode .format-bar, .focus-mode .paper-actions { display: none; }
.focus-mode .editor-scroll { position: relative; padding-top: 3.05rem; background: var(--manuscript-paper); }
.focus-mode .paper { border: 0; box-shadow: none; background: transparent; }
.focus-mode .manuscript { padding-top: 1.4rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
.exit-focus { position: fixed; z-index: 2; top: .75rem; right: 1rem; background: var(--paper); border: 1px solid var(--line); }

@media (max-width: 900px) {
  :root { --rail-width: 12.5rem; }
  .sidebar-top { padding-inline: 1.1rem; }
  .side-bottom { padding-inline: 1.1rem; }
  .editor-scroll { padding: 1.15rem; }
  .manuscript { padding: 2rem 2rem 3.5rem; }
  .format-bar { padding-inline: .6rem; }
}
@media (max-width: 740px) {
  .sidebar, .no-sidebar .sidebar { display: none; }
  .drawer-open .sidebar { display: flex; position: fixed; z-index: 10; inset: 0 auto 0 0; width: min(18rem, 87vw); overflow-y: auto; }
  .drawer-open .backdrop { display: block; position: fixed; z-index: 9; inset: 0; background: var(--overlay); }
  .mobile-close { display: inline-flex; color: var(--side-muted); }
  .sidebar-top { padding-top: 1.3rem; }
  .side-scroll { padding-top: 1.45rem; min-height: min(12rem, 32dvh); }
  .topbar { min-height: 3.6rem; }
  .topbar-left { gap: .5rem; }
  .topbar-actions { gap: .25rem; }
  .statusbar { min-height: 2.55rem; padding-bottom: max(.4rem, env(safe-area-inset-bottom)); }
  .library-heading, .dialog-footer { flex-wrap: wrap; }
  .editor-scroll { padding: 1rem; scrollbar-gutter: auto; }
  .paper { min-height: calc(100dvh - 8.3rem); }
  .manuscript { padding: 1.5rem clamp(1.2rem, 5.3vw, 2.8rem) 3.5rem; }
  #draft-title { font-size: clamp(2.95rem, 2.4rem + 2.2vw, 3.45rem); }
  .side-bottom { padding-bottom: max(.8rem, env(safe-area-inset-bottom)); }
}
@media (max-width: 575px), (min-width: 741px) and (max-width: 900px) {
  .breadcrumbs button, .breadcrumbs > span[aria-hidden], .topbar-divider { display: none; }
}
@media (min-width: 741px) and (max-width: 825px) {
  .topbar-left, .topbar-actions { gap: .35rem; }
  #focus-button span { display: none; }
}
@media (max-width: 480px) {
  .topbar { padding: .43rem .65rem; }
  .breadcrumbs { gap: .38rem; font-size: .81rem; }
  .topbar-divider { display: none; }
  .topbar-left { gap: .25rem; }
  #focus-button span { display: none; }
  .top-button { min-height: 2.2rem; padding-inline: .45rem; }
  .export-button { padding-inline: .58rem; }
  .editor-scroll { padding: 0; }
  .paper { min-height: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .format-bar { border-radius: 0; padding: .3rem .55rem; gap: 0; min-height: 2.95rem; }
  .style-control select { width: 5.85rem; font-size: .82rem; }
  .tool { width: 1.9rem; height: 2.1rem; font-size: 1.03rem; }
  .tool-divider { margin-inline: .21rem; }
  .manuscript { padding: 1.6rem 1.4rem 3rem; }
  #draft-title { font-size: clamp(2.75rem, 2.15rem + 2.5vw, 3.3rem); }
  .manuscript-rule { margin: 1.3rem 0; }
  .statusbar { padding-inline: .75rem; font-size: .75rem; gap: .35rem; }
  .stats { gap: .35rem; }
  .save-state { gap: .3rem; }
  .library { padding: 1.65rem 1.1rem; }
  .library-new { min-height: 2.3rem; padding-inline: .65rem; }
  .draft-row { padding-inline: .45rem; }
  .open-row { gap: .55rem; }
  .file-icon { width: 2rem; height: 2.55rem; font-size: 1.15rem; }
  .row-actions .icon-button { width: 1.8rem; }
  .row-copy small { font-size: .75rem; }
  .focus-mode .editor-scroll { padding: 3.2rem 0 0; }
}
@media (max-width: 360px) {
  .format-bar .tool { width: 1.65rem; }
  .sidebar-toggle { width: 1.9rem; }
}
.sidebar .sidebar-top, .sidebar .side-bottom { padding-inline: min(1.08rem, 7cqi); }
/* Keep the page accessible when large text takes up most of a compact window. */
@container workspace (max-width: 22em) {
  .topbar { gap: .25rem; min-height: 2.6rem; padding: .2rem min(.45rem, 2vw); }
  .topbar-left { flex: none; }
  .topbar .breadcrumbs, .topbar .topbar-divider { display: none; }
  .topbar-actions { flex: 1; gap: .15rem; }
  .topbar .icon-button, .topbar .top-button { min-width: 44px; min-height: 44px; height: auto; width: auto; padding: .2em; }
  #export-menu > summary .small-icon { display: none; }
  #share-button span, #focus-button span, #show-feedback > span, #export-menu > summary > span {
    position: absolute; height: 1px; width: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .manuscript { padding-inline: min(1.2rem, 5.5vw); }
}
.empty .solid-button {margin:.85rem .4rem .1rem;}
.empty .account-link {display:inline-block;margin-left:1rem;color:var(--primary);text-underline-offset:.2rem;}

/* The imprint uses a transparent wing so it takes on the paper behind it. */
body .brand, body .sidebar .brand {
  font: 600 1.82rem/1.1 Spectral, Georgia, serif; letter-spacing: -.055em; gap: .34em;
  color: var(--ink); text-decoration: none;
}
body img.brand-mark { width: 1.23em; height: .95em; border-radius: 0; object-fit: contain; }
:root[data-paper="night"] .brand-mark { content: url("/assets/kingfisher-night.png"); }
@media (prefers-color-scheme: dark) {
  :root:not([data-paper]) .brand-mark, :root[data-paper="system"] .brand-mark { content: url("/assets/kingfisher-night.png"); }
}
