
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1B1916;
  --panel: #23201C;
  --panel-soft: #2A2621;
  --control: #2A2621;
  --line: #3A342D;
  --line-strong: #494138;
  --text: #E8E0D4;
  --muted: #B3A99A;
  --muted-2: #978D80;
  --blue: #8FB3FF;
  --blue-soft: #2B3445;
  --shadow: 0 8px 30px rgba(0, 0, 0, .22);
  --header-bg: rgba(27, 25, 22, .94);
  --settings-panel-bg: rgba(35, 32, 28, .88);
  --settings-shell-bg: rgba(35, 32, 28, .74);
  --floating-bg: rgba(35, 32, 28, .94);
  --hover: #302B25;
  --title: #F1E9DE;
  --body-text: #D7CEC2;
  --badge-bg: #2B2925;
  --badge-border: #484139;
  --header-h: 78px;
  font-family: Arial, Helvetica, sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #fbfcfe;
  --control: #ffffff;
  --line: #e4e8f0;
  --line-strong: #d8deea;
  --text: #1d2736;
  --muted: #6f7b8f;
  --muted-2: #8a94a6;
  --blue: #2563eb;
  --blue-soft: #eff5ff;
  --shadow: 0 8px 30px rgba(22, 32, 55, .06);
  --header-bg: rgba(245, 247, 251, .92);
  --settings-panel-bg: rgba(255, 255, 255, .86);
  --settings-shell-bg: rgba(255, 255, 255, .72);
  --floating-bg: rgba(255, 255, 255, .94);
  --hover: #fafcff;
  --title: #172235;
  --body-text: #4f5c72;
  --badge-bg: #f8fafc;
  --badge-border: #d8dfec;
}


* { box-sizing: border-box; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  font-weight: 700;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.story-title, .story-summary, .story-meta, .detail-source-item > a, .story-detail-card h1 { overflow-wrap: anywhere; }

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
a { color: inherit; }
button, input, select { font: inherit; color-scheme: inherit; }

.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-strong);
}
.topbar {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: var(--header-h);
  padding: 8px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.brand-wrap { display: flex; align-items: center; min-width: 0; }
.brand {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
  border-radius: 10px;
  min-width: 0;
}
.brand-symbol {
  position: relative;
  display: block;
  width: 68px;
  height: 52px;
  flex: 0 0 68px;
}
.brand-monogram {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}
.brand-wordmark {
  position: relative;
  display: block;
  width: 104px;
  height: 31px;
}
.brand-wordmark-img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}
.brand-tagline {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: .005em;
  white-space: nowrap;
}
.brand-dark-asset { display: none; }
html[data-theme="dark"] .brand-light-asset { display: none; }
html[data-theme="dark"] .brand-dark-asset { display: block; }
html[data-theme="dark"] .brand-tagline { color: #fff; }

.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.language-menu { position: relative; flex: 0 0 auto; }
.language-toggle { font-size: .88rem; font-weight: 700; letter-spacing: .01em; }
.language-options {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1100;
  display: grid;
  gap: 6px;
  padding: 6px;
  background: var(--floating-bg);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.language-option {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--control);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  font-size: .88rem;
}
.language-option:hover, .language-option:focus { background: var(--hover); outline: none; }
.icon-btn, .btn {
  border: 1px solid var(--line-strong);
  background: var(--control);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  transition: .16s ease;
}
.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex: 0 0 auto;
}
.icon-btn:hover, .btn:hover { background: var(--hover); border-color: var(--line-strong); }
.icon-btn .icon { font-size: 1rem; line-height: 1; }
.theme-toggle .theme-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: block; }

.search-box {
  width: min(240px, 34vw);
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--control);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 14px;
}
.search-box input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  color: var(--text);
}
.search-box input::placeholder { color: var(--muted-2); }
.search-icon { color: var(--muted); font-size: 1rem; }

