/* Trove: personal feed. Tokens first; dark mode follows the system unless set in-app. */
:root {
  --bg: #F6F6F3;
  --surface: #FFFFFF;
  --sunk: #EEEEEA;
  --ink: #141416;
  --ink-2: #3A3A40;
  --muted: #6D6D75;
  --line: #E2E2DD;
  --accent: #2B45D4;
  --accent-ink: #FFFFFF;
  --accent-soft: #E7EBFF;
  --world: #4D5562;
  --art: #8A3B6E;
  --africa: #1F7A55;
  --money: #2B5FA8;
  --curatorial: #8A5A12;
  --brief-bg: #141416; --brief-ink: #F6F6F3;
  --shadow: 0 1px 2px rgba(20,20,22,.04), 0 6px 24px rgba(20,20,22,.06);
  --radius: 14px;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tabs-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0F11; --surface: #17181B; --sunk: #1E1F23; --ink: #EDEDEA; --ink-2: #C9C9C6; --muted: #9696A0;
    --line: #2A2B30; --accent: #93A5FF; --accent-ink: #0E0F11; --accent-soft: #1E2440;
    --world: #A7AFBC; --art: #E59ACB; --africa: #6FD3A6; --money: #8DB6F2; --curatorial: #E3B66A; --brief-bg: #1C2140; --brief-ink: #ECEEF8;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0F11; --surface: #17181B; --sunk: #1E1F23; --ink: #EDEDEA; --ink-2: #C9C9C6; --muted: #9696A0;
  --line: #2A2B30; --accent: #93A5FF; --accent-ink: #0E0F11; --accent-soft: #1E2440;
  --world: #A7AFBC; --art: #E59ACB; --africa: #6FD3A6; --money: #8DB6F2; --curatorial: #E3B66A; --brief-bg: #1C2140; --brief-ink: #ECEEF8;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 680px; margin: 0 auto; height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.brand { font-family: var(--serif); font-size: 23px; font-weight: 500; letter-spacing: -.01em; }
.top-actions { display: flex; gap: 2px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); font-family: var(--serif); font-size: 17px; }
.icon-btn:hover { background: var(--sunk); }
.icon-btn.on { color: var(--accent); }
.icon-btn.on svg { fill: currentColor; }

/* Tabs */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: center; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; max-width: 136px; height: var(--tabs-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .01em; }
.tabs button.on { color: var(--ink); }
.tabs button.on svg { stroke-width: 2.1; }

/* Layout */
.view { max-width: 680px; margin: 0 auto; padding: 14px 16px 40px; }
.view.wide { max-width: 1100px; }
.h1 { font-family: var(--serif); font-size: 30px; line-height: 1.1; font-weight: 500; margin: 8px 0 4px; letter-spacing: -.015em; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.section-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }

