/* ── Top nav ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 12px; z-index: 1100;
  margin: 12px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 10px 18px;
  background: var(--paper-glass);
  backdrop-filter: blur(12px);
  border: 1.5px solid var(--ink); border-radius: 999px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: 'Archivo Black', sans-serif; font-size: 20px; letter-spacing: -1px; text-transform: uppercase; white-space: nowrap; }
.brand .blob { width: 22px; height: 22px; border-radius: 60% 40% 30% 70%/60% 30% 70% 40%; background: var(--accent); border: 1.5px solid var(--ink); flex-shrink: 0; }
.brand .status { display: inline-flex; gap: 6px; align-items: center; margin-left: 8px; }
.brand .status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.brand .status .dot.off { background: var(--ink-mute); }
.nav-items { display: flex; gap: 4px; }
#nav-items { position: absolute; left: 50%; transform: translateX(-50%); }
.nav-items button { font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 13px; padding: 7px 14px; border-radius: 999px; border: none; background: transparent; color: var(--ink-2); }
.nav-items button.on { background: var(--ink); color: var(--paper); font-weight: 700; }
.nav-items button:hover:not(.on) { background: rgba(24, 21, 18, 0.06); }
.nav-cta { font-family: 'DM Sans'; font-weight: 700; font-size: 13px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--ink-on-accent); background: var(--accent); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.nav-cta:hover { background: var(--accent-soft); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.theme-btn { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; font-size: 15px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--ink); line-height: 1; padding: 0; }
.theme-btn:hover { background: var(--paper-2); }

/* ── Main layout ────────────────────────────────────────────────────────── */
main { max-width: 1320px; margin: 0 auto; padding: 28px 24px 40px; }
.page { display: none; }
.page.on { display: block; }

/* ── Page hero ──────────────────────────────────────────────────────────── */
.pg-hero { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.pg-hero .left .pg-label { margin-bottom: 6px; }
.pg-hero .title { font-family: 'Archivo Black', sans-serif; font-size: 64px; letter-spacing: -3px; line-height: 0.9; text-transform: uppercase; }
.pg-hero .title em { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; text-transform: none; letter-spacing: -2px; }
.pg-hero .actions { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

/* ── Pills ──────────────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--ink); background: var(--paper); font-size: 11px; font-weight: 500; white-space: nowrap; }
.pill.accent  { background: var(--accent); font-weight: 700; }
.pill.solid   { background: var(--ink); color: var(--paper); }
.pill.ghost   { background: transparent; border-style: dashed; }
.pill.danger  { background: #fde3df; color: #7a2015; border-color: #7a2015; }
.pill.sm      { font-size: 10px; padding: 3px 9px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn { padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--accent); font-family: 'DM Sans'; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.btn:not(.ghost):not(.solid):not(.danger):not(.on) { border-color: var(--ink-on-accent); }
.btn.ghost  { background: transparent; }
.btn.solid  { background: var(--ink); color: var(--paper); }
.btn.sm     { padding: 6px 14px; font-size: 12px; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.on     { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn:hover:not(.danger) { opacity: 0.85; }
.recs-panel { background: var(--paper-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 calc(50% - 50vw) 30px; padding: 18px calc(50vw - 50%) 8px; }
.hstrip { display: flex; flex-wrap: nowrap; gap: 16px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.hstrip > * { flex: none; }
.hstrip::-webkit-scrollbar { height: 8px; }
.hstrip::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 999px; }

/* ── Boxes ──────────────────────────────────────────────────────────────── */
.box        { border: 1px solid var(--ink); border-radius: 18px; padding: 14px; }
.box.soft   { border-color: var(--rule); }
.box.accent { background: var(--accent-soft); }
.box.dashed { border-style: dashed; }

/* ── Slam hero ──────────────────────────────────────────────────────────── */
.slam { background: var(--ink); color: var(--paper); border-radius: 20px; padding: 28px 28px 22px; display: flex; flex-direction: column; gap: 14px; border: 1.5px solid var(--ink); }
.slam .date { font-family: 'Space Mono'; font-size: 11px; letter-spacing: 0.08em; opacity: 0.65; }
.slam h1 { margin: 0; font-family: 'Archivo Black'; font-size: clamp(40px, 5vw, 72px); letter-spacing: -3.5px; line-height: 0.88; text-transform: lowercase; }
.slam h1 em { font-family: 'Instrument Serif'; font-style: italic; color: var(--accent); font-weight: 400; text-transform: none; }
.slam-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.slam-pills .pill { background: transparent; color: var(--paper); border-color: rgba(255, 255, 255, 0.3); }
.slam-pills .pill.a { background: var(--accent); color: var(--ink); border-color: var(--accent); }

/* ── Section sub-head ───────────────────────────────────────────────────── */
.sub-head { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 0 10px; flex-wrap: wrap; gap: 8px; }
.sub-head h3 { font-family: 'Archivo Black'; font-size: 26px; letter-spacing: -1.5px; text-transform: uppercase; margin: 0; }
.sub-head h3 em { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; text-transform: none; letter-spacing: -1px; }

/* ── Strip + album card ─────────────────────────────────────────────────── */
.strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; align-items: flex-start; }
.strip-wrap { min-width: 0; overflow: hidden; }

.album-card { flex: 0 0 140px; width: 140px; display: flex; flex-direction: column; gap: 5px; overflow: hidden; }
.album-card.sm { flex: 0 0 130px; width: 130px; }
.album-card.lg { flex: 0 0 160px; width: 160px; overflow: visible; }
.album-card.lg .title, .album-card.lg .artist, .album-card.lg .reason { white-space: normal; overflow: visible; text-overflow: unset; }
.album-card .art { aspect-ratio: 1; border-radius: 12px; object-fit: cover; width: 100%; border: 1px solid var(--rule); }
.album-card .art.ph { background: repeating-linear-gradient(135deg, transparent 0, transparent 7px, rgba(24, 21, 18, 0.1) 7px, rgba(24, 21, 18, 0.1) 8px); display: flex; align-items: center; justify-content: center; font-family: 'Space Mono'; font-size: 9px; color: var(--ink-mute); }
.album-card .art-wrap { position: relative; width: 100%; }
.album-card .match-badge { position: absolute; top: 6px; left: 6px; font-family: 'Space Mono'; font-size: 9px; font-weight: 700; padding: 2px 6px; background: var(--accent); border: 1px solid var(--ink); border-radius: 4px; letter-spacing: 0.05em; }
.album-card .title { font-weight: 700; font-size: 12px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-card .artist { font-size: 11px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-card .reason { font-size: 10px; color: var(--ink-2); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-card .progress { height: 4px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; margin-top: 3px; }
.album-card .progress .fill { height: 100%; background: var(--ink); }
.album-card .track-count { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); }

/* ── Ticker ─────────────────────────────────────────────────────────────── */
.ticker { border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); background: var(--accent); padding: 12px 0; overflow: hidden; position: relative; left: 50%; margin-left: -50vw; margin-right: -50vw; width: 100vw; }
.ticker-track { display: flex; gap: 32px; white-space: nowrap; width: max-content; animation: scroll 70s linear infinite; font-family: 'Archivo Black'; font-size: 20px; letter-spacing: -0.8px; text-transform: uppercase; }
.ticker-track .s { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; text-transform: lowercase; font-size: 20px; letter-spacing: 0; }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes scroll-reverse { from { transform: translateX(-50%); } to { transform: translateX(0); } }

/* ── Feed row ───────────────────────────────────────────────────────────── */
.feed-row { display: flex; align-items: center; gap: 10px; padding: 3px 8px; border-radius: 12px; border: 1px solid var(--rule); transition: background 0.12s; }
.feed-row:hover { background: rgba(24, 21, 18, 0.04); }
.feed-row .thumb { width: 56px; height: 56px; border-radius: 10px; flex-shrink: 0; object-fit: cover; border: 1px solid var(--rule); }
.feed-row .thumb.ph { background: repeating-linear-gradient(135deg, transparent 0, transparent 5px, rgba(24, 21, 18, 0.08) 5px, rgba(24, 21, 18, 0.08) 6px); }
.feed-row .info { flex: 1; min-width: 0; }
.feed-row .info .t { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-row .info .s { font-size: 12px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.feed-row .time { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); flex-shrink: 0; }

/* ── Day header ─────────────────────────────────────────────────────────── */
.day-header { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 0 8px; }
.day-header .day-label { font-family: 'Space Mono'; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); }
.day-header .day-count { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); }

/* ── Album-grouped track list ───────────────────────────────────────────── */
.album-group { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; padding: 4px 6px 6px; align-items: start; }
.album-group + .album-group { border-top: 1px solid var(--rule); }
.ag-art-wrap { grid-column: 1; grid-row: 1 / 3; width: 52px; height: 52px; border-radius: 8px; border: 1px solid var(--rule); overflow: hidden; align-self: start; }
.ag-art-wrap.ph { background: repeating-linear-gradient(135deg, transparent 0, transparent 5px, rgba(24,21,18,0.08) 5px, rgba(24,21,18,0.08) 6px); }
.ag-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.ag-artist { grid-column: 2; grid-row: 1; font-size: 11px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 1px; text-decoration: none; display: block; transition: color 0.12s; }
.ag-artist:hover { color: var(--ink); }
.ag-tracks { grid-column: 2; grid-row: 2; min-width: 0; }
.ag-row { display: flex; align-items: baseline; gap: 8px; padding: 2px 0 0; }
.ag-row:hover { background: rgba(24, 21, 18, 0.03); border-radius: 4px; }
.ag-track { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; text-decoration: none; transition: opacity 0.12s; }
.ag-track:hover { opacity: 0.65; }
.ag-time { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); flex-shrink: 0; }

