:root {
  /* Height of the .global-status-bar strip at the top of the phone frame.
     .screens fills the whole phone so overlay dims cover this strip too;
     .screen and the opaque full-page overlays are inset by it instead.
     Zeroed at the mobile/tablet breakpoints, where the strip is hidden. */
  --status-bar-h: 44px;

  /* ── Colors ── */
  --c-white:        #fff;
  --c-black:        #000;
  --c-blue:         #0095f6;
  --c-surface:      #1A1E24;
  --c-text-meta:      #9f9f9f;
  --c-text-secondary: #adadad;
  --c-surface-2:      #272C33;
  --c-text-muted:     #a0a0a0;
  --c-divider:        #383E46;
  --c-bg-black:       #0A1014;
  --c-stroke-top:     #24292D;
  --c-surface-3:      #353B42;
  --c-text-dim:       #b0b0b0;
  --c-amber:        #f59e0b;
  --c-light-gray:   #e0e0e0;
  --c-blue-soft:    #3b82f6;
  --c-gray-333:     #2D3239;
  --c-bg-222:       #1E2228;
  --c-green:        #10b981;
  --c-ig-orange:    #f09433;
  --c-red:          #ed4956;
  --c-ig-red:       #dc2743;
  --c-bg-1a:        #181C22;
  --c-border-dark:  #22272E;
  --c-aa-start:     #3A6FF2;
  --c-aa-end:       #B0223C;

  /* ── Typography — font family ── */
  --font-system: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;

  /* ── Typography — font sizes (2+ occurrences only) ── */
  --fs-xs:   11px;
  --fs-sm:   11px;
  --fs-md:   12px;
  --fs-base: 13px;
  --fs-lg:   14px;
  --fs-xl:   15px;
  --fs-2xl:  16px;
  --fs-3xl:  18px;
  --fs-4xl:  20px;
  --fs-5xl:  22px;

  /* ── Typography — font weights ── */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --fw-heavy:    800;

  /* ── Border-radius ── */
  --radius-sm:    12px;
  --radius-sheet: 24px;
  --radius-pill:  99px;

  /* ── Transitions (2+ occurrences) ── */
  --transition-sheet: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  --transition-bg:    background 0.14s ease-out;
  --transition-all:   all 0.18s ease-out;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Accessibility utilities ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; border-radius: 4px; }

/* Typography for the 'Another Angle' section */

.brand-text-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}

.brand-logo {
  width: auto;
  height: 70px;
  object-fit: contain;
  flex-shrink: 0;
}


.brand-accent-text {
    color: #ffffff;
    
    /* Font Stack */
    font-family: "warnock-pro", "Warnock Pro", "Warnock", serif;
    font-style: italic;
    font-weight: 400;
    
    /* Sizing & Spacing */
    font-size: clamp(1.75rem, 7vw); /* Scales based on screen size */
    line-height: 0.85;
    letter-spacing: -0.02em;
    
    margin: 0;
    padding-bottom: 0;
    text-transform: lowercase;
}

body {
  background: #000000;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-system);
  padding: 24px 0;
  overflow: hidden;
}

/* ── Bezel wrapper ── */
.bezel-wrap {
  position: relative;
  width: 437px;
  height: 894px;
  flex-shrink: 0;
  transform-origin: center center;
  transform: scale(var(--bezel-scale, 1));
}

.bezel-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 400;
  display: block;
}

/* ── Phone frame ── */
/* Sized/positioned to align with the Bezel.png screen window (desktop only —
   the tablet/mobile media queries below set their own native 390×844 rect
   since no bezel photo is shown there). */
.phone {
  width: 394px;
  height: 850px;
  background: var(--c-bg-black);
  border-radius: 44px;
  overflow: hidden;
  position: absolute;
  left: 22px;
  top: 22px;
  z-index: 1;
}

.screens {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  top: var(--status-bar-h);
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.active { display: block; }
#screen-feed.active { display: flex; flex-direction: column; overflow: hidden; }
#screen-feed .bottom-nav { position: relative; flex-shrink: 0; }

/* ── Global status bar ── */
/* Default: transparent — screen headers below provide background coverage */
body.screen-theme .global-status-bar {
  background: var(--c-bg-black);
}
body.light-mode.screen-theme .global-status-bar {
  background: #ffffff;
}
.sb-time {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-white);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
}
/* Light mode: invert any white-fill elements in status bar (covers battery fill rect) */
body.light-mode .global-status-bar *[fill="white"] { fill: #1c1c1e; }

/* ── Status bar ── */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.status-bar .time { font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.status-bar .icons { display: flex; gap: 6px; align-items: center; }

/* ══════════════════════════════════
   SCREEN 1 — FEED
══════════════════════════════════ */
#screen-feed { background: var(--c-bg-black); }

.feed-status { background: var(--c-bg-black); color: var(--c-white); }

.insta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 8px;
  border-bottom: 0.5px solid var(--c-stroke-top);
  position: sticky;
  top: 0;
  background: var(--c-bg-black);
  z-index: 10;
}
.insta-wordmark { color: #fff; display: block; }
body.light-mode .insta-wordmark { color: #000; }
.insta-logo {
  font-size: 26px;
  font-weight: var(--fw-regular);
  font-style: italic;
  color: var(--c-white);
  letter-spacing: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.insta-icons { display: flex; gap: 4px; align-items: center; }

/* Stories */
.stories-row {
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 0.5px solid var(--c-stroke-top);
}
.stories-row::-webkit-scrollbar { display: none; }

.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
  cursor: pointer;
}
.story-ring {
  width: 60px; height: 60px;
  border-radius: 50%;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(45deg, var(--c-ig-orange), #e6683c, var(--c-ig-red), #bc1888);
}
.story-ring.no-ring { background: var(--c-surface-2); }
.story-inner {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--c-bg-222);
  border: 2.5px solid var(--c-black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-5xl);
  overflow: hidden;
  position: relative;
}
.story-label { font-size: var(--fs-sm); color: var(--c-text-secondary); text-align: center; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Post */
.feed-post { border-bottom: 0.5px solid var(--c-stroke-top); padding-bottom: 8px; }

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 8px;
}
.post-user { display: flex; align-items: center; gap: 10px; }
.post-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c-surface-2);
  border: 0.5px solid var(--c-divider);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-base); font-weight: var(--fw-bold); color: var(--c-white);
  flex-shrink: 0;
}
.post-username { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-white); }
.post-location { font-size: var(--fs-sm); color: var(--c-text-secondary); }
.post-follow { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-blue); background: none; border: none; cursor: pointer; }

/* Post image — background:#000 covers transparent edge pixels in RGBA source images */
.post-image { width: 100%; aspect-ratio: 1; overflow: hidden; position: relative; background: #000; }

/* Another Angle CTA */
.aa-banner {
  margin: 0;
  background: linear-gradient(180deg, var(--c-aa-start), var(--c-aa-end));
  border: none;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-system);
  transition: filter 0.18s ease-out;
  -webkit-tap-highlight-color: transparent;
}
.aa-banner:active { filter: brightness(1.15); }
.aa-banner-left { display: flex; align-items: center; gap: 10px; }
.aa-icon {
  width: 32px; height: 32px;
  background: #000;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-lg); font-weight: var(--fw-heavy); color: var(--c-white);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.aa-banner-label { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-white); line-height: 1.2; text-align: left;}
.aa-banner-sub { font-size: var(--fs-sm); color: rgba(255,255,255,0.85); margin-top: 1px; }

/* Post actions */
.post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 4px 6px;
}
.action-grp { display: flex; gap: 4px; align-items: center; }
.act-btn { background: none; border: none; cursor: pointer; color: var(--c-white); display: flex; align-items: center; padding: 0; min-width: 44px; min-height: 44px; justify-content: center; }
.post-likes { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--c-white); padding: 0 16px 2px; }
.post-caption { padding: 0 16px 2px; font-size: var(--fs-lg); font-weight: 300; color: var(--c-white); line-height: 1.45; }
.post-caption .u { font-weight: var(--fw-semibold); }
.cap-read-more { font-weight: var(--fw-semibold); color: var(--c-text-meta); cursor: pointer; }
.post-time { padding: 0 16px 10px; font-size: var(--fs-sm); color: var(--c-text-meta); }
.post-comments-link { padding: 0 16px 3px; font-size: var(--fs-lg); color: var(--c-text-secondary); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.post-comment-row { display: flex; align-items: center; gap: 10px; padding: 3px 16px 12px; }
.post-comment-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--c-surface-2);
  border: 0.5px solid var(--c-divider);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--c-white);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.story-inner img, .story-inner svg,
.post-comment-avatar img, .post-comment-avatar svg,
.profile-avatar-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.post-comment-placeholder { font-size: var(--fs-base); color: var(--c-text-secondary); }

/* Bottom nav */
.bottom-nav {
  position: sticky;
  bottom: 0;
  background: var(--c-bg-black);
  border-top: 0.5px solid var(--c-stroke-top);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 0 16px;
  z-index: 50;
}
.nav-btn { background: none; border: none; cursor: pointer; color: var(--c-white); opacity: 0.65; padding: 4px 14px; min-height: 36px; display: flex; align-items: center; }
.nav-btn.active { opacity: 1; }

/* ══════════════════════════════════
   PERSPECTIVES SHEET
══════════════════════════════════ */
.sheet-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
}
.sheet-overlay.visible { display: flex; }

.bottom-sheet {
  background: var(--c-bg-black);
  border-radius: var(--radius-sheet);
  height: 88%;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: var(--transition-sheet);
  overflow: hidden;
}
.sheet-overlay.open .bottom-sheet { transform: translateY(0); }

