:root { color-scheme: light; --paper: #faf9f5; --surface: #fffefb; --ink: #302f2b; --muted: #86847b; --line: #e7e5dc; --green: #5d785c; --green-soft: #e8eee4; --warning: #916a34; --warning-soft: #f7f0df; --writing-font: Georgia, serif; --writing-size: 23px; }
:root[data-theme="night"] { color-scheme: dark; --paper: #222522; --surface: #2a2d29; --ink: #e4e2d7; --muted: #a09f94; --line: #41453e; --green: #a1b696; --green-soft: #364332; --warning: #d8ba80; --warning-soft: #3c3528; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .38; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
[hidden] { display: none !important; }
.topbar { height: 97px; max-width: 1260px; margin: 0 auto; padding: 0 54px; display: flex; align-items: center; gap: 24px; }
.wordmark { font-family: Georgia, serif; font-size: 34px; letter-spacing: -1.8px; font-weight: 700; text-decoration: none; color: var(--ink); }
.wordmark-dot { color: var(--green); }
.notebook-badge { border-left: 1px solid var(--line); padding-left: 22px; font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 19px; }
.quiet-button, .text-button, .arrow-button, .dismiss-button, .close-dialog { border: 0; background: none; padding: 4px 0; }
.quiet-button { font-size: 12px; color: var(--muted); }
.quiet-button:hover, .text-button:hover { color: var(--green); }
.key-hint { color: var(--muted); padding-left: 7px; }
main { width: min(960px, calc(100% - 88px)); margin: 35px auto 0; }
#archive-dialog { width: min(1100px, calc(100% - 32px)); }
.archive-description, #archive-count { color: var(--muted); font-size: 12px; line-height: 1.6; }
#archive-search { width: 100%; padding: 10px 12px; margin-top: 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); color: var(--ink); }
.archive-layout { display: grid; grid-template-columns: minmax(180px, 35%) minmax(0, 1fr); gap: 25px; }
.archive-list { max-height: 55vh; overflow-y: auto; }
.archive-item { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 12px 5px; overflow-wrap: anywhere; }
.archive-item:hover, .archive-item:focus-visible { background: var(--green-soft); }
.archive-item span { display: block; font-size: 12px; line-height: 1.5; }
.archive-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.archive-reading { min-width: 0; }
#archive-note-title { font-size: 12px; line-height: 1.6; font-weight: 500; overflow-wrap: anywhere; margin-top: 0; }
#archive-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 50vh; overflow-y: auto; font: 17px/1.8 var(--writing-font); }
@media (max-width: 760px) { .archive-layout { grid-template-columns: 1fr; } .archive-list { max-height: 18vh; } #archive-text { max-height: 38vh; } }
.calendar-section { margin: 0 0 74px; }
.calendar-heading, .calendar-caption, .writing-footer, .entry-bottom, .notebook-footer, .entry-eyebrow { display: flex; justify-content: space-between; align-items: center; }
.month-navigation { display: flex; align-items: center; gap: 14px; }
.month-navigation h2 { font-size: 14px; font-weight: 500; margin: 0; }
.arrow-button { font-size: 25px; width: 14px; font-weight: 300; color: var(--muted); }
.text-button { color: var(--green); font-size: 11px; text-decoration: none; }
#today-button { margin-left: 12px; border-bottom: 1px solid var(--line); }
.month-summary { font-size: 11px; color: var(--muted); margin: 0; }
.month-summary strong { color: var(--ink); font-weight: 500; }
.month-days { display: flex; gap: 6px; margin-top: 21px; width: 100%; }
.day-square { flex: 1; min-width: 0; aspect-ratio: 1 / 1.1; max-height: 31px; border: 1px solid var(--line); background: transparent; padding: 0; font-size: 9px; color: var(--muted); border-radius: 2px; position: relative; transition: background .15s, border-color .15s; }
.day-square:hover:not(:disabled) { border-color: var(--green); background: var(--green-soft); }
.day-square.started { background: var(--green-soft); color: var(--green); border-color: var(--green-soft); }
.day-square.complete { background: var(--green); border-color: var(--green); color: var(--paper); }
.day-square.today { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.day-square.selected::after { content: ''; position: absolute; width: 3px; height: 3px; border-radius: 100%; background: var(--green); bottom: -9px; left: calc(50% - 1.5px); }
.day-square.problem { border-style: dashed; border-color: var(--warning); }
.calendar-caption { color: var(--muted); font-size: 10px; letter-spacing: .01em; margin-top: 19px; }
.page { width: min(730px, 100%); margin: 0 auto; }
.entry-eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--muted); }
.entry-date-small { letter-spacing: .4px; text-transform: none; font-size: 10px; }
h1 { font-family: Georgia, serif; font-size: clamp(29px, 4.2vw, 43px); font-weight: 400; letter-spacing: -1.1px; line-height: 1.3; margin: 17px 0 31px; }
#journal { width: 100%; min-height: 340px; border: 0; border-radius: 0; padding: 0 1px 32px; resize: none; background: transparent; color: var(--ink); font-family: var(--writing-font); font-size: var(--writing-size); line-height: 1.85; letter-spacing: -.1px; overflow: hidden; display: block; caret-color: var(--green); }
#journal:focus { outline: none; }
#journal:focus-visible { box-shadow: -13px 0 0 -12px var(--line); }
#journal::placeholder { color: var(--muted); opacity: .63; }
.writing-footer { font-size: 11px; color: var(--muted); margin: 23px 0 14px; min-height: 22px; gap: 16px; }
.save-status { display: flex; align-items: center; gap: 7px; font-size: 10px; }
.status-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.save-status[data-state="saved"] .status-dot { background: var(--green); }
.save-status[data-state="warning"], .save-status[data-state="error"] { color: var(--warning); }
.save-status[data-state="warning"] .status-dot, .save-status[data-state="error"] .status-dot { background: var(--warning); }
.save-status[data-state="saving"] .status-dot { animation: breathe 1s infinite alternate; }
.word-progress { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; font-size: 11px; }
#word-count { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.word-divider { color: var(--line); }
#goal-check { color: var(--green); font-size: 16px; }
progress { width: 100%; height: 2px; appearance: none; border: none; display: block; background: var(--line); color: var(--green); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--green); transition: width .2s; }
progress::-moz-progress-bar { background: var(--green); }
.entry-bottom { color: var(--muted); font-size: 10px; gap: 20px; margin-top: 5px; }
.entry-bottom p { margin: 12px 0; }
#download-draft { font-size: 10px; color: var(--muted); }
.notebook-footer { border-top: 1px solid var(--line); margin: 77px 0 0; padding: 20px 0 30px; font-size: 9px; color: var(--muted); gap: 20px; }
.notebook-footer > :first-child { letter-spacing: 1.6px; font-size: 8px; }
.notice { display: flex; align-items: center; gap: 16px; padding: 13px 17px; background: var(--green-soft); border-radius: 4px; font-size: 12px; line-height: 1.6; margin: -30px auto 48px; max-width: 730px; }
.notice .text-button { flex: 0 0 auto; margin-left: auto; font-size: 11px; }
.dismiss-button { color: var(--muted); margin-left: auto; font-size: 18px; }
.conflict-notice { color: var(--warning); background: var(--warning-soft); }
.conflict-notice .text-button { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.notice + .notice { margin-top: -36px; }
.focused .topbar, .focused .calendar-section, .focused .notebook-footer { display: none; }
.focus-brand { display: none; }
.focused .focus-brand { display: flex; position: absolute; top: 25px; left: 34px; align-items: center; font: bold 25px Georgia, serif; letter-spacing: -1px; }
.focus-brand > span { color: var(--green); }
.focus-brand small { font: 9px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: .1px; color: var(--muted); margin-left: 15px; }
.focused main { margin-top: 86px; }
.focused .page { max-width: 760px; }
.focused #journal { min-height: 60vh; }
.leave-focus { position: fixed; right: 30px; top: 24px; padding: 10px 15px; font-size: 11px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; color: var(--muted); }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: min(530px, calc(100% - 32px)); padding: 31px; box-shadow: 0 20px 100px #0002; max-height: calc(100dvh - 50px); overflow-y: auto; }
dialog::backdrop { background: #22291f66; backdrop-filter: blur(3px); }
.wide-dialog { width: min(920px, calc(100% - 32px)); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { color: var(--green); font-size: 9px; letter-spacing: 1.8px; margin: 0 0 10px; }
.dialog-heading h2 { font-family: Georgia, serif; font-size: 28px; font-weight: 400; margin: 0; letter-spacing: -.5px; }
.close-dialog { font-size: 23px; color: var(--muted); line-height: 1; padding: 0 4px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 0; border-top: 1px solid var(--line); font-size: 12px; }
.setting-row select { border: 1px solid var(--line); padding: 8px; border-radius: 5px; color: var(--ink); background: var(--surface); max-width: 55%; font-size: 12px; }
input[type="checkbox"] { accent-color: var(--green); width: 17px; height: 17px; }
.dialog-note { font-size: 12px; line-height: 1.8; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 23px; }
.primary-button, .secondary-button { border-radius: 5px; padding: 11px 17px; font-size: 12px; border: 1px solid var(--green); }
.primary-button { color: var(--paper); background: var(--green); }
.secondary-button { color: var(--green); background: transparent; }
.primary-button:hover:not(:disabled) { filter: brightness(.92); }
.form-error { color: var(--warning); font-size: 12px; line-height: 1.6; }
.history-layout { display: grid; grid-template-columns: 230px 1fr; gap: 24px; margin-top: 24px; }
.history-list { max-height: 430px; overflow: auto; font-size: 12px; color: var(--muted); }
.history-item { text-align: left; width: 100%; background: none; border: 1px solid transparent; padding: 13px; border-radius: 5px; margin-bottom: 4px; display: flex; flex-direction: column; gap: 7px; }
.history-item strong { font-size: 11px; font-weight: 500; }
.history-item span { font-size: 10px; line-height: 1.6; color: var(--muted); }
.history-item.active, .history-item:hover { border-color: var(--line); background: var(--green-soft); }
.history-detail > p { color: var(--muted); font-size: 11px; margin: 0 0 18px; }
pre { font-family: Georgia, serif; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; font-size: 16px; margin: 0; }
.history-detail pre { max-height: 360px; overflow-y: auto; margin-bottom: 24px; min-height: 130px; }
.conflict-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 25px 0; }
.conflict-columns h3 { font-size: 12px; font-weight: 500; }
.conflict-columns pre { max-height: 300px; min-height: 120px; overflow-y: auto; background: var(--paper); border: 1px solid var(--line); padding: 15px; border-radius: 4px; margin: 15px 0; }
details { border-top: 1px solid var(--line); padding-top: 18px; font-size: 12px; }
summary { cursor: pointer; color: var(--green); }
details label { display: block; font-size: 11px; color: var(--muted); margin: 23px 0 8px; }
#combined-text { width: 100%; min-height: 220px; padding: 15px; font-family: Georgia, serif; font-size: 17px; line-height: 1.8; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); margin-bottom: 15px; }
.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; }
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#confetti i { position: absolute; width: 6px; height: 11px; top: -25px; background: var(--green); animation: fall 1.8s ease-in forwards; }
#confetti i:nth-child(3n) { background: #cdb47d; width: 5px; height: 5px; }
#confetti i:nth-child(3n + 1) { background: #b0b8a1; }
@keyframes fall { to { transform: translateY(105vh) rotate(430deg); opacity: 0; } }
@keyframes breathe { to { opacity: .3; } }
@media (min-width: 1400px) { main { margin-top: 55px; } .calendar-section { margin-bottom: 90px; } }
@media (max-width: 760px) {
  .topbar { height: 83px; padding: 0 24px; gap: 14px; }
  .wordmark { font-size: 31px; } .notebook-badge { padding-left: 14px; font-size: 10px; } .notebook-badge span { display: none; }
  .top-actions { gap: 13px; } .quiet-button { font-size: 11px; } .key-hint { display: none; }
  main { width: calc(100% - 48px); margin-top: 20px; } .calendar-section { margin-bottom: 59px; }
  .month-days { gap: 5px; overflow-x: auto; padding: 3px 2px 12px; margin-top: 17px; scrollbar-width: thin; }
  .day-square { flex: 0 0 25px; aspect-ratio: 1; max-height: none; font-size: 10px; }
  .day-square.selected::after { bottom: -7px; } .calendar-caption { align-items: flex-start; gap: 14px; line-height: 1.7; margin-top: 8px; }
  h1 { margin-bottom: 27px; } #journal { min-height: 330px; line-height: 1.8; }
  .notebook-footer { margin-top: 60px; align-items: flex-start; line-height: 1.8; } .notebook-footer > :last-child { max-width: 175px; text-align: right; }
  .notice { margin-top: -20px; margin-bottom: 36px; flex-wrap: wrap; gap: 8px; } .notice .text-button { margin-left: 0; }
  .notice .dismiss-button { margin-left: auto; } .focused main { margin-top: 75px; }
  .focused .focus-brand { left: 24px; top: 22px; } .focus-brand small { font-size: 8px; margin-left: 12px; }
  .history-layout { grid-template-columns: 1fr; } .history-list { max-height: 180px; } .conflict-columns { grid-template-columns: 1fr; }
  dialog { padding: 24px; } .dialog-heading h2 { font-size: 26px; }
}
@media (max-width: 430px) {
  .notebook-badge { display: none; } .top-actions { gap: 15px; } main { width: calc(100% - 40px); }
  .month-navigation { gap: 11px; } #today-button { margin-left: 4px; } .month-summary { font-size: 10px; }
  .writing-footer { align-items: flex-end; } .save-status { max-width: 180px; line-height: 1.6; }
  .word-progress { gap: 5px; font-size: 10px; } #word-count { font-size: 14px; }
  .entry-bottom { align-items: flex-start; } #download-draft { padding-top: 12px; text-align: right; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
