:root {
  --paper: #fff;
  --panel: #f1f0ec;
  --sidebar: #e9e8e4;
  --ink: #242321;
  --muted: #77736c;
  --line: rgba(60, 56, 49, .11);
  --yellow: #e9b500;
  --yellow-soft: #f7dc71;
  --glass: rgba(255, 255, 255, .72);
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); }
a { color: inherit; text-decoration: none; }
svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { display: grid; grid-template-columns: 270px minmax(320px, 410px) minmax(420px, 1fr); min-height: 100vh; }
.sidebar { position: relative; display: flex; flex-direction: column; padding: 44px 16px 26px; background: var(--sidebar); border-right: 1px solid var(--line); }
.sidebar-top { padding: 0 8px; }
.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .02em; }
.sidebar h1, .pane-header h2 { margin: 0; font-size: 2rem; letter-spacing: -.04em; }
.search { display: flex; align-items: center; gap: 7px; margin: 20px 0 18px; padding: 8px 10px; color: #7b7974; background: rgba(118,115,108,.12); border-radius: 10px; }
.search svg { width: 17px; height: 17px; }
.search input { min-width: 0; width: 100%; border: 0; outline: 0; font: inherit; font-size: .9rem; color: var(--ink); background: transparent; }
.folder { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 7px; min-height: 42px; padding: 4px 10px; border-radius: 9px; font-size: .95rem; }
.folder b { font-size: .85rem; color: var(--muted); font-weight: 500; }
.folder-icon { display: grid; place-items: center; color: var(--yellow); }
.folder-icon svg { width: 21px; fill: currentColor; stroke: none; }
.folder.is-active { background: rgba(255,255,255,.7); box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.sidebar-signoff { margin: auto 10px 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }

.notes-pane { background: var(--panel); border-right: 1px solid var(--line); }
.pane-header { display: flex; align-items: center; justify-content: space-between; min-height: 124px; padding: 42px 22px 18px; }
.round-control, .pill-control { display: inline-grid; place-items: center; border: 0; color: var(--ink); background: var(--glass); box-shadow: 0 8px 28px rgba(54,49,40,.08), inset 0 0 0 1px rgba(255,255,255,.7); backdrop-filter: blur(18px); }
.round-control { width: 42px; height: 42px; border-radius: 50%; }
.round-control svg { width: 22px; }
.note-list { padding: 0 10px 40px; }
.note-row { border-bottom: 1px solid var(--line); border-radius: 12px; }
.note-row a { display: block; padding: 15px 15px 13px; }
.note-row h3 { margin: 0 0 5px; font-size: .98rem; letter-spacing: -.01em; }
.note-row.is-selected { background: var(--yellow-soft); border-color: transparent; }
.note-preview { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-preview time { color: var(--ink); margin-right: 5px; }
.note-meta { display: flex; align-items: center; gap: 5px; margin-top: 7px; color: var(--muted); font-size: .74rem; }
.tiny-folder svg { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.empty-state { padding: 40px 15px; color: var(--muted); text-align: center; }

.preview-pane { min-width: 0; background: var(--paper); }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; height: 84px; padding: 20px 30px; }
.pill-control { display: flex; gap: 9px; padding: 10px 15px; border-radius: 22px; font-size: .82rem; }
.pill-control span { font-size: 1.3rem; line-height: .7; }
.note-content { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif; color: #383633; }
.preview-content { max-width: 710px; padding: 36px clamp(40px, 8vw, 110px) 80px; }
.note-date { margin: 0 0 7px; color: #9b978e; font-size: .72rem; text-align: center; }
.note-content h1 { margin: 0 0 38px; color: #302f2c; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.04; letter-spacing: -.045em; }
.note-content h2 { margin: 36px 0 10px; font-size: 1.25rem; letter-spacing: -.02em; }
.note-content p, .note-content li { font-family: inherit; font-size: 1.08rem; line-height: 1.58; }
.note-content blockquote { margin: 30px 0; padding: 1px 0 1px 22px; border-left: 3px solid var(--yellow); color: #68645d; font-style: italic; }
.note-content blockquote p { font-size: 1.08rem; }
.note-content ul { padding-left: 1.25rem; }
.note-content li { margin: .35rem 0; }

.post-shell { min-height: 100vh; background: var(--paper); }
.post-toolbar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left)); background: linear-gradient(var(--paper) 70%, transparent); }
.toolbar-actions { display: flex; gap: 8px; }
.post-toolbar button { font: inherit; cursor: pointer; }
.share-button.copied { color: var(--yellow); }
.full-note { width: min(680px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 100px; }
.full-note .note-date { margin-bottom: 10px; }
.full-note h1 { text-align: left; }
.post-footer { display: flex; justify-content: space-between; width: min(680px, calc(100% - 40px)); margin: 0 auto; padding: 25px 0 calc(30px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.post-footer a { color: #a67f00; }
.mobile-toolbar { display: none; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 240px minmax(330px, 1fr); }
  .preview-pane { display: none; }
  .note-row.is-selected { background: transparent; border-color: var(--line); }
}

@media (max-width: 650px) {
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .app-shell { display: block; min-height: auto; }
  .sidebar { display: none; }
  .notes-pane { min-height: 100vh; border: 0; background: var(--paper); }
  .pane-header { min-height: 145px; padding: max(48px, env(safe-area-inset-top)) 20px 18px; align-items: flex-end; }
  .pane-header h2 { font-size: 2.15rem; }
  .pane-header .round-control { margin-bottom: 2px; }
  .note-list { padding: 0 12px 30px; }
  .note-row { margin: 0 0 2px; }
  .note-row a { padding: 14px 10px 13px; }
  .note-row h3 { font-size: 1.02rem; }
  .note-preview { font-size: .84rem; }
  .mobile-toolbar { position: fixed; z-index: 3; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); color: #a77e00; background: rgba(250,249,246,.84); border-top: 1px solid var(--line); backdrop-filter: blur(22px); }
  .mobile-toolbar span:last-child { justify-self: end; }
  .mobile-toolbar b { color: var(--muted); font-size: .72rem; font-weight: 500; }
  .post-toolbar { padding: max(16px, env(safe-area-inset-top)) 20px 8px; background: linear-gradient(var(--paper) 78%, transparent); }
  .post-toolbar .round-control { width: 46px; height: 46px; background: rgba(255,255,255,.84); box-shadow: 0 7px 24px rgba(0,0,0,.05), inset 0 0 0 1px rgba(60,60,67,.14); }
  .post-toolbar .toolbar-actions { gap: 0; padding: 0 2px; background: rgba(255,255,255,.84); border-radius: 24px; box-shadow: 0 7px 24px rgba(0,0,0,.05), inset 0 0 0 1px rgba(60,60,67,.14); }
  .post-toolbar .toolbar-actions .round-control { width: 44px; background: transparent; box-shadow: none; }
  .full-note { width: calc(100% - 56px); padding: 8px 0 110px; }
  .full-note .note-date { margin-bottom: 10px; color: #8e8e93; font-size: .87rem; line-height: 1.3; }
  .note-content h1 { margin-bottom: 36px; font-size: 1.45rem; line-height: 1.18; letter-spacing: -.025em; }
  .note-content h2 { margin: 32px 0 12px; font-size: 1.08rem; line-height: 1.25; letter-spacing: -.015em; }
  .note-content p, .note-content li { margin: 0 0 29px; font-size: 1.05rem; line-height: 1.52; }
  .note-content blockquote { margin: 29px 0 34px; padding-left: 18px; border-left-width: 2px; }
  .note-content blockquote p { font-size: 1.05rem; line-height: 1.52; }
  .post-footer { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root { --paper: #1c1c1e; --panel: #222224; --sidebar: #2c2c2e; --ink: #f2f2f0; --muted: #a4a19b; --line: rgba(255,255,255,.09); --glass: rgba(63,63,66,.72); --yellow: #ffd60a; --yellow-soft: #665614; }
  .note-content, .note-content h1 { color: #efede8; }
  .folder.is-active { background: rgba(255,255,255,.1); }
  .mobile-toolbar { background: rgba(28,28,30,.82); }
}

@media (prefers-reduced-motion: no-preference) {
  .note-row, .round-control { transition: background-color .18s ease, transform .18s ease; }
  .note-row:hover { background: rgba(233,181,0,.12); }
  .round-control:hover { transform: translateY(-1px); }
}
