/* Screens and components: shelf, reader chrome, review, vocab, highlights, toasts. */

/* Real brand logos, drawn on neutral surfaces (cover badge, filter buttons, reader badge) */
:root {
  --logo-youtube: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FF0000' d='M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31 31 0 0 0 0 12a31 31 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31 31 0 0 0 24 12a31 31 0 0 0-.5-5.8z'/%3E%3Cpath fill='%23fff' d='M9.8 15.5V8.5l6.2 3.5-6.2 3.5z'/%3E%3C/svg%3E");
  --logo-tiktok: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%230E1116' d='M19.6 3.3A4.9 4.9 0 0 1 14.7 0h-3.4v16.4a2.9 2.9 0 0 1-2.9 2.5 2.9 2.9 0 0 1-2.9-2.9 2.9 2.9 0 0 1 2.9-2.9c.3 0 .5 0 .8.1V9.6a6.5 6.5 0 0 0-.8-.1A6.4 6.4 0 0 0 2 16a6.4 6.4 0 0 0 6.4 6.4A6.4 6.4 0 0 0 14.7 16V8.2a8.2 8.2 0 0 0 4.9 1.6V6.4a5 5 0 0 1-3.3-3.1h3.3z'/%3E%3C/svg%3E");
  --logo-tiktok-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M19.6 3.3A4.9 4.9 0 0 1 14.7 0h-3.4v16.4a2.9 2.9 0 0 1-2.9 2.5 2.9 2.9 0 0 1-2.9-2.9 2.9 2.9 0 0 1 2.9-2.9c.3 0 .5 0 .8.1V9.6a6.5 6.5 0 0 0-.8-.1A6.4 6.4 0 0 0 2 16a6.4 6.4 0 0 0 6.4 6.4A6.4 6.4 0 0 0 14.7 16V8.2a8.2 8.2 0 0 0 4.9 1.6V6.4a5 5 0 0 1-3.3-3.1h3.3z'/%3E%3C/svg%3E");
  --logo-instagram: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23E4405F' d='M12 2.2c3.2 0 3.6 0 4.9.1 3.3.1 4.8 1.6 4.9 4.9.1 1.3.1 1.7.1 4.9s0 3.6-.1 4.9c-.1 3.2-1.6 4.8-4.9 4.9-1.3.1-1.6.1-4.9.1s-3.6 0-4.9-.1C3.8 21.8 2.3 20.2 2.1 17 2 15.7 2 15.3 2 12s0-3.6.1-4.9C2.3 3.8 3.8 2.3 7.1 2.1 8.4 2 8.8 2 12 2zm0-2.2c-3.3 0-3.7 0-5 .1C2.7.3.3 2.7.1 7 0 8.3 0 8.7 0 12s0 3.7.1 5c.2 4.3 2.6 6.7 6.9 6.9 1.3.1 1.7.1 5 .1s3.7 0 5-.1c4.3-.2 6.7-2.6 6.9-6.9.1-1.3.1-1.7.1-5s0-3.7-.1-5C23.7 2.7 21.3.3 17 .1 15.7 0 15.3 0 12 0zm0 5.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 12 5.8zM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm6.4-11.9a1.44 1.44 0 1 0 0 2.88 1.44 1.44 0 0 0 0-2.88z'/%3E%3C/svg%3E");
}

/* ===================== Shelf ===================== */

.lib-hero {
  display: grid; gap: var(--gap); margin-bottom: 20px;
  grid-template-columns: minmax(0, 1.9fr) minmax(260px, 1fr);
}
.lib-hero > :only-child { grid-column: 1 / -1; }