/* ── Strava distance chart ──────────────────────────────────────────────── */
.strava-dist-panel { padding: 0; }
.sdc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sdc-sub { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); letter-spacing: 0.04em; }
.sdc-date { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.sdc-chart-wrap { position: relative; }
.sdc-overlay { position: absolute; bottom: 12px; right: 14px; text-align: right; pointer-events: none; line-height: 1; }
.sdc-val { font-family: 'Archivo Black'; font-size: 64px; letter-spacing: -3px; line-height: 1; color: var(--ink); }
.sdc-unit { font-size: 28px; letter-spacing: -1px; margin-left: 4px; }
.strava-dist-chart { width: 100%; height: 160px; display: block; cursor: crosshair; }
.strava-dist-chart .area { fill: #c9ff47; opacity: 0.2; }
.strava-dist-chart .trace { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.strava-dist-chart .cursor { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 5; opacity: 0.3; }
.strava-dist-chart .dot { fill: #c9ff47; stroke: var(--ink); stroke-width: 2; }

/* ── Strava activity card ───────────────────────────────────────────────── */
.activity-block { border: 1px solid var(--ink); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.activity-block .act-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.activity-block .act-title { font-family: 'Archivo Black'; font-size: 20px; letter-spacing: -1px; }
.activity-block .act-meta { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); margin-top: 4px; }
.act-play-btn { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--ink); background: var(--accent-soft); color: var(--ink); font-size: 12px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.act-play-btn:disabled { opacity: 0.6; cursor: default; }
.act-tracks { margin-top: 12px; padding-top: 10px; }
.act-tracks-label { font-family: 'Space Mono'; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 8px; }
.map-ph { border-radius: 14px; border: 1px solid var(--ink); background: repeating-linear-gradient(90deg, transparent 0, transparent 23px, rgba(24, 21, 18, 0.04) 23px, rgba(24, 21, 18, 0.04) 24px), repeating-linear-gradient(0deg, transparent 0, transparent 23px, rgba(24, 21, 18, 0.04) 23px, rgba(24, 21, 18, 0.04) 24px), var(--paper); overflow: hidden; }

/* ── Stat grid ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-grid.three { grid-template-columns: repeat(3, 1fr); }
.stat-cell { border: 1px solid var(--ink); border-radius: 14px; padding: 10px 12px; }
.stat-cell .v { font-family: 'Archivo Black'; font-size: 22px; line-height: 1; letter-spacing: -1px; }
.stat-cell .v sub { font-family: 'DM Sans'; font-size: 12px; font-weight: 500; vertical-align: baseline; }
.stat-cell .k { font-family: 'Space Mono'; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); margin-top: 4px; }

/* ── Period grid ────────────────────────────────────────────────────────── */
.period-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.period-card { border: 1px solid var(--ink); border-radius: 14px; padding: 14px; }
.period-card.current { background: var(--accent-soft); }
.period-card .pc-title { font-weight: 700; font-size: 14px; }
.period-card .pc-range { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); margin-top: 2px; }
.period-card .pc-stats { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.period-card .pc-stats .row { display: flex; justify-content: space-between; }
.period-card .pc-stats .k { color: var(--ink-mute); }
.period-card .pc-stats .v { font-weight: 700; }

/* ── Disclosure ─────────────────────────────────────────────────────────── */
.disclosure { border: 1px solid var(--ink); border-radius: 12px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-family: 'Space Mono'; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 12px; }
.disclosure:hover { background: rgba(24, 21, 18, 0.04); }
.disclosure[aria-expanded="true"] { border-radius: 12px 12px 0 0; border-bottom: none; }
.disclosure-arrow { display: inline-block; width: 10px; margin-right: 6px; }
.disclosure-body { display: none; border: 1px solid var(--ink); border-top: none; border-radius: 0 0 12px 12px; overflow: hidden; padding: 12px 0 0; }
.disclosure-body.on { display: block; }
.disclosure-body iframe { border: none !important; box-shadow: none !important; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--paper-2); border: 1.5px solid var(--ink); border-radius: 999px; align-self: flex-start; }
.tabs button { padding: 7px 16px; border-radius: 999px; border: none; background: transparent; font-family: 'DM Sans'; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.tabs button.on { background: var(--ink); color: var(--paper); }
.tabs button:hover:not(.on) { background: rgba(24, 21, 18, 0.06); }
.tab-content { display: none; margin-top: 20px; }
.tab-content.on { display: block; }

/* ── Artist trends grid ─────────────────────────────────────────────────── */
.trends-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.artist-card { border: 1px solid var(--ink); border-radius: 14px; padding: 12px 14px; transition: background 0.15s; }
.artist-card:hover { background: rgba(24, 21, 18, 0.04); }
.top-artist-row { transition: background 0.15s; border-radius: 6px; }
.top-artist-row:hover { background: rgba(24, 21, 18, 0.04); }
.artist-card .ac-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.artist-card .ac-head { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.artist-card .ac-rank { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); flex-shrink: 0; width: 24px; }
.artist-card .ac-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist-card a.ac-name { transition: color 0.12s; }
.artist-card a.ac-name:hover { color: var(--ink); }
.artist-card .ac-metrics { display: flex; gap: 10px; flex-shrink: 0; margin-left: 8px; }
.artist-card .ac-metric { text-align: right; }
.artist-card .ac-metric .lbl { font-size: 9px; color: var(--ink-mute); }
.artist-card .ac-metric .val { font-size: 12px; font-weight: 700; }
#genre-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 calc(-50vw + 50%); padding: 14px calc(50vw - 50%); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 24px; }
#genre-scroll-wrap { position: relative; left: 50%; margin-left: -50vw; margin-top: 12px; margin-bottom: 24px; width: 100vw; overflow-x: scroll; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; padding: 64px 0; box-sizing: border-box; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
#genre-scroll-wrap::-webkit-scrollbar { display: none; }
#genre-scroll-track { position: relative; }
#genre-stage { position: sticky; left: 0; width: 100vw; perspective: 1600px; perspective-origin: 50% 50%; }
#genre-rotor { position: relative; width: 100%; transform-style: preserve-3d; will-change: transform; }
.genre-ring { position: relative; display: flex; flex-wrap: nowrap; transform-style: preserve-3d; }
#genre-scroll-wrap .genre-pill { backface-visibility: hidden; }
.genre-pill { font-family: 'Space Mono'; font-size: 9px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--ink); background: var(--accent-soft); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex-shrink: 0; transition: background 0.12s; margin: 2px 4px; }
.genre-pill:hover { background: var(--accent); }
.genre-pill.on { background: var(--ink); color: var(--paper); }
.genre-pill .genre-count { opacity: 0.55; }
.genre-pill.on .genre-count { opacity: 0.7; }
.artist-link { color: inherit; text-decoration: none; transition: color 0.12s; }
.artist-link:hover,
.artist-link.muted:hover { color: var(--ink); }
.artist-link.muted { color: var(--ink-mute); }
.delta-up   { color: var(--color-positive); font-family: 'Space Mono'; font-size: 11px; font-weight: 700; }
.delta-down { color: var(--danger); font-family: 'Space Mono'; font-size: 11px; font-weight: 700; }
.delta-flat { color: var(--ink-mute); font-family: 'Space Mono'; font-size: 11px; }
.artist-card .ac-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; border-top: 1px solid var(--rule); padding-top: 8px; }
.artist-card .ac-stats > div { display: flex; justify-content: space-between; align-items: baseline; }
.artist-card .ac-stats .lbl { font-size: 9px; color: var(--ink-mute); }
.artist-card .ac-stats .val { font-size: 10px; font-weight: 700; }

/* ── Search input ───────────────────────────────────────────────────────── */
.search-wrap { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--paper); }
.search-wrap input { border: none; background: transparent; outline: none; font-family: 'DM Sans'; font-size: 13px; flex: 1; color: var(--ink); }

/* ── News ───────────────────────────────────────────────────────────────── */
.news-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; margin-top: 20px; align-items: start; }
.news-list { overflow-y: auto; height: calc(100vh - 220px); height: calc(100dvh - 220px); min-height: 300px; }
.news-item { border-top: 1px solid var(--rule); padding: 12px 8px; cursor: pointer; border-radius: 10px; transition: background 0.12s; }
.news-item:first-child { border-top: none; }
.news-item:hover { background: rgba(24, 21, 18, 0.04); }
.news-item.on { background: var(--accent-soft); border: 1px solid var(--ink); margin: 0; padding: 12px; }
.news-item .ni-source { font-family: 'Space Mono'; font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 4px; }
.news-item .ni-title { font-weight: 700; font-size: 13.5px; line-height: 1.25; }
.news-item .ni-meta { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); margin-top: 4px; }
.news-reader { border: 1px solid var(--ink); border-radius: 18px; padding: 0; overflow: hidden; height: calc(100vh - 220px); height: calc(100dvh - 220px); min-height: 300px; display: flex; flex-direction: column; }
.news-reader .nr-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.news-reader iframe, .news-email-frame { width: 100%; height: 100%; border: none; display: block; flex: 1; min-height: 0; }
.news-reader-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.news-rtoolbar { display: none; }  /* mobile-only; shown via the reader-open overlay */

/* ── Day header + summarise button ──────────────────────────────────────── */
.news-day { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0 6px; }
.news-day .label { margin: 0; }

/* ── Claude summary view ────────────────────────────────────────────────── */
.news-summary { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px; }
.news-summary .ns-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.news-summary .ns-title { font-family: 'Space Mono'; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); }
.news-summary .ns-body { font-size: 13.5px; line-height: 1.65; color: var(--ink); }
.news-summary .ns-body h4 { font-family: 'Space Mono'; font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); margin: 22px 0 7px; }
.news-summary .ns-body h4:first-child { margin-top: 0; }
.news-summary .ns-body p { margin: 6px 0; }
.news-summary .ns-body ul { margin: 6px 0 14px; padding-left: 18px; }
.news-summary .ns-body li { margin: 5px 0; }
.news-summary .ns-body li::marker { color: var(--ink-mute); }
.news-summary .ns-body strong { font-weight: 700; }
.news-summary .ns-body a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.news-summary .ns-body table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 12.5px; }
.news-summary .ns-body th, .news-summary .ns-body td { text-align: left; padding: 6px 10px; border: 1px solid var(--rule); vertical-align: top; }
.news-summary .ns-body th { font-family: 'Space Mono'; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-mute); }

