@font-face { font-family: Inter; src: url(/fonts/InterVariable.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light dark;
  --bg: #ffffff; --side: #fafaf8; --text: #17181c; --secondary: #646670; --tertiary: #9a9ca3; --line: #ebebe8;
  --accent: #8a5223; --syntax: #c3c4c8; --code: #f3f3f1; --mark: rgba(242, 218, 78, .55); --tag: #2b8a8f; --hover: #f2f2f0;
  --button: #17181c; --on-button: #ffffff; --shadow: 0 18px 50px rgba(20, 20, 30, .16), 0 0 0 1px rgba(20, 20, 30, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1b19; --side: #201f1d; --text: #ececea; --secondary: #a3a3a0; --tertiary: #75777a; --line: #2c2b28;
    --accent: #d39a5f; --syntax: #55555a; --code: #2a2926; --mark: rgba(138, 118, 32, .7); --tag: #5fb8bd; --hover: #2e2d29;
    --button: #ececea; --on-button: #1c1b19; --shadow: 0 18px 50px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
  }
}
:root[data-theme="dark"] {
    --bg: #1c1b19; --side: #201f1d; --text: #ececea; --secondary: #a3a3a0; --tertiary: #75777a; --line: #2c2b28;
    --accent: #d39a5f; --syntax: #55555a; --code: #2a2926; --mark: rgba(138, 118, 32, .7); --tag: #5fb8bd; --hover: #2e2d29;
    --button: #ececea; --on-button: #1c1b19; --shadow: 0 18px 50px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

.app { display: grid; grid-template-columns: 260px 1fr; height: 100vh; }

.sidebar { display: flex; flex-direction: column; background: var(--side); border-right: 1px solid var(--line); min-height: 0; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.brand img { border-radius: 5px; }
.icon-button { width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; color: var(--secondary); }
.icon-button:hover { background: var(--hover); color: var(--text); }
.place { margin: 0 14px 10px; font-size: 12px; color: var(--tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { margin: 0 12px 8px; padding: 7px 10px; border: 0; border-radius: 8px; background: var(--hover); color: var(--text); font: inherit; outline: none; }
.search:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.side-scroll { flex: 1; overflow: auto; padding: 0 8px 12px; min-height: 0; }
.notes { list-style: none; margin: 0; padding: 0; }
.note { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; color: var(--secondary); }
.note:hover, .note:focus-visible { background: var(--hover); outline: none; }
.note.on { color: var(--text); font-weight: 500; background: var(--hover); }
.note-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-folder { flex-shrink: 0; max-width: 45%; font-size: 11.5px; color: var(--tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; }
.none { padding: 8px; color: var(--tertiary); font-size: 12.5px; }
.side-bottom { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.link-button { border: 0; background: none; padding: 3px 0; color: var(--secondary); font-size: 12.5px; cursor: pointer; text-align: left; }
.link-button:hover { color: var(--text); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.bar { display: flex; align-items: center; gap: 12px; padding: 9px 16px 9px 22px; font-size: 12px; color: var(--tertiary); }
.path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.status { flex-shrink: 0; }
.panes { flex: 1; display: flex; min-height: 0; }
.scroller { flex: 1; overflow: auto; min-width: 0; }
.panes.split .preview-scroller { border-left: 1px solid var(--line); }
.panes.split .page { padding-left: 32px; padding-right: 32px; }
.page { max-width: var(--column, 820px); margin: 0 auto; padding: 24px 48px 40vh; }
.empty { display: grid; place-items: center; gap: 12px; padding-top: 30vh; color: var(--tertiary); }

/* The typing goes over a coloured copy of itself. Both are set alike to the pixel, so the colours sit under the words. */
.writer { position: relative; }
.mirror, .text {
  font: var(--size, 16.5px)/1.7 var(--face, Inter, system-ui, sans-serif); letter-spacing: 0; white-space: pre-wrap; overflow-wrap: break-word;
  padding: 0 130px 0 0; margin: 0; border: 0; width: 100%; tab-size: 4;
}
.mirror { color: var(--text); pointer-events: none; }
.text { position: absolute; inset: 0 auto auto 0; resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: var(--accent); outline: none; }
.text::selection { background: rgba(138, 82, 35, .22); color: transparent; }
.text[readonly] { caret-color: transparent; }
.ln { min-height: 1.7em; }
.syn { color: var(--syntax); }
.h { color: var(--text); font-weight: inherit; text-decoration: underline; text-decoration-color: transparent; }
.ln:has(> .syn + .h) { color: var(--text); }
.b { text-shadow: 0 0 .01px currentColor; color: var(--text); }
.i { font-style: normal; color: var(--text); }
.code { background: var(--code); border-radius: 3px; }
.ln:has(> .code-line) { background: var(--code); }
.code-line { display: block; }
.mark { background: var(--mark); border-radius: 2px; }
.link { color: var(--accent); }
.tag { color: var(--tag); }
.q { color: var(--secondary); }
.done { color: var(--tertiary); text-decoration: line-through; text-decoration-color: var(--tertiary); }
.table { color: var(--secondary); }
.answers { position: absolute; inset: 0 0 auto auto; width: 120px; pointer-events: none; }
.answer { position: absolute; right: 0; font: var(--size, 16.5px)/1.7 var(--face, Inter, system-ui, sans-serif); color: var(--accent); white-space: nowrap; }

.welcome { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.welcome-card { max-width: 440px; text-align: center; }
.welcome-card img { border-radius: 14px; }
.welcome-card h1 { font-size: 26px; letter-spacing: -.02em; margin: 14px 0 8px; }
.welcome-card p { color: var(--secondary); }
.welcome-card .button { margin: 6px; }
.fine { font-size: 12.5px; color: var(--secondary); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border: 0; border-radius: 9px;
  background: var(--button); color: var(--on-button); font-weight: 500; cursor: pointer; }
.button.secondary { background: var(--hover); color: var(--text); }
.button.small { padding: 6px 12px; font-size: 13px; }
.button:focus-visible, .link-button:focus-visible, .icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

.notice { position: fixed; left: 50%; top: 18vh; transform: translateX(-50%); width: min(460px, calc(100vw - 32px));
  background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); padding: 22px 24px; z-index: 10; }
.notice h2 { font-size: 17px; margin: 0 0 8px; }
.notice p { color: var(--secondary); margin: 0 0 6px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 12.5px; color: var(--secondary); }
.field input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.notice a { color: var(--accent); }

.toast { position: fixed; right: 18px; bottom: 18px; width: min(340px, calc(100vw - 36px)); background: var(--bg); border-radius: 12px;
  box-shadow: var(--shadow); padding: 14px 16px; z-index: 9; }
.toast p { margin: 0; color: var(--secondary); font-size: 13px; }

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .page { padding: 16px 16px 40vh; }
  .mirror, .text { padding-right: 90px; }
  .answers { width: 84px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Settings */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting > span { display: flex; flex-direction: column; gap: 2px; }
.setting small { color: var(--secondary); font-size: 12px; }
.segments { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--hover); flex-shrink: 0; }
.segments button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; font-size: 12.5px; color: var(--secondary); cursor: pointer; }
.segments button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.segments button:focus-visible { outline: 2px solid var(--accent); }

/* The sidebar's sections, as on the Mac: All notes, Folders, Tags, Tasks, then the notes. */
.side-item, .side-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: 0; border-radius: 7px; background: none;
  color: var(--secondary); text-align: left; cursor: pointer; font-size: 13.5px; }
.side-item:hover, .side-row:hover, .side-item:focus-visible, .side-row:focus-visible { background: var(--hover); outline: none; }
.side-item.on, .side-row.on { background: var(--hover); color: var(--text); font-weight: 500; }
.side-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-row[data-depth="1"] { padding-left: 22px; } .side-row[data-depth="2"] { padding-left: 36px; } .side-row[data-depth="3"] { padding-left: 50px; }
.side-row[data-depth="4"] { padding-left: 64px; }
.count { margin-left: auto; font-size: 11px; color: var(--tertiary); font-variant-numeric: tabular-nums; font-weight: 400; }
.side-section { margin-top: 12px; }
.side-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 2px 8px 4px; border: 0; background: none; cursor: pointer;
  font-size: 11.5px; font-weight: 500; color: var(--tertiary); text-align: left; }
.side-head::after { content: ""; width: 5px; height: 5px; border-right: 1.3px solid currentColor; border-bottom: 1.3px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.side-head[aria-expanded="false"]::after { transform: rotate(-45deg); }
.side-head:hover { color: var(--secondary); }
.side-head[aria-expanded="false"] + * { display: none; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tag); flex-shrink: 0; }
.folder-mark { width: 13px; height: 10px; border: 1.3px solid currentColor; border-radius: 2px 2px 3px 3px; flex-shrink: 0; opacity: .8; }
.task-row { cursor: default; padding-left: 4px; }
.task-row .box { width: 13px; height: 13px; margin: 0 2px 0 4px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.task-row .where { flex-shrink: 0; max-width: 40%; font-size: 11px; color: var(--tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row .name { cursor: pointer; }

/* Write, Split, Preview */
.views { flex-shrink: 0; }
.views button { padding: 3px 10px; }

/* Preview: the note as it reads */
.preview { font: var(--size, 16.5px)/1.7 var(--face, Inter, system-ui, sans-serif); color: var(--text); overflow-wrap: break-word; }
.preview > :first-child { margin-top: 0; }
.preview h1, .preview h2, .preview h3, .preview h4, .preview h5, .preview h6 { line-height: 1.25; letter-spacing: -.015em; margin: 1.4em 0 .5em; }
.preview h1 { font-size: 1.9em; } .preview h2 { font-size: 1.45em; } .preview h3 { font-size: 1.2em; } .preview h4, .preview h5, .preview h6 { font-size: 1em; }
.preview p { margin: 0 0 .9em; }
.preview a { color: var(--accent); text-decoration: none; }
.preview a:hover { text-decoration: underline; }
.preview code { background: var(--code); border-radius: 4px; padding: .1em .3em; font: .88em ui-monospace, "Cascadia Mono", Consolas, monospace; }
.preview pre { background: var(--code); border-radius: 8px; padding: 12px 14px; overflow: auto; margin: 0 0 1em; }
.preview pre code { background: none; padding: 0; }
.preview mark { background: var(--mark); color: inherit; border-radius: 2px; }
.preview .tag { color: var(--tag); }
.preview blockquote { margin: 0 0 1em; padding-left: 14px; border-left: 3px solid var(--line); color: var(--secondary); }
.preview .callout { margin: 0 0 1em; padding: 10px 14px; border-radius: 8px; background: var(--hover); }
.preview .callout-title { font-weight: 600; margin: 0 0 .3em; }
.preview .callout > :last-child { margin-bottom: 0; }
.preview ul, .preview ol { margin: 0 0 .9em; padding-left: 1.4em; }
.preview li[data-depth="1"] { margin-left: 1.4em; } .preview li[data-depth="2"] { margin-left: 2.8em; } .preview li[data-depth="3"], .preview li[data-depth="4"] { margin-left: 4.2em; }
.preview li.task { list-style: none; margin-left: -1.4em; }
.preview li.task input { accent-color: var(--accent); margin: 0 .35em 0 0; vertical-align: -.1em; cursor: pointer; }
.preview li.done > span { color: var(--tertiary); text-decoration: line-through; }
.preview table { border-collapse: collapse; margin: 0 0 1em; font-size: .95em; }
.preview th, .preview td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.preview th { background: var(--hover); font-weight: 600; }
.preview hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.preview .pic { color: var(--tertiary); font-style: italic; }
.preview .pic::before { content: "Picture: "; }
.preview-empty { color: var(--tertiary); }

@media (max-width: 720px) {
  .views button[data-view="split"] { display: none; }
}