/* Chips + segmented */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: inline-flex; background: var(--sunk); border-radius: 999px; padding: 3px; margin-bottom: 12px; }
.seg button { padding: 6px 14px; border-radius: 999px; font-size: 13px; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.search { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; margin-bottom: 12px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; position: relative; }
.card-pad { padding: 14px 16px 12px; }
.kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kicker .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.lane-world { color: var(--world); } .lane-art, .lane-art-world, .lane-art-history { color: var(--art); }
.lane-africa { color: var(--africa); } .lane-money, .lane-data-tech, .lane-osint { color: var(--money); }
.lane-curatorial, .lane-mind, .lane-writing, .lane-learn { color: var(--curatorial); }
.kicker b { font-weight: 600; color: var(--ink-2); }
.card h3 { font-family: var(--serif); font-weight: 500; font-size: 21px; line-height: 1.22; margin: 0 0 6px; letter-spacing: -.005em; }
.card p { margin: 0; color: var(--ink-2); }
.card .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-actions { display: flex; align-items: center; gap: 4px; padding: 4px 8px 8px; color: var(--muted); }
.card-actions .grow { flex: 1; }
.act { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 10px; font-size: 13px; color: var(--muted); }
.act:hover { background: var(--sunk); color: var(--ink); }
.act svg { width: 19px; height: 19px; }
.act.on { color: var(--accent); }
.act.on svg { fill: currentColor; }
.tap { cursor: pointer; }

.card-art .art-img { background: var(--sunk); display: grid; place-items: center; }
.card-art .art-img img { width: 100%; height: auto; max-height: 78vh; object-fit: contain; }
.card-hero img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--sunk); }
.card-news .row { display: flex; gap: 12px; }
.card-news .row .thumb { width: 92px; height: 92px; border-radius: 10px; object-fit: cover; flex: none; background: var(--sunk); }
.card-read .read-cover { aspect-ratio: 16/9; background: var(--sunk); overflow: hidden; }
.card-read .read-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-read.typo { background: var(--accent-soft); border-color: transparent; }
.card-read.typo h3 { font-size: 25px; }
.pill { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 500; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.card-vocab { background: var(--surface); }
.card-vocab .term { font-family: var(--serif); font-size: 30px; line-height: 1.1; margin: 2px 0 4px; }
.card-vocab .type { font-style: italic; color: var(--muted); font-family: var(--serif); }
.card-vocab .ex { margin-top: 10px; padding-left: 12px; border-left: 2px solid var(--accent); font-family: var(--serif); font-size: 17px; color: var(--ink-2); }

.card-flash .q { font-family: var(--serif); font-size: 19px; line-height: 1.35; }
.card-flash .a { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); color: var(--ink-2); }
.card-reframe textarea, .note-box { width: 100%; min-height: 92px; margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 16px/1.45 var(--serif); resize: vertical; }

.card-book .book { display: flex; gap: 14px; }
.cover { width: 84px; flex: none; aspect-ratio: 2/3; border-radius: 4px 8px 8px 4px; overflow: hidden; box-shadow: 0 1px 0 var(--line), 0 6px 16px rgba(0,0,0,.12); background: var(--sunk); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.typo { display: flex; flex-direction: column; justify-content: space-between; padding: 8px 7px; color: #fff; font-family: var(--serif); font-size: 12px; line-height: 1.15; }
.cover.typo small { font-family: var(--sans); font-size: 8px; opacity: .8; text-transform: uppercase; letter-spacing: .06em; }

.card-brief { border: 0; background: var(--brief-bg); color: var(--brief-ink); }
.card-brief .kicker, .card-brief p, .card-brief li { color: color-mix(in srgb, var(--brief-ink) 80%, transparent); }
.card-brief h3 { color: var(--brief-ink); font-size: 24px; }
.card-brief ul { margin: 6px 0 0; padding-left: 18px; }
.card-brief li { margin: 4px 0; }
.card-brief .lane-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-top: 14px; color: var(--brief-ink); opacity: .9; font-weight: 600; }
.card-brief .talk { margin-top: 14px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--brief-ink) 10%, transparent); font-family: var(--serif); font-size: 17px; color: var(--brief-ink); }
.card-brief .act { color: color-mix(in srgb, var(--brief-ink) 75%, transparent); }

.card-pause { text-align: center; padding: 26px 18px; background: var(--sunk); border: 0; }
.card-pause h3 { font-size: 24px; }

/* Art grid */
.grid { columns: 2; column-gap: 10px; }
@media (min-width: 760px) { .grid { columns: 3; } }
@media (min-width: 1000px) { .grid { columns: 4; } }
.tile { break-inside: avoid; margin-bottom: 10px; border-radius: 10px; overflow: hidden; background: var(--sunk); cursor: pointer; position: relative; }
.tile img { width: 100%; height: auto; }
.tile .cap { padding: 7px 9px 9px; font-size: 12px; color: var(--muted); background: var(--surface); }
.tile .cap b { display: block; color: var(--ink); font-weight: 500; font-family: var(--serif); font-size: 14px; line-height: 1.25; }

/* Shelf grid */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 18px 14px; }
.shelf .item { cursor: pointer; }
.shelf .cover { width: 100%; }
.shelf .t { font-size: 13px; line-height: 1.25; margin-top: 7px; font-weight: 500; }
.shelf .a { font-size: 12px; color: var(--muted); }
.status-dot { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); }