.drag-handle {
  width: 36px; height: 4px;
  background: var(--c-surface-3);
  border-radius: var(--radius-pill);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--fs-md) 16px 8px;
  flex-shrink: 0;
}
.sheet-head-left { display: flex; align-items: center; gap: 10px; }
.sheet-aa-badge {
  width: 36px; height: 36px;
  background: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-lg); font-weight: var(--fw-heavy); color: var(--c-white);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.sheet-title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--c-white); }
.sheet-sub { font-size: var(--fs-md); color: var(--c-text-muted); }
.sheet-x {
  width: 44px; height: 44px;
  background: transparent;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-secondary); font-size: 24px;
  border: none; cursor: pointer;
  flex-shrink: 0;
}
.sheet-x:active { opacity: 0.45; transition: opacity 0.07s ease; }

/* Coverage */
.coverage-wrap { padding: 12px 0 12px; margin-bottom: 6px; }
.cov-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-text-secondary); letter-spacing: 0; text-transform: none; margin-bottom: 8px; }
.cov-bars { display: flex; gap: 2px; height: 24px; border-radius: 6px; overflow: hidden; margin-top: 4px; margin-bottom: 8px; align-items: stretch; }
.cov-left { background: var(--c-blue-soft); flex: 31; display: flex; align-items: center; justify-content: center; height: 100%; }
.cov-center { background: var(--c-surface-3); flex: 41; display: flex; align-items: center; justify-content: center; height: 100%; }
.cov-right { background: var(--c-red); flex: 28; display: flex; align-items: center; justify-content: center; height: 100%; }
.cov-seg-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: rgba(255,255,255,0.9); white-space: nowrap; overflow: hidden; text-overflow: clip; padding: 0 4px; }
.cov-meta { font-size: var(--fs-sm); color: var(--c-text-meta); display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cov-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cov-link { color: var(--c-blue); text-decoration: none; margin-left: 4px; cursor: pointer; background: none; border: none; font-family: inherit; font-size: inherit; padding: 0; }

/* Sheet scroll area */
.sheet-body {
  overflow-y: auto;
  flex: 1;
  padding: 8px 16px 16px;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.sheet-body::-webkit-scrollbar { display: none; }

/* Source cards */
.src-card {
  background: var(--c-surface);
  border-radius: 14px;
  margin-bottom: 10px;
  overflow: visible;
  border: 1px solid var(--c-border-dark);
  transition: none;
  -webkit-tap-highlight-color: transparent;
}
.src-card:last-child { margin-bottom: 0; }
.src-card.expanded { border-color: var(--c-border-dark); }
.src-card.expanded .src-card-top { border-top: none; }

.src-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px;
  border-top: 1px solid var(--c-border-dark);
  margin-top: 4px;
}
.src-logo {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: var(--fw-heavy); color: var(--c-white);
  flex-shrink: 0;
  letter-spacing: -0.3px;
  border: 1px solid var(--c-border-dark);
}
.src-logo.wsj { color: var(--c-white); }
.src-logo.bbc { color: var(--c-white); }

.src-info { flex: 1; min-width: 0; }
.src-name { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-white); margin-bottom: 2px;}
.src-desc { font-size: var(--fs-sm); color: var(--c-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-time { font-size: var(--fs-sm); color: var(--c-text-meta); margin-top: 1px; }

.chevron-btn {
  color: var(--c-text-meta); flex-shrink: 0; margin-top: 2px; cursor: pointer;
  transition: transform 0.36s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.28s ease;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.chevron-btn:active { opacity: 0.45; transition: transform 0.36s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.07s ease; }
.src-card.expanded .chevron-btn { transform: rotate(180deg); }

.src-headline-row {
  display: flex;
  align-items: flex-start;
  gap: 0px;
  padding: var(--fs-md) 12px var(--fs-md);
  background: none; border: none; width: 100%; text-align: left; font-family: inherit; cursor: pointer;
}
.src-headline-row .chevron-btn { flex-shrink: 0; margin-top: 1px; }
.src-headline { font-size: var(--fs-xl); font-weight: var(--fw-medium); color: #e8e8e8; line-height: 1.44; flex: 1; cursor: pointer; }

/* Expanded content — grid animation (Apple-style spring) */
.src-expanded {
  display: grid;
  grid-template-rows: 0fr;
  transition:
    grid-template-rows 0.38s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.26s ease-out;
  opacity: 0;
  border-bottom: 1px solid transparent;
}
.src-expanded-inner {
  overflow: hidden;
  padding: 0 14px;
}
.src-card.expanded .src-expanded {
  grid-template-rows: 1fr;
  opacity: 1;
  border-bottom-color: var(--c-surface-2);
}
.src-card.expanded .src-headline-row {
  padding-bottom: 4px;
}

/* 4px system spacing inside expanded */
.exp-section { margin-bottom: 20px; }
.exp-section:last-child { margin-bottom: 4px; }
.exp-label {
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--c-white);
  letter-spacing: 0.6px; text-transform: uppercase;
  margin-bottom: 8px;
}
.exp-bullets {
  list-style: none; display: flex; flex-direction: column; gap: 8px;
}
.exp-bullets li { display: flex; gap: 7px; font-size: var(--fs-md); font-weight: 300; color: var(--c-text-secondary); line-height: 1.4; }
.exp-bullets li::before { content: "•"; color: var(--c-blue); flex-shrink: 0; }

.lean-val { font-size: var(--fs-sm); color: var(--c-text-muted); margin-bottom: 8px; }
.lean-track { height: 6px; background: var(--c-surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.lean-fill { height: 100%; border-radius: var(--radius-pill); }
.lean-labs { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--c-text-meta); margin-top: 4px; }
.lean-spectrum-track {
  height: 6px;
  background: linear-gradient(to right, #3b82f6, #3a3a3c 50%, #ef4444);
  border-radius: var(--radius-pill);
  position: relative;
  margin-top: 2px;
}
.lean-spectrum-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.15);
  box-shadow: 0 1px 4px rgba(0,0,0,0.45);
}
.lean-spectrum-label {
  font-size: var(--fs-xs);
  color: var(--c-text-meta);
  text-align: center;
  margin-top: 6px;
  margin-bottom: var(--fs-md);
}

/* Card footer */
.src-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 12px;
}
.view-btn {
  padding: 8px var(--fs-md);
  border: 1px solid var(--c-surface-3);
  border-radius: 8px;
  background: rgba(39, 44, 51, 0.7); /* --c-surface-2 @ 50% */
  color: var(--c-light-gray);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-system);
  transition: var(--transition-bg), opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.view-btn:active { background: var(--c-bg-222); opacity: 0.82; transition: background 0.05s ease, opacity 0.07s ease; }
.tag-pill {
  padding: 6px 12px;
  min-height: 32px;
  background: var(--c-surface-2);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-dim);
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--c-surface-3);
  font-family: var(--font-system);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.14s ease-out, border-color 0.14s ease-out;
}
.tag-pill:active { background: var(--c-surface-2); border-color: var(--c-text-meta); }

/* Sheet footer */
.sheet-foot {
  padding: var(--fs-md) 16px 22px;
  text-align: center;
  margin-top: 10px;
}
.sheet-foot a { font-size: var(--fs-md); color: var(--c-blue); text-decoration: none; cursor: pointer; }
.sheet-powered { font-size: var(--fs-sm); color: var(--c-text-meta); margin-top: 4px; font-weight: 400; }
.sheet-powered-brand { font-family: 'Warnock Pro', 'Palatino Linotype', Palatino, serif; font-style: italic; font-weight: 400; font-size: 12px; }

/* ══════════════════════════════════
   TRANSPARENCY SOURCES SHEET
══════════════════════════════════ */
.transparency-sheet {
  background: var(--c-bg-black);
  border-radius: var(--radius-sheet);
  max-height: 85%;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: var(--transition-sheet);
  overflow: hidden;
}
.sheet-overlay.why-open .transparency-sheet { transform: translateY(0); }

.why-body {
  overflow-y: auto;
  flex: 1;
  padding: 4px 16px 28px;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.why-body::-webkit-scrollbar { display: none; }

.why-intro { font-size: var(--fs-base); color: var(--c-text-muted); line-height: 1.5; margin-bottom: 20px; }
.why-intro strong { color: var(--c-light-gray); font-weight: var(--fw-medium); }
.why-transparency {
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--c-text-meta);
  letter-spacing: 0.8px; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 16px;
}
.why-transparency::before { content: "○"; font-size: var(--fs-md); color: var(--c-blue); }

.why-src-item { background: #131820; border: 1px solid var(--c-surface-2); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; }
.why-src-item:last-child { margin-bottom: 0; }
.why-src-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.why-src-desc { font-size: var(--fs-base); color: var(--c-text-muted); line-height: 1.45; margin-bottom: 8px; }
.show-more-btn {
  font-size: var(--fs-md); color: var(--c-blue);
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 4px; padding: 0; font-family: var(--font-system);
  transition: opacity 0.25s ease;
}
.show-more-btn:active { opacity: 0.45; transition: opacity 0.07s ease; }

/* ══════════════════════════════════
   SCREEN — ARTICLE
══════════════════════════════════ */
#screen-article { background: var(--c-bg-black); }
.art-status { background: var(--c-bg-black); color: var(--c-white); }

.art-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--c-border-dark);
  position: sticky;
  top: 0;
  background: var(--c-bg-black);
  z-index: 10;
}
.art-back {
  display: flex; align-items: center;
  font-size: var(--fs-base); color: var(--c-white);
  background: none; border: none; cursor: pointer; font-family: var(--font-system);
}
.art-post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
}
.art-user { display: flex; align-items: center; gap: 10px; }
.art-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--c-surface); border: 1px solid var(--c-gray-333);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: var(--fw-heavy); color: var(--c-white);
  flex-shrink: 0;
}
.art-username { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-white); }
.art-sub { font-size: var(--fs-sm); color: var(--c-text-secondary); }
.art-follow { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-blue); background: none; border: none; cursor: pointer; }