/* ── Health day controls ────────────────────────────────────────────────── */
.health-day-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.health-day-controls .health-day-label {
  position: relative; display: inline-flex; align-items: center;
  font-family: 'Archivo Black'; font-size: 13px; letter-spacing: -0.4px;
  text-transform: uppercase; color: var(--ink); cursor: pointer;
  background: transparent; border: none; padding: 6px 8px; margin: 0 2px;
}
.health-day-controls .health-day-label:hover { opacity: 0.7; }
.health-day-controls .health-day-label input[type="date"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; padding: 0; cursor: pointer;
}
.health-day-controls .health-day-label input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: transparent; cursor: pointer;
}
.health-day-controls .btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ── Health ─────────────────────────────────────────────────────────────── */
.health-hr-panel,.health-sleep-stages-panel,.health-sb-panel,.health-steps-panel { border: none; border-radius: 0; padding: 20px 10vw; background: transparent; box-shadow: none; width: 100vw; margin-left: calc(50% - 50vw); }
.hc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
/* Daily chart titles match the trends .tc-title scale (11px). */
[data-page="health"] .label { font-size: 11px; }
.health-hr-live { display: flex; align-items: baseline; gap: 10px; }
.health-hr-live #health-hr-live-val { font-family: 'Archivo Black'; font-size: 30px; letter-spacing: -1.5px; line-height: 1; }
.health-hr-live #health-hr-live-time { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.health-hr-meta { margin-top: 4px; display: flex; gap: 16px; flex-wrap: wrap; font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.05em; }
.health-hr-chart,.health-sb-chart { width: 100%; display: block; margin-top: 8px; background: transparent; border-radius: 0; cursor: crosshair; overflow: hidden; }
.health-hr-chart { height: 160px; }
.hr-chart-wrap { position: relative; }
.hr-chart-wrap .health-hr-chart { display: block; }
.hr-spotify-overlay { position: absolute; top: 8px; left: 0; right: 0; height: 220px; pointer-events: none; overflow: visible; }
.hr-album-chip { position: absolute; top: 8px; pointer-events: auto; transform: translateX(-50%); }
.hr-album-chip > img { width: 32px; height: 32px; border-radius: 5px; border: 2px solid var(--paper); box-shadow: 0 1px 6px rgba(0,0,0,0.22); display: block; object-fit: cover; opacity: 0.9; transition: opacity 0.15s; }
.hr-album-chip:hover > img { opacity: 1; }
.hr-album-count { position: absolute; top: -5px; right: -6px; background: #dc2626; color: #fff; font-size: 9px; font-family: 'Space Mono'; border-radius: 8px; padding: 1px 4px; line-height: 1.3; pointer-events: none; }
.hr-album-popout { display: none; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--paper); border: 1.5px solid rgba(24,21,18,0.18); border-radius: 10px; padding: 8px; flex-direction: column; gap: 6px; z-index: 30; min-width: 190px; max-width: 230px; box-shadow: 0 4px 18px rgba(0,0,0,0.14); }
.hr-album-chip:hover .hr-album-popout, .hr-album-chip.chart-active .hr-album-popout { display: flex; }
.hr-album-chip.chart-active:not(:hover) .hr-album-popout-item { display: none; }
.hr-album-chip.chart-active:not(:hover) .hr-album-popout-item.active-track { display: flex; }
.hr-album-chip.near-left .hr-album-popout { left: 0; transform: none; }
.hr-album-chip.near-right .hr-album-popout { left: auto; right: 0; transform: none; }
.hr-album-popout-item { display: flex; align-items: center; gap: 8px; }
.hr-album-popout-item > img { width: 38px; height: 38px; border-radius: 5px; flex-shrink: 0; object-fit: cover; }
.hr-album-popout-info { min-width: 0; overflow: hidden; }
.hr-album-popout-info .track { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-album-popout-info .artist { font-size: 10px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'Space Mono'; }
.hr-album-popout-info .time { font-size: 9px; color: var(--ink-mute); font-family: 'Space Mono'; margin-top: 1px; }
.health-steps-chart { width: 100%; height: 160px; display: block; margin-top: 8px; background: transparent; border-radius: 0; cursor: crosshair; overflow: hidden; }
.health-steps-chart .grid { stroke: rgba(24,21,18,0.12); stroke-width: 1; }
.health-steps-chart .cursor { stroke: rgba(24,21,18,0.5); stroke-width: 1.5; stroke-dasharray: 4 3; }
.health-steps-chart .trace { stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.health-steps-chart .dot { fill: var(--color-steps); stroke: var(--paper); stroke-width: 2; }
.health-steps-live { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.health-steps-live #health-steps-live-val { font-family: 'Archivo Black'; font-size: 30px; letter-spacing: -1.5px; line-height: 1; }
.health-steps-live #health-steps-live-unit { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.health-steps-live #health-steps-live-level { font-family: 'Space Mono'; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.health-steps-live #health-steps-live-time { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.health-sb-chart { height: 160px; }
.health-hr-chart .grid,.health-sb-chart .grid { stroke: rgba(24,21,18,0.12); stroke-width: 1; }
.sleep-stages-wrap { position: relative; display: flex; gap: 0; width: 100%; margin-top: 8px; align-items: stretch; }
.sleep-y-labels { position: relative; width: 38px; flex-shrink: 0; font-family: 'Space Mono'; font-size: 10px; letter-spacing: 0.04em; color: var(--ink-mute); text-align: right; padding-right: 8px; }
.sleep-y-labels span { position: absolute; right: 8px; transform: translateY(-50%); white-space: nowrap; }
.sleep-y-labels span:nth-child(1) { top: 7.9%;  } /* Awake  — BOTTOM - H_USABLE*1.00 = 22px / 140 */
.sleep-y-labels span:nth-child(2) { top: 30.1%; } /* REM    — BOTTOM - H_USABLE*0.78 = 42px / 140 */
.sleep-y-labels span:nth-child(3) { top: 48.2%; } /* Light  — BOTTOM - H_USABLE*0.55 = 67.5px / 140 */
.sleep-y-labels span:nth-child(4) { top: 71.8%; } /* Deep   — BOTTOM - H_USABLE*0.25 = 101px / 140 */
.health-sleep-chart { flex: 1; height: 160px; display: block; background: transparent; border-radius: 0; cursor: crosshair; overflow: hidden; }
.health-sleep-chart .grid { stroke: rgba(24,21,18,0.12); stroke-width: 1; }
.health-sleep-chart .cursor { stroke: rgba(24,21,18,0.5); stroke-width: 1.5; stroke-dasharray: 4 3; }
.sleep-hrv-trace { fill: none; stroke: rgba(24,21,18,0.5); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .sleep-hrv-trace { stroke: rgba(240,236,224,0.65); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sleep-hrv-trace { stroke: rgba(240,236,224,0.65); } }
.health-hr-chart .trace { fill: none; stroke: var(--color-hr); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.health-sb-chart .trace { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.health-sb-chart .trace.stress { stroke: url(#grad-stress-stroke); }
.health-sb-chart .trace.battery { stroke: var(--color-battery); }
.health-sb-chart .sb-avg-line { stroke: var(--color-stress); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.6; }
.health-hr-chart .cursor,.health-sb-chart .cursor { stroke: rgba(24,21,18,0.5); stroke-width: 1.5; stroke-dasharray: 4 3; }
.health-hr-chart .dot { fill: var(--color-hr); stroke: var(--paper); stroke-width: 2; }
.health-sb-chart .dot.stress { fill: var(--color-stress); stroke: var(--paper); stroke-width: 2; }
.health-sb-chart .dot.battery { fill: var(--color-battery); stroke: var(--paper); stroke-width: 2; }
.health-hr-panel .hc-empty,.health-sb-panel .hc-empty { margin-top: 12px; color: var(--ink-mute); font-size: 13px; }
.hc-axis { margin-top: 6px; display: flex; justify-content: space-between; font-family: 'Space Mono'; font-size: 10px; letter-spacing: 0.03em; color: var(--ink-mute); }
.health-sb-live { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.health-sb-live #health-sb-live-stress { font-family: 'Archivo Black'; font-size: 30px; letter-spacing: -1.2px; color: var(--color-stress); }
.health-sb-live #health-sb-live-battery { font-family: 'Archivo Black'; font-size: 30px; letter-spacing: -1.2px; color: var(--color-battery); }
.health-sb-live #health-sb-live-time { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
/* ── Health: view toggle + trends ─────────────────────────────────────── */
/* The Daily/Trends switch and range selector reuse the app-standard .tabs pill. */
/* Banner + controls span the same 80vw band as the charts (content sits at 10vw–90vw). */
[data-page="health"] .slam,
.health-controls-row { width: 80vw; max-width: none; margin-left: calc(50% - 40vw); }
.health-controls-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

.trend-grid { display: block; }

.trend-card { width: 100vw; margin-left: calc(50% - 50vw); padding: 20px 10vw; border: none; border-radius: 0; background: transparent; display: flex; flex-direction: column; }
.trend-card .tc-skeleton { display: flex; justify-content: center; align-items: center; min-height: 180px; opacity: 0.5; }
.tc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.tc-titles { display: flex; align-items: center; gap: 8px; }
.tc-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tc-title { font-family: 'Space Mono'; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); }
.tc-readout { display: flex; align-items: baseline; gap: 6px; }
.tc-val { font-family: 'Archivo Black'; font-size: 30px; letter-spacing: -1.5px; line-height: 1; }
.tc-unit { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.tc-delta { font-family: 'Space Mono'; font-size: 11px; padding: 2px 7px; border-radius: 999px; margin-left: 2px; }
.tc-delta.good { background: rgba(34,197,94,0.16); color: #15803d; }
.tc-delta.bad  { background: rgba(220,38,38,0.14); color: #dc2626; }
.tc-delta.flat { background: rgba(24,21,18,0.08); color: var(--ink-mute); }
.trend-chart { width: 100%; height: 132px; display: block; overflow: visible; }
.trend-chart .tc-band { fill: rgba(24,21,18,0.06); }
.trend-chart .tc-mean { stroke: var(--ink-mute); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.55; }
.trend-chart .tc-band-baseline { fill: rgba(34,197,94,0.16); stroke: rgba(34,197,94,0.42); stroke-width: 1; }
.trend-chart .tc-wavg { fill: none; stroke: var(--color-battery); stroke-width: 1.75; stroke-dasharray: 5 3; opacity: 0.85; }
.trend-chart .tc-wpt { fill: var(--color-battery); stroke: var(--paper); stroke-width: 2; }
.trend-chart .tc-bar { opacity: 0.5; }
.trend-chart .tc-score-line { fill: none; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.trend-chart .tc-spt { stroke: var(--paper); stroke-width: 2; }
.tc-hrs-label { font-family: 'Space Mono'; font-size: 11px; font-weight: 700; }
.tc-wavg-label { font-family: 'Space Mono'; font-size: 11px; color: var(--color-battery); }
.tc-band-label { font-family: 'Space Mono'; font-size: 11px; color: rgba(22,163,74,0.9); }
.trend-chart .tc-trace { fill: none; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.trend-chart .tc-cursor { stroke: rgba(24,21,18,0.5); stroke-width: 1.5; stroke-dasharray: 4 3; }
.trend-chart .tc-pt { stroke: var(--paper); stroke-width: 2; }
.tc-foot { display: flex; gap: 14px; align-items: baseline; margin-top: 8px; font-family: 'Space Mono'; font-size: 10px; letter-spacing: 0.03em; color: var(--ink-mute); }
.tc-foot b { color: var(--ink); font-weight: 700; }
.tc-foot .tc-date { margin-left: auto; }
.tc-legend { display: inline-flex; align-items: center; gap: 5px; }
.tc-legend i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.tc-empty { color: var(--ink-mute); font-size: 13px; padding: 40px 0; text-align: center; }

/* Mobile: reclaim the 10vw side gutters and let the banner/controls span the
   full width so the two .tabs (Daily/Trends + range) don't get cramped in the
   80vw band. Charts keep their viewBox=clientWidth math, so dots stay round. */
@media (max-width: 600px) {
  .health-hr-panel,.health-sleep-stages-panel,.health-sb-panel,.health-steps-panel,
  .trend-card { padding-left: 16px; padding-right: 16px; }
  [data-page="health"] .slam,
  .health-controls-row { width: 100vw; margin-left: calc(50% - 50vw); padding-left: 16px; padding-right: 16px; box-sizing: border-box; }
  .health-controls-row { gap: 10px; }
  /* Override the global mobile .tabs rule (full-width scrollable strip): the
     Daily/Trends toggle + range tabs are short, so keep them content-sized and
     inset instead of stretching to the screen edges. */
  .health-controls-row .tabs { width: auto; flex: 0 0 auto; }
  /* Scale the big Archivo Black headline numbers down uniformly across every
     daily + trend chart so they stay consistent and don't crowd narrow screens.
     Secondary labels/axes are already 10–11px and stay as-is. */
  .health-hr-live #health-hr-live-val,
  .health-steps-live #health-steps-live-val,
  .health-sb-live #health-sb-live-stress,
  .health-sb-live #health-sb-live-battery,
  .sleep-live-row #health-sleep-live-stage,
  .tc-val,
  .sleep-headline-time,
  .sleep-score-num { font-size: 24px; letter-spacing: -1px; }
}

.sleep-headline-time { font-family: 'Archivo Black'; font-size: 30px; letter-spacing: -1.5px; line-height: 1; margin-top: 4px; }
.sleep-score-block { text-align: center; flex-shrink: 0; }
.sleep-score-num { font-family: 'Archivo Black'; font-size: 30px; letter-spacing: -2px; line-height: 1; margin-top: 4px; }
.sleep-live-row { display: flex; gap: 12px; align-items: baseline; margin-top: 4px; justify-content: flex-end; }
.sleep-live-row #health-sleep-live-stage { font-family: 'Archivo Black'; font-size: 30px; letter-spacing: -1px; line-height: 1; }
.sleep-live-row #health-sleep-live-hrv,
.sleep-live-row #health-sleep-live-time { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.health-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.health-card { border: 1.5px solid var(--ink); border-radius: 16px; padding: 16px; background: var(--paper); box-shadow: 0 1px 4px rgba(24,21,18,0.05); }
.health-card .hc-val { font-family: 'Archivo Black'; font-size: 36px; letter-spacing: -1.5px; line-height: 1; margin-top: 10px; }
.health-card .hc-sub { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.06em; min-height: 14px; }
.sleep-stages-bar { display: flex; height: 9px; border-radius: 4px; overflow: hidden; margin-top: 6px; gap: 2px; }
.sleep-stages-bar > div { min-width: 2px; }
.sleep-stages-legend { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); }
.sleep-stages-legend span { display: flex; align-items: center; gap: 4px; }

/* ── Photos ─────────────────────────────────────────────────────────────── */
.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.photo-card { position: relative; border-radius: 10px; overflow: hidden; }
.photo-card img, .photo-card video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-card .pc-meta { position: absolute; left: 6px; right: 6px; bottom: 6px; background: var(--paper-glass); border: 1px solid var(--ink); border-radius: 8px; padding: 4px 8px; font-family: 'Space Mono'; font-size: 9.5px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 6px; opacity: 0; transition: opacity 0.15s; }
.photo-card:hover .pc-meta { opacity: 1; }
.photo-card .pc-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.photo-card:hover .pc-actions { opacity: 1; }
.icn-btn { width: 26px; height: 26px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink); display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; line-height: 1; }

/* ── Uploader ───────────────────────────────────────────────────────────── */
.uploader { border: 2px dashed var(--ink); border-radius: 18px; padding: 24px; text-align: center; background: var(--paper); }
.uploader.drag-over { background: var(--accent-soft); }

/* ── Lightbox ───────────────────────────────────────────────────────────── */
#lightbox { display: none; position: fixed; inset: 0; z-index: 1300; background: rgba(24, 21, 18, 0.9); align-items: center; justify-content: center; }
#lightbox.on { display: flex; }
#lightbox-inner { display: flex; flex-direction: row; align-items: center; gap: 32px; }
#lightbox img, #lightbox video { max-width: 60vw; max-height: 88vh; border-radius: 8px; object-fit: contain; flex-shrink: 0; }
#lightbox-caption { color: var(--paper); font-size: 13px; opacity: 0.75; text-align: left; margin: 0; width: 260px; line-height: 1.6; flex-shrink: 0; }
#lightbox-caption:empty { display: none; }
#lightbox-close { position: absolute; top: 20px; right: 24px; color: var(--paper); font-size: 28px; cursor: pointer; font-family: 'Archivo Black'; }
#lightbox-prev, #lightbox-next { position: absolute; top: 0; bottom: 0; width: 120px; background: none; border: none; color: var(--paper); font-size: 32px; cursor: pointer; opacity: 0.4; transition: opacity 0.15s; display: flex; align-items: center; }
#lightbox-prev { left: 0; justify-content: flex-start; padding-left: 24px; }
#lightbox-next { right: 0; justify-content: flex-end; padding-right: 24px; }
#lightbox-prev:hover, #lightbox-next:hover { opacity: 1; }

/* ── Blog ───────────────────────────────────────────────────────────────── */
.blog-state { display: none; }
.blog-state.on { display: block; }
.post-row { padding: 22px 0; border-top: 1px solid var(--rule); }
.post-row:first-child { border-top: none; }
.post-inner { display: flex; gap: 20px; align-items: flex-start; }
.post-num { font-family: 'Archivo Black'; font-size: 28px; letter-spacing: -1.5px; color: var(--ink-mute); flex-shrink: 0; }
.post-body { flex: 1; min-width: 0; }
.post-title { font-family: 'Archivo Black'; font-size: 26px; letter-spacing: -1.5px; text-transform: lowercase; }
.post-title-link { background: none; border: none; padding: 0; text-align: left; color: inherit; }
.post-title-link .post-title { cursor: pointer; transition: opacity 0.12s; }
.post-title-link:hover .post-title { opacity: 0.7; }
.post-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.post-excerpt { font-family: 'Instrument Serif'; font-style: italic; font-size: 17px; color: var(--ink-2); margin-top: 10px; max-width: 640px; }
.post-actions { display: flex; gap: 6px; flex-shrink: 0; }
.md-editor { border: 1.5px solid var(--rule); border-radius: 14px; padding: 16px; background: var(--paper-2); font-family: 'Space Mono'; font-size: 12.5px; min-height: clamp(200px, 50vh, 440px); line-height: 1.6; color: var(--ink); width: 100%; resize: vertical; outline: none; transition: border-color 0.15s; }
.md-editor:focus { border-color: var(--ink); }
.form-label { font-family: 'Space Mono'; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px; display: block; }
.form-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--paper); font-family: 'DM Sans'; font-size: 14px; color: var(--ink); outline: none; }
.form-input:focus { border-color: var(--accent); }
.blog-read h1 { font-family: 'Archivo Black'; font-size: clamp(40px, 5vw, 72px); text-transform: lowercase; letter-spacing: -3.5px; margin: 24px 0 0; }
.blog-read .content { max-width: 100%; font-size: 15px; line-height: 1.7; margin-top: 24px; }
.blog-read .content h1, .blog-read .content h2, .blog-read .content h3 { font-family: 'Archivo Black'; margin: 20px 0 10px; letter-spacing: -1px; }
.blog-read .content p { margin-bottom: 12px; }
.blog-read .content ul, .blog-read .content ol { margin-left: 20px; margin-bottom: 12px; }
.blog-read .content li { margin-bottom: 4px; }
.blog-read .content code { font-family: 'Space Mono'; font-size: 12px; background: var(--paper-2); padding: 2px 6px; border-radius: 4px; }
.blog-read .content pre { background: var(--paper-2); padding: 14px; border-radius: 10px; overflow-x: auto; margin-bottom: 12px; }
.blog-read .content pre code { background: none; padding: 0; }
.blog-read .content blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--ink-2); font-style: italic; margin-bottom: 12px; }
.blog-read .content table { border-collapse: collapse; width: 100%; margin-bottom: 16px; font-size: 14px; }
.blog-read .content th, .blog-read .content td { border: 1px solid var(--rule); padding: 8px 12px; text-align: left; }
.blog-read .content th { background: var(--paper-2); font-weight: 700; }
.blog-read .content tr:nth-child(even) { background: var(--paper-2); }
.blog-read .content img { max-width: 100%; border-radius: 8px; margin: 8px 0; }

/* ── Page action dock ───────────────────────────────────────────────────── */
#page-dock { position: fixed; right: 20px; top: 50%; transform: translateY(-50%); z-index: 1200; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
#page-dock button { font-family: 'DM Sans'; font-weight: 700; font-size: 12px; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; white-space: nowrap; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10); transition: background 0.12s, transform 0.1s; }
#page-dock button:hover { background: var(--paper-2); transform: translateX(-2px); }
#page-dock button.primary { background: var(--accent); border-color: var(--ink-on-accent); color: var(--ink-on-accent); }
#page-dock button.primary:hover { background: var(--accent-soft); }

/* ── Chat FAB ───────────────────────────────────────────────────────────── */
.fab { position: fixed; right: 24px; bottom: 24px; z-index: 1200; width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: var(--paper); border: 1.5px solid var(--ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); cursor: pointer; transition: transform 0.15s; }
.fab:hover { transform: translateY(-2px); }
.fab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ── Chat panel ─────────────────────────────────────────────────────────── */
.chat-panel { position: fixed; right: 24px; bottom: 80px; z-index: 1200; width: 360px; border: 1.5px solid var(--ink); border-radius: 18px; background: var(--paper); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); display: none; flex-direction: column; max-height: 520px; }
.chat-panel.on { display: flex; }
.chat-hdr { padding: 12px 14px; border-bottom: 1.5px solid var(--ink); background: var(--accent-soft); display: flex; justify-content: space-between; align-items: center; border-radius: 16px 16px 0 0; flex-shrink: 0; }
.chat-hdr .ch-title { font-family: 'Archivo Black'; font-size: 14px; letter-spacing: -0.5px; text-transform: uppercase; }
.chat-hdr .ch-actions { display: flex; gap: 8px; align-items: center; }
.chat-hdr .ch-actions button { background: none; border: none; font-size: 16px; color: var(--ink); cursor: pointer; padding: 2px 4px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.45; border: 1px solid var(--ink); }
.bubble.user { align-self: flex-end; background: var(--ink); color: var(--paper); border-top-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: var(--paper-2); border-top-left-radius: 4px; }
.bubble.bot.streaming { opacity: 0.8; }
.chat-composer { padding: 10px; border-top: 1.5px solid var(--ink); display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.chat-composer input { flex: 1; padding: 8px 12px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--paper); font-family: 'DM Sans'; font-size: 13px; outline: none; }
.chat-composer input:focus { border-color: var(--accent); }
.chat-composer .send-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--paper); border: 1.5px solid var(--ink); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }

/* ── Login screen ───────────────────────────────────────────────────────── */
#login-screen { display: none; position: fixed; inset: 0; z-index: 1000; background: var(--paper); align-items: center; justify-content: center; }
#login-screen.on { display: flex; }
.login-box { border: 1.5px solid var(--ink); border-radius: 24px; padding: 40px 36px; width: 360px; text-align: center; }
.login-box h2 { font-family: 'Archivo Black'; font-size: 36px; letter-spacing: -2px; margin-bottom: 8px; }
.login-box p { color: var(--ink-mute); margin-bottom: 24px; }
.login-box input { width: 100%; padding: 12px 16px; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--paper); font-size: 14px; margin-bottom: 12px; outline: none; }
.login-box input:focus { border-color: var(--accent); }
.login-box .login-btn { width: 100%; padding: 12px; border-radius: 999px; border: 1.5px solid var(--ink-on-accent); background: var(--accent); font-family: 'Archivo Black'; font-size: 15px; letter-spacing: -0.5px; cursor: pointer; }
.login-box .login-err { color: var(--danger); font-size: 12px; margin-top: 8px; min-height: 18px; }

/* ── Contact row ────────────────────────────────────────────────────────── */
.contact-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; transition: background 0.12s; }
.contact-row:last-child { border-bottom: none; }
.contact-row:hover { background: rgba(24, 21, 18, 0.04); }

/* ── Now Playing ────────────────────────────────────────────────────────── */
#now-playing { display: none; }
#now-playing.on { display: flex; align-items: center; }
.np-card {
  display: flex; align-items: center; gap: 0;
  overflow: hidden;
  width: 320px;
  height: 32px;
}
.np-art-link { display: block; flex-shrink: 0; }
.np-art { width: 32px; height: 32px; object-fit: cover; display: block; border-radius: 4px; }
.np-art.ph { width: 32px; height: 32px; background: var(--paper-2); display: block; border-radius: 4px; }
.np-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 0 0 9px;
  gap: 2px;
}
.np-top { min-width: 0; display: flex; align-items: baseline; gap: 5px; overflow: hidden; }
.np-track {
  font-weight: 700; font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--ink); text-decoration: none; flex-shrink: 1; min-width: 0;
}
.np-track:hover { opacity: 0.7; }
.np-sep { font-size: 10px; color: var(--ink-mute); flex-shrink: 0; }
.np-artist {
  font-size: 10px; color: var(--ink-mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none; flex-shrink: 2; min-width: 0;
}
.np-artist:hover { color: var(--ink); }
.np-wave { display: block; width: 100%; height: 10px; }
.np-dot { display: none; }
/* Desktop: the marquee wrapper is invisible — children participate in
   .np-top's flex layout so flex-shrink + ellipsis work as before. */
.np-scroll-inner { display: contents; }
/* Mobile: hide album art + sine wave; show a green status dot, with the
   track + artist line that auto-scrolls horizontally when it overflows.
   Let now-playing expand to fill all leftover space in the topbar's
   first row (between brand and the theme + Ask buttons). */
@media (max-width: 700px) {
  .topbar-right { flex: 1; min-width: 0; justify-content: flex-end; margin-left: 14px; }
  #now-playing { flex: 1; min-width: 0; margin-right: 8px; }
  #now-playing.on { display: flex; }
  .np-card { width: 100%; max-width: 100%; height: auto; gap: 6px; }
  .np-art-link, .np-wave { display: none; }
  .np-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: #1db954; box-shadow: 0 0 6px rgba(29, 185, 84, 0.6);
    flex-shrink: 0;
  }
  .np-body { padding: 0; flex-direction: row; align-items: center; gap: 0; min-width: 0; }
  .np-top { overflow: hidden; flex: 1; min-width: 0; display: block; white-space: nowrap; }
  .np-scroll-inner { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
  .np-top.marquee .np-scroll-inner {
    animation: np-marquee var(--marquee-duration, 10s) linear infinite;
  }
  .np-top.marquee .np-marquee-clone { padding-left: 24px; }
  .np-track, .np-artist { white-space: nowrap; overflow: visible; text-overflow: clip; flex-shrink: 0; }
  .np-sep, .np-artist { display: inline; }
  .np-track { font-size: 11.5px; }
  .np-artist { font-size: 11px; }
}
@keyframes np-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(var(--marquee-distance, 0)); }
}