.list-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-row:last-child { border-bottom: 0; }
.list-row .t { font-weight: 500; }
.list-row .m { font-size: 13px; color: var(--muted); }
.list-row .grow { flex: 1; min-width: 0; }
.series { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; margin-bottom: 12px; }
.series summary { list-style: none; padding: 12px 0; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.series summary::-webkit-details-marker { display: none; }
.series summary b { font-family: var(--serif); font-size: 19px; font-weight: 500; }
.bar { height: 4px; background: var(--sunk); border-radius: 4px; overflow: hidden; margin-top: 6px; width: 120px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; margin-top: 2px; display: grid; place-items: center; }
.check.done { background: var(--accent); border-color: var(--accent); }
.check.done::after { content: ''; width: 8px; height: 4px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }

/* News */
.day-label { font-family: var(--serif); font-size: 20px; margin: 22px 0 8px; }
.news-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.news-row .thumb { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; flex: none; background: var(--sunk); }
.news-row h4 { margin: 0 0 4px; font-family: var(--serif); font-weight: 500; font-size: 17px; line-height: 1.28; }
.news-row p { margin: 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.updated { font-size: 12px; color: var(--muted); }

/* Sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); animation: fade .2s ease; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 18px 18px calc(28px + env(safe-area-inset-bottom)); animation: up .25s cubic-bezier(.2,.8,.2,1); max-width: 720px; margin: 0 auto; -webkit-overflow-scrolling: touch; }
.sheet-x { position: sticky; top: 0; float: right; margin: -6px -6px 0 0; background: var(--surface); z-index: 2; }
.sheet h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; line-height: 1.15; margin: 4px 40px 6px 0; }
.sheet .meta { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.sheet .big-img { margin: 0 -18px 14px; background: var(--sunk); }
.sheet .big-img img { width: 100%; max-height: 70vh; object-fit: contain; }
.sheet .prose { font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--ink-2); }
.sheet label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.sheet input[type=text], .sheet input[type=url], .sheet input[type=password] { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--sunk); padding: 8px 10px; border-radius: 8px; word-break: break-all; color: var(--ink-2); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* Reader */
.reader { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.reader-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: calc(6px + env(safe-area-inset-top)) 10px 6px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.reader-meta { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-progress { position: sticky; top: calc(53px + env(safe-area-inset-top)); height: 2px; z-index: 2; }
.reader-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.reader-body { max-width: 640px; margin: 0 auto; padding: 20px 20px 120px; font-family: var(--serif); font-size: var(--rsize, 19px); line-height: 1.62; color: var(--ink); }
.reader-body .r-series { font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.reader-body h1 { font-size: 1.75em; line-height: 1.12; font-weight: 500; margin: 8px 0 18px; letter-spacing: -.015em; }
.reader-body h2 { font-size: 1.3em; line-height: 1.2; font-weight: 500; margin: 1.8em 0 .5em; }
.reader-body h3 { font-size: 1.08em; font-weight: 600; margin: 1.5em 0 .4em; }
.reader-body p { margin: 0 0 1em; }
.reader-body img { width: calc(100% + 40px); max-width: none; margin: 1.2em -20px .4em; height: auto; background: var(--sunk); }
@media (min-width: 700px) { .reader-body img { width: 100%; margin: 1.2em 0 .4em; border-radius: 8px; } }
.reader-body em { color: var(--ink-2); }
.reader-body p > em:only-child { display: block; font-size: .78em; color: var(--muted); font-family: var(--sans); font-style: normal; margin-top: -.6em; }
.reader-body a { color: var(--accent); }
.reader-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.reader-body table { width: 100%; border-collapse: collapse; font-size: .8em; font-family: var(--sans); display: block; overflow-x: auto; }
.reader-body th, .reader-body td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.reader-body blockquote { margin: 1em 0; padding-left: 16px; border-left: 2px solid var(--accent); color: var(--ink-2); }
.reader-body ul, .reader-body ol { padding-left: 1.2em; }
.reader-body li { margin: .3em 0; }
.check-yourself { margin-top: 40px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-family: var(--sans); font-size: 15px; }
.check-yourself h3 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin: 0 0 4px; }
.check-yourself .q { font-weight: 500; margin-top: 14px; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loader { height: 60px; }
.small { font-size: 13px; color: var(--muted); }
.mt { margin-top: 12px; }