/* Today's pick: the one dark card on the shelf (the hub's "Next up") */
.daily-pick {
  display: flex; flex-direction: column; min-height: 212px; overflow: hidden;
  background: var(--hero); color: var(--hero-ink); border: 0; text-decoration: none;
  transition: transform var(--t-base) var(--ease);
}
.daily-pick .lab { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--pop); }
.daily-pick .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .4; transform: scale(.7); } }
.daily-pick .pick-title {
  font: 700 clamp(22px, 2.3vw, 30px)/1.12 var(--font); letter-spacing: -.025em; margin-top: 14px; max-width: 30ch;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-wrap: balance;
}
.daily-pick .pick-meta { font-size: 14px; font-weight: 700; margin-top: 10px; }
.daily-pick .pick-meta span { color: var(--hero-sub); font-weight: 500; }
.daily-pick .pick-why {
  font-size: 14px; color: var(--hero-sub); margin-top: 6px; max-width: 58ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.daily-pick .pick-go {
  margin-top: auto; padding-top: 18px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--hero-ink);
}
.daily-pick .pick-go svg.i { width: 18px; height: 18px; transition: transform var(--t-base) var(--spring); }
@media (hover: hover) { .daily-pick:hover .pick-go svg.i { transform: translateX(4px); } }
.daily-pick:active { transform: scale(.99); }

/* Daily goal + streak */
.goal-card { display: flex; flex-direction: column; }
.goal-body { margin-block: auto; padding-top: 8px; }
.goal-count { font: 700 34px/1.05 var(--font); letter-spacing: -.025em; }
.goal-count small { font-size: 14px; font-weight: 600; color: var(--ink2); letter-spacing: 0; margin-left: 4px; }
.goal-card .meter { margin-top: 12px; }
.goal-card .g-sub { margin-top: 10px; font-size: 13.5px; color: var(--ink2); }
.goal-card.goal-done .goal-count { color: var(--good-ink); }

/* Controls: status switch, search, source filters, tags, sort */
.list-controls { display: grid; gap: 12px; margin-bottom: 14px; }
.controls-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.status-tabs .status-tab-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--hover); color: var(--ink2); font-size: 11.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.status-tabs .status-tab.active .status-tab-count { background: rgba(255,255,255,.16); color: #fff; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px 0 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600; color: var(--ink2); white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--spring);
}
.filter-btn svg.i { width: 18px; height: 18px; }
.filter-btn[data-filter="all"] { padding: 0 16px; }
.filter-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.filter-btn:active { transform: scale(.96); }
.filter-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-btn[data-filter="youtube"]::before, .filter-btn[data-filter="tiktok"]::before, .filter-btn[data-filter="instagram"]::before {
  content: ""; width: 18px; height: 18px; flex: none; background: center / contain no-repeat;
}
.filter-btn[data-filter="youtube"]::before { background-image: var(--logo-youtube); }
.filter-btn[data-filter="tiktok"]::before { background-image: var(--logo-tiktok); width: 16px; }
.filter-btn[data-filter="tiktok"].active::before { background-image: var(--logo-tiktok-light); }
.filter-btn[data-filter="instagram"]::before { background-image: var(--logo-instagram); width: 17px; }
.filter-btn .swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(14,17,22,.14); }

