:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --ink: #11110f;
  --muted: #62625c;
  --line: #d8d6cf;
  --accent: #047857;
  --surface: #ffffff;
  --error: #9f1239;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--accent);
}

body {
  text-rendering: geometricPrecision;
}

button,
a {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100svh;
  padding: 18px clamp(16px, 3vw, 44px) 40px;
  background: var(--paper);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 20px;
  background: var(--paper);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(48px, 8vw, 112px);
  line-height: 0.92;
  font-weight: 520;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1;
  font-weight: 560;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#refresh-button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.button-link {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.view-strip,
.source-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.view-strip {
  padding: 0 0 10px;
}

.source-strip {
  padding: 0 0 18px;
}

.view-filter,
.source-filter {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.view-filter.is-active,
.source-filter.is-active {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}

.feed-page {
  max-width: 1080px;
  min-height: calc(100svh - 190px);
}

.feed-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
}

.article-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.article-card {
  display: block;
  width: 100%;
  padding: clamp(18px, 3vw, 28px) 0 8px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.article-card:hover .article-title,
.article-card:focus-visible .article-title {
  color: var(--accent);
}

.article-source,
.article-date {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.article-title {
  display: block;
  margin-top: 8px;
  max-width: 980px;
  font-size: clamp(18px, 2.3vw, 31px);
  line-height: 1.12;
  font-weight: 620;
  transition: color 140ms ease;
}

.article-excerpt {
  margin: 9px 0 0;
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
  line-height: 1.45;
}

.article-why {
  margin-top: 10px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
}

.article-list li {
  border-bottom: 1px solid var(--line);
}

.article-actions {
  display: flex;
  gap: 8px;
  padding: 0 0 clamp(18px, 3vw, 28px);
}

.article-actions button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.article-actions button:hover,
.article-actions button:focus-visible {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}

.article-actions button:disabled {
  display: none;
}

.reader-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 20px;
  background: var(--paper);
}

.reader-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.reader-topbar a,
.reader-action-button,
.back-link {
  color: var(--accent);
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 0.84rem;
  font-weight: 800;
}

.reader-action-button:hover,
.reader-action-button:focus-visible,
.reader-topbar a:hover,
.reader-topbar a:focus-visible {
  color: var(--ink);
}

.reader-action-button[aria-pressed="true"] {
  color: var(--ink);
}

.reader-action-button:disabled {
  cursor: default;
  opacity: 0.7;
}

.admin-link {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
}

.admin-link:hover,
.admin-link:focus-visible {
  color: var(--ink);
}

.reader-panel {
  max-width: 940px;
  min-height: auto;
  margin: 34px auto 0;
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 3vw, 38px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reader-page h1 {
  max-width: 840px;
  font-size: clamp(24px, 3.5vw, 42px);
  line-height: 1.08;
  font-weight: 620;
}

.reader-head {
  flex: 0 0 auto;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.reader-action-status {
  min-height: 1.1em;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.reader-note-form {
  display: grid;
  gap: 10px;
  max-width: 680px;
  margin-top: 20px;
}

.reader-note-form label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reader-note-form textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  padding: 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  line-height: 1.4;
}

.reader-note-form button {
  justify-self: start;
}

.reader-head a {
  display: inline-flex;
  margin-top: 18px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
}

.reader-content {
  display: flex;
  flex-direction: column;
}

.reader-body {
  max-width: 780px;
  padding-top: 22px;
  color: #22221f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.58;
}

.reader-body p {
  margin: 0 0 1.05em;
}

.public-reader-page {
  display: flex;
  flex-direction: column;
}

.public-reader-topbar {
  align-items: flex-start;
}

.public-reader-intro {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 1080px;
  padding: 8px 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.public-reader-intro p {
  margin: 0;
}

.public-source-strip {
  padding-bottom: 18px;
}

.public-feed-page {
  min-height: calc(100svh - 230px);
}

.public-empty-state {
  margin: 0;
  padding: clamp(18px, 3vw, 28px) 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}

.review-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 14px clamp(14px, 3vw, 36px) 18px;
  color: var(--paper);
  background: var(--accent);
  overscroll-behavior: contain;
}

.review-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.review-topbar .back-link {
  color: var(--paper);
  border-color: rgba(247, 247, 242, 0.35);
}

.review-progress {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-size: 0.76rem;
  font-weight: 800;
}

.review-progress span:last-child {
  color: rgba(247, 247, 242, 0.74);
}

.review-stage {
  min-height: 0;
  display: grid;
  place-items: center;
}

.review-card {
  position: relative;
  width: min(100%, 760px);
  min-height: min(68svh, 720px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(22px, 5vw, 42px);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(17, 17, 15, 0.12);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(17, 17, 15, 0.24);
  touch-action: none;
  transition: transform 140ms ease;
  will-change: transform;
}

.review-card h1 {
  font-size: clamp(34px, 8vw, 74px);
}

.review-excerpt,
.review-chunk {
  max-width: 66ch;
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.1rem, 3.2vw, 1.55rem);
  line-height: 1.36;
  font-weight: 520;
}

.review-chunk {
  cursor: pointer;
}

.review-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.review-card-footer a {
  color: var(--accent);
}

.swipe-hint {
  position: absolute;
  top: 18px;
  padding: 6px 9px;
  border: 2px solid currentColor;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  text-transform: uppercase;
  transition: opacity 120ms ease;
}

.swipe-hint.save {
  left: 18px;
  color: var(--accent);
}

.swipe-hint.archive {
  right: 18px;
  color: var(--error);
}

.review-card.is-saving .swipe-hint.save,
.review-card.is-archiving .swipe-hint.archive {
  opacity: 1;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 1.25fr) 1fr;
  gap: 10px;
}

.review-actions button,
.review-undo {
  min-height: 46px;
  color: var(--paper);
  background: rgba(17, 17, 15, 0.92);
  border: 1px solid rgba(247, 247, 242, 0.28);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 850;
}

.review-actions button:first-child {
  background: #7f1d1d;
}

.review-actions button:last-child {
  background: #064e3b;
}

.review-actions button:disabled,
.review-undo:disabled {
  opacity: 0.45;
  cursor: default;
}

.review-undo {
  width: min(100%, 240px);
  justify-self: center;
  background: transparent;
}

.error {
  color: var(--error);
}

.admin-shell .topbar {
  align-items: flex-start;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: start;
  max-width: 1180px;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(18px, 3vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-panel h2 {
  font-size: clamp(24px, 4vw, 44px);
}

.admin-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-panel input {
  min-height: 42px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  text-transform: none;
}

.admin-panel button {
  min-height: 38px;
  padding: 0 13px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.admin-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.source-manager-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.source-manager-head button,
.admin-source-actions button {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.admin-source-list {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.admin-source-list li {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.compact-list li {
  padding: 12px 0;
}

.admin-source-list li.is-disabled {
  opacity: 0.55;
}

.admin-source-body {
  display: grid;
  gap: 5px;
}

.admin-source-body strong {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.1;
}

.admin-source-body span,
.admin-source-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.admin-source-body p {
  overflow-wrap: anywhere;
}

.admin-source-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 0 0 auto;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 14px 16px 28px;
  }

  .topbar {
    padding-top: 12px;
  }

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

  .admin-source-list li {
    flex-direction: column;
  }

  .reader-panel {
    padding: 20px;
  }

  .reader-topbar {
    align-items: flex-start;
  }

  .reader-topbar-actions {
    gap: 10px 12px;
  }
}