/* ── Home row 2 (unfinished + release radar) ───────────────────────────── */
.home-row2-flex { display: flex; gap: 20px; align-items: flex-start; }
.home-row2-col { flex: 1; min-width: 0; }

/* ── Spotify console grid ──────────────────────────────────────────────── */
.sp-console-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.sp-console-grid > div { min-width: 0; }
.sp-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 24px; }
.sp-stats-grid > div { min-width: 0; }

/* ── Daily listening bar chart ──────────────────────────────────────────── */
.sp-daily-section { margin-bottom: 28px; }
.sp-daily-chart { display: block; }
.sp-dbar { fill: url(#grad-sp-daily); }
.sp-chart-tip { position: fixed; z-index: 200; background: var(--ink); color: var(--paper); border-radius: 7px; padding: 5px 9px; font-size: 11px; display: none; flex-direction: column; gap: 1px; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.sp-tip-date { font-family: 'Space Mono'; font-size: 9px; opacity: 0.55; }
.sp-tip-val { font-weight: 700; font-size: 12px; }
.sp-tip-sub { font-size: 10px; opacity: 0.65; }

/* ── Gig setlist panel ─────────────────────────────────────────────────── */
.setlist { border: 1px solid var(--rule); border-radius: 14px; background: var(--paper-2); padding: 14px 16px; }
.setlist-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--rule); }
.setlist-meta { min-width: 0; }
.setlist-meta .sl-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.setlist-count { font-family: 'Archivo Black'; font-size: 17px; letter-spacing: -0.8px; line-height: 1; }
.setlist-tour { font-family: 'Instrument Serif'; font-style: italic; font-size: 15px; color: var(--ink-2); }
.setlist-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.setlist-status { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); white-space: nowrap; }

