/* LinkPith. Built to the design handoff (design/handoff/README.md).
   Red is reserved for exactly three things: the + Save button, the unopened dot, and key-idea numbers. */
:root {
  --paper: #ffffff; --ink: #0b0b0b; --red: #d62f17; --red-hover: #b82713;
  --body: #3a3a3a; --muted: #6b6b6b; --ph: #8a8a8a; --rule: #e3e3e3; --border: #bdbdbd;
  --stone: #efede8; --on-stone: #5e5e5e; --row-hover: #f7f6f3; --hover: #f4f3f0;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pad: 40px; --topbar: 72px; --side: 220px;
  --hero-h: 340px; --hero-title: 72px; --hero-quote: 48px; --h1: 44px; --h1-big: 56px;
  --reader-w: min(780px, 56vw); --reader-title: 40px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; border-radius: 0; }
button { background: none; border: 0; cursor: pointer; text-align: left; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
::placeholder { color: var(--ph); }
.muted { color: var(--muted); }
.ul { text-decoration: underline; text-underline-offset: 3px; }
.balance { text-wrap: balance; }
p, .pretty { text-wrap: pretty; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); grid-template-rows: auto 1fr;
  grid-template-areas: "side top" "side main"; max-width: 1680px; margin: 0 auto; min-height: 100vh; }
@media (min-width: 1681px) { .shell { border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); } }
.side { grid-area: side; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--rule); padding: 26px 18px;
  display: flex; flex-direction: column; }
.wordmark { font: 700 28px/1 var(--font); letter-spacing: -.06em; padding: 0 10px; display: inline-block; }
.wordmark span { color: var(--red); }
.nav { margin-top: 44px; display: flex; flex-direction: column; gap: 2px; }
.nav a { padding: 9px 10px; font-size: 16px; border-left: 2px solid transparent; }
.nav a:hover { background: var(--hover); }
.nav a.on { font-weight: 700; border-left-color: var(--ink); }
.nav a.on:hover { background: none; }
.side-hints { margin-top: auto; padding: 0 10px; font-size: 12px; color: var(--muted); line-height: 1.8; }

.topbar { grid-area: top; position: sticky; top: 0; z-index: 10; height: var(--topbar); background: var(--paper);
  border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 16px; padding: 0 var(--pad); }
.topbar .wordmark { display: none; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; height: 44px; border: 1px solid var(--ink); padding: 0 52px 0 16px; font-size: 15px; background: var(--paper); }
.search input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }
.key { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted);
  border: 1px solid var(--border); padding: 0 6px; line-height: 18px; pointer-events: none; }
.save-btn { margin-left: auto; height: 44px; padding: 0 22px; background: var(--red); color: #fff; font-size: 15px; font-weight: 700;
  white-space: nowrap; }
.save-btn:hover { background: var(--red-hover); }

.main { grid-area: main; padding: 40px var(--pad) 72px; min-width: 0; }
.main.home { padding-top: 32px; }
.tabs-bar { display: none; }

