:root {
  color-scheme: dark;
  --bg: #050608;
  --bg-soft: #0c0e12;
  --panel: rgba(15, 18, 24, 0.72);
  --panel-border: rgba(255, 255, 255, 0.055);
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #ff3b30;
  --accent-rgb: 255, 59, 48;
  --accent-dark: #cc1b10;
  --accent-soft: rgba(255, 59, 48, 0.09);
  --line: rgba(255, 255, 255, 0.06);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --font-heading: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (max-width: 700px) {
  .source-picker {
    align-items: center;
    padding: 18px;
  }

  .source-picker-menu summary {
    width: 100%;
  }

  .source-picker-panel {
    right: auto;
    left: 0;
    width: 100%;
  }

  .source-picker-options {
    grid-template-columns: 1fr;
  }

  .source-picker-actions {
    flex-wrap: wrap;
  }
}

* {
  box-sizing: border-box;
}

body.modal-open {
  overflow: hidden;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: 
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.08) 0%, transparent 60%),
    radial-gradient(circle at 10% 20%, rgba(120, 119, 198, 0.03) 0%, transparent 40%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Header Styling */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 6, 8, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.3s ease;
}

.app-header-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.pulse-dot {
  width: 18px;
  height: 18px;
  background-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--accent), 0 0 28px rgba(var(--accent-rgb), 0.6);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: scale(0.85);
    opacity: 0.6;
    box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(var(--accent-rgb), 0.5);
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
    box-shadow: 0 0 20px var(--accent), 0 0 35px rgba(var(--accent-rgb), 0.9);
  }
}

.logo-accent {
  background: linear-gradient(135deg, #ff7b72, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.global-nav {
  display: flex;
  gap: 18px;
}

.global-nav-link {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
  position: relative;
  transition: color 0.25s ease;
}

.global-nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.25s ease;
}

.global-nav-link:hover {
  color: #ffffff;
}

.global-nav-link:hover::after {
  width: 100%;
}

.global-nav-link.active {
  color: #ffffff;
}

.global-nav-link.active::after {
  width: 100%;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.5);
}

/* Channel Navigation */
.channel-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  align-items: start;
  gap: 24px;
  margin: 10px 0 28px;
  padding: 20px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(15, 18, 24, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.03);
}

.channel-nav-groups {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-source-picker-button {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 13px;
  border-color: rgba(var(--accent-rgb), 0.28);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.12), rgba(17, 20, 26, 0.96)),
    #11141a;
  color: #ffffff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.channel-source-picker-button:hover,
.channel-source-picker-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-rgb), 0.58);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.34);
}

.channel-source-picker-button span:first-child {
  display: grid;
  gap: 3px;
}

.channel-source-picker-button small {
  color: var(--muted);
}

.channel-source-picker-button > span:last-child {
  font-size: 1.35rem;
  color: #ff4a51;
}

.home-source-picker-button {
  flex: 0 0 auto;
  width: min(320px, 100%);
}

@media (max-width: 700px) {
  .home-source-picker-button {
    width: 100%;
    min-height: 64px;
  }

  .source-picker {
    gap: 18px;
    margin-bottom: 24px;
  }
}

.source-picker-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.source-picker-lightbox[hidden] {
  display: none;
}

.source-picker-dialog {
  width: min(660px, 100%);
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.1), transparent 38%),
    #11141a;
  box-shadow: 0 38px 100px rgba(0, 0, 0, 0.72);
  animation: source-picker-enter 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes source-picker-enter {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.source-picker-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.source-picker-dialog-header h2,
.source-picker-dialog-header p {
  margin: 0;
}

.source-picker-dialog-header h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.source-picker-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 1.6rem;
  cursor: pointer;
}

.source-picker-dialog-copy {
  margin: 8px 0 18px;
  color: var(--muted);
}

.source-picker-browser {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.source-picker-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
}

.source-picker-tab {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.source-picker-tab span {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
}

.source-picker-tab.active {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.14);
  color: #ffffff;
}

.source-picker-category-panels {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 5px;
}

.source-picker-category-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.source-picker-category-panel[hidden] {
  display: none;
}

