/* ── 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: rgba(244, 240, 230, 0.92);
  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); 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.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; }

/* ── 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: 6px 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: flex; gap: 12px; padding: 8px 6px; }
.album-group + .album-group { border-top: 1px solid var(--rule); }
.ag-art-wrap { flex-shrink: 0; width: 52px; height: 52px; border-radius: 8px; border: 1px solid var(--rule); overflow: hidden; align-self: flex-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-tracks { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.ag-artist { font-size: 11px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; text-decoration: none; display: block; transition: color 0.12s; }
.ag-artist:hover { color: var(--ink); }
.ag-row { display: flex; align-items: baseline; gap: 8px; padding: 2px 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 { border: 1px solid var(--ink); border-radius: 14px; padding: 14px; background: linear-gradient(180deg, rgba(244,240,230,0.95), rgba(236,230,215,0.75)); }
.strava-dist-panel .hc-subtle { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.strava-dist-live { display: flex; align-items: baseline; gap: 10px; }
.strava-dist-live .sdl-val { font-family: 'Archivo Black'; font-size: 28px; letter-spacing: -1.3px; line-height: 1; }
.strava-dist-live .sdl-date { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.strava-dist-chart { width: 100%; height: 100px; display: block; margin-top: 8px; background: rgba(24,21,18,0.02); border: 1px solid var(--rule); border-radius: 10px; cursor: crosshair; }
.strava-dist-chart .grid { stroke: rgba(24,21,18,0.12); stroke-width: 1; }
.strava-dist-chart .trace { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.strava-dist-chart .cursor { stroke: rgba(24,21,18,0.45); stroke-width: 1.25; stroke-dasharray: 4 4; }
.strava-dist-chart .dot { fill: var(--accent); stroke: var(--ink); stroke-width: 1.5; }

/* ── 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; }
.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; }
.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: #1e7a3a; }
.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::-webkit-scrollbar { display: none; }
.genre-pill { font-family: 'Space Mono'; font-size: 10px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--ink); background: var(--accent-soft); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex-shrink: 0; transition: background 0.12s; margin: 3px 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: var(--ink-mute); text-decoration: none; }
.artist-link:hover { color: var(--ink); }
.delta-up   { color: #1e7a3a; 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; }

/* ── Health ─────────────────────────────────────────────────────────────── */
.health-hr-panel,.health-sleep-stages-panel,.health-sb-panel,.health-steps-panel,.health-hrv-panel,.health-vo2-panel { border: 1.5px solid var(--ink); border-radius: 20px; padding: 20px 20px 16px; background: var(--paper); box-shadow: 0 2px 12px rgba(24,21,18,0.07); margin-bottom: 16px; }
.hc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.health-hr-live { display: flex; align-items: baseline; gap: 10px; }
.health-hr-live #health-hr-live-val { font-family: 'Archivo Black'; font-size: 32px; 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: 10px; 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,.health-hrv-chart,.health-vo2-chart { width: 100%; display: block; margin-top: 14px; background: var(--paper-2); border-radius: 12px; cursor: crosshair; overflow: hidden; }
.health-hr-chart { height: 220px; }
.health-steps-chart { width: 100%; height: 160px; display: block; margin-top: 14px; background: var(--paper-2); border-radius: 12px; cursor: crosshair; overflow: hidden; }
.health-steps-chart .grid { stroke: rgba(24,21,18,0.07); 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: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.health-steps-chart .dot { fill: #22c55e; 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: 32px; 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: 220px; }
.health-hrv-chart { height: 160px; }
.health-vo2-chart { height: 160px; }
.health-hr-chart .grid,.health-sb-chart .grid,.health-hrv-chart .grid,.health-vo2-chart .grid { stroke: rgba(24,21,18,0.07); stroke-width: 1; }
.sleep-stages-wrap { position: relative; display: flex; gap: 0; margin-top: 14px; align-items: stretch; }
.sleep-y-labels { position: relative; width: 38px; flex-shrink: 0; font-family: 'Space Mono'; font-size: 9px; 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: 140px; display: block; background: var(--paper-2); border-radius: 12px; cursor: crosshair; overflow: hidden; }
.health-sleep-chart .grid { stroke: rgba(24,21,18,0.07); 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.6); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.health-hr-chart .trace { fill: none; stroke: #dc2626; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.health-hrv-chart .trace { fill: none; stroke: #15803d; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.health-vo2-chart .trace { fill: none; stroke: #7c3aed; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.health-sb-chart .trace { fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.health-sb-chart .trace.stress { stroke: url(#grad-stress-stroke); }
.health-sb-chart .trace.battery { stroke: #1f7aff; }
.health-sb-chart .sb-avg-line { stroke: #ea580c; stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.6; }
.health-hr-chart .cursor,.health-sb-chart .cursor,.health-hrv-chart .cursor,.health-vo2-chart .cursor { stroke: rgba(24,21,18,0.5); stroke-width: 1.5; stroke-dasharray: 4 3; }
.health-hr-chart .dot { fill: #dc2626; stroke: var(--paper); stroke-width: 2; }
.health-hrv-chart .dot { fill: #15803d; stroke: var(--paper); stroke-width: 2; }
.health-vo2-chart .dot { fill: #7c3aed; stroke: var(--paper); stroke-width: 2; }
.health-sb-chart .dot.stress { fill: #ea580c; stroke: var(--paper); stroke-width: 2; }
.health-sb-chart .dot.battery { fill: #1f7aff; stroke: var(--paper); stroke-width: 2; }
.health-hr-panel .hc-empty,.health-sb-panel .hc-empty,.health-hrv-panel .hc-empty,.health-vo2-panel .hc-empty { margin-top: 12px; color: var(--ink-mute); font-size: 13px; }
.hc-axis { margin-top: 10px; 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: 26px; letter-spacing: -1.2px; color: #ea580c; }
.health-sb-live #health-sb-live-battery { font-family: 'Archivo Black'; font-size: 26px; letter-spacing: -1.2px; color: #1f7aff; }
.health-sb-live #health-sb-live-time { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.health-hrv-live { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.health-hrv-live #health-hrv-live-val { font-family: 'Archivo Black'; font-size: 32px; letter-spacing: -1.5px; line-height: 1; color: #15803d; }
.health-hrv-live #health-hrv-live-date { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.health-hrv-chart .baseline-band { fill: rgba(34,197,94,0.16); stroke: rgba(34,197,94,0.42); stroke-width: 1; }
.health-hrv-chart .trace.wavg { stroke: #1f7aff; stroke-width: 1.75; stroke-dasharray: 5 3; opacity: 0.8; }
.health-hrv-chart .dot.wavg-dot { fill: #1f7aff; stroke: var(--paper); stroke-width: 2.5; }
.hrv-wavg-label { font-family: 'Space Mono'; font-size: 11px; color: #1f7aff; }
.hrv-band-label { font-family: 'Space Mono'; font-size: 11px; color: rgba(22,163,74,0.9); }
.health-vo2-live { display: flex; align-items: baseline; gap: 10px; }
.health-vo2-live #health-vo2-live-val { font-family: 'Archivo Black'; font-size: 32px; letter-spacing: -1.5px; line-height: 1; color: #7c3aed; }
.health-vo2-live #health-vo2-live-date { font-family: 'Space Mono'; font-size: 11px; color: var(--ink-mute); }
.sleep-headline-time { font-family: 'Archivo Black'; font-size: 36px; letter-spacing: -2px; line-height: 1; margin-top: 6px; }
.sleep-score-block { text-align: center; flex-shrink: 0; }
.sleep-score-num { font-family: 'Archivo Black'; font-size: 52px; letter-spacing: -3px; line-height: 1; }
.sleep-live-row { display: flex; gap: 12px; align-items: baseline; margin-top: 10px; justify-content: flex-end; }
.sleep-live-row #health-sleep-live-stage { font-family: 'Archivo Black'; font-size: 22px; 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: 10px; 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: 7px; border-radius: 4px; overflow: hidden; margin-top: 12px; 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: rgba(244, 240, 230, 0.92); 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: 500; background: rgba(24, 21, 18, 0.9); align-items: center; justify-content: center; }
#lightbox.on { display: flex; }
#lightbox img, #lightbox video { max-width: 90vw; max-height: 90vh; border-radius: 8px; object-fit: contain; }
#lightbox-close { position: absolute; top: 20px; right: 24px; color: #f4f0e6; font-size: 28px; cursor: pointer; font-family: 'Archivo Black'; }

/* ── 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: 640px; 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 { margin-left: 20px; margin-bottom: 12px; }
.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 blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--ink-2); font-style: italic; margin-bottom: 12px; }

/* ── 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); }
#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); 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); }

/* ── 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; }
  /* Strava hero */
  #strava-hero-grid { grid-template-columns: 1fr !important; }
  #strava-dist-panel { grid-column: 1 !important; }
  /* Chat panel */
  .chat-panel { width: min(360px, calc(100vw - 48px)); right: 16px; }
  /* Hide fixed dock (overlaps content) */
  #page-dock { display: none !important; }
  /* 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; }
}
@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 hardcoded dark text.
      --ink flips to cream in dark mode so we can't use it here.                */
[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: #181512; }

/* Ticker text sits on lime bg */
[data-theme="dark"] .ticker-track { color: #181512; }

/* 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: #0f0e0b;
  border-color: #0f0e0b;
  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: #181512;
}

/* 3b. Topbar glass */
[data-theme="dark"] .topbar { background: rgba(26, 23, 20, 0.93); }

/* 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: #181512; }
[data-theme="dark"] .feed-row:hover,
[data-theme="dark"] .news-item:hover,
[data-theme="dark"] .disclosure:hover,
[data-theme="dark"] .contact-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: rgba(26, 23, 20, 0.92); }

/* 7. Strava dist panel gradient */
[data-theme="dark"] .strava-dist-panel { background: linear-gradient(180deg, rgba(34, 32, 25, 0.95), rgba(26, 24, 20, 0.75)); }

/* 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-hrv-panel,
[data-theme="dark"] .health-vo2-panel,
[data-theme="dark"] .health-card { background: var(--paper-2); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3); }

/* 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); }
[data-theme="dark"] #page-dock button.primary { color: #181512; }

/* 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: #181512; }
  :root:not([data-theme="light"]) .ticker-track { color: #181512; }
  :root:not([data-theme="light"]) .slam { background: #0f0e0b; border-color: #0f0e0b; 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: #181512; }
  :root:not([data-theme="light"]) .topbar { background: rgba(26, 23, 20, 0.93); }
  :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: #181512; }
  :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 { 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: rgba(26, 23, 20, 0.92); }
  :root:not([data-theme="light"]) .strava-dist-panel { background: linear-gradient(180deg, rgba(34, 32, 25, 0.95), rgba(26, 24, 20, 0.75)); }
  :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-hrv-panel,
  :root:not([data-theme="light"]) .health-vo2-panel,
  :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"]) .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"]) #page-dock button.primary { color: #181512; }
  :root:not([data-theme="light"]) .blog-read .content code,
  :root:not([data-theme="light"]) .blog-read .content pre { background: var(--paper-2); }
}