.art-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--c-surface); padding: 3px 10px 3px 7px;
  border-radius: 5px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-white);
  margin: 0 16px 8px;
}

.art-image { width: 100%; aspect-ratio: 1; overflow: hidden; }

.art-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 6px 6px;
}
.art-act-grp { display: flex; gap: 16px; align-items: center; }
.art-act { background: none; border: none; cursor: pointer; color: var(--c-white); padding: 0; display: flex; align-items: center; }
.art-likes { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-white); padding: 0 16px 4px; }
.art-caption { padding: 0 16px 8px; font-size: var(--fs-base); color: var(--c-white); line-height: 1.45; }
.art-caption .u { font-weight: var(--fw-semibold); }

.art-read-btn {
  margin: 8px 16px 14px;
  padding: 8px var(--fs-md);
  background: rgba(39, 44, 51, 0.7);
  border: 1px solid var(--c-surface-3);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--c-light-gray);
  cursor: pointer; width: calc(100% - 32px);
  font-family: var(--font-system);
  transition: var(--transition-bg), opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.art-read-btn:active { background: var(--c-bg-222); opacity: 0.82; transition: background 0.05s ease, opacity 0.07s ease; }

.art-comments { padding: 0 16px 4px; font-size: var(--fs-base); color: var(--c-text-secondary); }
.art-time { padding: 0 16px 20px; font-size: var(--fs-sm); color: var(--c-text-secondary); }

/* ══════════════════════════════════
   SCREEN — DASHBOARD
══════════════════════════════════ */
#screen-dashboard { background: var(--c-bg-black); }

.dash-status { background: var(--c-bg-black); color: var(--c-white); }

.dash-head {
  display: flex; align-items: center;
  padding: 10px 16px 8px;
  border-bottom: 0.5px solid var(--c-stroke-top);
  position: sticky; top: 0; background: var(--c-bg-black); z-index: 10;
}
.dash-back { display: flex; align-items: center; gap: 4px; font-size: var(--fs-lg); color: var(--c-white); background: none; border: none; cursor: pointer; font-family: var(--font-system); }
.dash-title { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); color: var(--c-white); position: absolute; left: 50%; transform: translateX(-50%); }

.dash-body { padding-bottom: 60px; }

/* Sections */
.dash-section {
  padding: 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.dash-section:first-child { padding-top: 10px; }
.dash-section:last-child { border-bottom: none; }
.dash-section-divider { height: 8px; background: #191E25; margin: 0 -16px; }

.dash-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; width: 100%; }
.dash-sec-title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--c-white); text-align: left; }
.dash-sec-more { font-size: var(--fs-base); color: var(--c-blue); cursor: pointer; }
.dash-sec-desc { font-size: var(--fs-md); color: var(--c-text-meta); margin-bottom: 24px; margin-top: -6px; }

/* Time tabs */
.time-tabs { display: flex; background: var(--c-surface); border-radius: 8px; padding: 2px; margin-bottom: 20px; }
.time-tab {
  flex: 1; padding: 7px 0; text-align: center;
  font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--c-text-secondary);
  cursor: pointer; border-radius: 6px;
  background: none; border: none; font-family: var(--font-system);
  transition: background 0.18s ease-out, color 0.18s ease-out;
}
.time-tab.active { background: var(--c-surface-3); color: var(--c-white); }

/* Variety stats */
.variety-num { font-size: 54px; font-weight: var(--fw-bold); color: var(--c-white); line-height: 1; }
.variety-unit { font-size: 38px; }
.variety-desc { font-size: var(--fs-base); color: var(--c-text-meta); margin: 4px 0 8px; }
.variety-delta {
  display: flex; align-items: center; gap: 4px;
  font-size: var(--fs-md); margin-bottom: 18px;
}
.variety-delta.down { color: #f27a84; }
.variety-delta.up { color: var(--c-green); }

/* Bar chart */
.var-chart-wrap { position: relative; margin-bottom: 8px; padding-top: 22px; }
.var-bar-chart { display: flex; align-items: flex-end; gap: 5px; min-height: 40px; position: relative; overflow: visible; transition: height 0.35s cubic-bezier(0.34, 1.06, 0.64, 1); }
.var-bar-chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.var-bar-chart-bar { width: 100%; border-radius: 4px 4px 0 0; transition: height 0.42s cubic-bezier(0.34, 1.06, 0.64, 1), opacity 0.18s ease-out; min-height: 3px; }
.var-bar-chart-bar-wrap.selected .var-bar-chart-bar { opacity: 1; outline: 1.5px solid rgba(255,255,255,0.4); outline-offset: 1px; }
.var-bar-chart-label { font-size: 9px; color: var(--c-text-meta); white-space: nowrap; }
.var-chart-goal-line {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center; gap: 6px;
  pointer-events: none;
}
.var-chart-goal-line::before {
  content: ''; flex: 1; height: 1.5px;
  background: repeating-linear-gradient(90deg, var(--c-text-meta) 0, var(--c-text-meta) 4px, transparent 4px, transparent 8px);
}
.var-chart-goal-label { font-size: 10px; color: var(--c-text-meta); white-space: nowrap; }
.var-chart-goal-edit {
  background: none; border: none; cursor: pointer; pointer-events: all;
  color: #3db2ff; font-size: 11px; font-family: var(--font-system);
  padding: 0; text-decoration: underline;
}
.var-bar-val-tip {
  position: absolute; top: 0; background: rgba(255,255,255,0.12);
  border-radius: 6px; padding: 3px 7px; font-size: 11px;
  font-weight: var(--fw-semibold); color: var(--c-white);
  pointer-events: none; display: none; white-space: nowrap;
}
.var-chart-axis { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--c-divider); margin-top: 2px; }

/* Info tooltip */
.info-btn { background: none; border: none; cursor: pointer; padding: 0; display: flex; align-items: center; color: var(--c-text-meta); position: relative; min-width: 44px; min-height: 44px; justify-content: center; }
.info-tooltip {
  position: absolute; right: 4px; top: 34px; z-index: 50;
  background: var(--c-surface-3); border: 0.5px solid var(--c-divider);
  border-radius: 10px; padding: 10px 12px;
  font-size: var(--fs-md); font-weight: 300; color: var(--c-text-dim); line-height: 1.4;
  width: max-content; max-width: 220px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.14);
  display: none; text-align: center;
}
.info-tooltip.visible { display: block; }
/* border triangle pointing up */
.info-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 9px;
  border: 7px solid transparent;
  border-bottom-color: var(--c-divider);
}
/* fill triangle on top */
.info-tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 10px;
  border: 6px solid transparent;
  border-bottom-color: var(--c-surface-3);
}

/* Disabled adj buttons */
.save-btn:disabled { background: var(--c-surface); color: var(--c-divider); cursor: default; }
.reset-btn:disabled { color: var(--c-divider); cursor: default; }

/* Spider chart */
.spider-wrap { margin-top: 20px; display: flex; flex-direction: column; align-items: center; }
.spider-title { font-size: var(--fs-md); color: var(--c-text-meta); margin-bottom: var(--fs-md); align-self: flex-start; }
.spider-svg { overflow: visible; }
.spider-insight { margin-top: 12px; width: 100%; padding: 10px 13px; background: rgba(0,149,246,0.08); border: 1px solid rgba(0,149,246,0.22); border-radius: 10px; font-size: 12px; font-weight: 300; color: #6cb4f5; line-height: 1.4; }
/* Spider chart grid: theme-aware strokes */
#spider-svg polygon:not([fill="rgba(0,149,246,0.15)"]),
#spider-svg line { stroke: rgba(255,255,255,0.18) !important; }
body.light-mode #spider-svg polygon:not([fill="rgba(0,149,246,0.15)"]),
body.light-mode #spider-svg line { stroke: rgba(0,0,0,0.14) !important; }

/* Full-page overlays */
.full-page-overlay {
  position: absolute; inset: 0; top: var(--status-bar-h);
  background: var(--c-bg-black); z-index: 220;
  display: none; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  opacity: 0;
  transform: translateX(14px);
  transition: opacity 0.22s ease-out, transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.full-page-overlay.visible { display: flex; }
.full-page-overlay.open { opacity: 1; transform: translateX(0); }
.full-page-overlay::-webkit-scrollbar { display: none; }
.fp-topbar {
  display: flex; align-items: center; gap: var(--fs-md);
  padding: 14px 16px 10px; border-bottom: 0.5px solid var(--c-stroke-top);
  position: sticky; top: 0; background: var(--c-bg-black); z-index: 10; flex-shrink: 0;
}
.fp-back { background: none; border: none; color: var(--c-white); font-size: var(--fs-lg); cursor: pointer; display: flex; align-items: center; gap: 4px; font-family: inherit; }
.fp-title { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); color: var(--c-white); }
.fp-body { padding: 16px; flex: 1; }
.fp-desc { font-size: var(--fs-md); color: var(--c-text-meta); margin-bottom: 18px; line-height: 1.4; }

/* Explore topic perspectives modal — AA-style */
.angle-sheet-overlay {
  position: absolute;
  top: 22px; left: 22px;
  width: 394px; height: 850px;
  border-radius: 44px;
  overflow: hidden;
  background: rgba(0,0,0,0.55); z-index: 210;
  display: none; flex-direction: column; justify-content: flex-end;
}
/* Sheet dims keep the screen-area box — the sheets inside are sized as a
   percentage of it (max-height: 85–90%), so enlarging it would make them
   taller. Instead ::before paints the dim up over the status-bar strip.
   .screens spans the whole phone, so this is clipped at the phone edge. */
.sheet-overlay {
  top: var(--status-bar-h);
}
.angle-sheet-overlay {
  top: calc(22px + var(--status-bar-h));
  height: calc(850px - var(--status-bar-h));
}
.sheet-overlay::before,
.angle-sheet-overlay::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: 100%;
  height: var(--status-bar-h);
  background: inherit;
}

