:root {
  --bg: #f5efe4;
  --surface: rgba(255, 251, 245, 0.82);
  --surface-strong: #fffdf9;
  --ink: #16110f;
  --muted: #6b625d;
  --line: rgba(22, 17, 15, 0.12);
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(30, 23, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Space Grotesk", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 32%),
    radial-gradient(circle at right, rgba(180, 83, 9, 0.18), transparent 28%),
    linear-gradient(180deg, #fbf7ee 0%, #f2e7d7 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(22, 17, 15, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 17, 15, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 90%);
}

.page-shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.85fr);
  gap: 20px;
  align-items: stretch;
}

.hero,
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 28px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero::after,
.panel::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.1), transparent 70%);
}

.hero {
  padding: 28px;
}

.hero-copy h1,
.panel-heading h2 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-weight: 700;
  line-height: 0.95;
}

.hero-copy h1 {
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  letter-spacing: -0.05em;
  max-width: 9ch;
}

.lede,
.panel-meta,
.account-meta,
.timestamp,
.empty-state {
  color: var(--muted);
}

.eyebrow,
.section-kicker,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-panel {
  display: grid;
  gap: 12px;
}

.hero-stat {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
}

.hero-stat span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-stat strong {
  font-size: 2rem;
  line-height: 1;
}

.dashboard {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  margin-top: 22px;
}

.page-tools {
  position: sticky;
  top: 14px;
  z-index: 30;
  display: flex;
  justify-content: end;
  margin-top: 18px;
}

.auto-play-toggle {
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255, 253, 249, 0.92);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(30, 23, 20, 0.08);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.auto-play-toggle[data-enabled="true"] {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.26);
  color: var(--accent);
}

.panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.account-grid,
.tweet-list {
  display: grid;
  gap: 14px;
}

.account-card,
.tweet-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-strong);
}

.account-card {
  padding: 16px 16px 18px;
}

.account-header,
.tweet-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.tweet-header-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-name,
.tweet-account {
  margin: 0;
  font-size: 1rem;
}

.account-name a,
.tweet-account a {
  color: inherit;
  text-decoration: none;
}

.account-meta {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.88rem;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status.ok {
  background: var(--accent-soft);
  color: var(--accent);
}

.status.warn {
  background: rgba(180, 83, 9, 0.14);
  color: var(--warn);
}

.status.error {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.tweet-card {
  padding: 18px;
}

.audio-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.audio-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.28);
}

.audio-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.audio-button[data-state="playing"] {
  background: rgba(15, 118, 110, 0.18);
  border-color: rgba(15, 118, 110, 0.34);
}

.audio-button[data-state="error"] {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.2);
  background: rgba(180, 35, 24, 0.08);
}

.audio-button-icon {
  font-size: 0.82rem;
  line-height: 1;
}

.tweet-text,
.tweet-analysis {
  margin: 12px 0 0;
  line-height: 1.65;
  white-space: pre-wrap;
}

.tweet-analysis {
  padding: 14px;
  border-radius: 16px;
  background: rgba(15, 118, 110, 0.08);
}

.tweet-analysis-copy {
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.tweet-analysis-copy strong {
  color: var(--ink);
}

.tweet-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.tweet-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.feed-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: end;
}

.filter-field {
  display: grid;
  gap: 6px;
  min-width: 180px;
  font-size: 0.85rem;
  color: var(--muted);
}

.filter-field select {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.empty-state {
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  text-align: center;
}

@media (max-width: 960px) {
  .hero,
  .dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding: 18px 0 28px;
  }

  .hero,
  .panel {
    border-radius: 22px;
  }

  .hero {
    padding: 20px;
  }

  .page-tools {
    top: 10px;
    justify-content: stretch;
  }

  .auto-play-toggle {
    width: 100%;
  }

  .panel {
    padding: 18px;
  }

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

  .feed-controls {
    width: 100%;
    justify-content: start;
  }
}