/* ---------- shared bits ---------- */
h1 { font: 700 var(--h1)/1 var(--font); letter-spacing: -.045em; }
h1.big { font-size: var(--h1-big); letter-spacing: -.05em; line-height: .95; }
.sub { color: var(--muted); font-size: 15px; margin-top: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px; font-weight: 700; font-size: 15px;
  border: 1px solid var(--ink); white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.ink { background: var(--ink); color: #fff; height: 48px; padding: 0 24px; }
.btn.ink:hover { background: #2a2a2a; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.red:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: none; display: inline-block; }
.textbtn { font-size: 15px; padding: 2px 0; }
.textbtn.on { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.filters { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.filter-line { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.filter-line .lbl { width: 72px; color: var(--muted); font-size: 14px; flex: none; }
.empty { color: var(--muted); font-size: 16px; padding: 28px 0; }
.small-label { font-size: 13px; font-weight: 700; }

/* ---------- home ---------- */
.hero { background: var(--ink); color: #fff; min-height: var(--hero-h); padding: 44px; display: flex; flex-direction: column;
  justify-content: flex-end; gap: 18px; cursor: pointer; }
.hero .kicker { font-size: 14px; color: var(--border); }
.hero .h-title { font: 700 var(--hero-title)/.92 var(--font); letter-spacing: -.055em; text-wrap: balance; }
.hero .h-quote { font: 500 var(--hero-quote)/1.05 var(--font); letter-spacing: -.04em; text-indent: -.4em; text-wrap: balance; }
.hero .h-sentence { font-size: 20px; color: #e6e6e6; max-width: 640px; text-wrap: pretty; }
.hero .h-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.hero .h-read { height: 44px; padding: 0 22px; background: #fff; color: var(--ink); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; }
.hero .h-read:hover { background: #e9e9e9; }
.hero .h-orig { height: 44px; padding: 0 22px; border: 1px solid #fff; color: #fff; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; }
.hero .h-orig:hover { background: #222; }
.rows-home { margin-top: 48px; display: flex; flex-direction: column; gap: 40px; }
.row-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.row-head .t { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.row-head .n { font-size: 14px; color: var(--muted); }
.row-head .all { margin-left: auto; font-size: 14px; color: var(--muted); }
.row-head .all:hover { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tile { position: relative; min-height: 150px; padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between;
  gap: 14px; transition: transform .15s; cursor: pointer; }
.tile:hover { transform: translateY(-3px); }
.tile.paper { border: 1px solid var(--ink); }
.tile.stone { background: var(--stone); }
.tile.stone .lbl { color: var(--on-stone); }
.tile.ink { background: var(--ink); color: #fff; }
.tile.ink .lbl { color: var(--border); }
.tile .lbl { font-size: 12px; color: var(--muted); padding-right: 16px; }
.tile .tt { font: 700 22px/1.02 var(--font); letter-spacing: -.04em; text-wrap: balance; }
.tile .tq { font: 500 16px/1.2 var(--font); text-indent: -.4em; text-wrap: pretty; }
.tile .dot { position: absolute; top: 18px; right: 16px; }
.topics-line { margin-top: 48px; border-top: 1px solid var(--rule); padding-top: 18px; display: flex; flex-wrap: wrap; gap: 8px 22px;
  font-size: 15px; align-items: baseline; }
.topics-line a:hover { text-decoration: underline; text-underline-offset: 3px; }
.small-home { margin-top: 40px; border-top: 1px solid var(--ink); padding-top: 18px; display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.small-home .lbl { font-weight: 700; }
.small-home p { font-size: 16px; color: var(--body); max-width: 620px; }
.small-home .acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- library / rows ---------- */
.page { max-width: 1280px; }
.lib-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.lib-head .link { font-size: 15px; font-weight: 700; white-space: nowrap; padding-bottom: 6px; }
.lib-head .link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--rule); margin-top: 24px; }
.tabs button, .tabs a { font-size: 15px; padding: 0 0 10px; }
.tabs .on { font-weight: 700; box-shadow: inset 0 -2px 0 var(--ink); }
.group { margin-top: 30px; }
.group-head { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; padding-bottom: 8px; border-bottom: 1px solid var(--ink); }
.group-head span { font-weight: 400; color: var(--muted); }
.lrow { display: grid; grid-template-columns: 18px minmax(0, 2fr) minmax(0, 1fr); gap: 0 40px; padding: 18px 12px 18px 4px;
  border-bottom: 1px solid var(--rule); cursor: pointer; }
.lrow:hover { background: var(--row-hover); }
.lrow .c1 { padding-top: 8px; }
.lrow .dot { width: 7px; height: 7px; }
.lrow .rt { font-size: 18px; font-weight: 700; line-height: 1.25; }
.lrow .rq { font: 500 19px/1.3 var(--font); text-indent: -.4em; }
.lrow .rby { font-size: 15px; font-weight: 700; margin-top: 4px; }
.lrow .rs { font-size: 16px; line-height: 1.45; color: var(--body); margin-top: 4px; }
.lrow .rm { font-size: 13px; color: var(--muted); margin-top: 6px; }
.lrow .wl { font-size: 12px; font-weight: 700; color: var(--muted); }
.lrow .wt { font-size: 15px; margin-top: 2px; }
.lrow .pending { color: var(--muted); }
.note-fix { color: var(--muted); font-size: 15px; margin-top: 6px; }

/* ---------- index & entity ---------- */
.index-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.sort { display: flex; gap: 18px; align-items: baseline; font-size: 15px; }
.sort .lbl { color: var(--muted); }
.index-cols { margin-top: 44px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px; }
.col-head { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.entry { display: block; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.entry:hover .en { text-decoration: underline; text-underline-offset: 3px; }
.entry .top { display: flex; justify-content: space-between; gap: 12px; }
.entry .en { font-size: 18px; font-weight: 700; }
.entry .ec { color: var(--muted); font-size: 15px; }
.entry .er { color: var(--muted); font-size: 14px; margin-top: 4px; }
.back { font-size: 15px; color: var(--muted); }
.back:hover { color: var(--ink); }
.kind { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-top: 28px; margin-bottom: 10px; }

/* ---------- reader ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(255, 255, 255, .72); z-index: 30; opacity: 0; transition: opacity .18s; }
.backdrop.in { opacity: 1; }
.reader { position: fixed; top: 0; right: 0; bottom: 0; width: var(--reader-w); background: var(--paper); border-left: 1px solid var(--ink);
  z-index: 31; display: flex; flex-direction: column; transform: translateX(32px); opacity: 0; transition: transform .22s ease-out, opacity .22s ease-out; }
.reader.in { transform: none; opacity: 1; }
.rd-top { height: 64px; flex: none; display: flex; align-items: center; gap: 22px; padding: 0 48px; border-bottom: 1px solid var(--rule); font-size: 15px; }
.rd-top .ctx { color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-top .nav-b:hover { text-decoration: underline; text-underline-offset: 3px; }
.rd-top .close { font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.rd-top .close .key { position: static; transform: none; }
.rd-top .back-m { display: none; font-weight: 700; }
.rd-body { flex: 1; overflow-y: auto; padding: 40px 48px; display: flex; flex-direction: column; gap: 30px; }
.rd-title { font: 700 var(--reader-title)/1 var(--font); letter-spacing: -.045em; text-wrap: balance; }
.rd-quote { font: 500 40px/1.1 var(--font); letter-spacing: -.035em; text-indent: -.4em; text-wrap: balance; white-space: pre-line; }
.rd-by { font-size: 18px; font-weight: 700; margin-top: 14px; }
.rd-meta { color: var(--muted); font-size: 15px; margin-top: 12px; }
.rd-len { font-size: 15px; font-weight: 700; margin-top: 8px; }
.rd-why .val { font-size: 17px; margin-top: 6px; }
.rd-why .val .ul { font-size: 14px; color: var(--muted); margin-left: 10px; }
.addlink { color: var(--muted); font-size: 15px; margin-top: 6px; display: inline-block; }
.addlink:hover { color: var(--ink); }
.why-edit { display: flex; gap: 10px; margin-top: 8px; }
.why-edit input { flex: 1; height: 44px; border: 1px solid var(--ink); padding: 0 14px; font-size: 16px; }
.rd-sentence { font-size: 24px; line-height: 1.3; letter-spacing: -.015em; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 28px 0; text-wrap: pretty; }
.rd-sentence.pending { color: var(--muted); font-size: 20px; }
.rd-note { font-size: 20px; line-height: 1.5; white-space: pre-wrap; }
.rd-note.md { white-space: normal; }
.rd-note.md > * + * { margin-top: 14px; }
.rd-note.md .md-h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 28px; }
.rd-note.md .md-h2 { font-size: 23px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; margin-top: 24px; }
.rd-note.md .md-h3 { font-size: 20px; font-weight: 700; margin-top: 20px; }
.rd-note.md > :first-child { margin-top: 0; }
.rd-note.md ul, .rd-note.md ol { padding-left: 1.3em; }
.rd-note.md li + li { margin-top: 6px; }
.rd-note.md blockquote { border-left: 3px solid var(--ink); padding-left: 16px; }
.rd-note.md a, .rd-quote a { text-decoration: underline; text-underline-offset: 3px; }
.md-hint { margin-top: 8px; font-size: 13px; color: var(--muted, #6b6b6b); }
.rd-text { font-size: 17px; line-height: 1.55; }
.rd-text p + p { margin-top: 12px; }
.ideas { list-style: none; margin-top: 10px; }
.ideas li { display: grid; grid-template-columns: 28px 1fr; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.ideas li:last-child { border-bottom: 0; }
.ideas .num { color: var(--red); font-weight: 700; font-size: 18px; }
.ideas .ih { font-size: 18px; font-weight: 700; line-height: 1.3; }
.ideas .ib { font-size: 16px; color: var(--body); margin-top: 4px; }
.apply { margin-top: 10px; padding-left: 20px; font-size: 17px; line-height: 1.55; }
.apply li + li { margin-top: 6px; }
.pt-head { display: flex; justify-content: space-between; align-items: baseline; }
.pt-head .ul { font-size: 14px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip-person { background: var(--ink); color: #fff; padding: 8px 14px; font-size: 15px; font-weight: 700; }
.chip-person:hover { background: #2a2a2a; }
.chip-topic { border: 1px solid var(--ink); padding: 7px 14px; font-size: 15px; }
.chip-topic:hover { background: var(--hover); }
.edit-panel { background: var(--row-hover); padding: 20px; margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.opt { border: 1px solid var(--border); padding: 7px 12px; font-size: 14px; background: var(--paper); }
.opt.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.opt:disabled { opacity: .4; cursor: default; }
.related .rel { display: block; padding: 12px 0; border-bottom: 1px solid var(--rule); cursor: pointer; }
.related .rel:hover .rt { text-decoration: underline; text-underline-offset: 3px; }
.related .rt { font-size: 16px; font-weight: 700; }
.related .rm { font-size: 13px; color: var(--muted); margin-top: 3px; }
.notes textarea { width: 100%; min-height: 80px; border: 1px solid var(--border); padding: 10px 12px; font-size: 15px; margin-top: 8px; resize: vertical; }
.notes .saved { font-size: 12px; color: var(--muted); height: 16px; }
.rd-foot { flex: none; border-top: 1px solid var(--rule); padding: 18px 48px; display: flex; align-items: center; gap: 24px; font-size: 15px; }
.rd-foot .act { text-decoration: underline; text-underline-offset: 3px; }
.rd-foot .act.strong { font-weight: 700; }
.rd-foot .hint { margin-left: auto; color: var(--muted); font-size: 13px; }
.rd-foot .danger { color: var(--muted); font-size: 13px; }
.banner { background: var(--row-hover); padding: 12px 14px; font-size: 15px; }
.bar { height: 3px; background: var(--rule); overflow: hidden; margin-top: 14px; }
.bar i { display: block; height: 100%; width: 40%; background: var(--ink); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- save window ---------- */
.modal { position: fixed; inset: 0; background: rgba(11, 11, 11, .32); z-index: 40; display: flex; justify-content: center; align-items: flex-start; padding: 120px 20px 20px; }
.sheet { background: var(--paper); border: 1px solid var(--ink); width: 560px; max-width: 100%; padding: 32px; max-height: calc(100vh - 140px); overflow-y: auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; }
.sheet-head h2 { font: 700 32px/1 var(--font); letter-spacing: -.04em; }
.sheet-head button { color: var(--muted); font-size: 15px; }
.sheet .tabs { margin-top: 20px; }
.sheet form { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.field { width: 100%; border: 1px solid var(--ink); padding: 0 14px; font-size: 16px; height: 48px; background: var(--paper); }
textarea.field { height: auto; min-height: 140px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.field.light { border-color: var(--border); height: 44px; }
.field:focus, .new-topic:focus, .why-edit input:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.f-label { font-size: 14px; color: var(--body); margin-top: 14px; }
.topic-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.new-topic { border: 1px dashed var(--border); padding: 7px 12px; font-size: 14px; width: 130px; }
.err { color: var(--red); font-size: 14px; min-height: 0; }
.err:empty { display: none; }

/* ---------- welcome ---------- */
.welcome { position: fixed; inset: 0; background: var(--paper); z-index: 50; overflow-y: auto; }
.w-top { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 40px; }
.w-top .r { display: flex; gap: 20px; font-size: 15px; color: var(--muted); }
.w-top .r button:hover { color: var(--ink); }
.w-prog { display: flex; gap: 4px; }
.w-prog i { flex: 1; height: 3px; background: var(--rule); }
.w-prog i.on { background: var(--ink); }
.w-col { max-width: 680px; margin: 0 auto; padding: clamp(32px, 9vh, 104px) 24px 80px; }
.w-big { font: 700 clamp(44px, 7.5vw, 88px)/.92 var(--font); letter-spacing: -.055em; text-wrap: balance; }
.w-h { font: 700 52px/1 var(--font); letter-spacing: -.05em; text-wrap: balance; }
.w-lead { font-size: 19px; color: var(--body); margin-top: 18px; max-width: 600px; }
.w-acts { display: flex; gap: 18px; align-items: center; margin-top: 32px; flex-wrap: wrap; }
.w-acts .muted { font-size: 15px; }
.w-card { border: 1px solid var(--ink); padding: 32px; margin-top: 32px; display: flex; flex-direction: column; gap: 14px; }
.w-card .meta { font-size: 14px; color: var(--muted); }
.w-card .tt { font: 700 40px/1 var(--font); letter-spacing: -.045em; }
.w-card .s { font-size: 20px; line-height: 1.35; }
.w-card .why { font-size: 15px; }
.skel { height: 14px; background: var(--rule); }
.w-panel { background: var(--row-hover); padding: 28px; margin-top: 28px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.btn.w-url { height: 56px; }

/* ---------- message bar ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); opacity: 0; background: var(--ink); color: #fff;
  padding: 14px 20px; font-size: 15px; z-index: 60; display: flex; gap: 18px; align-items: center; transition: transform .2s, opacity .2s;
  max-width: calc(100vw - 32px); pointer-events: none; }
.toast.in { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { color: #fff; text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }

@media (prefers-reduced-motion: reduce) { .tile, .reader, .backdrop, .toast { transition: none; } .bar i { animation: none; width: 100%; } }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  :root { --pad: 16px; --topbar: 60px; --hero-h: 360px; --hero-title: 44px; --hero-quote: 30px; --h1: 36px; --h1-big: 40px;
    --reader-w: 100vw; --reader-title: 30px; }
  .shell { display: block; padding-bottom: 64px; }
  .side { display: none; }
  .topbar { gap: 10px; }
  .topbar .wordmark { display: inline-block; font-size: 22px; padding: 0; }
  .search input { height: 40px; padding-right: 12px; font-size: 16px; }
  .search .key { display: none; }
  .save-btn { height: 40px; padding: 0 14px; }
  .main { padding: 24px var(--pad) 48px; }
  .main.home { padding-top: 16px; }
  .hero { padding: 24px; }
  .hero .h-sentence { font-size: 17px; }
  .rows-home { margin-top: 36px; gap: 32px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tiles .tile:nth-child(n+3) { display: none; }
  .tile { min-height: 140px; padding: 12px; }
  .tile .tt { font-size: 18px; }
  .tile .tq { font-size: 15px; }
  .small-home { grid-template-columns: 1fr; gap: 8px; }
  .lrow { grid-template-columns: 14px minmax(0, 1fr); gap: 0 10px; }
  .lrow .c3 { grid-column: 2; margin-top: 10px; }
  .lrow .c3:empty { display: none; }
  .index-cols { grid-template-columns: 1fr; gap: 36px; }
  .rd-top { padding: 0 16px; }
  .rd-top .close { display: none; }
  .rd-top .back-m { display: inline; }
  .rd-body { padding: 24px 16px; gap: 24px; }
  .rd-quote { font-size: 28px; }
  .rd-sentence { font-size: 20px; padding: 20px 0; }
  .rd-foot { padding: 14px 16px; gap: 18px; }
  .rd-foot .hint { display: none; }
  .modal { padding: 0; align-items: flex-end; }
  .sheet { width: 100%; max-height: 92vh; padding: 22px 16px; border: 0; border-top: 1px solid var(--ink); }
  .tabs-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 64px; background: var(--paper); border-top: 1px solid var(--rule); z-index: 20; }
  .tabs-bar a { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 15px; border-top: 2px solid transparent; margin-top: -1px; }
  .tabs-bar a.on { font-weight: 700; border-top-color: var(--ink); }
  .w-top { padding: 0 16px; }
  .w-h { font-size: 36px; }
  .w-card { padding: 20px; }
  .w-card .tt { font-size: 28px; }
  .toast { bottom: 80px; }
}

/* ---------- settings ---------- */
.settings { max-width: 920px; }
.set-sec { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding: 30px 0; border-top: 1px solid var(--rule); }
.set-sec.first { margin-top: 32px; border-top-color: var(--ink); }
.set-lbl { font-size: 16px; font-weight: 700; }
.set-desc { font-size: 14px; margin-top: 8px; line-height: 1.45; }
.set-sec p { font-size: 16px; }
.set-sec .bm { margin-top: 16px; }
.set-sec .hint { font-size: 14px; margin-top: 14px; }
.set-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 16px; }
.set-row:first-child { padding-top: 0; }
.set-row.nob { border-bottom: 0; }
.set-row.muted b { color: var(--muted); font-weight: 400; }
.set-row .tacts { display: flex; gap: 16px; font-size: 14px; }
.set-row .small { font-size: 13px; }
.add-topic { display: flex; gap: 10px; margin-top: 16px; }
.add-topic .field { max-width: 320px; }
.rename { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; width: 100%; }
.rename .field { max-width: 260px; }
@media (max-width: 760px) {
  .set-sec { grid-template-columns: 1fr; gap: 12px; }
}

/* the loader shown while a new save is being read */
.working { position: fixed; left: 28px; bottom: 28px; z-index: 59; background: var(--ink); color: #fff; width: 340px; max-width: calc(100vw - 32px);
  padding: 14px 18px 16px; transform: translateY(12px); opacity: 0; pointer-events: none; transition: transform .2s, opacity .2s; }
.working.in { transform: none; opacity: 1; pointer-events: auto; }
.working .w-text { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.working .w-text span { color: var(--border); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.working .w-bar { height: 3px; background: #3a3a3a; overflow: hidden; margin-top: 12px; }
.working .w-bar i { display: block; height: 100%; width: 35%; background: #fff; animation: slide 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .working { transition: none; } .working .w-bar i { animation: none; width: 100%; opacity: .5; } }
@media (max-width: 760px) { .working { left: 16px; right: 16px; width: auto; bottom: 80px; } }

/* editing the words of a note or quote */
.text-edit textarea { min-height: 140px; font-size: 17px; line-height: 1.55; resize: vertical; }
.text-edit .te-acts { display: flex; align-items: center; gap: 16px; margin-top: 14px; font-size: 14px; }
.text-edit .te-acts .btn { height: 40px; }

/* sign in (hosted LinkPith) */
#login { position: fixed; inset: 0; z-index: 100; background: var(--paper, #fff); display: flex; align-items: center; justify-content: center; padding: 24px; }
#login .login-box { width: 100%; max-width: 380px; }
#login .wordmark { font-size: 30px; padding: 0; }
#login h1 { font-size: 34px; letter-spacing: -.03em; margin: 36px 0 18px; }
#login .muted { margin-top: 16px; font-size: 14px; }

/* Settings: the bookmark button only where it can be dragged (a mouse or trackpad); phones get their own tips */
.only-phone { display: none; }
@media (hover: none) and (pointer: coarse) {
  .only-phone { display: grid; }
  .only-desktop, .set-row.only-desktop { display: none; }
}

/* Share button setup (iOS Shortcut) */
.keybox { display: flex; gap: 10px; align-items: stretch; margin: 10px 0 18px; }
.keybox code { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--ink); font: 15px/1.3 ui-monospace, Menlo, monospace; overflow-wrap: anywhere; user-select: all; }
.steps { padding-left: 1.3em; margin: 6px 0 14px; }
.steps li { margin-top: 10px; line-height: 1.5; }
.steps code { font: 14px ui-monospace, Menlo, monospace; background: #f3f3f1; padding: 1px 5px; overflow-wrap: anywhere; }

/* profile */
.avatar-btn { flex: none; width: 36px; height: 36px; margin-left: 14px; border-radius: 50%; border: 1px solid var(--ink); background: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden; font: 700 13px/1 var(--font); letter-spacing: .02em; color: var(--ink); }
.avatar-btn img, .p-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-btn:hover { background: #f3f3f1; }
.profile-sheet { width: 440px; }
.p-photo { display: flex; align-items: center; gap: 20px; margin: 24px 0 8px; }
.p-avatar { width: 96px; height: 96px; border-radius: 50%; border: 1px solid var(--ink); overflow: hidden; display: flex; align-items: center; justify-content: center;
  font: 700 32px/1 var(--font); flex: none; }
.p-photo-acts { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; font-size: 14px; }
.p-photo-acts .btn { cursor: pointer; }
.p-signout { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--rule); display: flex; align-items: center; gap: 14px; }
.p-signout .muted { font-size: 14px; }

/* daily nudge settings */
.nudge-times { margin-top: 6px; }
.time-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.time-row { display: flex; align-items: center; gap: 14px; font-size: 15px; }
.time-row span { width: 110px; color: var(--muted); }
.time-row input { width: 150px; height: 42px; }
@media (max-width: 760px) { .avatar-btn { margin-left: 10px; width: 34px; height: 34px; } .profile-sheet { padding: 24px; } }

#nudge-sec > * + * { margin-top: 12px; }
