:root {
  --bg: #efe8dd;
  --surface: rgba(255, 251, 246, 0.86);
  --surface-strong: #fffdf9;
  --surface-dark: #103f31;
  --surface-dark-2: #0c3327;
  --ink: #13392d;
  --ink-soft: #587063;
  --line: rgba(19, 57, 45, 0.1);
  --line-strong: rgba(255, 255, 255, 0.12);
  --mint: #baf09f;
  --mint-2: #d7f8c6;
  --white: #ffffff;
  --shadow-lg: 0 28px 80px rgba(14, 47, 35, 0.12);
  --shadow-md: 0 14px 38px rgba(14, 47, 35, 0.08);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --font-body: 'Manrope', sans-serif;
  --font-display: 'Manrope', sans-serif;
  --font-serif: 'Instrument Serif', serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(186, 240, 159, 0.18), transparent 24%),
    linear-gradient(180deg, #0f4333 0, #0f4333 520px, var(--bg) 520px, var(--bg) 100%);
}

a,
button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0 16px;
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--white);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.05em;
  text-transform: lowercase;
}

.brand-kicker,
.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-kicker {
  color: rgba(255, 255, 255, 0.62);
}

.brand-copy h1,
.hero-copy h2,
.section-head h3,
.command-head h4,
.results-head h4,
.sources-headline h4,
.info-card h4 {
  margin: 0;
}

.brand-copy h1 {
  font-size: 22px;
  color: var(--white);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.topnav a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
}

.layout {
  display: grid;
  gap: 24px;
  padding-bottom: 48px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  border-radius: 36px;
  background:
    radial-gradient(circle at top left, rgba(186, 240, 159, 0.16), transparent 28%),
    linear-gradient(135deg, var(--surface-dark) 0%, var(--surface-dark-2) 100%);
  box-shadow: var(--shadow-lg);
}

.hero-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(186, 240, 159, 0.38) 1.3px, transparent 1.3px);
  background-size: 42px 42px;
  opacity: 0.24;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 1), transparent 85%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 430px);
  gap: 32px;
  padding: 48px;
}

.hero-copy {
  padding: 28px 0;
  color: var(--white);
}

.eyebrow {
  color: var(--ink-soft);
}

.eyebrow.light {
  color: rgba(255, 255, 255, 0.68);
}

.eyebrow.soft {
  color: rgba(255, 255, 255, 0.56);
}

.hero-copy h2 {
  max-width: 11ch;
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: clamp(52px, 7vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.07em;
  font-weight: 600;
}

.hero-text {
  max-width: 640px;
  margin: 24px 0 0;
  font-size: 19px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.78);
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-notes span {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 700;
}

.hero-side {
  display: grid;
  gap: 16px;
  align-content: center;
}

.hero-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
}

.hero-card.muted {
  background: rgba(255, 255, 255, 0.04);
}

.hero-card h3 {
  margin: 10px 0 12px;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.hero-card p,
.hero-list {
  margin: 0;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.74);
}

.hero-list {
  padding-left: 18px;
}