.page-shell {
  width: 100%;
  max-width: none;
  margin: 0 auto 28px;
  padding: 10px 24px 24px;
}
.control-panel.hidden { display: none; }
.control-panel {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 50%;
  z-index: 990;
  width: min(1260px, calc(100vw - 32px));
  max-height: calc(100vh - var(--header-h) - 24px);
  margin: 0;
  overflow: auto;
  transform: translateX(-50%);
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--settings-shell-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.settings-search {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}
.settings-search > span:first-child {
  font-size: .76rem;
  color: var(--muted);
}
.settings-search .search-box { width: 100%; }
.settings-search .search-box input { height: 38px; }
.panel-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr .9fr;
  gap: 14px;
}
.panel-card {
  background: var(--settings-panel-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.panel-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.panel-fields, .inline-settings {
  display: grid;
  gap: 10px;
}
.compact-fields {
  grid-template-columns: 1fr 1fr;
}
.source-filter {
  grid-column: 1 / -1;
}
.panel-fields label, .inline-settings label {
  display: grid;
  gap: 4px;
}
.panel-fields span, .inline-settings span, .field-hint {
  font-size: .76rem;
  color: var(--muted);
}
.panel-fields input, .panel-fields select,
.inline-settings input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--control);
  padding: 0 12px;
  color: var(--text);
}
.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.left-actions { justify-content: flex-start; flex-wrap: wrap; }
.btn {
  height: 40px;
  padding: 0 14px;
  font-weight: 600;
}
.btn.subtle { background: var(--control); }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.source-list { display: grid; gap: 10px; }
.source-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .95rem;
  color: var(--text);
}
.column-picker {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.column-option {
  width: 48px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--control);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}
.column-option span {
  display: block;
  width: 6px;
  height: 18px;
  border-radius: 99px;
  background: var(--muted-2);
}
.column-option.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.column-option.active span { background: var(--blue); }
.inline-settings {
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
}
.feed-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: width .18s ease, max-width .18s ease;
}
html[data-news-columns="1"] .feed-shell { width: min(880px, 100%); }
html[data-news-columns="2"] .feed-shell { width: min(1480px, 100%); }
html[data-news-columns="3"] .feed-shell { width: min(2040px, 100%); }
html[data-news-columns="4"] .feed-shell { width: 100%; }
.meta-line {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 22px 7px;
  font-size: .83rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.compact-meta { text-align: right; }

.news-grid {
  --cols: 2;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 0;
  align-items: start;
}
.news-grid[data-columns="1"] { --cols: 1; }
.news-grid[data-columns="2"] { --cols: 2; }
.news-grid[data-columns="3"] { --cols: 3; }
.news-grid[data-columns="4"] { --cols: 4; }

.news-column {
  min-width: 0;
  padding: 4px 16px 6px;
}
.news-column + .news-column {
  border-left: 1px solid var(--line);
}
.day-label {
  padding: 7px 0 1px;
  font-size: .9rem;
  font-weight: 700;
  color: var(--muted);
}
.news-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  padding: 5px 0 4px;
  border-bottom: 1px solid var(--line);
}
.news-item:last-child { border-bottom: 0; }
.news-time {
  font-size: .92rem;
  font-weight: 700;
  color: var(--muted);
  padding-top: 1px;
}
.news-title {
  margin: 0;
  font-size: .96rem;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.news-title a {
  color: var(--title);
  text-decoration: none;
}
.news-title a:hover { color: var(--blue); }
.news-source {
  font-size: .86rem;
  font-weight: 500;
  color: var(--muted);
}
.news-summary {
  margin-top: 2px;
  font-size: .87rem;
  line-height: 1.26;
  color: var(--body-text);
}
.news-summary.empty { display: none; }
.empty-state {
  grid-column: 1 / -1;
  padding: 36px 24px 42px;
  text-align: center;
  color: var(--muted);
}

.feed-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}
.footer-left { font-size: .88rem; color: var(--muted); }
.pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: center;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--control);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}
.page-btn:hover { background: var(--hover); }
.page-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.page-btn:disabled { opacity: .45; cursor: default; }
.page-ellipsis { color: var(--muted-2); padding: 0 4px; }

@media (max-width: 1200px) {
  .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .topbar { padding-left: 18px; padding-right: 18px; }
  .news-grid[data-columns="4"], .news-grid[data-columns="3"] { --cols: 2; }
}
@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .topbar { gap: 8px; align-items: center; padding: 6px 10px; }
  .top-actions { gap: 6px; }
  .brand { gap: 7px; }
  .brand-symbol { width: 55px; height: 42px; flex-basis: 55px; }
  .brand-wordmark { width: 88px; height: 27px; }
  .brand-tagline { font-size: 9px; }
  .page-shell { padding-left: 14px; padding-right: 14px; }
  .compact-fields, .inline-settings { grid-template-columns: 1fr; }
  .feed-footer { grid-template-columns: 1fr; }
  .pager { justify-self: start; }
  .news-grid { --cols: 1 !important; }
  .news-column + .news-column { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .brand { gap: 6px; }
  .brand-symbol { width: 48px; height: 37px; flex-basis: 48px; }
  .brand-wordmark { width: 76px; height: 23px; }
  .brand-tagline { font-size: 8px; letter-spacing: 0; }
}

