:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --ink: #292c29;
  --muted: #6d726d;
  --line: #e3e5df;
  --soft: #eeefea;
  --accent: #53644e;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color-scheme: light;
}
[data-theme="rose"] {
  --bg: #fcf7f7;
  --surface: #fffafa;
  --ink: #413537;
  --muted: #806c70;
  --line: #eadfe0;
  --soft: #f2e8e9;
  --accent: #86565f;
}
[data-theme="night"] {
  --bg: #181a19;
  --surface: #1e211f;
  --ink: #e5e7e2;
  --muted: #a3aaa1;
  --line: #343a34;
  --soft: #2a302a;
  --accent: #bac9ae;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 var(--sans); }
body:has(dialog[open]) { overflow: hidden; }
[hidden] { display: none !important; }
::selection { background: var(--soft); }
button, input { font: inherit; color: inherit; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, [contenteditable]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.25; }
h1 { font-size: 36px; letter-spacing: -1px; }
h2 { font-size: 24px; }
.site-shell { max-width: 1080px; margin: auto; padding: 0 32px 64px; }
.header { min-height: 84px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.home-link { font-size: 15px; font-weight: 500; }
.header nav { display: flex; align-items: center; gap: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; background: var(--surface); transition: background .15s; }
.button:hover:not(:disabled) { background: var(--soft); }
.button-dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.button-dark:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 5px; font-size: 23px; }
.icon-button:hover { background: var(--soft); }
.text-link { color: var(--muted); font-size: 13px; padding: 8px 0; }
.text-link:hover:not(:disabled) { color: var(--ink); text-decoration: underline; }
.entries-section {
  position: relative;
  max-width: 820px;
  min-height: 520px;
  margin: 48px auto 16px;
  padding: 42px 48px 48px 70px;
  border: 1px solid var(--line);
  border-radius: 4px 10px 10px 4px;
  background-color: var(--surface);
  background-image: linear-gradient(90deg, transparent 43px, color-mix(in srgb, var(--accent) 16%, transparent) 43px, color-mix(in srgb, var(--accent) 16%, transparent) 44px, transparent 44px), radial-gradient(var(--line) .5px, transparent .5px);
  background-size: auto, 6px 6px;
  box-shadow: 4px 4px 0 var(--bg), 5px 5px 0 var(--line), 8px 8px 0 var(--surface), 9px 9px 0 var(--line), 0 18px 50px #18251c0a;
}
.entries-section::before { content: ''; position: absolute; left: 15px; top: 30px; bottom: 30px; width: 10px; background: radial-gradient(circle, var(--bg) 3px, var(--line) 3px, transparent 4px) 0 0 / 10px 38px repeat-y; pointer-events: none; }
.entries-section::after { content: ''; position: absolute; top: -1px; right: 42px; width: 15px; height: 39px; background: var(--accent); opacity: .6; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 83%, 0 100%); pointer-events: none; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.reader-title { display: flex; align-items: center; gap: 16px; }
.reader-title h1 { font-size: 42px; }
.pressed-leaf { flex-shrink: 0; width: 43px; height: 61px; color: var(--accent); transform: rotate(-13deg); }
.entry-count { color: var(--muted); font-size: 12px; }
.entry-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: 14px; }
.filter { min-height: 40px; padding: 4px 0; font-size: 12px; color: var(--muted); }
.filter.active { color: var(--ink); text-decoration: underline; text-underline-offset: 7px; }
.search input { width: 170px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 5px; background: transparent; font-size: 13px; }
input::placeholder { color: var(--muted); }
.notes-grid { display: flex; flex-direction: column; }
.note-card { position: relative; width: 100%; display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 30px 24px 30px 0; border-bottom: 1px solid var(--line); transition: transform .2s; }
.note-card::before { content: ''; position: absolute; left: -30px; top: 64px; width: 5px; height: 5px; background: var(--accent); transform: rotate(45deg); opacity: .45; }
.note-card::after { content: ''; position: absolute; right: 3px; top: 68px; width: 7px; height: 7px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); transform: rotate(45deg); opacity: .5; transition: transform .2s; }
.note-card:hover { transform: translateX(3px); }
.note-card:hover h2 { color: var(--accent); }
.note-card:hover::after { transform: translateX(3px) rotate(45deg); }
.card-date { font: italic 13px var(--serif); color: var(--muted); margin-bottom: 11px; }
.note-card h2 { font-size: 27px; overflow-wrap: anywhere; transition: color .2s; }
.card-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 14px; line-height: 1.8; margin-top: 10px; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 70px 16px; color: var(--muted); }
.empty strong { display: block; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
.empty .button { margin-top: 18px; }
.eyebrow { color: var(--muted); font-size: 12px; margin-bottom: 18px; }
.login-panel { max-width: 340px; margin: 80px auto; }
.login-panel form { margin: 30px 0 20px; }
.login-panel label { display: block; font-size: 13px; margin-bottom: 8px; }
.login-panel input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 11px 12px; }
.login-panel .button { width: 100%; margin-top: 16px; }
.form-error { font-size: 13px; color: #b34f4f; }
.form-error:not(:empty) { margin-top: 14px; }
.workspace { display: grid; grid-template-columns: 210px minmax(0, 1fr); margin-top: 32px; min-height: 70vh; }
.writer-sidebar { padding: 4px 24px 0 0; border-right: 1px solid var(--line); min-width: 0; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sidebar-top h2 { font: 500 14px var(--sans); }
.writer-sidebar > .button { width: 100%; }
.writer-notes { display: flex; flex-direction: column; gap: 4px; margin-top: 20px; max-height: 65vh; overflow: auto; }
.writer-note { text-align: left; padding: 11px 10px; border-radius: 5px; }
.writer-note:hover, .writer-note.selected { background: var(--soft); }
.writer-note strong { display: block; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.writer-note small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.sidebar-empty { color: var(--muted); font-size: 13px; padding: 10px 0; }
.editor-panel { padding-left: 36px; min-width: 0; }
.editor-empty { padding: 100px 16px; text-align: center; color: var(--muted); }
.editor-empty h2 { font: 400 16px var(--sans); margin-bottom: 10px; }
.editor-empty p { font-size: 13px; }
.editor-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 32px; }
#save-status { color: var(--muted); font-size: 11px; }
.editor-top > div { display: flex; align-items: center; gap: 7px; }
.editor-top .button { font-size: 12px; padding: 8px 11px; }
.danger { color: #ad5a50; }
.note-title { width: 100%; border: 0; background: transparent; font: 36px/1.3 var(--serif); letter-spacing: -1px; padding: 0; margin-bottom: 22px; }
.format-options { margin-bottom: 24px; }
.format-options summary { width: fit-content; cursor: pointer; min-height: 40px; padding: 8px 0; color: var(--muted); font-size: 12px; }
.format-options summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; border-block: 1px solid var(--line); padding: 6px 0; }
.editor-toolbar button { min-width: 32px; min-height: 36px; border-radius: 4px; font-size: 12px; }
.editor-toolbar button:hover { background: var(--soft); }
.toolbar-divider { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.prose { font: 18px/1.9 var(--serif); overflow-wrap: anywhere; }
.prose p { margin-bottom: 1em; }
.prose h2 { font-size: 29px; margin: 1.4em 0 .5em; }
.prose h3 { font-size: 23px; margin: 1.3em 0 .5em; }
.prose h4 { font-size: 19px; margin: 1.2em 0 .5em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote { margin: 24px 0; padding: 0 20px; border-left: 2px solid var(--line); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 30px 0; }
.prose ul, .prose ol { padding-left: 26px; }
.editable { min-height: 350px; padding-bottom: 30px; }
.editable:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.editor-bottom { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding-top: 16px; color: var(--muted); font-size: 11px; }
.editor-bottom span:last-child { text-align: right; }
.slash-menu { position: fixed; z-index: 10; width: 260px; max-height: 300px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px; box-shadow: 0 8px 24px #0001; }
.slash-menu button { display: block; width: 100%; text-align: left; font-size: 13px; padding: 10px 12px; border-radius: 4px; }
.slash-menu button:hover, .slash-menu button:focus { background: var(--soft); }
dialog { color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0; }
dialog::backdrop { background: #161c1860; }
dialog[open] { animation: appear .18s ease-out; }
.reading-dialog { width: min(760px, calc(100% - 32px)); max-height: 92dvh; background-color: var(--surface); background-image: linear-gradient(90deg, transparent 28px, var(--line) 28px, var(--line) 29px, transparent 29px), radial-gradient(var(--line) .5px, transparent .5px); background-size: auto, 6px 6px; box-shadow: 0 20px 70px #0002; }
.reading-actions { display: flex; justify-content: flex-end; padding: 10px 14px 0; }
.reading-dialog article { padding: 12px 56px 48px; }
.reading-dialog article::after { content: ''; display: block; width: 48px; height: 4px; border-block: 1px solid var(--line); margin: 40px auto 0; }
.reading-dialog h1 { margin-bottom: 28px; overflow-wrap: anywhere; }
.reading-bottom { display: flex; justify-content: space-between; gap: 20px; padding: 16px 30px; border-top: 1px solid var(--line); }
.small-dialog { position: relative; width: min(400px, calc(100% - 32px)); padding: 36px 28px 28px; }
.small-dialog h2 { font: 500 19px var(--sans); margin: 5px 0 18px; }
.small-dialog p { color: var(--muted); font-size: 14px; }
.small-dialog .form-error { color: #b34f4f; }
.small-dialog .button { margin-top: 24px; }
.dialog-close { position: absolute; top: 6px; right: 6px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); z-index: 20; padding: 12px 18px; background: var(--ink); color: var(--bg); border-radius: 5px; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 700px) {
  .site-shell { padding: 0 20px 40px; }
  .header { min-height: 72px; }
  .header nav { gap: 6px; }
  .entries-section { margin-top: 28px; padding: 32px 22px 28px 36px; min-height: 440px; background-image: linear-gradient(90deg, transparent 20px, color-mix(in srgb, var(--accent) 16%, transparent) 20px, color-mix(in srgb, var(--accent) 16%, transparent) 21px, transparent 21px), radial-gradient(var(--line) .5px, transparent .5px); }
  .entries-section::before { left: 5px; width: 7px; background-size: 7px 38px; }
  .entries-section::after { right: 22px; height: 28px; width: 12px; }
  .reader-title { gap: 8px; }
  .reader-title h1 { font-size: 32px; }
  .pressed-leaf { width: 29px; height: 47px; }
  .entry-count { font-size: 11px; }
  h1 { font-size: 32px; }
  .section-heading { margin-bottom: 22px; }
  .entry-tools { flex-wrap: wrap; gap: 12px; }
  .search, .search input { width: 100%; }
  .note-card { padding: 24px 14px 24px 0; }
  .note-card::before { left: -19px; top: 54px; width: 4px; height: 4px; }
  .note-card::after { top: 57px; right: 0; width: 5px; height: 5px; }
  .note-card h2 { font-size: 24px; }
  .workspace { grid-template-columns: 1fr; margin-top: 20px; }
  .writer-sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 18px; }
  .sidebar-top { margin-bottom: 10px; }
  .writer-sidebar > .button { width: auto; }
  .writer-notes { flex-direction: row; margin-top: 14px; max-height: 100px; }
  .writer-note { flex-shrink: 0; min-width: 145px; max-width: 200px; }
  .writer-note strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .editor-panel { padding: 24px 0 0; }
  .editor-top { margin-bottom: 26px; }
  .note-title { font-size: 32px; }
  .editor-bottom { font-size: 10px; }
  .editor-bottom span:last-child { max-width: 180px; }
  .reading-dialog { background-image: linear-gradient(90deg, transparent 15px, var(--line) 15px, var(--line) 16px, transparent 16px), radial-gradient(var(--line) .5px, transparent .5px); }
  .reading-dialog article { padding: 12px 26px 32px; }
  .reading-bottom { padding: 14px 24px; }
  .login-panel { margin: 48px auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