.angle-sheet-overlay.visible { display: flex; }
.angle-sheet-overlay.open .angle-inner-sheet { transform: translateY(0); }
.angle-inner-sheet {
  background: var(--c-bg-black); border-radius: var(--radius-sheet); height: 88%;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: var(--transition-sheet);
  overflow: hidden;
}
.angle-sheet-body { overflow-y: auto; flex: 1; padding: 0px 16px 24px; scrollbar-width: none; overscroll-behavior: contain; }
.angle-sheet-body::-webkit-scrollbar { display: none; }
.angle-missed-label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-text-secondary); letter-spacing: 0.8px; text-transform: uppercase; margin: 16px 0 10px; }
.angle-src-card {
  background: var(--c-bg-1a); border-radius: var(--radius-sm); padding: 14px 14px var(--fs-md); margin-bottom: 10px;
}
.angle-src-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.angle-src-logo { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: var(--fw-heavy); flex-shrink: 0; border: 1px solid var(--c-border-dark); overflow: hidden; }
.angle-src-name { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--c-white); }
.angle-src-meta { font-size: var(--fs-sm); color: var(--c-text-meta); }
.angle-src-headline { font-size: var(--fs-base); color: var(--c-light-gray); line-height: 1.45; margin-bottom: 8px; }
.angle-src-lean-row { display: flex; align-items: center; gap: 8px; }
.angle-src-lean-track { flex: 1; height: 6px; background: var(--c-surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.angle-src-lean-fill { height: 100%; border-radius: var(--radius-pill); }
.angle-src-lean-label { font-size: var(--fs-xs); color: var(--c-text-meta); white-space: nowrap; }

/* Adjust source */
.adj-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.adj-label { font-size: var(--fs-lg); color: var(--c-white); }
.adj-controls { display: flex; align-items: center; gap: var(--fs-md); }
.adj-val { font-size: var(--fs-lg); color: var(--c-text-muted); min-width: 38px; text-align: center; }
.adj-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--c-surface); border: none; color: var(--c-white);
  font-size: 20px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; line-height: 1; font-family: var(--font-system);
  transition: transform 0.38s cubic-bezier(0.34, 1.12, 0.64, 1), opacity 0.28s ease;
}
.adj-btn:active { transform: scale(0.86); opacity: 0.6; transition: transform 0.09s ease, opacity 0.07s ease; }
.adj-actions { display: flex; gap: 10px; margin-top: 16px; }
.save-btn {
  flex: 1; padding: 13px;
  background: var(--c-blue); border-radius: var(--radius-sm);
  font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--c-white);
  border: none; cursor: pointer; font-family: var(--font-system);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.32s cubic-bezier(0.34, 1.12, 0.64, 1), opacity 0.25s ease;
}
.save-btn:not(:disabled):active { transform: scale(0.97); opacity: 0.82; transition: transform 0.08s ease, opacity 0.07s ease; }
.reset-btn {
  padding: 13px 16px;
  background: transparent; border: none;
  font-size: var(--fs-xl); color: var(--c-text-secondary);
  cursor: pointer; font-family: var(--font-system);
  transition: opacity 0.25s ease;
}
.reset-btn:not(:disabled):active { opacity: 0.45; transition: opacity 0.07s ease; }

/* Explore rows */
.explore-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0;
  border-bottom: 0.5px solid var(--c-stroke-top);
  cursor: pointer;
  background: none; border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left; font-family: inherit;
}
.explore-row:last-child { border-bottom: none; }
.explore-row-l { display: flex; align-items: center; gap: var(--fs-md); }
.explore-icon { width: 38px; height: 38px; border-radius: var(--fs-md); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.explore-title { font-size: var(--fs-lg); font-weight: var(--fw-medium); color: var(--c-white); }
.explore-sub { font-size: var(--fs-md); color: var(--c-text-meta); }

/* Topic rows */
.topic-row { margin-bottom: 16px; background: none; border: none; width: 100%; text-align: left; font-family: inherit; cursor: pointer; padding: 0; }
.topic-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.topic-name { font-size: var(--fs-lg); color: var(--c-white); }
.topic-meta { display: flex; align-items: center; gap: 6px; font-size: var(--fs-md); color: var(--c-text-meta); }
.topic-track { height: 6px; background: var(--c-surface); border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 4px; }
.topic-fill { height: 100%; border-radius: var(--radius-pill); }
.topic-fill.low { background: var(--c-amber); }
.topic-fill.mixed { background: var(--c-blue-soft); }
.topic-fill.high { background: var(--c-green); }

.var-badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 300;
}
.var-badge.low { background: rgba(245,158,11,0.15); color: var(--c-amber); }
.var-badge.mixed { background: rgba(59,130,246,0.15); color: #80aef9; }
.var-badge.high { background: rgba(16,185,129,0.15); color: #11ca8d; }

/* Bar chart legend */
.bar-chart-legend { display: flex; gap: var(--fs-md); margin-top: 16px; font-size: var(--fs-xs); color: var(--c-text-meta); align-items: center; }
.bar-chart-legend span { display: flex; align-items: center; gap: 5px; }
.legend-squircle { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; display: inline-block; }

/* Topic goal marker */
.topic-bar-wrap { position: relative; margin-bottom: 4px; }
.topic-bar-wrap .topic-track { margin-bottom: 0; }
.topic-goal-marker {
  position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px;
  background: repeating-linear-gradient(to bottom, var(--c-text-meta) 0, var(--c-text-meta) 3px, transparent 3px, transparent 6px);
  pointer-events: none; border-radius: 1px;
}

/* Full-page topic/explore overlays inside full-page */
.fp-inner-sheet-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 5;
  display: none; flex-direction: column; justify-content: flex-end;
}
.fp-inner-sheet-overlay.visible { display: flex; }
.fp-inner-sheet-overlay.open .angle-inner-sheet,
.fp-inner-sheet-overlay.open .dark-sheet { transform: translateY(0); }

/* Follow button on source rows */
.src-follow-btn {
  padding: 5px 12px; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  border: 1px solid var(--c-blue); color: var(--c-blue);
  background: transparent; cursor: pointer; font-family: inherit; white-space: nowrap; flex-shrink: 0;
}
.src-follow-btn.unfollow { border-color: var(--c-text-meta); color: var(--c-text-meta); }

/* Topic search bar */
.topic-search-bar {
  width: 100%; background: var(--c-surface); border: none; border-radius: 10px;
  padding: 10px 14px; color: var(--c-white); font-size: var(--fs-base);
  font-family: var(--font-system); margin-bottom: 12px; outline: none;
}
.topic-search-bar::placeholder { color: var(--c-text-meta); }

/* Goal edit input */
.goal-edit-wrap { display: none; align-items: center; gap: 6px; margin-top: 2px; }
.goal-edit-wrap.visible { display: flex; }
.goal-input {
  width: 52px; background: var(--c-surface); border: 1px solid var(--c-surface-3); border-radius: 6px;
  color: var(--c-white); font-size: var(--fs-base); font-weight: var(--fw-semibold); text-align: center;
  padding: 4px 6px; font-family: inherit;
}
.goal-input:focus { outline: none; border-color: var(--c-blue); transition: border-color 0.18s ease-out; }

/* Adj label descriptions */
.adj-sub { font-size: var(--fs-sm); color: var(--c-text-meta); margin-top: 2px; }

/* ── Overlay fade ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet-overlay.visible { animation: fadeIn 0.24s ease-out; }

/* ══ ONBOARDING OVERLAY (ghost/spotlight) ══ */
/* Overlay must cover the phone screen exactly. The phone's box changes across
   breakpoints (394×850 at 22/22 on desktop, full-viewport on mobile/tablet), so
   syncOnboardOverlay() in script.js measures .phone and writes the real size,
   position and border-radius inline — on open and on every resize.
   The values below are only the pre-sync fallback; keep them matching the
   desktop .phone rule. */
.onboard-overlay {
  position: absolute;
  top: 22px; left: 22px;
  width: 394px; height: 850px;
  border-radius: 44px;
  overflow: hidden;
  z-index: 300;
}
.onboard-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.82);
  pointer-events: none;
  transition: background 0.25s;
}
.onboard-overlay.has-spotlight .onboard-backdrop { background: transparent; }
.onboard-overlay.light-dim .onboard-backdrop { background: rgba(0,0,0,0.55); }
.onboard-spotlight {
  position: absolute;
  background: transparent;
  box-shadow: 0 0 0 2000px rgba(0,0,0,0.82);
  border: 1.5px solid rgba(200,210,220,0.55);
  pointer-events: none;
  z-index: 301;
  border-radius: 10px;
  transition: top 0.38s cubic-bezier(0.34, 1.06, 0.64, 1), left 0.38s cubic-bezier(0.34, 1.06, 0.64, 1), width 0.38s cubic-bezier(0.34, 1.06, 0.64, 1), height 0.38s cubic-bezier(0.34, 1.06, 0.64, 1), border-radius 0.28s ease-out;
}
.onboard-card {
  position: absolute;
  top: 50%;
  left: 20px; right: 20px;
  transform: translateY(-50%);
  z-index: 302;
  background: #16222C;
  border-radius: 14px;
  padding: 20px 0 0;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.onboard-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding: 0 20px;
}
.onboard-dots { display: flex; gap: 5px; align-items: center; }
.onboard-dot {
  height: 4px; border-radius: var(--radius-pill); background: var(--c-divider);
  transition: width 0.28s cubic-bezier(0.34, 1.06, 0.64, 1), background 0.2s ease-out; width: 6px;
}
.onboard-dot.active { background: var(--c-white); width: 22px; }
.onboard-skip {
  font-size: var(--fs-md); font-weight: var(--fw-m,--fw-medium); color: var(--c-text-secondary); background: none; border: none;
  cursor: pointer; font-family: var(--font-system); padding: 0;
}
.onboard-icon-wrap {
  width: 56px; height: 56px; background: var(--c-blue); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.onboard-title {
  font-size: var(--fs-3xl); font-weight: var(--fw-bold); color: var(--c-white);
  margin-bottom: 8px; line-height: 1.3; text-align: center;
  padding: 0 20px;
}
.onboard-body {
  font-size: var(--fs-lg); color: var(--c-text-secondary); line-height: 1.45;
  margin-bottom: 20px; text-align: center;
  padding: 0 20px;
}
#onboard-content {
  will-change: opacity, transform;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.onboard-btns { display: flex; flex-direction: row; gap: 0; border-top: 0.5px solid var(--c-surface-3); }
.onboard-back {
  flex: 1; padding: 14px; background: transparent;
  border-radius: 0;
  font-size: var(--fs-2xl); font-weight: var(--fw-regular); color: var(--c-text-secondary);
  border: none; border-right: 0.5px solid var(--c-surface-3);
  cursor: pointer; font-family: var(--font-system);
  -webkit-tap-highlight-color: transparent;
  text-align: center; display: none;
  transition: opacity 0.25s ease;
}
.onboard-back:active { opacity: 0.45; transition: opacity 0.07s ease; }
.onboard-continue {
  flex: 1; padding: 14px; background: transparent;
  border-radius: 0;
  font-size: var(--fs-2xl); font-weight: var(--fw-semibold); color: var(--c-blue);
  border: none; cursor: pointer; font-family: var(--font-system);
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  transition: opacity 0.25s ease;
}
.onboard-continue:active { opacity: 0.45; transition: opacity 0.07s ease; }

/* ══ DARK BOTTOM SHEET (shared by explore + topic detail) ══ */
.dark-sheet {
  background: var(--c-bg-black); border-radius: var(--radius-sheet); max-height: 88%;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: var(--transition-sheet);
  overflow: hidden;
}
.sheet-overlay.open .dark-sheet { transform: translateY(0); }
.dark-sheet-body {
  overflow-y: auto; flex: 1; padding: 0 16px 28px; scrollbar-width: none;
}
.dark-sheet-body::-webkit-scrollbar { display: none; }
.dsh-topic-name { font-size: var(--fs-4xl); font-weight: var(--fw-bold); color: var(--c-white); margin-bottom: 4px; }
.dsh-variety-row { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 4px; }
.dsh-variety-pct { font-size: 36px; font-weight: var(--fw-bold); color: var(--c-white); line-height: 1; }
.dsh-variety-unit { font-size: var(--fs-5xl); font-weight: var(--fw-bold); color: var(--c-white); }
.dsh-desc { font-size: var(--fs-base); color: var(--c-text-meta); line-height: 1.45; margin: 10px 0 20px; }
.dsh-section-label {
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-text-secondary);
  letter-spacing: 0.8px; text-transform: uppercase; margin-bottom: var(--fs-md);
}
.dsh-src-row {
  display: flex; align-items: center; gap: var(--fs-md);
  padding: 13px 0; border-bottom: 0.5px solid var(--c-stroke-top); cursor: pointer;
}
.dsh-src-row:last-child { border-bottom: none; }
.dsh-src-logo {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: var(--fw-heavy); color: var(--c-white); flex-shrink: 0;
  border: 1px solid var(--c-border-dark); overflow: hidden;
}
.dsh-src-info { flex: 1; min-width: 0; }
.dsh-src-name { font-size: var(--fs-lg); font-weight: var(--fw-medium); color: var(--c-white); margin-bottom: 2px; }
.dsh-src-meta { font-size: var(--fs-md); color: var(--c-text-meta); }
.new-badge {
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); padding: 3px 8px; border-radius: var(--radius-pill);
  background: #1C3A4A; color: #58C4DC; flex-shrink: 0;
  white-space: nowrap;
}
.dsh-var-track { height: 6px; background: var(--c-surface); border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 20px; }
.dsh-var-fill { height: 100%; border-radius: var(--radius-pill); }
.dsh-cta {
  width: 100%; padding: 14px; background: var(--c-blue); border-radius: 10px;
  font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--c-white);
  border: none; cursor: pointer; font-family: var(--font-system); margin-top: 8px;
  display: block; text-align: center;
}