.tag-cloud-wrap { display: grid; gap: 4px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; max-height: 88px; overflow: hidden; transition: max-height .4s var(--ease); }
.tag-cloud.expanded { max-height: 1200px; }
.tag-cloud:empty { display: none; }
.tag-chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border-radius: var(--r-pill);
  background: transparent; border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink2);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--spring);
}
.tag-chip::after { content: ""; position: absolute; inset: -4px 0; }
.tag-chip:hover { background: var(--surface); color: var(--ink); }
.tag-chip:active { transform: scale(.95); }
.tag-chip.active { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.tag-chip-count { font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.tag-chip.active .tag-chip-count { color: var(--accent-ink); }
.tag-chip-x { display: inline-grid; place-items: center; }
.tag-chip-x svg.i { width: 14px; height: 14px; }
.tag-cloud-controls { display: flex; align-items: center; gap: 4px; }
.tag-cloud-toggle, .tag-cloud-clear {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 700; color: var(--accent);
}
.tag-cloud-clear { color: var(--ink2); }
.tag-cloud-toggle:hover, .tag-cloud-clear:hover { background: var(--hover); }
.tag-cloud-toggle:hover { color: var(--accent-ink); }
.tag-cloud-toggle svg.i { width: 16px; height: 16px; transition: transform var(--t-base) var(--ease); }
.tag-cloud-toggle.open svg.i { transform: rotate(180deg); }

.sort-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
#note-count { font-size: 13px; font-weight: 600; color: var(--ink2); }
.sort-row .switch > button { min-height: 36px; padding: 0 13px; font-size: 13px; position: relative; }
.sort-row .switch > button::after { content: ""; position: absolute; inset: -4px 0; }

/* Note cards (mockup Library screen) */
.note-list { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.note-list > li { display: flex; min-width: 0; }
.note-card {
  position: relative; flex: 1; min-width: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-content: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; text-decoration: none; color: inherit;
}
.note-card:active { transform: scale(.99); }
.card-body { min-width: 0; display: flex; flex-direction: column; }
.card-top { display: flex; align-items: baseline; gap: 10px; }
.card-src { font-size: 12.5px; font-weight: 700; color: var(--accent); }
.card-min { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ink2); white-space: nowrap; }
.card-min.is-done { color: var(--good-ink); }
.card-title {
  font: 700 17px/1.25 var(--font); letter-spacing: -.01em; margin-top: 6px; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-summary {
  font-size: 14.5px; line-height: 1.5; color: var(--ink2); margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: 12.5px; font-weight: 600; color: var(--ink2); margin-top: 10px; }
.note-card .meter { grid-column: 1 / -1; margin-top: 14px; }
.note-card .card-cover {
  grid-column: 2; grid-row: 1; width: 76px; height: 76px; margin-top: 2px;
  object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg);
  transition: transform var(--t-base) var(--spring);
}
@media (hover: hover) { .note-card:hover .card-cover { transform: scale(1.04) rotate(-1deg); } }
.note-completed .card-title { color: var(--ink2); }
.note-completed .card-cover { opacity: .7; }

/* Cover fallback: neutral tile with the real brand logo or a drawn icon */
.cover-grad { display: grid; place-items: center; }
.cover-badge { width: 30px; height: 30px; display: grid; place-items: center; color: var(--ink2); }
.cover-badge svg.i { width: 26px; height: 26px; }
.cover-badge[data-platform="youtube"], .cover-badge[data-platform="tiktok"], .cover-badge[data-platform="instagram"] { background: center / 26px no-repeat; }
.cover-badge[data-platform="youtube"] { background-image: var(--logo-youtube); }
.cover-badge[data-platform="tiktok"] { background-image: var(--logo-tiktok); }
.cover-badge[data-platform="instagram"] { background-image: var(--logo-instagram); }

.skeleton-list .note-card { min-height: 150px; }

/* ===================== Reader ===================== */

.reader-article { padding-top: 12px; }
.note-meta { margin-bottom: 22px; view-transition-name: lib-card; }
.meta-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  font-size: 13.5px; font-weight: 600; color: var(--ink2);
}
.meta-row .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink3); }
.note-meta .title {
  font: 700 clamp(28px, 4vw, 40px)/1.1 var(--font); letter-spacing: -.025em; color: var(--ink);
  margin: 12px 0 10px; text-wrap: balance;
}
.note-meta .author { font-size: 14.5px; font-weight: 600; color: var(--ink2); }
.note-meta .summary {
  margin-top: 14px; font-size: 16px; line-height: 1.6; color: var(--ink2); max-width: 62ch;
}
.note-meta .meter { margin-top: 18px; }
.meta-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }

.platform-badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px 0 8px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap;
}
.platform-badge svg.i { width: 14px; height: 14px; color: var(--ink2); }
.platform-badge[data-platform="youtube"]::before, .platform-badge[data-platform="tiktok"]::before, .platform-badge[data-platform="instagram"]::before {
  content: ""; width: 14px; height: 14px; flex: none; background: center / contain no-repeat;
}
.platform-badge[data-platform="youtube"]::before { background-image: var(--logo-youtube); }
.platform-badge[data-platform="tiktok"]::before { background-image: var(--logo-tiktok); }
.platform-badge[data-platform="instagram"]::before { background-image: var(--logo-instagram); }

.tag-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 700; text-decoration: none;
  position: relative; transition: background var(--t-fast) var(--ease);
}
.tag-pill::after { content: ""; position: absolute; inset: -6px 0; }
.tag-pill:hover { background: var(--accent-soft-hover); }
.view-original { gap: 7px; }

.offline-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px;
  padding: 5px 10px; border-radius: var(--r-pill); background: var(--warn-soft); color: var(--warn-ink);
  font-size: 12.5px; font-weight: 700;
}
.offline-badge svg.i { width: 15px; height: 15px; }

/* Section nav (table of contents) */
.section-nav { position: relative; margin: -4px 0 24px; }
.section-nav-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 12px;
  border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 700; color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--spring);
}
.section-nav-toggle:hover { border-color: var(--line-strong); }
.section-nav-toggle:active { transform: scale(.97); }
.section-nav-toggle .chev { transition: transform var(--t-base) var(--ease); width: 16px; height: 16px; color: var(--ink2); }
.section-nav.open .section-nav-toggle .chev { transform: rotate(180deg); }
.section-nav-menu {
  display: grid; margin-top: 8px; padding: 6px; max-height: 0; opacity: 0; overflow: hidden; visibility: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: max-height var(--t-base) var(--ease), opacity var(--t-fast) var(--ease), visibility 0s linear var(--t-base);
}
.section-nav.open .section-nav-menu {
  max-height: 60vh; overflow-y: auto; opacity: 1; visibility: visible;
  transition: max-height var(--t-base) var(--ease), opacity var(--t-fast) var(--ease);
}
.toc-item {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 6px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--ink2); text-align: left;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.toc-item.sub { padding-left: 28px; font-size: 13.5px; }
.toc-item:hover { background: var(--bg); color: var(--ink); }
.toc-item.active { color: var(--accent-ink); background: var(--accent-soft); font-weight: 700; }

/* Mark complete */
.reader-actions { display: flex; justify-content: center; padding: 36px 0 12px; }
.complete-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 20px 0 16px;
  border-radius: var(--r-sm); background: var(--ink); color: #fff; font-size: 15px; font-weight: 700;
  transition: background var(--t-base) var(--ease), transform var(--t-fast) var(--spring);
}
.complete-btn:hover { background: var(--ink-hover); }
.complete-btn:active { transform: scale(.97); }
.complete-btn-icon { display: inline-grid; }
.complete-btn-icon svg.i { width: 22px; height: 22px; }
.complete-btn-icon .tick { stroke-dasharray: 14; stroke-dashoffset: 14; transition: stroke-dashoffset .3s var(--ease) .05s; }
.complete-btn.completed { background: var(--good-soft); color: var(--good-ink); }
.complete-btn.completed .complete-btn-icon svg.i { fill: var(--good); stroke: #fff; }
.complete-btn.completed .tick { stroke-dashoffset: 0; }
.complete-btn.completed .complete-btn-icon svg.i circle { stroke: var(--good); }
.complete-btn.loading { pointer-events: none; opacity: .7; }

/* Rendered-note components (from render.js) */
.callout {
  --cc: var(--callout-color, var(--accent));
  margin: 1.4em 0; border-radius: var(--r-sm); overflow: hidden;
  background: color-mix(in srgb, var(--cc) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--cc) 26%, var(--line));
}
.callout-title {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px 4px;
  font-family: var(--font); font-weight: 700; font-size: .88em;
  color: color-mix(in srgb, var(--cc) 62%, var(--ink));
}
.callout-content { padding: 4px 16px 14px; font-size: .95em; }
.callout-content > :last-child { margin-bottom: 0; }
.callout-multicolumn { display: flex; gap: 12px; margin: 1.4em 0; align-items: flex-start; }
.callout-multicolumn > .callout { flex: 1; margin: 0; }
@media (max-width: 600px) { .callout-multicolumn { flex-direction: column; } }