@media (max-width: 600px) {
  .source-picker-tab {
    min-height: 42px;
    font-size: 0.88rem;
  }

  .source-picker-category-panel {
    grid-template-columns: 1fr;
  }
}

.source-picker-lightbox-options {
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  padding-right: 5px;
}

.source-picker-lightbox-actions {
  flex-shrink: 0;
}

.channel-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

@media (max-width: 900px) {
  .channel-nav {
    grid-template-columns: 1fr;
  }

  .channel-source-picker-button {
    max-width: 420px;
  }
}

.channel-group-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  width: 80px;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding-right: 10px;
}

.channel-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.channel-link {
  min-height: 32px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.2;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.channel-link[hidden],
.channel-group[hidden] {
  display: none !important;
}

.channel-link:hover,
.channel-link:focus-visible {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.channel-link:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.4);
  outline-offset: 2px;
}

/* Active navigation item styling based on active source on body */
body[data-source="fox-news"] .channel-link[href="/fox-news"],
body[data-source="ap-news"] .channel-link[href="/ap-news"],
body[data-source="the-sun"] .channel-link[href="/the-sun"],
body[data-source="daily-mail"] .channel-link[href="/daily-mail"],
body[data-source="cbs8"] .channel-link[href="/cbs8"],
body[data-source="drudge-report"] .channel-link[href="/drudge-report"],
body[data-source="techcrunch"] .channel-link[href="/techcrunch"],
body[data-source="deepview"] .channel-link[href="/deepview"],
body[data-source="wired"] .channel-link[href="/wired"],
body[data-source="code-newsletter"] .channel-link[href="/code-newsletter"] {
  border-color: rgba(var(--accent-rgb), 0.38);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.06));
  color: #ffffff;
  box-shadow: 
    0 0 15px rgba(var(--accent-rgb), 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

body[data-source="cnn"] .channel-link[href="/cnn"],
body[data-source="bbc-news"] .channel-link[href="/bbc-news"],
body[data-source="nbc-news"] .channel-link[href="/nbc-news"],
body[data-source="abc-news"] .channel-link[href="/abc-news"],
body[data-source="cbs-news"] .channel-link[href="/cbs-news"],
body[data-source="npr"] .channel-link[href="/npr"],
body[data-source="nytimes"] .channel-link[href="/nytimes"] {
  color: #ffffff;
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.14);
}

body[data-source="the-verge"] .channel-link[href="/the-verge"],
body[data-source="ars-technica"] .channel-link[href="/ars-technica"],
body[data-source="engadget"] .channel-link[href="/engadget"],
body[data-source="espn"] .channel-link[href="/espn"],
body[data-source="cbs-sports"] .channel-link[href="/cbs-sports"],
body[data-source="yahoo-sports"] .channel-link[href="/yahoo-sports"],
body[data-source="bbc-sport"] .channel-link[href="/bbc-sport"],
body[data-source="sporting-news"] .channel-link[href="/sporting-news"] {
  color: #ffffff;
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.14);
}

body[data-source="cnet"] .channel-link[href="/cnet"],
body[data-source="zdnet"] .channel-link[href="/zdnet"],
body[data-source="mashable"] .channel-link[href="/mashable"],
body[data-source="toms-hardware"] .channel-link[href="/toms-hardware"],
body[data-source="techradar"] .channel-link[href="/techradar"] {
  color: #ffffff;
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.14);
}

.page {
  width: min(1000px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.landing-page {
  display: grid;
  gap: 32px;
}

.landing-card-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
}

.landing-hero {
  position: relative;
  padding: clamp(32px, 4vw, 48px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 100%, rgba(var(--accent-rgb), 0.06) 0%, transparent 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.005) 100%),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.landing-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.4), transparent);
}

.landing-actions {
  margin-top: 24px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
}

.source-category {
  display: grid;
  gap: 16px;
  align-content: start;
}

.source-category-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-category-title::after {
  content: '';
  height: 1px;
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.08);
}

.source-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.source-card {
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.06), rgba(var(--accent-rgb), 0)),
    var(--panel);
  color: #ffffff;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

.source-card:hover,
.source-card:focus-visible {
  transform: translateY(-5px);
  border-color: rgba(var(--accent-rgb), 0.38);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.15), rgba(var(--accent-rgb), 0.02)),
    var(--panel);
  box-shadow: 
    0 24px 50px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(var(--accent-rgb), 0.1);
}

