:root {
  --bg: #f7f1e7;
  --paper: rgba(255, 251, 245, 0.82);
  --paper-strong: #fffaf3;
  --ink: #1b2431;
  --muted: #5e6571;
  --line: rgba(27, 36, 49, 0.1);
  --accent: #1b7f78;
  --accent-deep: #155e62;
  --accent-soft: #dff2ed;
  --warm: #b9673a;
  --warm-soft: #f3dfd1;
  --shadow: 0 30px 90px rgba(74, 53, 34, 0.15);
  --radius-lg: 30px;
  --radius-md: 22px;
  --radius-sm: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(185, 103, 58, 0.18), transparent 24%),
    radial-gradient(circle at 85% 10%, rgba(27, 127, 120, 0.16), transparent 22%),
    linear-gradient(160deg, #fbf6ef 0%, #f5ecdf 55%, #f0e0c9 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 78%);
}

.page-shell {
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.3rem 0 2.4rem;
}

.hero,
.app-grid {
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.8fr;
  gap: 1rem;
  align-items: start;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--paper);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-card,
.panel {
  border-radius: var(--radius-lg);
}

.hero-copy {
  padding: 1.5rem;
}

.hero-card {
  padding: 1.35rem;
}

.eyebrow,
.section-label,
.speaker,
.insight-label,
.stat-value {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0;
}

.eyebrow,
.section-label,
.insight-label,
.stat-value {
  color: var(--warm);
}

h1,
h2,
h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  line-height: 1.04;
  margin: 0;
}

h1 {
  font-size: clamp(2.15rem, 4vw, 3.8rem);
  max-width: 13ch;
  margin-top: 0.55rem;
}

h2 {
  font-size: clamp(1.55rem, 2.5vw, 2.3rem);
  margin-top: 0.35rem;
}

h3 {
  font-size: 1.35rem;
}

.intro,
.hero-card p,
.empty-state,
.result-summary,
.saved-summary,
.theme-list li,
.insight-grid p,
.next-steps li,
.bubble,
.progress-text {
  color: var(--muted);
  line-height: 1.7;
}

.intro {
  font-size: 1rem;
  max-width: 60ch;
  margin: 0.8rem 0 0;
}

[hidden] {
  display: none !important;
}

.hero-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-top: 1.1rem;
  align-items: stretch;
}

.primary-link,
.secondary-button,
.ghost-button,
.chat-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.primary-link {
  min-height: 48px;
  padding: 0.9rem 1.2rem;
  background: var(--accent);
  color: white;
  box-shadow: 0 16px 28px rgba(27, 127, 120, 0.2);
  width: 100%;
}

.secondary-button,
.ghost-button {
  min-height: 48px;
  padding: 0.9rem 1.1rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  width: 100%;
}

.primary-link:hover,
.secondary-button:hover,
.ghost-button:hover,
.chat-form button:hover {
  transform: translateY(-1px);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: stretch;
}

.hero-stats article,
.insight-grid article,
.action-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.hero-stats article {
  background: rgba(255, 250, 244, 0.86);
  padding: 0.85rem;
}

.hero-stats p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.theme-list {
  margin: 1.2rem 0 0;
  padding-left: 1.2rem;
}

.theme-list li + li {
  margin-top: 0.65rem;
}

.app-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1.15fr 0.9fr;
  gap: 1rem;
  align-items: start;
}

.panel {
  padding: 1.3rem;
}

.panel-header,
.results-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.chat-panel {
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

.results-column {
  display: grid;
  gap: 1.4rem;
  align-content: start;
}

.results-panel,
.saved-panel {
  min-height: 300px;
}

.progress-text {
  margin: 0.9rem 0 0.35rem;
  font-size: 0.95rem;
}

.save-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--warm-soft);
  color: var(--warm);
  font-size: 0.8rem;
  font-weight: 700;
}

.chat-log {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  padding: 0.45rem 0.2rem 1rem;
  scroll-behavior: smooth;
}

.message {
  max-width: 85%;
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.42s ease forwards;
}

.message.assistant {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
}

.speaker {
  color: var(--accent);
}

.message.continuing .speaker {
  display: none;
}

.message.continuing {
  margin-top: -0.55rem;
}

.message.user .speaker {
  text-align: right;
}

.bubble {
  margin: 0.35rem 0 0;
  padding: 1rem 1.05rem;
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
}