.wikilink { color: var(--accent); cursor: default; }
.hashtag { color: var(--accent); font-weight: 600; font-size: .92em; }
.timestamp-badge {
  display: inline-block; vertical-align: baseline; padding: .05em .55em; border-radius: var(--r-pill);
  font-family: var(--font); font-size: .78em; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--accent-soft); color: var(--accent-ink); text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.timestamp-badge:hover { background: var(--accent); color: #fff; }

.youtube-embed {
  position: relative; width: 100%; padding-bottom: 56.25%; margin: 1.5em 0;
  border-radius: var(--r); overflow: hidden; background: #000;
}
.youtube-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 1.5em 0; }
.image-grid:empty { display: none; }
.image-grid img, .image-grid video { width: 100%; height: auto; border-radius: var(--r-sm); }
.embed-image, .embed-video { display: block; max-width: 100%; height: auto; margin: 1.4em auto; border-radius: var(--r-sm); }
.embed-audio { display: block; width: 100%; margin: 1em auto; }
.prose > :first-child > .embed-image:first-child, .prose > :first-child > .embed-video:first-child { margin-top: 0; }
/* Images are online only: an unreachable one shows its filename on a quiet tile */
.prose img.img-missing { min-height: 56px; padding: 16px; background: var(--surface-2); border: 1px dashed var(--line); font-size: 13px; color: var(--ink2); cursor: default; }
.prose img.zoomable { cursor: zoom-in; transition: transform var(--t-base) var(--spring); }
@media (hover: hover) { .prose img.zoomable:hover { transform: scale(1.01); } }

/* ===================== Review + Vocab ===================== */

.card-grid { columns: 2 380px; column-gap: var(--gap); }
.card-grid > * { break-inside: avoid; margin-bottom: var(--gap); display: block; }

.review-card, .vocab-card { padding: 20px 20px 16px; }
.review-card-num, .vocab-card-num {
  position: absolute; top: 18px; right: 18px; font-size: 12.5px; font-weight: 700; color: var(--ink2);
  font-variant-numeric: tabular-nums;
}
.review-quote {
  font-family: var(--font-read); font-size: 17px; line-height: 1.6; color: var(--ink);
  padding-right: 22px; margin: 0;
}
[data-font="source-serif"] .review-quote { font-family: var(--font-serif); }
.review-annotation {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg);
  font-size: 14px; color: var(--ink2);
}
.review-section { font-size: 12.5px; font-weight: 600; color: var(--ink2); margin-top: 6px; }
.review-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.review-source, .vocab-source {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; min-height: 40px;
  font-size: 13.5px; font-weight: 700; color: var(--ink); text-decoration: none;
}
.review-source span:last-child, .vocab-source span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-source:hover span:last-child, .vocab-source:hover span:last-child { text-decoration: underline; text-underline-offset: 3px; }
.review-actions { margin-left: auto; flex: none; }

.vocab-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding-right: 24px; }
.vocab-word { font: 700 22px/1.2 var(--font); letter-spacing: -.02em; color: var(--ink); }
.vocab-phonetic { font-size: 14px; color: var(--ink2); }
.vocab-body { margin-top: 10px; }
.vocab-pos { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin: 12px 0 4px; }
.vocab-pos:first-child { margin-top: 0; }
.vocab-defs { list-style: decimal; padding-left: 1.2em; }
.vocab-def-item { font-size: 14.5px; line-height: 1.5; margin-bottom: 6px; }
.vocab-def-item::marker { color: var(--ink2); font-weight: 600; }
.vocab-example { font-size: 13.5px; color: var(--ink2); margin-top: 2px; }
.vocab-source { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); width: 100%; }