/* ══ PREFERENCES SHEET ══ */
.prefs-sheet {
  background: var(--c-bg-black); border-radius: var(--radius-sheet); max-height: 88%;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: var(--transition-sheet);
  overflow: hidden;
}
.sheet-overlay.open .prefs-sheet { transform: translateY(0); }
.prefs-body {
  overflow-y: auto; flex: 1; padding: 0 16px 28px; scrollbar-width: none; overscroll-behavior: contain;
}
.prefs-body::-webkit-scrollbar { display: none; }
.prefs-cat-label {
  font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--c-text-secondary);
  letter-spacing: 0; text-transform: none; margin: 20px 0 var(--fs-md);
}
.chips-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.pref-chip {
  padding: 8px 14px; border-radius: 999px;
  font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--c-text-muted);
  background: var(--c-surface); border: 1px solid var(--c-surface-2);
  cursor: pointer; font-family: var(--font-system);
  transition: background 0.18s ease-out, color 0.18s ease-out, border-color 0.18s ease-out, opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.pref-chip:active { opacity: 0.65; transition: background 0.05s ease, color 0.05s ease, opacity 0.07s ease; }
.pref-chip.selected { background: rgba(0,149,246,0.15); color: var(--c-blue); border-color: rgba(0,149,246,0.4); }
.prefs-actions {
  display: flex; gap: 10px; padding: 14px 16px 24px;
  flex-shrink: 0; border-top: 0.5px solid var(--c-stroke-top);
}

/* ══ TOPIC ROW TAPPABLE ══ */
.topic-row { cursor: pointer; }
.topic-chevron { flex-shrink: 0; margin-left: 4px; }

/* ══ TAG TOOLTIP ══ */
.tag-pill { cursor: pointer; position: relative; }
.tag-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--c-surface-3);
  border: 0.5px solid var(--c-divider);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: var(--fs-md);
  font-weight: 300;
  color: var(--c-text-dim);
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 185px;
  z-index: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  pointer-events: none;
  text-align: center;
}
/* border triangle */
.tag-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  right: 17px;
  border: 7px solid transparent;
  border-top-color: var(--c-divider);
}
/* fill triangle on top */
.tag-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 18px;
  border: 6px solid transparent;
  border-top-color: var(--c-surface-3);
}

/* ══ VIEW BTN hug content ══ */
.view-btn {
  flex: unset !important;
  width: auto !important;
}

/* ══ ALL SOURCES SCREEN ══ */
.all-sources-overlay {
  position: absolute;
  inset: 0;
  top: var(--status-bar-h);
  background: var(--c-bg-black);
  z-index: 400;
  display: none;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.all-sources-overlay.open {
  display: flex;
  transform: translateX(0);
}
.all-sources-overlay.visible { display: flex; }

.as-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 8px;
  border-bottom: 0.5px solid var(--c-stroke-top);
  flex-shrink: 0;
}
.as-back { display: flex; align-items: center; color: var(--c-white); background: none; border: none; cursor: pointer; font-family: inherit; }
.as-title { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); color: var(--c-white); }

.as-count-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--c-stroke-top);
  flex-shrink: 0;
}
.as-count-label { font-size: var(--fs-lg); color: var(--c-white); }
.as-count-sub { font-size: var(--fs-sm); color: var(--c-text-meta); margin-top: 2px; }
.as-count-controls { display: flex; align-items: center; gap: var(--fs-md); }
.as-count-val { font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--c-white); min-width: 24px; text-align: center; }
.as-count-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--c-surface); border: none; color: var(--c-white);
  font-size: 20px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; line-height: 1; font-family: inherit;
  transition: transform 0.38s cubic-bezier(0.34, 1.12, 0.64, 1), opacity 0.28s ease;
}
.as-count-btn:active { transform: scale(0.86); opacity: 0.6; transition: transform 0.09s ease, opacity 0.07s ease; }

.as-body { overflow-y: auto; flex: 1; padding: 0 16px 28px; scrollbar-width: none; overscroll-behavior: contain; }
.as-body::-webkit-scrollbar { display: none; }

.as-lean-section { margin-bottom: 4px; }
.as-lean-header {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 0 10px;
}
.as-lean-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.as-lean-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--c-text-muted); letter-spacing: 0.6px; text-transform: uppercase; }

.as-src-row {
  display: flex; align-items: center; gap: var(--fs-md);
  padding: var(--fs-md) var(--fs-md);
  background: var(--c-bg-1a);
  border-radius: 10px;
  margin-bottom: 6px;
  border: 1px solid #272727;
}
.as-src-row.selected { border-color: rgba(0,149,246,0.5); }
.as-src-logo-sm {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: var(--fw-heavy); flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--c-border-dark);
}
.as-src-info { flex: 1; min-width: 0; }
.as-src-name { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-white); }
.as-src-meta { font-size: var(--fs-sm); color: var(--c-text-muted); }

.as-priority-badge {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--c-blue); display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--c-white); flex-shrink: 0;
}
.as-priority-badge.inactive { background: var(--c-surface-2); color: var(--c-text-meta); }