.source-card:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.25);
  outline-offset: 3px;
}

.source-card-label {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.source-card-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
}

.source-card-text {
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 24px;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(var(--accent-rgb), 0.05) 0%, transparent 60%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.015) 0%, rgba(255, 255, 255, 0.005) 100%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.intro {
  max-width: 600px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.source-picker {
  position: relative;
  z-index: 20;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  margin: 0;
  padding: clamp(32px, 4vw, 48px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 100%, rgba(var(--accent-rgb), 0.06) 0%, transparent 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.005) 100%),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
  color: #ffffff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.source-picker::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.4), transparent);
}

@media (max-width: 760px) {
  .landing-card-pair {
    grid-template-columns: 1fr;
  }
}

.source-picker:hover,
.source-picker:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(var(--accent-rgb), 0.58);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.42);
}

.source-picker:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.72);
  outline-offset: 4px;
}

.source-picker-copy h2,
.source-picker-copy p {
  margin: 0;
}

.source-picker-copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.source-picker-copy h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.source-picker-copy > p:last-child {
  max-width: 600px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.source-picker-cta {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  padding: 14px 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff3b30, #d91f16);
  box-shadow: 0 14px 30px rgba(var(--accent-rgb), 0.26);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1;
  text-align: center;
}

.source-picker-menu {
  position: relative;
  flex: 0 0 auto;
}

.source-picker-menu summary {
  min-width: 230px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: #11141a;
  color: #ffffff;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

.source-picker-menu summary::-webkit-details-marker {
  display: none;
}

.source-picker-menu[open] summary span {
  transform: rotate(180deg);
}

.source-picker-menu summary span {
  transition: transform 180ms ease;
}

.source-picker-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 40px));
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(13, 15, 20, 0.99);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.62);
}

.source-picker-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 310px;
  overflow-y: auto;
}

.source-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  color: #ffffff;
  cursor: pointer;
}

.source-picker-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.source-picker-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.source-picker-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.source-picker-link,
.source-picker-apply {
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.source-picker-link {
  padding: 8px 4px;
  color: var(--muted);
  background: transparent;
}

.source-picker-apply {
  margin-left: auto;
  padding: 10px 18px;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(135deg, #ff343d, var(--accent-dark));
}

.source-card[hidden],
.source-category-empty {
  display: none;
}

.refresh-button {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px 20px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  background: linear-gradient(135deg, #ff4c54, var(--accent-dark));
  cursor: pointer;
  box-shadow: 
    0 10px 24px rgba(var(--accent-rgb), 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.refresh-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 
    0 14px 28px rgba(var(--accent-rgb), 0.35),
    0 0 10px rgba(var(--accent-rgb), 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, #ff5e65, #e01b10);
}

.refresh-button:active:not(:disabled) {
  transform: translateY(0);
}

.refresh-button:disabled {
  opacity: 0.5;
  cursor: progress;
  box-shadow: none;
}

.status {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
  padding-left: 6px;
}

.status-bar {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.delete-all-button {
  justify-self: start;
  min-width: 110px;
  height: 38px;
  min-height: 38px;
  border-radius: 999px;
}

.return-top-button {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.82);
  color: #d71920;
  text-decoration: none;
  font-size: 1.5rem;
  line-height: 1;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.return-top-button:hover,
.return-top-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(22, 22, 22, 0.92);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.45);
}

.return-top-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.22);
  outline-offset: 3px;
}

.articles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.story-card {
  position: relative;
  min-height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
  scroll-margin-top: 24px;
}

.story-card:hover,
.story-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.44);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.01)),
    var(--panel);
}

.story-card:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.18);
  outline-offset: 3px;
}

.story-card-new {
  border-color: rgba(86, 232, 154, 0.78);
  box-shadow:
    0 0 0 1px rgba(86, 232, 154, 0.22),
    var(--shadow);
}

.story-card-new:hover,
.story-card-new:focus-visible {
  border-color: rgba(86, 232, 154, 0.92);
  box-shadow:
    0 0 0 1px rgba(86, 232, 154, 0.34),
    0 32px 72px rgba(0, 0, 0, 0.52);
}

