:root {
  --bg: #f4f1ea;
  --paper: #fffdf7;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #ddd6c8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --orange: #ff9800;
  --shadow: 0 22px 60px rgba(70, 55, 32, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.daily-shell {
  display: grid;
  grid-template-columns: 56px 1fr;
  min-height: 100vh;
}

.nav {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  padding: 18px 10px;
  border-right: 1px solid var(--line);
  background: #fbfaf7;
}

.brand {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--orange);
  border-radius: 50%;
  color: var(--orange);
  font-weight: 800;
}

.icon-button,
.icon-action {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #667085;
  text-decoration: none;
}

.icon-button:hover,
.icon-button.active,
.icon-action:hover {
  background: #fff0d9;
  color: var(--orange);
}

.nav .icon-button:last-of-type {
  margin-top: auto;
  margin-bottom: 58px;
}

.newspaper {
  width: min(1480px, calc(100vw - 88px));
  margin: 0 auto;
  padding: 28px 32px 64px;
}

.daily-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 4px double var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 5.8vw, 76px);
  line-height: 0.96;
}

.meta,
.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.head-actions [data-unified-switcher].is-inline {
  height: 38px;
  margin-right: 8px;
  border-color: var(--line);
}

.head-actions [data-unified-switcher].is-inline a {
  min-height: 30px;
}

.primary-button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.status-line {
  min-height: 24px;
  margin: 14px 0;
  color: var(--accent);
  font-size: 14px;
}

.status-line.error {
  color: #b42318;
}

.daily-content {
  display: grid;
  gap: 34px;
}

.lead-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.lead-stats div {
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.lead-stats div:last-child {
  border-right: 0;
}

.lead-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.lead-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.section {
  padding-top: 24px;
  border-top: 2px solid var(--ink);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
}

.section-head p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 26px;
}

.story {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  overflow: hidden;
  min-height: 100%;
  border: 1px solid rgba(221, 214, 200, 0.92);
  border-radius: 14px;
  background: color-mix(in srgb, var(--paper) 92%, white 8%);
  box-shadow: 0 20px 52px rgba(70, 55, 32, 0.1);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.story:hover,
.story:focus-visible {
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: 0 28px 70px rgba(70, 55, 32, 0.16);
  transform: translateY(-2px);
}

.story:hover h3,
.story:focus-visible h3 {
  color: var(--accent);
}

.story:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  outline-offset: 4px;
}

.story-cover {
  position: relative;
  overflow: hidden;
  background: #e5e7eb;
}

.story-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.story-body {
  display: grid;
  gap: 8px;
  padding: 16px 18px 18px;
}

.story-kicker {
  justify-self: start;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.story h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.24;
}

.story p {
  margin: 0;
  color: #4b5563;
  font-size: 15px;
  line-height: 1.65;
}

.story small {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.score {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
}

.empty {
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--muted);
  text-align: center;
}

.light-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.light-button:hover {
  border-color: rgba(15, 118, 110, 0.36);
  color: var(--accent);
}

.favorite-button.active {
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent);
}

.text-button {
  margin-left: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.text-button:hover {
  color: var(--accent-strong);
}

.modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483600 !important;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

.modal[hidden] {
  display: none !important;
}

.modal-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.32);
}

.detail-card {
  width: min(1120px, 100%);
  padding: 0;
}

.detail-modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(18px);
}

.detail-body {
  padding: 22px;
}

.detail-loading {
  padding: 58px;
  color: var(--muted);
  text-align: center;
}

.detail-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.detail-toolbar h2 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.18;
}

.detail-meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.detail-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.detail-open-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.detail-insight {
  display: grid;
  gap: 8px;
  margin: 18px 0 24px;
  padding: 18px 20px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 12px;
  background:
    radial-gradient(circle at 16% 0%, rgba(45, 212, 191, 0.16), transparent 38%),
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(255, 255, 255, 0.72));
  box-shadow: 0 18px 48px rgba(15, 118, 110, 0.1);
}

.detail-insight strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 17px;
}

.detail-insight strong::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2dd4bf, #7c3aed);
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.42);
}

.detail-insight p {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
}

.detail-insight .detail-reason {
  color: var(--muted);
}

.detail-insight span {
  justify-self: start;
  color: var(--accent);
  font-weight: 800;
}

.article-content {
  display: grid;
  gap: 14px;
  max-width: 820px;
  margin: 0 auto;
  color: #263241;
  font-size: 16px;
  line-height: 1.9;
}

.article-content p,
.article-content section {
  margin: 0;
}

.article-content img {
  display: block;
  max-width: 100%;
  height: auto !important;
  margin: 14px auto;
  border-radius: 8px;
}

.article-content a {
  color: var(--accent);
}

.detail-player {
  margin-bottom: 22px;
}

.detail-video-frame,
.detail-video-cover {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #050608;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.18);
}

.detail-video-frame {
  aspect-ratio: 16 / 9;
}

.detail-video-frame iframe,
.detail-video-frame video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

.article-content svg {
  width: auto;
  max-width: 100%;
  height: auto;
  fill: revert;
  stroke: revert;
  color: #111827;
  background: #ffffff;
}

.article-content svg text,
.article-content svg tspan,
.article-content svg .label,
.article-content svg foreignObject,
.article-content svg foreignObject * {
  fill: #111827 !important;
  color: #111827 !important;
  stroke: none !important;
}

.detail-video-cover {
  display: grid;
  place-items: center;
  min-height: 360px;
}

