/* ==========================================================
   ActiveNews24 — app styles
   Keeps the old digest's DNA (blue brand, category colours,
   rank bubbles, save stars, grid/list, dark mode) in a
   cleaner, app-like shell.
   ========================================================== */

:root {
  --brand: #1E90FF;
  --brand-2: #0B5FD0;
  --hot: #FF4500;
  --gold: #F5C518;
  --radius: 18px;
  --radius-sm: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Plus Jakarta Sans', var(--font);
  --ease: cubic-bezier(.2,.8,.2,1);
  --tabbar-h: 0px;
}
html.theme-dark {
  --bg: #0a1020;
  --bg-2: #0e1628;
  --surface: #131c31;
  --surface-2: #1a2540;
  --line: rgba(255,255,255,.08);
  --text: #e9eef7;
  --muted: #94a3bd;
  --glass: rgba(10,16,32,.72);
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  color-scheme: dark;
}
html.theme-light {
  --bg: #f4f6fb;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --line: rgba(10,25,60,.09);
  --text: #0e1730;
  --muted: #5b6782;
  --glass: rgba(255,255,255,.78);
  --shadow: 0 10px 30px rgba(20,40,90,.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 200px; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.55; font-size: 16px; -webkit-font-smoothing: antialiased;
  transition: background-color .35s, color .35s;
  padding-bottom: var(--tabbar-h);
}
html.theme-dark body { background: radial-gradient(1200px 600px at 80% -10%, rgba(30,144,255,.14), transparent 60%), var(--bg); background-attachment: fixed; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
svg { width: 20px; height: 20px; flex-shrink: 0; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; line-height: 1.15; margin: 0; }
.muted { color: var(--muted); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }

/* ---------- preview banner ---------- */
.preview-banner { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: .85rem; padding: 8px 14px; background: linear-gradient(90deg, #5b21b6, #1E90FF); color: #fff; text-align: center; }
.preview-banner svg { width: 16px; height: 16px; }

/* ---------- app bar ---------- */
.appbar { position: sticky; top: 0; z-index: 50; background: var(--glass); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); border-bottom: 1px solid var(--line); }
.appbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 9px; }
.brand-text { font-family: var(--display); font-size: 1.12rem; font-weight: 600; letter-spacing: .01em; white-space: nowrap; color: var(--text); }
.brand-text i { font-style: italic; font-weight: 800; background: linear-gradient(90deg, #2B3990, #1B7FD1); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .06em; }
html.theme-dark .brand-text i { background-image: linear-gradient(90deg, #8FB4FF, #14ADEB); }
.brand-24 { font-size: .74em; background: #EE3524; color: #fff; padding: 2px 6px; border-radius: 5px; vertical-align: 2px; font-weight: 800; margin-left: 2px; }
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a { padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .95rem; color: var(--muted); transition: .2s; }
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a.on { color: var(--text); background: var(--surface-2); }
.appbar-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; position: relative; color: var(--text); transition: background .2s, transform .2s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.saved-count { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--gold); color: #111; font-size: .68rem; font-weight: 800; display: grid; place-items: center; }
html.theme-dark .i-sun, html.theme-light .i-moon { display: none; }
html.theme-dark .i-moon, html.theme-light .i-sun { display: inline-grid; }

/* ---------- digest header ---------- */
.digest-head { padding-top: 36px; padding-bottom: 18px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; font-weight: 700; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.eyebrow svg { width: 16px; height: 16px; }
.live { color: var(--hot); position: relative; padding-left: 14px; }
.live::before { content: ""; position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 0 0 rgba(255,69,0,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(255,69,0,0); } 100% { box-shadow: 0 0 0 0 rgba(255,69,0,0); } }
.digest-head h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; }
.intro { max-width: 760px; color: var(--muted); font-size: 1.08rem; margin: 14px 0 18px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); padding: 7px 14px; border-radius: 999px; font-size: .88rem; color: var(--muted); }
.stat b { color: var(--text); }

/* ---------- filter bars (sticky): dates on top, sections below ---------- */
.filterbar { position: sticky; top: 61px; z-index: 40; background: var(--glass); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.fbar-inner { display: flex; align-items: center; gap: 12px; }
.fbar-dates { border-bottom: 1px solid var(--line); overflow: hidden; max-height: 90px; transition: max-height .3s var(--ease), opacity .25s, border-color .3s; }
.fbar-dates .fbar-inner { padding-top: 10px; padding-bottom: 10px; }
.fbar-cats .fbar-inner { padding-top: 10px; padding-bottom: 10px; align-items: flex-start; }
.fbar-label { flex-shrink: 0; width: 72px; font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.fbar-cats .fbar-label { padding-top: 10px; }
.scroller { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.dates { display: flex; gap: 8px; }
.date { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 74px; padding: 6px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); line-height: 1.15; transition: .2s; }
.date small { display: flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.date b { font-size: .95rem; font-weight: 700; }
.date:hover { border-color: var(--brand); }
.date.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(30,144,255,.35); }
.date.on small { color: rgba(255,255,255,.85); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 0 0 rgba(255,69,0,.6); animation: pulse 2s infinite; }
.date.on .live-dot { background: #fff; }
.fbar-link { flex-shrink: 0; display: inline-flex; align-items: center; gap: 2px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.fbar-link:hover { color: var(--brand); }
.fbar-link svg { width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px 8px 14px; border-radius: 999px; font-weight: 600; font-size: .88rem; background: var(--surface); border: 1px solid var(--line); transition: .2s; }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip b { font-size: .72rem; font-weight: 800; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--surface-2); color: var(--muted); text-align: center; }
.chip:hover { border-color: var(--c, var(--brand)); }
.chip[aria-pressed="true"] { background: var(--c, var(--text)); border-color: var(--c, var(--text)); color: #fff; }
.chip-all[aria-pressed="true"] { color: var(--bg); }
.chip[aria-pressed="true"] i { background: #fff; }
.chip[aria-pressed="true"] b { background: rgba(255,255,255,.25); color: inherit; }
html.list-view .i-list, html:not(.list-view) .i-grid { display: none; }

/* ---------- hero carousel ---------- */
.hero { margin-top: 22px; }
.hero-track { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: calc(var(--radius) + 4px); scrollbar-width: none; gap: 14px; }
.hero-track::-webkit-scrollbar { display: none; }
.hero-slide { position: relative; scroll-snap-align: start; border-radius: calc(var(--radius) + 4px); overflow: hidden; aspect-ratio: 21/9; min-height: 300px; box-shadow: var(--shadow); }
.hero-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 6s var(--ease); }
.hero-slide:hover img { transform: scale(1.04); }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(5,10,22,.92) 0%, rgba(5,10,22,.45) 45%, rgba(5,10,22,0) 75%); }
.hero-text { position: absolute; left: 0; right: 0; bottom: 0; padding: clamp(20px, 4vw, 40px); color: #fff; max-width: 860px; }
.hero-text h2 { font-size: clamp(1.5rem, 3.6vw, 2.6rem); font-weight: 800; margin: 12px 0 8px; text-shadow: 0 2px 20px rgba(0,0,0,.4); }
.hero-text p { margin: 0; color: rgba(255,255,255,.82); font-size: 1.05rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-rank { margin-left: 8px; font-weight: 800; font-size: .85rem; background: var(--hot); padding: 4px 10px; border-radius: 999px; }
.hero-dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.hero-dots button { width: 8px; height: 8px; border-radius: 99px; background: var(--line); transition: .3s var(--ease); }
html.theme-dark .hero-dots button { background: rgba(255,255,255,.2); }
.hero-dots button.on { width: 28px; background: var(--brand) !important; }

/* ---------- blocks ---------- */
.block { margin-top: 44px; }
.block-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.block-head h2 { font-size: 1.7rem; font-weight: 800; }
.block-head h2::after { content: ""; display: block; width: 44px; height: 4px; margin-top: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--hot)); }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .01em; color: #fff; background: var(--c); box-shadow: 0 2px 10px color-mix(in srgb, var(--c) 40%, transparent); }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.card-link { display: flex; flex-direction: column; height: 100%; }
.card-media { aspect-ratio: 16/9; overflow: hidden; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .card-media img { transform: scale(1.06); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card h3 { font-size: 1.06rem; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-dek { margin: 8px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin: auto 0 0; padding-top: 12px; font-size: .78rem; color: var(--muted); font-weight: 500; }
.card-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.card-top > * { pointer-events: auto; }
.rank { margin-left: auto; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: var(--hot); color: #fff; font-weight: 800; font-size: .95rem; box-shadow: 0 4px 12px rgba(255,69,0,.45); font-family: var(--display); }
.save-btn { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(8,12,24,.55); color: rgba(255,255,255,.92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: .2s var(--ease); }
.save-btn svg { width: 17px; height: 17px; }
.save-btn:hover { transform: scale(1.1); background: rgba(8,12,24,.8); }
.save-btn.is-saved { background: var(--gold) !important; color: #111 !important; box-shadow: 0 4px 14px rgba(245,197,24,.5); }
.save-btn.pop { animation: pop .35s var(--ease); }
@keyframes pop { 50% { transform: scale(1.3); } }

/* Top 3 get bigger cards (keeps the old "top section" emphasis) */
.top-grid .card:nth-child(-n+3) .card-body h3 { font-size: 1.15rem; }

/* list view (the old "compact" toggle) */
html.list-view .top-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
html.list-view .top-grid .card-link { flex-direction: row; }
html.list-view .top-grid .card-media { width: 150px; aspect-ratio: auto; flex-shrink: 0; }
html.list-view .top-grid .card-body { padding: 12px 14px; }
html.list-view .top-grid .card h3 { font-size: 1rem; -webkit-line-clamp: 2; padding-right: 30px; }
html.list-view .top-grid .card-top { left: 8px; top: 8px; right: 8px; }
html.list-view .top-grid .card-top .badge { display: none; }
html.list-view .top-grid .card-top .save-btn { width: 28px; height: 28px; }
html.list-view .top-grid .rank { position: absolute; right: 0; top: 0; min-width: 26px; height: 26px; font-size: .8rem; }

/* filtered out */
.card.is-hidden, .section-row.is-hidden { display: none; }
.empty-filter { text-align: center; color: var(--muted); padding: 30px 0; }
.link-btn { color: var(--brand); font-weight: 700; }

/* ---------- section rows (horizontal, app-style) ---------- */
.section-row { margin-bottom: 30px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title h3 { font-size: 1.25rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.section-title h3::before { content: ""; width: 6px; height: 22px; border-radius: 4px; background: var(--c); }
.section-title a { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.section-title a:hover { color: var(--c); }
.section-title a svg { width: 18px; height: 18px; }
.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 23%); gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 8px; scrollbar-width: thin; }
.row-scroll .card { scroll-snap-align: start; }
.card.mini .card-dek { display: none; }

.prev-day { text-align: center; }
.prev-link { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.prev-link:hover { border-color: var(--brand); }

/* ---------- story page ---------- */
.story { padding-top: 26px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); margin-bottom: 18px; flex-wrap: wrap; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.crumbs a:hover { color: var(--brand); }
.crumbs svg { width: 16px; height: 16px; }
.story-media { border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/8; box-shadow: var(--shadow); margin-bottom: 22px; }
.story-media img { width: 100%; height: 100%; object-fit: cover; }
.story-meta-top { display: flex; align-items: center; gap: 12px; font-size: .88rem; margin-bottom: 12px; }
.story h1 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); font-weight: 800; }
.dek { font-size: 1.2rem; color: var(--muted); margin: 14px 0 20px; line-height: 1.5; }
.story-actions { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: none; border-radius: 0; border-left: 0; border-right: 0; overflow: visible; }
.story-actions:hover { transform: none; box-shadow: none; border-color: var(--line); }
.story-actions time { font-size: .9rem; color: var(--muted); }
.spacer { flex: 1; }
.pill-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: .88rem; width: auto; height: auto; color: var(--text); backdrop-filter: none; }
.pill-btn svg { width: 16px; height: 16px; }
.pill-btn:hover { border-color: var(--brand); transform: none; background: var(--surface); }
.prose { font-size: 1.12rem; line-height: 1.75; margin-top: 24px; }
.prose p { margin: 0 0 1.1em; }
.callout { position: relative; margin: 28px 0; padding: 20px 22px 20px 26px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--c) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.callout::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 4px; background: var(--c); }
.callout h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c); margin-bottom: 6px; }
html.theme-dark .callout h2 { filter: brightness(1.35); }
.callout p { margin: 0; font-size: 1.05rem; }
.keypoints h2, .sources h2 { font-size: 1.2rem; margin: 30px 0 12px; }
.keypoints ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.keypoints li { position: relative; padding: 12px 14px 12px 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.keypoints li::before { content: ""; position: absolute; left: 16px; top: 20px; width: 10px; height: 10px; border-radius: 3px; background: var(--brand); transform: rotate(45deg); }
.sources ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.sources a { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); transition: .2s; }
.sources a:hover { border-color: var(--brand); transform: translateX(3px); }
.sources a svg { color: var(--brand); margin-top: 2px; }
.sources span { display: flex; flex-direction: column; gap: 2px; }
.sources em { font-style: normal; color: var(--muted); font-size: .92rem; }
.sources small { color: var(--muted); font-size: .78rem; }
.ai-note { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .85rem; margin: 26px 0; }
.ai-note svg { width: 16px; height: 16px; color: var(--brand); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 28px 0 10px; }
.pager a { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 600; font-size: .92rem; line-height: 1.3; }
.pager a:hover { border-color: var(--brand); }
.pager a.next { justify-content: flex-end; text-align: right; }
.pager small { display: block; color: var(--hot); font-weight: 800; }
.pager span span, .pager a > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- sections / archive ---------- */
.section-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile { position: relative; padding: 22px; border-radius: var(--radius); background: linear-gradient(140deg, color-mix(in srgb, var(--c) 22%, var(--surface)), var(--surface) 60%); border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line)); min-height: 170px; display: flex; flex-direction: column; transition: .3s var(--ease); overflow: hidden; }
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.tile-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 25%, transparent); margin-bottom: 18px; }
.tile h2 { font-size: 1.35rem; }
.tile p { color: var(--muted); font-size: .92rem; margin: 8px 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile small { margin-top: auto; font-weight: 700; color: var(--c); }
html.theme-dark .tile small { filter: brightness(1.3); }
.archive-list { display: grid; gap: 12px; }
.archive-item { display: flex; gap: 18px; align-items: center; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: .2s; }
.archive-item:hover { border-color: var(--brand); transform: translateY(-2px); }
.archive-date { width: 64px; height: 64px; border-radius: 16px; background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-content: center; text-align: center; flex-shrink: 0; line-height: 1.05; }
.archive-date b { font-size: 1.6rem; font-family: var(--display); }
.archive-date span { font-size: .75rem; text-transform: uppercase; font-weight: 700; letter-spacing: .08em; }
.archive-item h2 { font-size: 1.15rem; margin-bottom: 6px; }
.archive-item ol { margin: 0; padding-left: 18px; color: var(--muted); font-size: .92rem; }
.archive-count { margin-left: auto; font-weight: 800; color: var(--muted); background: var(--surface-2); padding: 6px 12px; border-radius: 999px; font-size: .85rem; }

/* ---------- footer ---------- */
.site-footer { margin-top: 70px; padding: 34px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.foot-brand { display: flex; align-items: center; gap: 10px; }
.foot-brand img { border-radius: 8px; }
.site-footer p { max-width: 680px; }
.foot-links a { color: var(--text); font-weight: 600; }

/* ---------- bottom tab bar (mobile) ---------- */
.tabbar { display: none; }

/* ---------- sheets (saved + search) ---------- */
.sheet { position: fixed; inset: 0; z-index: 100; pointer-events: none; visibility: hidden; transition: visibility 0s .4s; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(2,6,16,.55); opacity: 0; transition: opacity .3s; backdrop-filter: blur(2px); }
.sheet-panel { position: absolute; left: 50%; bottom: 0; width: min(760px, 100%); max-height: 78vh; display: flex; flex-direction: column; transform: translate(-50%, 105%); transition: transform .4s var(--ease); background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; box-shadow: 0 -20px 50px rgba(0,0,0,.35); padding-bottom: env(safe-area-inset-bottom); }
.sheet.open { pointer-events: auto; visibility: visible; transition: visibility 0s; }
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: translate(-50%, 0); }
.sheet-grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 10px auto 0; }
html.theme-dark .sheet-grip { background: rgba(255,255,255,.2); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.2rem; }
.sheet-head > div { display: flex; gap: 6px; align-items: center; }
.chip-btn { padding: 7px 12px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: .82rem; }
.saved-list { overflow-y: auto; padding: 14px 18px 22px; display: grid; gap: 10px; }
.saved-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.saved-item img { width: 76px; height: 50px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.saved-item a { flex: 1; min-width: 0; }
.saved-item b { display: block; font-size: .92rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.saved-item .badge { font-size: .66rem; padding: 2px 8px; margin-top: 4px; }
.saved-item .save-btn { background: var(--gold); color: #111; }
.saved-empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.search-sheet .sheet-panel { top: 70px; bottom: auto; border-radius: 22px; border-bottom: 1px solid var(--line); transform: translate(-50%, -20px); opacity: 0; transition: transform .3s var(--ease), opacity .25s; max-height: calc(100vh - 100px); }
.search-sheet.open .sheet-panel { transform: translate(-50%, 0); opacity: 1; }
.search-box { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.search-box svg { color: var(--muted); }
.search-box input { flex: 1; font: inherit; font-size: 1.1rem; background: none; border: 0; color: var(--text); padding: 8px 0; outline: none; }
.search-results { overflow-y: auto; padding: 10px; }
.search-results .muted { padding: 10px 8px; margin: 0; }
.sr { display: block; padding: 12px; border-radius: 12px; }
.sr:hover, .sr:focus { background: var(--surface-2); }
.sr b { display: block; line-height: 1.3; }
.sr small { color: var(--muted); }
.sr i { font-style: normal; font-weight: 700; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--tabbar-h)); transform: translate(-50%, 20px); opacity: 0; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; transition: .3s var(--ease); z-index: 200; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .row-scroll { grid-auto-columns: minmax(240px, 31%); }
}
@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .section-tiles { grid-template-columns: 1fr 1fr; }
  html.list-view .top-grid { grid-template-columns: 1fr; }
  .topnav { display: none; }
}
@media (max-width: 640px) {
  :root { --tabbar-h: calc(64px + env(safe-area-inset-bottom)); }
  .wrap, .wrap-narrow { padding: 0 16px; }
  .appbar-inner { padding: 8px 16px; }
  .appbar-actions [data-action="saved"] { display: none; }
  .brand-text { font-size: 1.08rem; }
  .filterbar { top: 57px; }
  .fbar-label, .fbar-link { display: none; }
  .fbar-dates .fbar-inner, .fbar-cats .fbar-inner { padding-top: 8px; padding-bottom: 8px; }
  .date { min-width: 64px; padding: 5px 10px; }
  .chips { flex-wrap: nowrap; gap: 6px; }
  .chip { padding: 6px 9px 6px 11px; font-size: .8rem; gap: 5px; }
  .chip i { width: 7px; height: 7px; }
  .chip b { font-size: .66rem; min-width: 17px; padding: 1px 5px; }
  .fbar-cats .scroller { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 24px; }
  .filterbar.compact .fbar-dates { max-height: 0; opacity: 0; border-color: transparent; }
  .digest-head { padding-top: 24px; }
  .intro { font-size: 1rem; }
  .hero-slide { aspect-ratio: 4/5; min-height: 0; max-height: 70vh; }
  .hero-text p { -webkit-line-clamp: 3; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .top-grid .card:nth-child(n+4) .card-link { flex-direction: row; }
  .top-grid .card:nth-child(n+4) .card-media { width: 120px; aspect-ratio: 1; flex-shrink: 0; }
  .top-grid .card:nth-child(n+4) .card-body { padding: 10px 12px; }
  .top-grid .card:nth-child(n+4) h3 { font-size: .98rem; padding-right: 26px; }
  .top-grid .card:nth-child(n+4) .card-dek { display: none; }
  .top-grid .card:nth-child(n+4) .card-top { top: 6px; left: 6px; right: 6px; }
  .top-grid .card:nth-child(n+4) .badge { display: none; }
  .top-grid .card:nth-child(n+4) .save-btn { width: 28px; height: 28px; }
  .top-grid .card:nth-child(n+4) .rank { position: absolute; right: 0; top: 0; min-width: 26px; height: 26px; font-size: .8rem; }
  html.list-view .top-grid .card-media { width: 110px; }
  .row-scroll { grid-auto-columns: 72%; }
  .section-tiles { grid-template-columns: 1fr; }
  .story-media { aspect-ratio: 16/10; margin-left: -16px; margin-right: -16px; border-radius: 0; }
  .prose { font-size: 1.06rem; }
  .pager { grid-template-columns: 1fr; }
  .pill-btn span { display: none; }
  .archive-item { padding: 14px; gap: 14px; }
  .archive-count { display: none; }
  .site-footer { margin-top: 40px; }

  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom); background: var(--glass); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .7rem; font-weight: 600; color: var(--muted); }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar .on { color: var(--brand); }
  .sheet-panel { padding-bottom: calc(env(safe-area-inset-bottom) + 8px); }
  .search-sheet .sheet-panel { top: 10px; width: calc(100% - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.saved-count[hidden] { display: none; }
.saved-item a:first-child { flex: 0 0 auto; }
.preview-link { color: #fff; font-weight: 700; text-decoration: underline; margin-left: 6px; white-space: nowrap; }

/* ---------- newsletter ---------- */
.newsletter { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; padding: 28px; border-radius: calc(var(--radius) + 4px); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 22%, var(--surface)), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); }
.newsletter h2 { font-size: 1.45rem; margin-bottom: 6px; }
.newsletter p { margin: 0; color: var(--muted); }
.nl-row { display: flex; gap: 8px; }
.nl-row input[type=email] { flex: 1; min-width: 0; font: inherit; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.nl-row input:focus { outline: none; border-color: var(--brand); }
.nl-row button { padding: 13px 20px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; white-space: nowrap; box-shadow: 0 6px 16px rgba(30,144,255,.35); }
.nl-row button:hover { filter: brightness(1.08); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.nl-msg { grid-column: 1 / -1; font-weight: 600; min-height: 0; }
.nl-msg:empty { display: none; }
.nl-msg.ok { color: #22c55e !important; }
.nl-msg.err { color: #ef4444 !important; }
.newsletter.compact { grid-template-columns: 1fr; gap: 10px; padding: 18px; margin: 18px 0; max-width: 560px; background: var(--surface); }
.newsletter.compact h2 { font-size: 1.05rem; }
.newsletter.compact .nl-text p { font-size: .88rem; }
.newsletter.compact .nl-row { flex-wrap: nowrap; }
@media (max-width: 760px) { .newsletter { grid-template-columns: 1fr; padding: 20px; } .nl-row { flex-direction: column; } }
.newsletter.compact .nl-row { flex-direction: row; }

/* ---------- originals & rich prose ---------- */
.orig-tag { color: var(--hot); font-weight: 800; }
.card.original .card-meta::before { content: "Original · "; color: var(--hot); font-weight: 700; }
.prose h2 { font-size: 1.45rem; margin: 1.4em 0 .5em; }
.prose h3 { font-size: 1.2rem; margin: 1.2em 0 .4em; }
.prose ul { padding-left: 1.3em; margin: 0 0 1.1em; }
.prose li { margin-bottom: .4em; }
.prose blockquote { margin: 1.2em 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--brand); color: var(--muted); font-style: italic; }
.prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- read aloud: briefing button + player ---------- */
.stat-row { align-items: center; }
.briefing-btn { display: inline-flex; align-items: center; gap: 9px; padding: 4px 14px 4px 4px; border-radius: 999px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 16px rgba(30,144,255,.3); transition: transform .2s var(--ease), box-shadow .2s; text-align: left; font: inherit; border: 0; cursor: pointer; }
.briefing-btn:hover { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(30,144,255,.4); }
.briefing-btn[hidden] { display: none; }
.bb-icon { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--brand-2); display: grid; place-items: center; flex-shrink: 0; }
.bb-icon svg { width: 14px; height: 14px; margin-left: 2px; }
.bb-text { display: flex; flex-direction: column; line-height: 1.15; }
.bb-text b { font-family: var(--display); font-size: .86rem; white-space: nowrap; }
.bb-text small { opacity: .85; font-size: .72rem; white-space: nowrap; }
.bb-wave { display: flex; align-items: flex-end; gap: 2px; height: 14px; margin-left: 2px; }
.bb-wave i { width: 3px; height: 30%; background: rgba(255,255,255,.75); border-radius: 2px; }
.briefing-btn.is-active .bb-wave i { animation: wave 1s ease-in-out infinite; }
.briefing-btn.is-active .bb-wave i:nth-child(2) { animation-delay: .15s; } .briefing-btn.is-active .bb-wave i:nth-child(3) { animation-delay: .3s; } .briefing-btn.is-active .bb-wave i:nth-child(4) { animation-delay: .45s; }
@keyframes wave { 0%, 100% { height: 25%; } 50% { height: 100%; } }
.listen-btn[hidden] { display: none; }
.listen-btn.is-active { border-color: var(--brand); color: var(--brand); }

.player { position: fixed; left: 50%; bottom: calc(16px + var(--tabbar-h)); transform: translateX(-50%); width: min(720px, calc(100% - 24px)); z-index: 70; background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 40px rgba(0,0,0,.4); overflow: hidden; animation: plIn .35s var(--ease); }
.player[hidden] { display: none; }
@keyframes plIn { from { transform: translate(-50%, 20px); opacity: 0; } }
.pl-progress { height: 3px; background: var(--line); }
.pl-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--hot)); transition: width .4s; }
.pl-inner { display: flex; align-items: center; gap: 6px; padding: 8px 10px; }
.pl-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--text); flex-shrink: 0; }
.pl-btn:hover { background: var(--surface-2); }
.pl-main { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; }
.pl-main:hover { background: var(--brand-2); }
.player .i-play { display: none; } .player.is-paused .i-play { display: grid; } .player.is-paused .i-pause { display: none; }
.pl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; padding: 0 6px; color: var(--text); }
.pl-info small { color: var(--muted); font-size: .74rem; font-weight: 600; }
.pl-info b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.pl-info[href]:hover b { color: var(--brand); }
.pl-speed { flex-shrink: 0; min-width: 46px; height: 32px; border-radius: 10px; border: 1px solid var(--line); font-weight: 700; font-size: .82rem; color: var(--text); }
.pl-speed:hover { border-color: var(--brand); }
body.has-player .site-footer { padding-bottom: 120px; }
body.has-player .toast { bottom: calc(100px + var(--tabbar-h)); }
.card.is-playing { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand), var(--shadow); }
.card.is-playing .rank { background: var(--brand); box-shadow: 0 4px 12px rgba(30,144,255,.5); }
@media (max-width: 640px) {
  .pl-inner { gap: 2px; padding: 6px 8px; }
  .pl-btn { width: 34px; height: 34px; }
  .pl-main { width: 42px; height: 42px; }
  .pl-speed { min-width: 40px; }
}

/* newsletter: daily / weekly choice */
.nl-freq { grid-column: 2; display: flex; gap: 6px; align-items: center; margin-top: -14px; }
.nl-freq::before { content: 'Send me:'; font-size: .85rem; color: var(--muted); margin-right: 4px; }
.nl-freq label { cursor: pointer; }
.nl-freq input { position: absolute; opacity: 0; pointer-events: none; }
.nl-freq span { display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--muted); transition: .15s; }
.nl-freq input:checked + span { background: color-mix(in srgb, var(--brand) 18%, transparent); border-color: var(--brand); color: var(--text); }
.nl-freq input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.newsletter.compact .nl-freq { grid-column: auto; margin-top: -2px; }
@media (max-width: 760px) { .nl-freq { grid-column: auto; margin-top: -10px; } }
/* keep the signup form inside narrow screens */
.newsletter.compact { grid-template-columns: minmax(0, 1fr); }
.newsletter > * { min-width: 0; }
@media (max-width: 760px) { .newsletter { grid-template-columns: minmax(0, 1fr); } .nl-row button { flex-shrink: 0; } }
/* about page */
.about .prose li { margin-bottom: .55em; }
.about h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); }
.btn-link { display: inline-block; margin-top: 6px; padding: 11px 20px; border-radius: 999px; background: var(--brand); color: #fff !important; font-weight: 700; text-decoration: none !important; }
.btn-link:hover { filter: brightness(1.08); }
@media (max-width: 760px) { .digest-head .stat-row { padding-bottom: 14px; } }

/* app install / alerts banner */
.app-banner { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--tabbar-h)); z-index: 80; display: flex; align-items: center; gap: 12px; padding: 12px 40px 12px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 40px rgba(0,0,0,.45); transform: translateY(24px); opacity: 0; transition: .3s var(--ease); max-width: 560px; margin: 0 auto; }
.app-banner.show { transform: none; opacity: 1; }
.app-banner img { border-radius: 11px; flex-shrink: 0; }
.ab-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ab-text b { font-family: var(--display); font-size: .95rem; }
.ab-text span { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.ab-share { width: 15px; height: 15px; vertical-align: -3px; color: var(--brand); }
.ab-go { flex-shrink: 0; border: 0; border-radius: 999px; padding: 9px 16px; font: 700 .85rem var(--display); color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); cursor: pointer; }
.ab-x { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border: 0; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; border-radius: 50%; }
.ab-x:hover { background: var(--line); }
/* bell turns blue when edition alerts are on */
.notify-btn.is-on { color: var(--brand); }
.notify-btn.is-on svg path { fill: currentColor; fill-opacity: .25; }
.foot-copy { font-size: .78rem; color: var(--muted); opacity: .8; margin-top: 10px; }