/* Small secondary action inside cards (copy) */
.hl-copy-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 700; color: var(--ink2);
  position: relative; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.hl-copy-btn::after { content: ""; position: absolute; inset: -4px 0; }
.hl-copy-btn svg.i { width: 16px; height: 16px; }
.hl-copy-btn:hover { background: var(--bg); color: var(--ink); }

/* ===================== Highlights dashboard ===================== */

.dash-controls { display: grid; gap: 12px; margin-bottom: 18px; }
.hl-dashboard-group { padding: 6px 20px 8px; }
.group-header {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 0;
  text-decoration: none; color: inherit; border-bottom: 1px solid var(--line-soft);
}
.group-title {
  flex: 1; min-width: 0; font: 700 15.5px/1.3 var(--font); color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.group-header:hover .group-title { text-decoration: underline; text-underline-offset: 3px; }
.group-count { font-size: 13px; font-weight: 700; color: var(--ink2); font-variant-numeric: tabular-nums; }

/* ===================== Toasts ===================== */

.resume-toast {
  position: fixed; z-index: 150; left: 16px; right: 16px; margin-inline: auto;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px)); width: min(360px, calc(100% - 32px));
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--float);
  opacity: 0; transform: translateY(16px);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.resume-toast.visible { opacity: 1; transform: none; }
.resume-toast.exiting { opacity: 0; transform: translateY(10px); transition-duration: var(--t-fast); }
.resume-toast-top { flex: 1; min-width: 0; }
.resume-toast-text { font-size: 14px; font-weight: 700; color: var(--ink); }
.resume-btn {
  min-height: 44px; padding: 0 16px; border-radius: var(--r-sm); background: var(--ink); color: #fff;
  font-size: 14px; font-weight: 700; flex: none; transition: transform var(--t-fast) var(--spring), background var(--t-fast) var(--ease);
}
.resume-btn:hover { background: var(--ink-hover); }
.resume-btn:active { transform: scale(.96); }
.resume-dismiss { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); color: var(--ink2); flex: none; order: 3; }
.resume-dismiss:hover { background: var(--bg); color: var(--ink); }
.resume-dismiss svg.i { width: 18px; height: 18px; }

.status-toast {
  position: fixed; z-index: 1000; left: 16px; right: 16px; margin-inline: auto; width: max-content; max-width: calc(100% - 32px);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  padding: 12px 18px; border-radius: var(--r-pill); background: var(--ink); color: #fff;
  font-size: 14px; font-weight: 600; box-shadow: var(--float); pointer-events: none;
  opacity: 0; transform: translateY(12px);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--spring);
}
.status-toast.visible { opacity: 1; transform: none; }

/* Offline-first: pending-sync pill */
#outbox-pill {
  position: fixed; z-index: 60; left: calc(var(--rail) + 16px); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--float);
  font-size: 12.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; pointer-events: none;
}
#outbox-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: pulse 2.4s var(--ease) infinite; }
#outbox-pill[hidden] { display: none !important; }

/* ===================== Responsive ===================== */
@media (max-width: 1000px) {
  .lib-hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .lib-hero { gap: 12px; margin-bottom: 16px; }
  .daily-pick { min-height: 0; }
  .controls-row .switch { width: 100%; }
  .controls-row .switch > button { flex: 1; padding: 0 8px; }
  .filter-row, .dash-controls .filter-row {
    flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px;
    scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-btn { flex: none; }
  .note-list { gap: 12px; }
  .note-card { padding: 16px; }
  .note-card .card-cover { width: 64px; height: 64px; }
  .card-title { font-size: 16px; }
  .card-grid { columns: 1; }
  .card-grid > * { margin-bottom: 12px; }
  #outbox-pill { left: 16px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  body.is-reading #outbox-pill { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .status-toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  body.is-reading .status-toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .resume-toast { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}