.detail-video-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.62;
}

.detail-video-cover .primary-button {
  position: relative;
  z-index: 1;
}

.detail-image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.detail-image-gallery img {
  display: block;
  width: 100%;
  max-height: 620px;
  border-radius: 10px;
  object-fit: contain;
  background: #111827;
}

.detail-playback-note,
.detail-excerpt {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.modal-card header,
.modal-card footer,
.source-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.modal-card h2,
.source-title h3 {
  margin: 0;
}

.settings-grid,
.ai-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.ai-settings {
  grid-template-columns: 1fr 1fr;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-row input {
  width: auto;
  min-height: 0;
}

.source-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 20px 0;
}

.source-column {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.44);
}

.source-title button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 750;
}

.source-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  margin-top: 12px;
  overflow: auto;
}

.source-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 7px;
  background: #fff;
  font-weight: 650;
}

.source-main-check,
.priority-check {
  display: grid;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.source-main-check {
  grid-template-columns: auto minmax(0, 1fr);
}

.source-main-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.priority-check {
  position: relative;
  grid-template-columns: auto;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid rgba(15, 118, 110, 0.26);
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.09);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.priority-check:hover {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.14);
}

.priority-check.is-priority {
  border-color: rgba(220, 38, 38, 0.34);
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.priority-check.is-priority:hover {
  border-color: rgba(220, 38, 38, 0.5);
  background: rgba(220, 38, 38, 0.15);
}

.source-option input {
  width: auto;
  min-height: 0;
}

.priority-check input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.source-option.blocked {
  color: #b42318;
  background: #fff1f0;
}

.source-option.blocked input {
  opacity: 0.5;
}

.context-menu {
  position: fixed;
  z-index: 10020;
  display: grid;
  min-width: 210px;
  padding: 6px;
  border: 1px solid rgba(216, 218, 221, 0.92);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 42px rgba(21, 25, 32, 0.16);
  backdrop-filter: blur(14px);
}

.context-menu button {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.context-menu button:hover {
  background: #eef7f5;
  color: var(--accent);
}

.context-menu button.danger {
  color: #b42318;
}

.context-menu button.danger:hover {
  background: #fde9e7;
}

.settings-status {
  color: var(--accent);
  font-size: 14px;
}

@media (max-width: 1000px) {
  .lead-stats,
  .source-picker,
  .settings-grid,
  .ai-settings {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .daily-shell {
    grid-template-columns: 48px 1fr;
  }

  .newspaper {
    width: calc(100vw - 48px);
    padding: 24px 16px 48px;
  }

  .daily-head {
    display: grid;
  }

  .detail-toolbar {
    display: grid;
  }

  .detail-actions {
    flex-wrap: wrap;
  }

  .detail-body {
    padding: 16px;
  }
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .daily-shell {
  background: #07090d;
  color: #e7edf5;
}

:root[data-theme="dark"] .nav,
:root[data-theme="dark"] .modal-card,
:root[data-theme="dark"] .lead-stats,
:root[data-theme="dark"] .empty,
:root[data-theme="dark"] .light-button {
  border-color: #26303b;
  background: #0b0f15;
  color: #e7edf5;
}

:root[data-theme="dark"] .favorite-button.active {
  border-color: rgba(94, 234, 212, 0.34);
  background: rgba(45, 212, 191, 0.12);
  color: #5eead4;
}

:root[data-theme="dark"] .daily-head,
:root[data-theme="dark"] .section,
:root[data-theme="dark"] .story,
:root[data-theme="dark"] .source-column,
:root[data-theme="dark"] .ai-settings,
:root[data-theme="dark"] .detail-modal-head {
  border-color: #26303b;
}

:root[data-theme="dark"] .detail-modal-head {
  background: rgba(11, 15, 21, 0.92);
}

:root[data-theme="dark"] .detail-insight {
  border-color: rgba(94, 234, 212, 0.2);
  background:
    radial-gradient(circle at 16% 0%, rgba(45, 212, 191, 0.12), transparent 38%),
    linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(17, 24, 32, 0.72));
}

:root[data-theme="dark"] .detail-insight p,
:root[data-theme="dark"] .article-content {
  color: #d8e1ec;
}

:root[data-theme="dark"] .source-option,
:root[data-theme="dark"] .story,
:root[data-theme="dark"] input {
  border-color: #26303b;
  background: #111720;
  color: #e7edf5;
}

:root[data-theme="dark"] .priority-check {
  border-color: #1f4f4b;
  background: rgba(20, 184, 166, 0.12);
  color: #5eead4;
}

:root[data-theme="dark"] .priority-check.is-priority {
  border-color: rgba(248, 113, 113, 0.46);
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
}

:root[data-theme="dark"] .source-option.blocked,
:root[data-theme="dark"] .context-menu {
  border-color: #5f2a2a;
  background: #1a1012;
}

:root[data-theme="dark"] .context-menu button {
  color: #e7edf5;
}

:root[data-theme="dark"] .story p,
:root[data-theme="dark"] .meta,
:root[data-theme="dark"] .hint,
:root[data-theme="dark"] .section-head p,
:root[data-theme="dark"] .story small,
:root[data-theme="dark"] .detail-meta,
:root[data-theme="dark"] .detail-playback-note,
:root[data-theme="dark"] .detail-excerpt,
:root[data-theme="dark"] .detail-insight .detail-reason {
  color: #9aa5b4;
}