.story-card-new-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #04140b;
  background: #56e89a;
}

.story-card-body {
  display: grid;
  gap: 14px;
  padding: 22px 22px 16px;
}

.story-card-image-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-card-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-card-kicker {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
}

.story-card-title {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
  font-weight: 650;
}

.story-card-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0 22px 22px;
}

.story-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.story-card-summary-btn,
.story-card-read {
  width: 100%;
  min-width: 0;
  height: 38px;
  min-height: 38px;
  padding: 4px 8px;
  text-align: center;
}

.story-card-delete {
  width: 100%;
  min-width: 0;
  height: 38px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.story-card-delete:hover,
.story-card-delete:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.story-card-delete:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.18);
  outline-offset: 2px;
}

.story-card-delete:disabled {
  opacity: 0.7;
  cursor: progress;
}

.story-card-follow:disabled {
  background: rgba(215, 25, 32, 0.22);
  border-color: rgba(255, 98, 98, 0.28);
}

.story-card-link {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.story-card-link:hover,
.story-card-link:focus-visible {
  color: #ffffff;
  text-decoration: underline;
}

.story-card-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.18);
  outline-offset: 3px;
  border-radius: 8px;
}

.article-summary {
  margin: 16px 0;
  color: #ffffff;
  font-size: 18px;
  line-height: 1.7;
  padding-left: 20px;
}

.article-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.article-figure {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.article-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.article-image {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.article-summary li + li {
  margin-top: 8px;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.action-button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #ff2a33, var(--accent-dark));
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.action-button:hover,
.action-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.action-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.18);
  outline-offset: 2px;
}

.ask-ai-button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #ff2a33, var(--accent-dark));
  cursor: pointer;
}

.chat-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.chat-message {
  min-width: 0;
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  outline: none;
}

.chat-message:focus {
  box-shadow: 0 0 0 2px rgba(255, 58, 58, 0.34);
}

.chat-message-user {
  background: rgba(215, 25, 32, 0.14);
  border: 1px solid rgba(255, 58, 58, 0.18);
}

.chat-message-assistant {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-role {
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
}

.chat-body {
  min-width: 0;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #ffffff;
  line-height: 1.6;
  font-size: 1.05rem;
}

.chat-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  padding: 10px 14px;
  font: inherit;
  font-size: 1rem;
  resize: none;
  height: 60px;
  scrollbar-width: thin;
}

.chat-input::placeholder {
  color: #8f8f8f;
}

.chat-input-with-context {
  border-color: rgba(255, 98, 98, 0.4);
  box-shadow: inset 0 0 0 1px rgba(255, 98, 98, 0.08);
}

.chat-submit {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #ff2a33, var(--accent-dark));
  cursor: pointer;
  align-self: flex-end;
  min-width: 100px;
}

.chat-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

.article-modal-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.article-modal-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  cursor: zoom-in;
}

.article-modal-image {
  display: block;
  width: 100%;
  height: 210px;
  object-fit: cover;
}

.article-chat-sticky-bottom {
  margin-top: auto;
  padding: 12px 24px 16px;
  background: rgba(18, 21, 27, 0.98);
  border-top: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 5;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.article-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  height: 52px;
  cursor: pointer;
  user-select: none;
}

.article-chat-header-copy {
  display: flex;
  align-items: center;
  gap: 12px;
}

.article-chat-eyebrow {
  margin: 0;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.9rem;
  font-weight: 800;
}

.article-chat-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.article-chat-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 1.35rem;
  cursor: pointer;
  transform: rotate(0deg); /* Points DOWN when expanded */
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1), transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.article-chat-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
}

.article-chat-pane.collapsed .article-chat-toggle {
  transform: rotate(180deg); /* Points UP when collapsed */
}

.article-chat-context {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 98, 98, 0.24);
  border-radius: 14px;
  background: rgba(215, 25, 32, 0.1);
}

.article-chat-context-copy {
  min-width: 0;
}

.article-chat-context-label {
  margin: 0 0 6px;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
}