.setlist-songs { column-count: 2; column-gap: 40px; }
.setlist-songs.single { column-count: 1; }
.setlist-set-label { font-family: 'Space Mono'; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); margin: 14px 0 6px; break-inside: avoid; break-after: avoid-column; }
.setlist-set-label:first-child { margin-top: 0; }
.setlist-song { display: flex; align-items: baseline; gap: 10px; padding: 3px 6px 3px 0; font-size: 13px; line-height: 1.4; break-inside: avoid; border-radius: 5px; transition: background 0.12s; }
.setlist-song:hover { background: rgba(24, 21, 18, 0.04); }
.setlist-song .num { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); width: 22px; text-align: right; flex-shrink: 0; }
.setlist-song .name { color: var(--ink); min-width: 0; }
.setlist-song .note { color: var(--ink-mute); font-size: 11px; font-style: italic; margin-left: 6px; }

.setlist-missing { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); line-height: 1.5; }
.setlist-missing b { color: var(--ink-2); font-weight: 700; }

.setlist-empty { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.setlist-empty-msg { font-size: 13px; color: var(--ink-mute); }

@media (max-width: 700px) {
  .setlist-songs { column-count: 1; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .topbar { margin: 8px 12px 0; padding: 8px 10px 8px 14px; }
  .nav-items button { font-size: 12px; padding: 6px 10px; }
  .period-grid { grid-template-columns: repeat(2, 1fr); }
  .trends-grid { grid-template-columns: repeat(2, 1fr); }
  .news-layout { grid-template-columns: 1fr; }
  .health-hr-live { flex-direction: column; align-items: flex-end; gap: 2px; }
  .health-grid { grid-template-columns: repeat(2, 1fr); }
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  /* Nav: move to scrollable second row inside topbar */
  .topbar { flex-wrap: wrap; border-radius: 16px; padding-bottom: 6px; }
  #nav-items {
    display: flex;
    position: static;
    transform: none;
    width: 100%;
    flex-basis: 100%;
    order: 3;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0 2px;
    gap: 2px;
    justify-content: flex-start;
  }
  #nav-items::-webkit-scrollbar { display: none; }
  /* Grids */
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .period-grid { grid-template-columns: repeat(2, 1fr); }
  .health-grid { grid-template-columns: 1fr; }
  /* Sub-tabs: scrollable strip */
  .tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; width: 100%; border-radius: 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex-shrink: 0; white-space: nowrap; }
  /* Settings grids (override inline styles) */
  #settings-connections { grid-template-columns: repeat(2, 1fr) !important; }
  #settings-sync-grid { grid-template-columns: repeat(2, 1fr) !important; }
  /* Recommended mode switch: wrap instead of overflowing the viewport.
     A horizontal overflow here breaks the full-bleed .recs-panel above
     (its 50vw math assumes no page-level horizontal scroll), which cut
     off the first "unfinished" album on the left. */
  #recs-mode-switch { flex-wrap: wrap; justify-content: flex-start; }
  /* Strava hero */
  #strava-hero-grid { grid-template-columns: 1fr !important; }
  #strava-dist-panel { grid-column: 1 !important; }
  .sdc-val { font-size: 40px; letter-spacing: -2px; }
  .sdc-unit { font-size: 18px; }
  /* Chat panel */
  .chat-panel { width: min(360px, calc(100vw - 48px)); right: 16px; }
  /* Floating page-dock: anchor bottom-left as a horizontal pill bar
     so it doesn't collide with the chat FAB (bottom-right). */
  #page-dock {
    top: auto;
    transform: none;
    right: auto;
    left: 16px;
    bottom: 20px;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    max-width: calc(100vw - 96px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  #page-dock::-webkit-scrollbar { display: none; }
  #page-dock button { padding: 8px 14px; font-size: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
  #page-dock button:hover { transform: none; }
  /* Search inputs */
  .search-wrap { width: 100% !important; }
  /* News heights use dvh already; make reader auto on mobile */
  .news-reader { height: auto; min-height: 60vh; }
  .news-list { height: 45vh; }
  /* Home row 2: stack unfinished + release radar.
     Override align-items so children stretch to full column width — without
     this, the strip child sizes to content and overflows the viewport. */
  .home-row2-flex { flex-direction: column; gap: 28px; align-items: stretch; }
  .home-row2-col { width: 100%; }
  /* Spotify: console panel + releases grid + trends + stats → single column */
  .sp-console-grid { grid-template-columns: 1fr; gap: 28px; }
  .sp-stats-grid { grid-template-columns: 1fr; gap: 24px 0; }
  #sp-releases-grid { grid-template-columns: 1fr !important; }
  .trends-grid { grid-template-columns: 1fr; }
  /* Trends artist cards: tighter padding, allow metrics to shrink/wrap so
     card never overflows a single-column grid on narrow viewports */
  .artist-card { padding: 10px 12px; min-width: 0; }
  .artist-card .ac-top { flex-wrap: wrap; gap: 6px; }
  .artist-card .ac-metrics { flex-shrink: 1; gap: 8px; margin-left: 0; }
  .artist-card .ac-metric .val { font-size: 11px; }
  .artist-card .ac-metric .lbl { font-size: 8.5px; }
  /* Recommendations: center the wrapped album cards. NOTE: only the wrapping
     grid (#sp-recs-grid) may be centred. #sp-unfinished-grid is a horizontal
     .hstrip — centring a scroll-overflowing flex row makes the first card
     unreachable/clipped at the start, so it must stay flex-start. */
  #sp-recs-grid { justify-content: center; }
  #sp-unfinished-grid { justify-content: flex-start; }

  /* Prevent page-level horizontal scroll without blocking child scroll containers.
     clip (unlike hidden) does not establish a new scroll container, so .hstrip
     and .strip can still scroll horizontally inside the page. */
  html, body { overflow-x: clip; }
  .strip { overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .hstrip { overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  /* Clip strips to their column width so the strip's own scroll is contained */
  .home-row2-col { overflow: hidden; }

  /* Recent tracks on mobile: art + artist as a compact header row,
     track rows span full width below so titles get maximum space. */
  .album-group { grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 2px; padding: 10px 4px 1px; }
  .ag-art-wrap { grid-column: 1; grid-row: 1; width: 40px !important; height: 40px !important; align-self: center; }
  .ag-artist { grid-column: 2; grid-row: 1; align-self: center; margin-bottom: 0; font-size: 12px; }
  .ag-tracks { grid-column: 1 / 3; grid-row: 2; padding-top: 4px; }
  .ag-row { padding: 4px 0 0; gap: 8px; align-items: flex-start; }
  .ag-track { white-space: normal; overflow: visible; text-overflow: clip; font-size: 13px; line-height: 1.3; }
  .ag-time { font-size: 10px; opacity: 0.7; margin-top: 2px; }
}
@media (max-width: 480px) {
  main { padding: 20px 14px 32px; }
  .pg-hero .title { font-size: 48px !important; letter-spacing: -2px; }
  .photo-grid { grid-template-columns: repeat(1, 1fr); }
  #settings-connections { grid-template-columns: 1fr !important; }
  #settings-sync-grid { grid-template-columns: 1fr !important; }
}

/* ── Dark mode overrides ────────────────────────────────────────────────── */

/* Helper: shared dark rules applied by both [data-theme="dark"] and OS media query.
   Written once as a ruleset, then @applied via the two selectors below.        */

/* 1. CONTRAST FIX — lime (accent) backgrounds always need dark text.
      --ink flips to cream in dark mode; use --ink-on-accent instead.           */
[data-theme="dark"] .nav-cta,
[data-theme="dark"] .btn:not(.ghost):not(.solid):not(.danger):not(.on),
[data-theme="dark"] .pill.accent,
[data-theme="dark"] .match-badge,
[data-theme="dark"] .slam-pills .pill.a,
[data-theme="dark"] .login-box .login-btn { color: var(--ink-on-accent); }
[data-theme="dark"] .btn:not(.ghost):not(.solid):not(.danger):not(.on) .spinner,
[data-theme="dark"] #page-dock button.primary .spinner { border-color: rgba(24,21,18,0.25); border-top-color: var(--ink-on-accent); }

/* Ticker text sits on lime bg */
[data-theme="dark"] .ticker-track { color: var(--ink-on-accent); }

/* 2. CONTRAST FIX — slam/hero block.
      .slam uses background:var(--ink) which flips to cream in dark mode,
      making var(--accent) em text (lime) unreadable on a light surface.
      Keep slam always visually dark; set text explicitly so it doesn't
      pick up the wrong inherited value.                                         */
[data-theme="dark"] .slam {
  background: var(--slam-bg);
  border-color: var(--slam-bg);
  color: var(--ink); /* #f0ece0 in dark mode — cream on near-black ✓ */
}
[data-theme="dark"] .slam .date { opacity: 0.55; }
[data-theme="dark"] .slam-pills .pill {
  color: var(--ink);
  border-color: rgba(240, 236, 224, 0.22);
}

/* 3. Active nav / tab pills — use accent lime instead of the flipped-cream --ink */
[data-theme="dark"] .nav-items button.on,
[data-theme="dark"] .tabs button.on {
  background: var(--accent);
  color: var(--ink-on-accent);
}

/* 3b. Topbar glass */
[data-theme="dark"] .topbar { background: var(--paper-dark-glass); }
[data-theme="dark"] .brand .blob { border-color: var(--accent); }

/* 4. Hover / interaction states */
[data-theme="dark"] .nav-items button:hover:not(.on),
[data-theme="dark"] .tabs button:hover:not(.on) { background: rgba(240, 236, 224, 0.07); }
[data-theme="dark"] .genre-pill:hover { color: var(--ink-on-accent); }
[data-theme="dark"] .feed-row:hover,
[data-theme="dark"] .news-item:hover,
[data-theme="dark"] .disclosure:hover,
[data-theme="dark"] .contact-row:hover,
[data-theme="dark"] .artist-card:hover,
[data-theme="dark"] .top-artist-row:hover { background: rgba(240, 236, 224, 0.04); }
[data-theme="dark"] .ag-row:hover { background: rgba(240, 236, 224, 0.03); }
[data-theme="dark"] .news-item.on { background: rgba(201, 255, 71, 0.10); color: var(--ink); }

/* 5. Art & media placeholders */
[data-theme="dark"] .album-card .art.ph,
[data-theme="dark"] .feed-row .thumb.ph,
[data-theme="dark"] .map-ph { background: repeating-linear-gradient(135deg, transparent 0, transparent 7px, rgba(240, 236, 224, 0.05) 7px, rgba(240, 236, 224, 0.05) 8px), var(--paper); }
[data-theme="dark"] .ag-art-wrap.ph { background: repeating-linear-gradient(135deg, transparent 0, transparent 5px, rgba(240, 236, 224, 0.05) 5px, rgba(240, 236, 224, 0.05) 6px); }

/* 6. Photo card meta overlay */
[data-theme="dark"] .photo-card .pc-meta { background: var(--paper-dark-glass); }

/* 7. Strava dist panel — no background override needed (panel is now transparent) */

/* 8. Health panels */
[data-theme="dark"] .health-hr-panel,
[data-theme="dark"] .health-sleep-stages-panel,
[data-theme="dark"] .health-sb-panel,
[data-theme="dark"] .health-steps-panel { border-top-color: rgba(255,255,255,0.16); }
[data-theme="dark"] .health-card { background: var(--paper-2); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3); }
[data-theme="dark"] .trend-chart .tc-band { fill: rgba(255,255,255,0.07); }
[data-theme="dark"] .trend-chart .tc-band-baseline { fill: rgba(34,197,94,0.18); stroke: rgba(34,197,94,0.45); }
[data-theme="dark"] .trend-chart .tc-cursor { stroke: rgba(255,255,255,0.55); }
[data-theme="dark"] .tc-delta.flat { background: rgba(255,255,255,0.1); }

/* 9. Chat, login, dock */
[data-theme="dark"] .chat-panel { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
[data-theme="dark"] .login-box input { background: var(--paper-2); }
[data-theme="dark"] #page-dock button { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }

/* 10. Blog code blocks */
[data-theme="dark"] .blog-read .content code,
[data-theme="dark"] .blog-read .content pre { background: var(--paper-2); }

/* ── OS-level dark mode (no explicit data-theme set) — mirrors all of the above */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-cta,
  :root:not([data-theme="light"]) .btn:not(.ghost):not(.solid):not(.danger),
  :root:not([data-theme="light"]) .pill.accent,
  :root:not([data-theme="light"]) .match-badge,
  :root:not([data-theme="light"]) .slam-pills .pill.a,
  :root:not([data-theme="light"]) .login-box .login-btn { color: var(--ink-on-accent); }
  :root:not([data-theme="light"]) .btn:not(.ghost):not(.solid):not(.danger) .spinner,
  :root:not([data-theme="light"]) #page-dock button.primary .spinner { border-color: rgba(24,21,18,0.25); border-top-color: var(--ink-on-accent); }
  :root:not([data-theme="light"]) .ticker-track { color: var(--ink-on-accent); }
  :root:not([data-theme="light"]) .slam { background: var(--slam-bg); border-color: var(--slam-bg); color: var(--ink); }
  :root:not([data-theme="light"]) .slam .date { opacity: 0.55; }
  :root:not([data-theme="light"]) .slam-pills .pill { color: var(--ink); border-color: rgba(240, 236, 224, 0.22); }
  :root:not([data-theme="light"]) .nav-items button.on,
  :root:not([data-theme="light"]) .tabs button.on { background: var(--accent); color: var(--ink-on-accent); }
  :root:not([data-theme="light"]) .topbar { background: var(--paper-dark-glass); }
  :root:not([data-theme="light"]) .brand .blob { border-color: var(--accent); }
  :root:not([data-theme="light"]) .nav-items button:hover:not(.on),
  :root:not([data-theme="light"]) .tabs button:hover:not(.on) { background: rgba(240, 236, 224, 0.07); }
  :root:not([data-theme="light"]) .genre-pill:hover { color: var(--ink-on-accent); }
  :root:not([data-theme="light"]) .feed-row:hover,
  :root:not([data-theme="light"]) .news-item:hover,
  :root:not([data-theme="light"]) .disclosure:hover,
  :root:not([data-theme="light"]) .contact-row:hover,
  :root:not([data-theme="light"]) .artist-card:hover,
  :root:not([data-theme="light"]) .top-artist-row:hover { background: rgba(240, 236, 224, 0.04); }
  :root:not([data-theme="light"]) .ag-row:hover { background: rgba(240, 236, 224, 0.03); }
  :root:not([data-theme="light"]) .news-item.on { background: rgba(201, 255, 71, 0.10); color: var(--ink); }
  :root:not([data-theme="light"]) .album-card .art.ph,
  :root:not([data-theme="light"]) .feed-row .thumb.ph,
  :root:not([data-theme="light"]) .map-ph { background: repeating-linear-gradient(135deg, transparent 0, transparent 7px, rgba(240, 236, 224, 0.05) 7px, rgba(240, 236, 224, 0.05) 8px), var(--paper); }
  :root:not([data-theme="light"]) .ag-art-wrap.ph { background: repeating-linear-gradient(135deg, transparent 0, transparent 5px, rgba(240, 236, 224, 0.05) 5px, rgba(240, 236, 224, 0.05) 6px); }
  :root:not([data-theme="light"]) .photo-card .pc-meta { background: var(--paper-dark-glass); }
  :root:not([data-theme="light"]) .health-hr-panel,
  :root:not([data-theme="light"]) .health-sleep-stages-panel,
  :root:not([data-theme="light"]) .health-sb-panel,
  :root:not([data-theme="light"]) .health-steps-panel { border-top-color: rgba(255,255,255,0.16); }
  :root:not([data-theme="light"]) .health-card { background: var(--paper-2); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3); }
  :root:not([data-theme="light"]) .trend-chart .tc-band { fill: rgba(255,255,255,0.07); }
  :root:not([data-theme="light"]) .trend-chart .tc-band-baseline { fill: rgba(34,197,94,0.18); stroke: rgba(34,197,94,0.45); }
  :root:not([data-theme="light"]) .trend-chart .tc-cursor { stroke: rgba(255,255,255,0.55); }
  :root:not([data-theme="light"]) .tc-delta.flat { background: rgba(255,255,255,0.1); }
  :root:not([data-theme="light"]) .chat-panel { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
  :root:not([data-theme="light"]) .login-box input { background: var(--paper-2); }
  :root:not([data-theme="light"]) #page-dock button { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
  :root:not([data-theme="light"]) .blog-read .content code,
  :root:not([data-theme="light"]) .blog-read .content pre { background: var(--paper-2); }
}

/* ── Training Plan Grid ─────────────────────────────────────────────────── */
.tg-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--ink); border-radius: 16px; background: var(--paper); }
.training-grid { border-collapse: collapse; width: 100%; font-family: 'Space Mono', monospace; font-size: 11px; table-layout: fixed; }