.hero-list li + li {
  margin-top: 10px;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.section-head h3 {
  margin-top: 10px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 0.98;
  letter-spacing: -0.06em;
  color: var(--ink);
}

.section-copy {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.command-panel,
.results-card,
.sources-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.command-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 20px;
  padding: 28px;
}

.command-head h4 {
  margin-top: 10px;
  font-size: 34px;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.command-head p {
  margin: 12px 0 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.run-activity {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(16, 63, 49, 0.05);
  border: 1px solid rgba(19, 57, 45, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.run-activity.active {
  background: rgba(186, 240, 159, 0.16);
  border-color: rgba(16, 63, 49, 0.12);
  box-shadow: inset 0 0 0 1px rgba(186, 240, 159, 0.18);
}

.run-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(19, 57, 45, 0.18);
  border-top-color: var(--surface-dark);
  opacity: 0.55;
}

.run-activity.active .run-spinner {
  opacity: 1;
  animation: spin 0.85s linear infinite;
}

.run-activity-copy {
  display: grid;
  gap: 2px;
}

.run-activity-copy strong {
  font-size: 14px;
  color: var(--ink);
}

.run-activity-copy span {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.system-key {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(19, 57, 45, 0.08);
}

.system-key label {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.system-key-row {
  display: flex;
  gap: 10px;
}

.system-key-row input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(19, 57, 45, 0.12);
  border-radius: 14px;
  background: var(--white);
  color: var(--ink);
  outline: none;
}

.system-key-row input:focus {
  border-color: rgba(16, 63, 49, 0.28);
  box-shadow: 0 0 0 4px rgba(186, 240, 159, 0.22);
}

.system-key-help {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.run-button {
  width: 100%;
  min-height: 64px;
  font-size: 17px;
}

.run-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.run-stat {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(19, 57, 45, 0.08);
}

.run-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.run-stat strong {
  font-size: 14px;
  color: var(--ink);
}

.results-panel {
  display: grid;
  gap: 20px;
}

.results-card {
  padding: 24px;
}

.results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.results-head h4 {
  margin-top: 10px;
  font-size: 28px;
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.status-meta,
.status-line,
.output-box,
.info-card p,
.feed-meta,
.section-copy,
.system-key-help {
  color: var(--ink-soft);
}

.status-meta,
.status-line {
  font-size: 14px;
  font-weight: 700;
}

.status-line {
  margin-bottom: 14px;
}

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

.publish-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(186, 240, 159, 0.18);
  border: 1px solid rgba(19, 57, 45, 0.1);
}

.publish-banner strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 15px;
  color: var(--ink);
}

.publish-banner a {
  color: var(--surface-dark);
  font-size: 14px;
  font-weight: 700;
  word-break: break-word;
}

.output-box {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(19, 57, 45, 0.08);
  padding: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.feed-output {
  display: grid;
  gap: 12px;
}

.feed-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(19, 57, 45, 0.08);
}

.feed-item-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.feed-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(186, 240, 159, 0.42);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.feed-item h4 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.2;
  color: var(--ink);
}

.feed-item p {
  margin: 10px 0 0;
  color: var(--ink-soft);
}

.feed-article {
  color: var(--ink);
}

.feed-item a {
  display: inline-block;
  margin-top: 12px;
  color: var(--ink);
  font-weight: 800;
  word-break: break-word;
}

.feed-meta {
  font-size: 13px;
  font-weight: 700;
}

.feed-failures {
  padding: 16px;
  border-radius: 18px;
  background: rgba(16, 63, 49, 0.06);
  color: var(--ink);
}

.feed-failures ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.newsletter-preview {
  width: 100%;
  min-height: 680px;
  margin-bottom: 14px;
  border: 1px solid rgba(19, 57, 45, 0.08);
  border-radius: 20px;
  background: var(--white);
}

.preview-shell {
  position: relative;
  margin-bottom: 14px;
}

.preview-processing {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.8);
  backdrop-filter: blur(8px);
  color: var(--ink);
}

.preview-shell.is-processing .preview-processing {
  display: flex;
}

.preview-shell.is-processing .newsletter-preview {
  filter: saturate(0.7) blur(1.2px);
}

.preview-processing p {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
}

.preview-processing-spinner {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 3px solid rgba(19, 57, 45, 0.14);
  border-top-color: var(--surface-dark);
  animation: spin 0.9s linear infinite;
}

.html-output {
  max-height: 320px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.sources-layout {
  display: grid;
  gap: 20px;
}

.sources-block {
  padding: 24px;
}

.sources-headline {
  margin-bottom: 16px;
}

.sources-headline h4 {
  margin-top: 10px;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.source-grid,
.channel-grid,
.x-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.info-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(19, 57, 45, 0.08);
}

.info-card h4 {
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.2;
}

.card-tag {
  color: var(--forest-soft);
}

.handle {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.info-card p {
  margin: 10px 0 0;
  min-height: 72px;
  line-height: 1.65;
}

.info-card a {
  display: inline-flex;
  margin-top: 14px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.64;
  cursor: wait;
  transform: none;
}

body.is-running .run-button {
  background: linear-gradient(135deg, var(--mint-2) 0%, var(--white) 100%);
  box-shadow: 0 0 0 1px rgba(19, 57, 45, 0.08), 0 0 0 10px rgba(186, 240, 159, 0.12);
}

.button.primary {
  background: var(--white);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(19, 57, 45, 0.06);
}

.button.secondary {
  background: var(--surface-dark);
  color: var(--white);
}

.button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(19, 57, 45, 0.12);
}

.button.small {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1120px) {
  .hero-grid,
  .section-head,
  .workspace {
    grid-template-columns: 1fr;
  }

  .command-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(1360px, calc(100% - 20px));
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topnav {
    flex-wrap: wrap;
    gap: 14px;
  }

  .hero-grid,
  .command-panel,
  .results-card,
  .sources-block {
    padding: 18px;
  }

  .hero-copy h2 {
    font-size: clamp(42px, 13vw, 64px);
  }

  .system-key-row,
  .results-head,
  .run-meta,
  .publish-banner {
    grid-template-columns: 1fr;
    display: grid;
  }

  .newsletter-preview {
    min-height: 520px;
  }
}