.as-select-btn {
  padding: 5px var(--fs-md); border-radius: var(--radius-pill);
  font-size: var(--fs-md); font-weight: var(--fw-medium);
  border: 1px solid var(--c-blue); color: var(--c-blue);
  background: transparent; cursor: pointer; font-family: inherit;
  transition: transform 0.32s cubic-bezier(0.34, 1.12, 0.64, 1), opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.as-select-btn:active { transform: scale(0.94); opacity: 0.72; transition: transform 0.08s ease, opacity 0.07s ease; }
.as-select-btn.selected-btn {
  background: rgba(0,149,246,0.15);
}
.as-one-required { font-size: var(--fs-sm); color: var(--c-text-muted); margin-top: 2px; font-style: italic; }

/* ══ WHY SOURCES expanded ══ */
.why-section-header {
  font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--c-white);
  margin: 20px 0 var(--fs-md);
}
.why-src-detail-row {
  display: flex; gap: 6px; margin-bottom: 5px;
}
.why-detail-key { font-size: var(--fs-md); color: var(--c-text-meta); min-width: 120px; flex-shrink: 0; }
.why-detail-val { font-size: var(--fs-md); color: var(--c-text-muted); line-height: 1.45; }
.why-cert-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--fs-md); }
.why-cert-chip {
  padding: 3px 8px; background: rgba(0,149,246,0.1);
  border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 300; color: var(--c-blue);
}
.why-how-section {
  margin-top: 20px; padding-top: 20px;
  border-top: 0.5px solid var(--c-surface-2);
}
.why-how-body { font-size: var(--fs-base); color: var(--c-text-muted); line-height: 1.5; }
.why-show-less-btn {
  font-size: var(--fs-md); color: var(--c-blue);
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 4px; padding: 0; font-family: inherit;
  margin-bottom: var(--fs-md);
  transition: opacity 0.25s ease;
}
.why-show-less-btn:active { opacity: 0.45; transition: opacity 0.07s ease; }

/* ══ Logo background utilities ══ */
.logo-reuters  { background: var(--c-white); overflow: hidden; }
.logo-ap       { background: var(--c-black); }
.logo-bbc      { background: #bb0000; color: var(--c-white);
                 font-size: 9px; font-weight: var(--fw-heavy);
                 display: flex; align-items: center; justify-content: center; }
.logo-guardian { background: #1a5a3a; color: var(--c-white);
                 font-size: 9px; font-weight: var(--fw-heavy);
                 display: flex; align-items: center; justify-content: center; }
.logo-npr      { background: #1a3a5a; color: var(--c-white);
                 font-size: 9px; font-weight: var(--fw-heavy);
                 display: flex; align-items: center; justify-content: center; }
.logo-wsj      { background: var(--c-black); color: var(--c-white);
                 border: 1px solid var(--c-gray-333);
                 display: flex; align-items: center; justify-content: center; }
.logo-fox      { background: #003087; color: var(--c-white); }
.logo-nyt      { background: var(--c-white); color: var(--c-black); }

/* ══ ONBOARDING: screen transition animation ══ */
@keyframes screenFadeIn {
  from { opacity: 0.1; }
  to   { opacity: 1; }
}
.screen-entering { animation: screenFadeIn 0.28s ease-out; }

/* Onboarding tap ripple */
@keyframes onboardRipple {
  0%   { transform: scale(0); opacity: 0.55; }
  60%  { opacity: 0.3; }
  100% { transform: scale(2.8); opacity: 0; }
}
.onboard-ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  animation: onboardRipple 0.52s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  pointer-events: none;
}

/* ══ SRC CARD: original post tag ══ */
.src-original-tag {
  display: flex; align-items: center; gap: 5px;
  padding: 12px 12px 0px;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  color: var(--c-blue); letter-spacing: 0.2px;
}

/* ══ INSTA PROFILE OVERLAY ══ */
.insta-profile-overlay {
  position: absolute; inset: 0; top: var(--status-bar-h);
  background: var(--c-black); z-index: 500;
  display: none; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.insta-profile-overlay.open { transform: translateX(0); }
.insta-profile-overlay.visible { display: flex; }

.ip-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 8px; flex-shrink: 0;
}
.ip-back { background: none; border: none; color: var(--c-white); cursor: pointer; display: flex; align-items: center; padding: 0; }
.ip-handle { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--c-white); display: flex; align-items: center; gap: 5px; }
.ip-topright { display: flex; gap: 14px; align-items: center; }

.ip-profile-row {
  display: flex; align-items: center; gap: 16px;
  padding: 6px 16px 12px; flex-shrink: 0;
}
.ip-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  flex-shrink: 0; overflow: hidden;
  background: var(--c-surface); border: 1px solid var(--c-border-dark);
  display: flex; align-items: center; justify-content: center;
}
.ip-stats { display: flex; gap: 0; flex: 1; justify-content: space-around; }
.ip-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ip-stat-num { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--c-white); }
.ip-stat-label { font-size: var(--fs-sm); color: var(--c-text-secondary); }

.ip-bio-section { padding: 0 16px 10px; flex-shrink: 0; }
.ip-displayname { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-white); margin-bottom: 2px; }
.ip-bio-text { font-size: var(--fs-base); color: var(--c-white); line-height: 1.4; margin-bottom: 2px; }
.ip-link { font-size: var(--fs-base); color: var(--c-blue-soft); }

.ip-actions { display: flex; gap: 6px; padding: 0 16px 10px; flex-shrink: 0; }
.ip-action-btn {
  flex: 1; padding: 7px 6px; background: var(--c-surface); border: none;
  border-radius: 8px; font-size: var(--fs-base); font-weight: var(--fw-semibold);
  color: var(--c-white); cursor: pointer; font-family: var(--font-system);
  display: flex; align-items: center; justify-content: center; gap: 4px;
  transition: transform 0.32s cubic-bezier(0.34, 1.12, 0.64, 1), opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.ip-action-btn:active { transform: scale(0.95); opacity: 0.78; transition: transform 0.08s ease, opacity 0.07s ease; }
.ip-action-btn.sm { flex: 0 0 36px; padding: 7px; }

.ip-tabs { display: flex; border-top: 0.5px solid var(--c-stroke-top); border-bottom: 0.5px solid var(--c-stroke-top); flex-shrink: 0; }
.ip-tab { flex: 1; display: flex; align-items: center; justify-content: center; padding: 10px 0; opacity: 0.4; }
.ip-tab.active { opacity: 1; border-bottom: 1.5px solid var(--c-white); }

.ip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; overflow-y: auto; flex: 1; }
.ip-grid-tile { aspect-ratio: 1; background: var(--c-surface); position: relative; overflow: hidden; }

/* ══ ALL SOURCES: balance header ══ */
.as-balance-header {
  padding: 14px 0 6px;
  border-bottom: 0.5px solid var(--c-stroke-top);
  margin-bottom: 4px;
}
.as-set-pills { display: flex; gap: 6px; margin-bottom: 8px; }
.as-lean-pill {
  padding: 4px 11px; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}
.as-lean-pill.red   { background: rgba(239,68,68,0.15);   color: var(--c-red); }
.as-lean-pill.amber { background: rgba(245,158,11,0.15);  color: var(--c-amber); }
.as-lean-pill.blue  { background: rgba(59,130,246,0.15);  color: var(--c-blue-soft); }

.as-balance-status {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--c-white);
  margin-bottom: 6px;
}
.as-balance-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.as-guidance {
  font-size: var(--fs-sm); color: var(--c-text-muted);
  background: var(--c-surface); border-radius: 8px;
  padding: 8px 10px; line-height: 1.4;
}

/* ══ Article info (expanded only) ══ */
.src-article-info {
  font-size: var(--fs-sm); color: var(--c-text-muted);
  padding: 3px 0px 24px; letter-spacing: 0.1px;
}

/* ══ Why-show-less collapse ══ */
.why-src-item.collapsed .why-src-detail-row,
.why-src-item.collapsed .why-cert-row,
.why-src-item.collapsed .why-cert-header { display: none; }

/* ══ Adj minimum note ══ */
.adj-min-note { font-size: var(--fs-xs); color: var(--c-text-muted); margin-top: 2px; }
.adj-error { font-size: var(--fs-sm); color: var(--c-red); margin-top: 12px; line-height: 1.4; min-height: 0; }