/* Header */
.tg-head-cell { padding: 9px 8px; text-align: center; font-family: 'Space Mono', monospace; font-size: 9px; color: var(--ink-2); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; background: var(--paper-2); border-bottom: 1.5px solid var(--rule); white-space: nowrap; }
.tg-head-cell.tg-label-cell { text-align: left; width: 124px; }
.tg-head-cell.tg-total-head { color: var(--ink); border-left: 1.5px solid var(--rule); }
.tg-head-cell:first-child { border-top-left-radius: 15px; }
.tg-head-cell:last-child { border-top-right-radius: 15px; }

/* Cells */
.tg-cell { padding: 7px 6px; vertical-align: middle; min-width: 60px; border-right: 1px solid var(--rule); }
.tg-cell:last-child { border-right: none; }
.tg-label-cell { color: var(--ink-mute); white-space: nowrap; padding: 8px 10px; }
.tg-week-label { vertical-align: top; padding-top: 9px; width: 124px; background: var(--paper-2); }
.tg-wk-no { font-family: 'Archivo Black', sans-serif; font-size: 15px; letter-spacing: -0.5px; color: var(--ink); line-height: 1; }
.tg-wk-range { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--ink-2); margin-top: 3px; line-height: 1.3; }

/* Plan cell — tint wash + inset accent bar; the primary (darkest) number */
.tg-plan-cell { text-align: center; font-family: 'Archivo Black', sans-serif; font-size: 15px; letter-spacing: -0.5px; color: var(--ink); cursor: default; transition: filter 0.12s; }
.tg-plan-cell:hover { filter: brightness(0.97) saturate(1.15); }
.tg-plan-cell:focus { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; position: relative; }
.tg-plan-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tg-plan-cell.tg-kb-intensity { outline: 2px solid var(--ink) !important; outline-offset: -2px; }
.tg-plan-cell.tg-kb-copied { outline: 2px solid var(--accent) !important; outline-offset: -2px; }