.message.assistant .bubble {
  background: var(--paper-strong);
  border: 1px solid rgba(27, 36, 49, 0.08);
}

.message.assistant.preview {
  max-width: 100%;
  align-self: stretch;
}

.message.assistant.preview .bubble {
  background: var(--accent-soft);
  border: 1px solid rgba(27, 127, 120, 0.25);
  border-left: 4px solid var(--accent);
}

.message.assistant.preview .speaker {
  color: var(--accent-deep);
}

.message.user .bubble {
  background: var(--accent-soft);
  border: 1px solid rgba(27, 127, 120, 0.14);
  color: #22444a;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  padding-top: 0.75rem;
}

.chat-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(27, 36, 49, 0.1);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font: inherit;
  padding: 1rem 1.05rem;
  border-radius: var(--radius-sm);
  outline: none;
}

.chat-form input:focus {
  border-color: rgba(27, 127, 120, 0.42);
  box-shadow: 0 0 0 4px rgba(27, 127, 120, 0.1);
}

.chat-form button {
  border: 0;
  background: var(--accent);
  color: white;
  padding: 0.95rem 1.2rem;
  box-shadow: 0 14px 26px rgba(27, 127, 120, 0.18);
}

.completion-block {
  margin-top: 1rem;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(27, 127, 120, 0.25);
  display: grid;
  gap: 0.75rem;
}

.completion-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.completion-text {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.completion-unlock {
  width: 100%;
  justify-self: stretch;
}

.empty-state {
  padding: 1.2rem;
  border: 1px dashed rgba(27, 36, 49, 0.18);
  border-radius: var(--radius-md);
  margin-top: 1rem;
}

.result-card {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

.result-summary {
  margin: 0;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  align-items: stretch;
}

.insight-grid article,
.action-block {
  background: rgba(255, 250, 244, 0.78);
  padding: 1rem;
}

.premium-panel {
  display: grid;
  gap: 1rem;
}

.paywall-card {
  border-radius: var(--radius-md);
  border: 1px solid rgba(27, 127, 120, 0.18);
  background:
    linear-gradient(135deg, rgba(27, 127, 120, 0.08), rgba(185, 103, 58, 0.1)),
    rgba(255, 250, 244, 0.88);
  padding: 1.15rem;
  display: grid;
  gap: 1rem;
}

.paywall-copy h3 {
  margin-top: 0.45rem;
}

.paywall-copy p,
.unlock-note,
.premium-note p,
.pricing-stack p {
  margin: 0.7rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.unlock-actions {
  display: grid;
  gap: 0.7rem;
}

.premium-jump-button {
  margin-top: 0.15rem;
}

.unlock-button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--warm), var(--accent));
  color: white;
  padding: 1rem 1.25rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 18px 30px rgba(27, 127, 120, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

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

.premium-content {
  display: grid;
  gap: 1rem;
}

.premium-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  align-items: stretch;
}

.premium-grid article,
.pricing-stack article {
  background: rgba(255, 250, 244, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.scenario-block {
  display: grid;
  gap: 0.9rem;
  align-items: stretch;
}

.scenario-block article {
  background: rgba(255, 250, 244, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.pricing-stack {
  margin-top: 1rem;
  display: grid;
  gap: 0.9rem;
}

.pricing-panel {
  min-height: 260px;
}

.insight-grid p,
.saved-summary p {
  margin: 0.55rem 0 0;
}

.action-block {
  margin-top: 0.1rem;
}

.next-steps {
  margin: 0.7rem 0 0;
  padding-left: 1.15rem;
}

.next-steps li + li {
  margin-top: 0.6rem;
}

.hidden {
  display: none;
}

.saved-summary {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 250, 244, 0.74);
  border: 1px solid var(--line);
}

.saved-summary strong {
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .chat-panel {
    min-height: 520px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 1rem, 100%);
    padding: 0.8rem 0 1.6rem;
  }

  .hero-copy,
  .hero-card,
  .panel {
    border-radius: 24px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 1rem;
  }

  .hero-stats,
  .insight-grid,
  .premium-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .primary-link,
  .secondary-button,
  .ghost-button,
  .chat-form button {
    width: 100%;
  }

  .hero-actions,
  .panel-header,
  .results-header {
    flex-direction: column;
    align-items: stretch;
  }

  .message {
    max-width: 100%;
  }
}