/* ══ Goal Modal ══ */
.goal-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.65); z-index: 600;
  display: none;
}
.goal-modal-backdrop.visible { display: block; }
.goal-modal {
  /* .screens now includes the status-bar strip, so offset the centre by half
     of it to keep the modal centred on the visible screen area as before. */
  position: absolute; left: 20px; right: 20px;
  top: calc(50% + var(--status-bar-h) / 2); transform: translateY(-50%);
  background: var(--c-surface); border-radius: 18px;
  padding: 24px 20px 0; z-index: 601; display: none;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  overflow: hidden;
}
.goal-modal.visible { display: block; }
.goal-modal-title { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); color: var(--c-white); margin-bottom: 10px; text-align: center; }
.goal-modal-body { font-size: var(--fs-base); color: var(--c-text-secondary); line-height: 1.45; margin-bottom: 20px; text-align: center; }
.goal-modal-stepper { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.goal-stepper-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--c-surface-2); border: none; cursor: pointer;
  color: var(--c-white); display: flex; align-items: center; justify-content: center;
  transition: transform 0.38s cubic-bezier(0.34, 1.12, 0.64, 1), opacity 0.28s ease;
}
.goal-stepper-btn:active { transform: scale(0.86); opacity: 0.6; transition: transform 0.09s ease, opacity 0.07s ease; }
.goal-modal-input {
  width: 72px; text-align: center;
  background: var(--c-surface-2); border: 1px solid var(--c-surface-3);
  color: var(--c-white); font-size: 28px; font-weight: var(--fw-bold);
  font-family: var(--font-system); border-radius: 10px; padding: 8px 0;
  -moz-appearance: textfield; appearance: textfield;
}
.goal-modal-input::-webkit-outer-spin-button,
.goal-modal-input::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
.goal-modal-pct { font-size: 24px; font-weight: var(--fw-bold); color: var(--c-text-secondary); }
.goal-modal-error { font-size: var(--fs-sm); color: #f48d95; text-align: center; min-height: 18px; margin-bottom: 8px; }
.goal-modal-actions { display: flex; border-top: 0.5px solid var(--c-surface-3); margin-top: 4px; }
.goal-modal-cancel {
  flex: 1; padding: 14px; background: transparent; border-radius: 0;
  font-size: var(--fs-2xl); font-weight: var(--fw-regular); color: var(--c-text-secondary);
  border: none; border-right: 0.5px solid var(--c-surface-3);
  cursor: pointer; font-family: var(--font-system); text-align: center;
  transition: opacity 0.25s ease;
}
.goal-modal-cancel:active { opacity: 0.45; transition: opacity 0.07s ease; }
.goal-modal-save {
  flex: 1; padding: 14px; background: transparent; border-radius: 0;
  font-size: var(--fs-2xl); font-weight: var(--fw-semibold); color: #3db2ff;
  border: none; cursor: pointer; font-family: var(--font-system); text-align: center;
  transition: opacity 0.25s ease;
}
.goal-modal-save:active { opacity: 0.45; transition: opacity 0.07s ease; }

/* ══ Source Preferences Page ══ */
.sp-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 16px 2px; padding: 10px 14px;
  background: rgba(0,149,246,0.08); border-radius: 10px;
  font-size: var(--fs-sm); font-weight: 300; color: var(--c-blue); line-height: 1.45;
  flex-shrink: 0;
}
.sp-save-row { padding: 0 0 24px; flex-shrink: 0; display: flex; border-top: 0.5px solid var(--c-surface-3); }

.sp-src-card {
  background: var(--c-surface); border: 1px solid var(--c-surface-2);
  border-radius: var(--radius-sm); margin-bottom: 8px; overflow: hidden;
}
.sp-src-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer;
}
.sp-src-logo { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: #fff; overflow: hidden;
  border: 1px solid var(--c-border-dark);
}
.sp-src-info { flex: 1; min-width: 0; }
.sp-src-name { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-white); }
.sp-src-meta { font-size: var(--fs-xs); color: var(--c-text-meta); margin-top: 1px; }
.sp-src-rank-badge {
  width: 24px; height: 24px; border-radius: 50%; background: var(--c-blue);
  color: var(--c-white); font-size: var(--fs-sm); font-weight: var(--fw-bold);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sp-src-rank-badge.dim { background: var(--c-surface-2); color: var(--c-text-meta); }
.sp-src-chevron { color: var(--c-text-meta); flex-shrink: 0; transition: transform 0.36s cubic-bezier(0.34, 1.2, 0.64, 1); }
.sp-src-card.open .sp-src-chevron { transform: rotate(180deg); }

.sp-src-expanded { display: none; padding: 0 14px 14px; border-top: 0.5px solid var(--c-surface-2); }
.sp-src-card.open .sp-src-expanded { display: block; }
.sp-src-detail { font-size: var(--fs-sm); color: var(--c-text-muted); line-height: 1.4; margin-bottom: 10px; margin-top: 10px; }
.sp-src-meta-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 0.5px solid var(--c-surface-2); }
.sp-src-meta-row:last-of-type { border-bottom: none; }
.sp-src-meta-key { font-size: var(--fs-xs); color: var(--c-text-meta); }
.sp-src-meta-val { font-size: var(--fs-xs); color: var(--c-text-secondary); text-align: right; max-width: 55%; }

.sp-rank-controls { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.sp-rank-btn {
  width: 44px; height: 44px; border-radius: 8px;
  background: var(--c-surface-2); border: none; cursor: pointer;
  color: var(--c-white); display: flex; align-items: center; justify-content: center;
  transition: transform 0.32s cubic-bezier(0.34, 1.12, 0.64, 1), opacity 0.25s ease;
}
.sp-rank-btn:not(:disabled):active { transform: scale(0.88); opacity: 0.6; transition: transform 0.08s ease, opacity 0.07s ease; }
.sp-rank-btn:disabled { opacity: 0.3; cursor: default; }
.sp-rank-label { font-size: var(--fs-sm); color: var(--c-text-meta); flex: 1; }
.sp-top-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0,149,246,0.15); color: var(--c-blue);
  border-radius: var(--radius-pill); padding: 3px 9px;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}

.sp-group-label {
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  color: var(--c-text-muted); letter-spacing: 0.8px; text-transform: uppercase;
  padding: 14px 0 8px;
}

/* ── Toast notifications ── */
#toast-container {
  position: absolute;
  bottom: 84px;
  left: 0; right: 0;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 9999;
  padding: 0 16px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-surface-3);
  border-radius: 14px;
  padding: 11px 15px;
  max-width: 340px;
  width: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.06, 0.64, 1);
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0,0,0,0.55);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.toast-success .toast-icon { color: var(--c-green); }
.toast-warning .toast-icon { color: var(--c-amber); }
.toast-error   .toast-icon { color: var(--c-red); }
.toast-info    .toast-icon { color: #8e8e8e; }

.toast-msg {
  font-size: var(--fs-base);
  color: #e8e8e8;
  font-family: var(--font-system);
  line-height: 1.4;
}

/* ── Safe area insets (unconditional — 0 on non-notch devices) ── */
.status-bar,
.insta-header,
.art-topbar,
.as-topbar {
  padding-top: max(env(safe-area-inset-top), 4px);
}
.dash-head {
  padding-top: max(env(safe-area-inset-top), 14px);
}
.bottom-nav {
  padding-bottom: max(env(safe-area-inset-bottom), 6px);
}
.prefs-actions,
.sheet-foot,
.sp-save-row {
  padding-bottom: max(env(safe-area-inset-bottom), 14px);
}

/* ── iPad / tablet: phone at native 390×844, centered, black surround ── */
@media (pointer: coarse) and (min-width: 600px) {
  :root { --status-bar-h: 0px; }
  body {
    background: #000;
  }
  .bezel-wrap {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    transform: none;
  }
  .bezel-overlay {
    display: none;
  }
  .phone {
    position: relative;
    left: auto;
    top: auto;
    width: 390px;
    height: 844px;
    border-radius: 44px;
  }
  .status-bar { display: none; }
  .global-status-bar { display: none !important; }
  .screens { top: 0 !important; height: 100% !important; }
}

/* ── Real mobile: remove frame chrome, fill screen ── */
@media (max-width: 599px) {
  :root {
    --status-bar-h: 0px;
    --fs-xs:   2.82vw;
    --fs-sm:   2.82vw;
    --fs-md:   3.08vw;
    --fs-base: 3.33vw;
    --fs-lg:   3.59vw;
    --fs-xl:   3.85vw;
    --fs-2xl:  4.10vw;
    --fs-3xl:  4.62vw;
    --fs-4xl:  5.13vw;
    --fs-5xl:  5.64vw;
  }
  body {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
    height: 100dvh;
    overflow: hidden;
    min-height: 0;
  }
  .bezel-wrap {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    transform: none;
  }
  .bezel-overlay {
    display: none;
  }
  .phone {
    position: relative;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }
  .status-bar { display: none; }
  .global-status-bar { display: none !important; }
  .screens { top: 0 !important; height: 100% !important; }
  /* Ensure bottom nav clears browser UI chrome */
  .bottom-nav {
    padding-bottom: max(env(safe-area-inset-bottom), 12px);
  }
}

/* ══════════════════════════════════════
   THEME CHOICE SCREEN
══════════════════════════════════════ */
#screen-theme.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--c-bg-black);
}
body.light-mode #screen-theme.active { background: #ffffff; }