/* Actual + notes rows attach to the plan row above */
.tg-actual-cell { text-align: center; font-family: 'Archivo Black', sans-serif; font-size: 13px; letter-spacing: -0.5px; color: var(--ink-2); cursor: default; }
.tg-actual-row .tg-cell { border-top: none; }
.tg-notes-row .tg-cell { border-top: none; }
.tg-notes-cell { font-family: 'Space Mono', monospace; font-size: 10.5px; color: var(--ink-2); cursor: text; min-height: 18px; padding: 5px 8px; }
.tg-notes-cell:focus { outline: 1.5px solid var(--accent); border-radius: 4px; background: var(--paper); }

/* Total column — accent-washed, big bold number */
.tg-total-cell { text-align: center; font-family: 'Archivo Black', sans-serif; font-size: 15px; letter-spacing: -0.5px; color: var(--ink); background: var(--accent-soft); border-left: 1.5px solid var(--rule); width: 54px; }

.tg-empty { background: transparent !important; box-shadow: none !important; }
.tg-week + .tg-week { border-top: 2px solid var(--rule); }

/* Today highlight */
.tg-plan-cell.tg-today { filter: brightness(0.92) saturate(1.2); }
.tg-actual-cell.tg-today { filter: brightness(0.92); }
.tg-notes-cell.tg-today { box-shadow: inset -5px 0 0 var(--accent); }

/* Legend */
.tg-legend { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; padding: 0 2px; }
.tg-legend-keys { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tg-leg-item { display: inline-flex; align-items: center; gap: 5px; font-family: 'Space Mono', monospace; font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); }
.tg-leg-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.tg-leg-rest { background: transparent; border: 1.5px solid var(--rule); }
.tp-build-select { background: var(--paper); border: 1.5px solid var(--ink); border-radius: 8px; padding: 3px 8px; font-family: 'Space Mono', monospace; font-size: 11px; color: var(--ink); cursor: pointer; max-width: 220px; }
.tp-intensity-pill { display:inline-flex;align-items:center;justify-content:center;padding:3px 8px;border-radius:999px;font-family:'Space Mono',monospace;font-size:10px;font-weight:700;letter-spacing:0.06em;white-space:nowrap; }
.tg-editor { display: flex; flex-direction: column; gap: 3px; }
.tg-mins-input { width: 100%; padding: 2px 4px; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper); font-family: 'Space Mono', monospace; font-size: 11px; color: var(--ink); outline: none; }
.tg-intensity-select { width: 100%; padding: 2px 4px; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper); font-family: 'Space Mono', monospace; font-size: 10px; color: var(--ink); outline: none; }

/* ════════════════════════════════════════════════════════════════════════
   MOBILE APP SHELL  (≤700px only — desktop is never affected)
   ════════════════════════════════════════════════════════════════════════ */

/* Material Symbols icon font (used by the mobile tab bar + sheets) */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal; font-style: normal;
  line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr;
  font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Hidden by default; activated inside the media query below. */