/* v10 AI stories */
.hidden { display: none !important; }
.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  margin-left: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--panel);
}
.view-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}
.view-switch button.active {
  background: var(--blue-soft);
  color: var(--blue);
}
#channelFilter:disabled { opacity: .48; cursor: not-allowed; }

.story-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  padding: 6px 0 5px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  outline: none;
  color: inherit;
  text-decoration: none;
}
.story-item:last-child { border-bottom: 0; }
.story-item:hover .story-title,
.story-item:focus-visible .story-title { color: var(--blue); }
.story-title {
  margin: 0;
  font-size: .96rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--title);
}
.story-summary {
  margin-top: 3px;
  color: var(--body-text);
  font-size: .87rem;
  line-height: 1.3;
}
.story-meta {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: .77rem;
  line-height: 1.2;
}
.story-difference-badge {
  display: inline-flex;
  margin-top: 5px;
  padding: 3px 7px;
  border: 1px solid var(--badge-border);
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.story-detail {
  width: min(900px, 100%);
  margin: 0 auto;
}
.story-detail-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}
.detail-back {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 6px 0 12px;
  cursor: pointer;
  font-weight: 700;
}
.story-detail-card {
  background: var(--control);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 26px 28px;
}
.detail-kicker {
  color: var(--muted);
  font-size: .82rem;
  margin-bottom: 8px;
}
.story-detail-card h1 {
  margin: 0;
  color: var(--title);
  font-size: 1.65rem;
  line-height: 1.18;
  letter-spacing: -.025em;
}
.detail-summary {
  margin-top: 14px;
  color: var(--body-text);
  font-size: 1rem;
  line-height: 1.5;
}

.detail-article {
  max-width: 760px;
  margin-top: 18px;
  color: var(--body-text);
  font-size: 1rem;
  line-height: 1.62;
}
.detail-article p { margin: 0 0 14px; }
.detail-article p:last-child { margin-bottom: 0; }
.background-sources {
  margin-top: 22px;
  padding-top: 2px;
  border-top: 1px solid var(--line);
}
.background-sources ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}
.background-sources li { margin: 6px 0; line-height: 1.35; }
.background-sources a { color: var(--blue); text-decoration: none; font-weight: 650; }
.background-sources a:hover { color: var(--blue); }
.background-sources span { color: var(--muted-2); font-size: .78rem; }

.story-detail-card h2 {
  margin: 24px 0 10px;
  font-size: 1rem;
  color: var(--text);
}
.differences {
  margin-top: 22px;
  padding-top: 2px;
  border-top: 1px solid var(--line);
}
.difference-item {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel-soft);
}
.difference-item strong { color: var(--text); }
.difference-item p {
  margin: 7px 0 0;
  color: var(--body-text);
  font-size: .88rem;
  line-height: 1.35;
}
.detail-sources { margin-top: 20px; border-top: 1px solid var(--line); }
.detail-source-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.detail-source-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .76rem;
}
.detail-source-item > a {
  color: var(--title);
  text-decoration: none;
  font-weight: 700;
  line-height: 1.28;
}
.detail-source-item > a:hover { color: var(--blue); }
.detail-source-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.32;
}

@media (max-width: 760px) {
  .brand-wrap { flex: 1 1 auto; min-width: 0; }
  .top-actions { flex: 0 0 auto; }
  .story-detail-card { padding: 20px 17px; border-radius: 15px; }
  .story-detail-card h1 { font-size: 1.35rem; }
  .detail-summary { font-size: .94rem; }
  .detail-source-head { flex-direction: column; gap: 2px; }
}

.story-time {
  font-size: .78rem;
  line-height: 1.18;
  white-space: normal;
}



/* v11.6 launch accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
@media (max-width: 480px) {
  .page-shell { padding-left: 10px; padding-right: 10px; }
  .control-panel { width: calc(100vw - 16px); }
  .story-item { grid-template-columns: 48px minmax(0, 1fr); }
}