.article-chat-context-text {
  margin: 0;
  color: #f2f2f2;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-chat-context-clear {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

.article-modal-actions {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.article-modal-read-more {
  min-width: 220px;
}

.article-modal-follow {
  min-width: 160px;
}

.article-modal-follow:disabled {
  opacity: 0.72;
  cursor: default;
}

.followed-stories {
  display: grid;
  gap: 18px;
}

.followed-story-card {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(215, 25, 32, 0.1), rgba(215, 25, 32, 0)),
    var(--panel);
  box-shadow: var(--shadow);
}

.followed-story-header {
  display: grid;
  gap: 12px;
}

.followed-story-source {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
}

.followed-story-title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.25;
}

.followed-story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.followed-story-summary {
  margin: 0;
  color: #ffffff;
  line-height: 1.7;
}

.followed-related-status {
  margin: 0;
  color: var(--muted);
  min-height: 1.4em;
}

.followed-related-section {
  display: grid;
  gap: 12px;
}

.followed-related-title {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.followed-related-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.related-story-list {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 12px;
}

.related-story-item {
  color: #ffffff;
}

.related-story-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.related-story-link {
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.related-story-delete,
.followed-story-delete {
  width: auto;
  min-width: 88px;
  height: 34px;
  min-height: 34px;
  padding: 4px 10px;
  flex: 0 0 auto;
}

.related-story-link:hover,
.related-story-link:focus-visible {
  text-decoration: underline;
}

.related-story-meta,
.related-story-reason {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.dev-footer {
  margin-top: 40px;
  width: 100%;
}

.dev-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 22px;
  width: 100%;
  padding: 28px 22px 32px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(215, 25, 32, 0.18), rgba(0, 0, 0, 0.22)),
    var(--panel);
  box-shadow: var(--shadow);
}

.dev-image {
  display: block;
  width: min(260px, 100%);
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dev-copy {
  width: min(720px, 100%);
  margin: 0 auto;
}

.dev-eyebrow {
  margin: 0 0 10px;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
}

.dev-title {
  margin: 0 0 12px;
  font-size: 1.6rem;
  line-height: 1.15;
}

.dev-text {
  margin: 0;
  color: #ffffff;
  line-height: 1.7;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.86);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close,
.chat-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-image {
  display: block;
  max-width: min(1100px, 100%);
  max-height: calc(100vh - 80px);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.article-page-lightbox {
  padding: 20px;
  z-index: 1150;
}

.article-page-frame-shell {
  position: relative;
  width: min(1280px, 100%);
  height: min(88vh, 980px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0b0b0b;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.article-page-toolbar {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 2;
}

.article-page-speedread {
  min-width: 140px;
}

.article-page-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.82);
}

.chat-modal[hidden] {
  display: none;
}

.chat-modal-dialog {
  position: relative;
  width: min(1120px, 100% - 32px);
  height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(215, 25, 32, 0.05), rgba(0, 0, 0, 0.2)),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.article-modal-content {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 32px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.06);
  transition:
    flex-basis 900ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 420ms ease,
    padding 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.article-chat-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  min-width: 0;
}

.article-chat-pane {
  flex: 0 0 50%;
  width: 100%;
  height: 50%;
  border-top: 1px solid var(--line);
  background: rgba(10, 11, 14, 0.55);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    height 900ms cubic-bezier(0.22, 1, 0.36, 1),
    flex-basis 900ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 650ms ease,
    box-shadow 650ms ease;
}

.article-chat-pane.response-active {
  flex-basis: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(16, 18, 24, 0.99), rgba(9, 10, 14, 0.99));
  box-shadow: 0 -28px 70px rgba(0, 0, 0, 0.48);
}

.chat-modal-dialog.chat-expanded .article-modal-content {
  flex: 0 1 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.chat-modal-dialog.chat-expanded .article-chat-header {
  background: linear-gradient(90deg, rgba(215, 25, 32, 0.16), rgba(18, 21, 27, 0.98) 42%);
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

.chat-modal-dialog.chat-expanded .chat-modal-messages {
  padding: 8px 24px 12px;
  margin-top: 12px;
}

.article-chat-pane.collapsed {
  flex: 0 0 52px;
  width: 100%;
  height: 52px;
}



.article-chat-pane.collapsed .chat-modal-messages,
.article-chat-pane.collapsed .article-chat-sticky-bottom {
  display: none !important;
}

.chat-modal-title {
  margin: 0;
  padding-right: 56px;
  font-size: 1.4rem;
  line-height: 1.25;
}

.chat-modal-summary {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  font-size: 15px;
  line-height: 1.55;
  overflow: visible;
  max-height: none;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.chat-modal-summary ::selection {
  background: rgba(255, 98, 98, 0.38);
  color: #ffffff;
}

.chat-modal-summary .article-summary-list {
  margin: 0;
  padding-left: 20px;
  font-size: 18px;
  user-select: text;
  -webkit-user-select: text;
}

.chat-modal-summary .article-summary-list li + li {
  margin-top: 6px;
}

.chat-modal-messages {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  display: grid;
  align-content: start;
  gap: 12px;
  padding-right: 6px;
  margin: 16px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.06);
}

.chat-modal-messages:empty {
  flex-grow: 0;
  margin: 0;
  display: none;
}

.chat-modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}


.summary-selection-action {
  position: fixed;
  z-index: 1200;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #ff2a33, var(--accent-dark));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
  cursor: pointer;
}

.summary-selection-action[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 24px, 1000px);
    padding-top: 16px;
  }

  .app-header-container {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
  }

  .global-nav {
    gap: 16px;
  }

  .channel-nav {
    padding: 14px;
    gap: 12px;
    border-radius: 12px;
  }

  .channel-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }

  .channel-group-title {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-right: 0;
    padding-bottom: 4px;
  }

  .channel-links {
    width: 100%;
    gap: 6px;
  }

  .channel-link {
    flex: 1 1 calc(50% - 4px);
    text-align: center;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: 6px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .refresh-button {
    width: 100%;
    text-align: center;
  }

  .status-bar {
    gap: 10px;
  }

  .delete-all-button {
    width: 100%;
    justify-self: stretch;
  }

  .articles {
    grid-template-columns: 1fr;
  }

  .story-card {
    min-height: 220px;
  }

  .story-card-footer {
    grid-template-columns: 1fr;
  }

  .story-card-actions {
    grid-template-columns: 1fr;
  }

  .chat-modal {
    padding: 14px;
  }

  .chat-modal-dialog {
    display: flex;
    flex-direction: column;
    width: min(100%, 100% - 16px);
    height: min(92vh, 760px);
    border-radius: 12px;
  }

  .article-modal-content {
    padding: 20px 20px 8px 20px;
  }



  .article-chat-pane.response-active {
    flex-basis: 100%;
    height: 100%;
  }

  .article-chat-header {
    padding: 6px 16px;
    height: 52px;
  }

  .article-chat-copy {
    display: none; /* Hide subtitle on mobile to save space */
  }

  .article-chat-toggle {
    width: 38px;
    height: 38px;
    font-size: 1.15rem;
    border-radius: 8px;
    transform: rotate(0deg); /* Points DOWN when expanded on mobile */
  }

  .chat-input {
    padding: 8px 10px;
    font-size: 0.95rem;
    border-radius: 8px;
    height: 52px;
    resize: none;
  }

  .chat-submit {
    padding: 8px 12px;
    font-size: 0.95rem;
    border-radius: 8px;
  }

  .chat-message {
    padding: 8px 10px;
    border-radius: 10px;
  }

  .chat-role {
    margin-bottom: 2px;
    font-size: 0.68rem;
  }

  .chat-body {
    font-size: 0.98rem;
    line-height: 1.5;
  }

  .chat-modal-messages {
    padding: 8px 16px;
    gap: 6px;
    margin: 8px 0;
  }

  .article-chat-context {
    padding: 6px 10px;
    border-radius: 10px;
    gap: 8px;
  }

  .article-chat-context-label {
    margin-bottom: 2px;
    font-size: 0.65rem;
  }

  .article-chat-context-text {
    font-size: 0.8rem;
    line-clamp: 2;
    -webkit-line-clamp: 2;
  }

  .article-chat-context-clear {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }

  .article-chat-sticky-bottom {
    padding: 8px 16px 12px;
  }
}

@media (min-width: 641px) and (max-width: 980px) {
  .articles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