.mobile-tabbar { display: none; }
.mobile-sheet  { display: none; }
.tgm-sheet     { display: none; }

/* ── Bottom tab bar ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .mobile-tabbar {
    display: flex;
    position: fixed; left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 1150;
    justify-content: space-around; align-items: stretch; gap: 1px;
    padding: 7px 6px 6px;
    background: var(--paper-glass);
    backdrop-filter: blur(16px);
    border: 1.5px solid var(--ink);
    border-radius: 26px;
    box-shadow: 0 8px 28px rgba(24, 21, 18, 0.20);
  }
  .mobile-tabbar button {
    position: relative; flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 0 3px; border: none; background: transparent;
    color: var(--ink-2);
    font-family: 'DM Sans', sans-serif; font-size: 9px; font-weight: 700;
    letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
  }
  /* Inactive icons read a touch lighter than labels; active fills + goes full ink */
  .mobile-tabbar button .material-symbols-rounded {
    font-size: 24px; color: var(--ink-2); opacity: 0.8; transition: transform 0.14s;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  }
  .mobile-tabbar button.on { color: var(--ink); }
  .mobile-tabbar button.on .material-symbols-rounded {
    color: var(--ink); opacity: 1; transform: translateY(-1px);
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  }
  .mobile-tabbar button.on::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 20px; height: 3px; border-radius: 999px; background: var(--accent);
  }

  /* Replace the in-bar nav with the tab bar; clear space for it */
  #nav-items { display: none !important; }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* Lift floating UI above the floating tab bar */
  .fab { bottom: calc(94px + env(safe-area-inset-bottom)); }
  .chat-panel { bottom: calc(152px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(112px + env(safe-area-inset-bottom)); }
  #page-dock {
    top: auto; transform: none; right: auto;
    left: 18px; bottom: calc(98px + env(safe-area-inset-bottom));
    flex-direction: row; gap: 6px; align-items: center;
    max-width: calc(100vw - 36px); overflow-x: auto; scrollbar-width: none;
  }
  #page-dock::-webkit-scrollbar { display: none; }
  #page-dock button:hover { transform: none; }
}

/* ── Bottom sheets (More menu + training day editor) ────────────────────── */
.mobile-sheet.on, .tgm-sheet.on { display: block; position: fixed; inset: 0; z-index: 1400; }
.ms-backdrop, .tgm-sheet-backdrop { position: absolute; inset: 0; background: rgba(24, 21, 18, 0.5); }
.ms-panel, .tgm-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--paper); border-top: 1.5px solid var(--ink);
  border-radius: 22px 22px 0 0;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.22);
  animation: sheet-up 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.ms-grab, .tgm-sheet-grab { width: 40px; height: 4px; border-radius: 999px; background: var(--rule); margin: 4px auto 16px; }
.ms-title, .tgm-sheet-title { font-family: 'Archivo Black'; font-size: 19px; letter-spacing: -0.5px; text-transform: lowercase; margin-bottom: 14px; }
.ms-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ms-grid button {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border: 1.5px solid var(--ink); border-radius: 14px; background: var(--paper);
  color: var(--ink); font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 15px;
}
.ms-grid button.on { background: var(--accent); }
.ms-ic { font-size: 22px; line-height: 1; color: var(--ink); }

/* ── Mobile training agenda (week cards) ────────────────────────────────── */
.tgm { display: flex; flex-direction: column; gap: 14px; }
.tgm-week { border: 1.5px solid var(--ink); border-radius: 16px; padding: 12px 12px 6px; background: var(--paper); }
.tgm-week-current { border-color: var(--accent); border-width: 2px; }
.tgm-week-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tgm-wk { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tgm-wk-no { font-family: 'Archivo Black'; font-size: 16px; letter-spacing: -0.5px; }
.tgm-range { font-family: 'Space Mono'; font-size: 11px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgm-tot { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); white-space: nowrap; flex-shrink: 0; }
.tgm-tot b { font-family: 'Archivo Black'; font-size: 15px; color: var(--ink); letter-spacing: -0.5px; }
.tgm-bar { height: 4px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--rule); overflow: hidden; margin: 8px 0 2px; }
.tgm-bar span { display: block; height: 100%; background: var(--accent); }
.tgm-days { display: flex; flex-direction: column; }
/* dow | chip | free-text note (fills the empty middle) | plan | actual.
   The two number columns are fixed + equal so they never shift when one of
   them is missing a value. */
.tgm-days-head {
  display: grid; grid-template-columns: 34px auto minmax(0, 1fr) 40px 40px;
  gap: 9px; padding: 0 4px 5px;
}
.tgm-days-head .tgm-cap { text-align: right; font-family: 'Space Mono'; font-size: 7.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); }
.tgm-day {
  display: grid; grid-template-columns: 34px auto minmax(0, 1fr) 40px 40px; align-items: center; gap: 9px;
  width: 100%; text-align: left; padding: 9px 4px;
  border: none; border-top: 1px solid var(--rule); background: transparent;
  color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.tgm-day:first-child { border-top: none; }
.tgm-day:active { background: rgba(24, 21, 18, 0.05); border-radius: 8px; }
.tgm-rest { opacity: 0.5; }
.tgm-today { background: var(--accent-soft); border-radius: 8px; box-shadow: 10px 0 0 var(--accent-soft), -10px 0 0 var(--accent-soft); border-top: none !important; }
.tgm-dow { font-family: 'Space Mono'; font-size: 10px; color: var(--ink-mute); display: flex; flex-direction: column; line-height: 1.15; text-transform: uppercase; }
.tgm-dow b { font-family: 'Archivo Black'; font-size: 15px; color: var(--ink); letter-spacing: -0.5px; }
.tgm-chip { display: inline-flex; align-items: center; justify-content: center; padding: 4px 11px; border-radius: 999px; font-family: 'Space Mono'; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink); white-space: nowrap; }
.tgm-chip-rest { border: 1.5px dashed var(--rule); color: var(--ink-mute); }
.tgm-note { min-width: 0; font-family: 'Space Mono'; font-size: 10px; color: var(--ink-2); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tgm-num { text-align: right; font-family: 'Archivo Black'; font-size: 16px; letter-spacing: -0.5px; color: var(--ink); }
.tgm-num.muted { color: var(--ink-mute); font-weight: 400; }
.tgm-num-actual { color: var(--ink-2); }
.tgm-num-actual.hit { color: var(--color-positive); }

/* ── Touch affordances + mobile overrides ───────────────────────────────── */
@media (hover: none) {
  /* hover-only controls must be permanently visible on touch devices */
  .photo-card .pc-meta, .photo-card .pc-actions { opacity: 1; }
}
@media (max-width: 700px) {
  /* Photo grid: keep at least 2 columns on phones */
  .photo-grid { grid-template-columns: repeat(2, 1fr); }

  /* Full-screen lightbox: image on top, caption as a scrollable panel below */
  #lightbox { align-items: stretch; justify-content: flex-start; }
  #lightbox-inner {
    flex-direction: column; gap: 0; width: 100%; height: 100%;
    justify-content: flex-start; align-items: center;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: calc(52px + env(safe-area-inset-top)) 0 calc(28px + env(safe-area-inset-bottom));
  }
  #lightbox img, #lightbox video { max-width: 100vw; max-height: 60vh; border-radius: 0; flex-shrink: 0; }
  #lightbox-caption {
    position: static; width: 100%; max-height: none; margin: 0; flex-shrink: 0;
    padding: 16px 20px 0; color: rgba(244, 240, 230, 0.82);
    text-align: left; font-size: 13px; line-height: 1.6;
  }
  /* Keep the tap-arrows over the image band only, clear of the caption */
  #lightbox-prev, #lightbox-next { top: calc(52px + env(safe-area-inset-top)); bottom: auto; height: 60vh; width: 48px; font-size: 26px; opacity: 0.5; }
  #lightbox-prev { padding-left: 10px; }
  #lightbox-next { padding-right: 10px; }
  #lightbox-close { top: calc(12px + env(safe-area-inset-top)); right: 16px; font-size: 30px; z-index: 2; }

  /* Modals: top-align + scroll so tall content (e.g. New Build) is reachable */
  #training-modal { align-items: flex-start !important; overflow-y: auto; padding: 16px 0 40px; }

  /* Bigger tap targets for sub-tabs */
  .tabs button { padding: 9px 16px; }

  /* Genre wheel: trim the tall vertical padding so it's compact on phones
     (row count + inter-pill gap are also reduced in JS) */
  #genre-scroll-wrap { padding: 40px 0; margin-top: 12px; margin-bottom: 22px; }
  .genre-pill { font-size: 8.5px; padding: 2px 7px; margin: 1px 3px; gap: 3px; }

  /* News: full-screen reader overlay instead of a stacked bottom pane.
     The inline reader is hidden until an email/summary is opened, so the
     list owns the whole viewport. */
  .news-list { height: auto; }
  .news-reader:not(.reader-open) { display: none; }
  .news-reader.reader-open {
    position: fixed; inset: 0; z-index: 1250;
    height: 100dvh; min-height: 0; margin: 0;
    border: none; border-radius: 0; background: var(--paper);
  }
  .news-reader.reader-open .news-rtoolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    border-bottom: 1.5px solid var(--ink); background: var(--paper);
  }
  .news-rtoolbar button {
    border: none; background: transparent; color: var(--ink);
    font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 14px;
    display: inline-flex; align-items: center; gap: 5px; padding: 6px 2px;
  }
  .news-rtoolbar .nrt-back span { font-size: 24px; line-height: 1; }
  .news-rtoolbar .nrt-archive { padding: 7px 16px; border: 1.5px solid var(--ink); border-radius: 999px; font-size: 12px; background: var(--accent); color: var(--ink-on-accent); }
  .news-reader.reader-open:not(.has-email) .nrt-archive { display: none; }
}
@media (max-width: 480px) {
  /* Override the old single-column rule — 2-up reads better */
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Dark-mode glass for the tab bar (mirrors the topbar rules) */
[data-theme="dark"] .mobile-tabbar { background: var(--paper-dark-glass); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mobile-tabbar { background: var(--paper-dark-glass); }
}