.theme-choice-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0 32px;
  width: 100%;
}
.theme-choice-aa {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--c-blue);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 36px;
}
.theme-choice-hint {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  color: var(--c-white);
  margin-bottom: 24px;
  text-align: center;
}
.theme-choice-cards {
  display: flex;
  gap: 14px;
  width: 100%;
}
.theme-card {
  flex: 1;
  border: none;
  border-radius: 18px;
  padding: 0 0 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  font-family: var(--font-system);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  transition: transform 0.32s cubic-bezier(0.34, 1.12, 0.64, 1), opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-card:active { transform: scale(0.97); opacity: 0.82; transition: transform 0.08s ease, opacity 0.07s ease; }
.theme-card-dark {
  background: #1c1c1e;
  color: #ffffff;
  outline: 2px solid #3a3a3c;
  outline-offset: 0;
}
.theme-card-light {
  background: #f2f2f7;
  color: #000000;
  outline: 2px solid #dcdce4;
  outline-offset: 0;
}
.theme-card.selected { outline: 2.5px solid #0095f6; outline-offset: 0; }
.theme-card-swatch {
  width: 100%;
  height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px 14px;
  gap: 7px;
  flex-shrink: 0;
}
.dark-swatch { background: #0A1014; }
.light-swatch { background: #ffffff; }
.theme-card-swatch::before,
.theme-card-swatch::after {
  content: '';
  display: block;
  height: 8px;
  border-radius: 4px;
}
.dark-swatch::before { background: #3a3a3c; width: 70%; }
.dark-swatch::after  { background: #2c2c2e; width: 50%; }
.light-swatch::before { background: #e5e5ea; width: 70%; }
.light-swatch::after  { background: #f2f2f7; width: 50%; border: 1px solid #e0e0e0; }


/* ══════════════════════════════════════
   LIGHT MODE OVERRIDES
══════════════════════════════════════ */
body.light-mode {
  /* ── CSS variable overrides ── */
  --c-black:       #f3f3f9;
  --c-white:       #000000;
  --c-bg-black:    #f3f3f9;
  --c-bg-1a:       #f8f8fe;
  --c-bg-222:      #e4e4ec;
  --c-surface:     #ffffff;
  --c-surface-2:   #e8e8f0;
  --c-surface-3:   #dcdce4;
  --c-gray-333:    #c8c8d0;
  --c-divider:     #d0d0d8;
  --c-border-dark: #d4d4dc;
  --c-text-dim:    #3a3a3a;
  --c-text-muted:     #4a4a4a;
  --c-text-secondary: #4a4a4a;
  --c-text-meta:      #4a4a4a;
  --c-light-gray:     #1c1c1e;
  background: #e8e8f0;
}

/* Phone frame — bezel provides the frame now, no box-shadow needed */

/* All SVG elements with hardcoded stroke/fill="white" → dark in light mode.
   CSS overrides SVG presentation attributes without !important. */
body.light-mode *[stroke="white"] { stroke: #1c1c1e; }
body.light-mode *[fill="white"][stroke="none"] { fill: #1c1c1e; }
body.light-mode svg[fill="white"] { fill: #1c1c1e; }
body.light-mode svg[fill="#fff"] { fill: #1c1c1e; }
/* Exceptions: keep white on colored-background badges */
body.light-mode .sheet-aa-badge *[stroke="white"] { stroke: white !important; }
body.light-mode .sheet-aa-badge *[fill="white"] { fill: white !important; }
body.light-mode .sp-src-rank-badge *[stroke="white"] { stroke: white !important; }
/* aa-icon: white bg, dark stroke in light mode (inverted from dark mode) */
body.light-mode .aa-icon { background: #fff; }
body.light-mode .aa-icon *[stroke="white"] { stroke: #000 !important; }

/* sheet-aa-badge (perspectives icon): black bg, white stroke in light mode */
body.light-mode .sheet-aa-badge:has(svg) { background: #000; }
body.light-mode .sheet-aa-badge *[stroke="black"] { stroke: #fff !important; }

/* Header text */
body.light-mode .insta-header .act-btn { color: #000000 !important; }
body.light-mode .insta-header .insta-logo { color: #000000 !important; }
body.light-mode .insta-header .act-btn > span { border-color: #f3f3f9 !important; }

/* Dashboard back arrow */
body.light-mode .dash-back { color: #000000 !important; }

/* Drag handle */
body.light-mode .drag-handle { background: #c7c7cc; }

/* Theme choice H1 */
body.light-mode .brand-accent-text { color: #000000; }

/* Dashboard sections */
body.light-mode .dash-section { border-bottom-color: rgba(0,0,0,0.06) !important; }
body.light-mode .dash-section-divider { background: #f2f2f7; }

/* Dashboard text colors — AAA-compliant darker variants for light bg */
body.light-mode .variety-delta.down { color: #a2101c; }
body.light-mode .var-chart-goal-edit { color: #00548b; }
body.light-mode .goal-modal-save { color: var(--c-blue); }
body.light-mode .var-badge.mixed { color: #07409e; }
body.light-mode .var-badge.high { color: #07533a; }
body.light-mode .var-badge.low { color: #674304; }
body.light-mode .goal-modal-error { color: #af111e; }
body.light-mode .spider-insight { color: #094c89; }
body.light-mode .variety-delta.up { color: #085d41; }

/* Bar chart selected outline */
body.light-mode .var-bar-chart-bar-wrap.selected .var-bar-chart-bar {
  outline-color: rgba(0,0,0,0.2);
}

/* Bar chart value tooltip */
body.light-mode .var-bar-val-tip {
  background: rgba(0,0,0,0.06);
  color: #000000;
}

/* Source cards in perspectives sheet */
body.light-mode .src-card { background: #f8f8ff; border-color: #e2e2ec; }
body.light-mode .src-card-top { border-top-color: #e2e2ec; }

/* Coverage bar segments — light pastels for black text legibility */
body.light-mode .cov-left   { background: #93c5fd; }
body.light-mode .cov-center { background: #c7c7cc; }
body.light-mode .cov-right  { background: #fca5a5; }
body.light-mode .cov-seg-label { color: rgba(0,0,0,0.85); }

/* Lean spectrum slider track center */
body.light-mode .lean-spectrum-track {
  background: linear-gradient(to right, #3b82f6, #aeaeb2 50%, #ef4444);
}

/* Your Story inner ring border */
body.light-mode .story-ring.no-ring .story-inner { border-color: #f3f3f9 !important; }

/* Source pref sheet */
body.light-mode .src-pref-container {
  background: #f8f8fe !important;
  border-color: #e2e2ec !important;
  color: #1c1c1e !important;
}

/* Article logo border */
body.light-mode #art-logo { border-color: #d4d4dc !important; }

/* JS-generated headline text (dsh-src-headline class) */
.dsh-src-headline {
  font-size: 13px;
  color: var(--c-light-gray);
  line-height: 1.45;
  padding-left: 54px;
}


/* ── Hardcoded grey text → readable in light mode ── */
/* src-headline: #e8e8e8 hardcoded — 1.2:1 on white (WCAG fail) */
body.light-mode .src-headline { color: #1c1c1e; }
/* Chart axis labels used --c-divider as text color — too light in light mode */
body.light-mode .var-chart-axis { color: var(--c-text-secondary); }

/* ── Goal modal: dark shadow too harsh in light mode ── */
body.light-mode .goal-modal {
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
}

/* ── Info tooltip (dashboard): match tag-tooltip light style ── */
body.light-mode .info-tooltip {
  background: #f8f8ff;
  border-color: #e5e5ea;
  color: #3a3a3a;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}
body.light-mode .info-tooltip::before { border-bottom-color: #e5e5ea; }
body.light-mode .info-tooltip::after  { border-bottom-color: #f8f8ff; }

/* ── Tag tooltip: shadow too dark ── */
body.light-mode .tag-tooltip {
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  background: #f8f8ff;
  border-color: #e5e5ea;
  color: #3a3a3a;
}
body.light-mode .tag-tooltip::before { border-top-color: #e5e5ea; }
body.light-mode .tag-tooltip::after  { border-top-color: #f8f8ff; }

/* ── Toast alerts: dark bg → light ── */
body.light-mode .toast {
  background: #f8f8ff;
  border-color: #e5e5ea;
  box-shadow: 0 4px 18px rgba(0,0,0,0.10);
}
body.light-mode .toast-msg { color: #1c1c1e; }

/* ── Buttons/controls with surface backgrounds → need visible bg ── */
/* Stepper +/− buttons: var(--c-surface) = white on white = invisible */
body.light-mode .adj-btn {
  background: #e5e5ea;
  color: #1c1c1e;
}
/* Goal modal stepper buttons */
body.light-mode .goal-stepper-btn {
  background: #e5e5ea;
  color: #1c1c1e;
}
/* Source pref rank buttons */
body.light-mode .sp-rank-btn {
  background: #e5e5ea;
  color: #1c1c1e;
}

/* ── Time tabs: container and active state ── */
/* Container uses var(--c-surface) = white, blends with section bg */
body.light-mode .time-tabs { background: #e5e5ea; }
/* Active tab: invert to white pill on grey container */
body.light-mode .time-tab.active {
  background: #ffffff;
  color: #000000;
}
/* Inactive tabs: darker grey for contrast against #e5e5ea */
body.light-mode .time-tab { color: #636366; }

/* ── Disabled button states: --c-divider (#dbdbdb) as text = invisible on white ── */
body.light-mode .save-btn:disabled {
  background: #e5e5ea;
  color: #8e8e93;
}
body.light-mode .reset-btn:disabled { color: #8e8e8e; }

/* ── Bar chart tracks: var(--c-surface) = white on white = invisible ── */
body.light-mode .topic-track  { background: #e5e5ea; }
body.light-mode .dsh-var-track { background: #e5e5ea; }

/* ── "Read on X" / "Back to Post" buttons: light mode overrides ── */
body.light-mode .view-btn,
body.light-mode .art-read-btn {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
  color: #000;
}
body.light-mode .view-btn:active,
body.light-mode .art-read-btn:active { background: rgba(0,0,0,0.08); }

body.light-mode .onboard-card { background: #ffffff; box-shadow: 0 24px 60px rgba(0,0,0,0.18); }
body.light-mode .onboard-skip { color: #3c3c43; }
body.light-mode .onboard-title { color: #000000; }
body.light-mode .onboard-dot.active { background: #000000; }
body.light-mode .onboard-backdrop { background: rgba(0,0,0,0.62); }

body.light-mode .why-src-item { background: #f5f5fa; }

body.light-mode .new-badge { background: #ddf0fb; color: #0176ae; }

/* AA banner: white label + sub + chevron in light mode, same gradient as logo */
body.light-mode .aa-banner-label { color: #ffffff; }
body.light-mode .aa-banner-sub { color: rgba(255,255,255,0.85); }
body.light-mode .aa-banner > svg[stroke="white"] { stroke: #ffffff !important; }

/* Story ring (no-ring / Your Story): darker outer ring in light mode */
body.light-mode .story-ring.no-ring { background: #b0b0b8; }

/* Tag pills: darker stroke in light mode */
body.light-mode .tag-pill { border-color: rgba(0,0,0,0.18); }

/* src-desc: slightly lighter in light mode */
body.light-mode .src-desc { color: #8e8e93; }

/* Profile avatar SVGs: match tab bar perceived lightness in light mode */
body.light-mode .post-comment-avatar [fill="#3a3a3a"],
body.light-mode .story-inner [fill="#3a3a3a"] { fill: #8e8e93; }
body.light-mode .post-comment-avatar [fill="#555555"],
body.light-mode .story-inner [fill="#555555"] { fill: #aeaeb2; }
