:root {
  --bg: #f7f1e8;
  --bg-strong: #f0e5d4;
  --paper: rgba(255, 252, 247, 0.92);
  --paper-soft: rgba(255, 248, 238, 0.76);
  --ink: #15333a;
  --ink-soft: #53686d;
  --line: rgba(21, 51, 58, 0.11);
  --teal: #0f7c78;
  --teal-deep: #0b5d5a;
  --amber: #d98e2f;
  --rose: #b55757;
  --mint: #dbeee7;
  --shadow: 0 20px 60px rgba(29, 49, 56, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(15, 124, 120, 0.1), transparent 34%),
    radial-gradient(circle at bottom right, rgba(217, 142, 47, 0.12), transparent 28%),
    linear-gradient(180deg, #fbf6ef 0%, #f5ede1 100%);
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
}

.page-noise,
.page-orbit {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.page-noise {
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black, transparent 76%);
}

.page-orbit {
  width: 34rem;
  height: 34rem;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.28;
}

.orbit-a {
  top: -10rem;
  right: -6rem;
  background: rgba(15, 124, 120, 0.24);
}

.orbit-b {
  bottom: -12rem;
  left: -8rem;
  background: rgba(217, 142, 47, 0.22);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 44px;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: rise 0.75s cubic-bezier(.2,.75,.2,1) forwards;
}

.topbar.reveal { animation-delay: 0.04s; }
.hero.reveal { animation-delay: 0.1s; }
.intake.reveal { animation-delay: 0.16s; }
.result.reveal { animation-delay: 0.22s; }
.history.reveal { animation-delay: 0.28s; }

.topbar,
.hero,
.panel,
.signal-card {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(100%, 960px);
  margin: 0 auto 22px;
  text-align: center;
}

.topbar-copy {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
}

.intro-video-shell {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, 380px);
}

.intro-video {
  width: 100%;
  aspect-ratio: 11 / 20;
  border-radius: 28px;
  object-fit: contain;
  object-position: center top;
  max-height: min(70vh, 620px);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.18), transparent 48%),
    linear-gradient(180deg, rgba(160, 181, 188, 0.85), rgba(210, 220, 224, 0.9));
  border: 1px solid rgba(21, 51, 58, 0.1);
  box-shadow: 0 18px 48px rgba(21, 51, 58, 0.18);
}

.intro-audio-button {
  min-width: 240px;
}

.topbar-lead {
  max-width: 34ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.45;
  text-wrap: balance;
}

.topbar h1,
.hero h2,
.panel h3 {
  margin: 0;
  letter-spacing: -0.03em;
  font-family: "Fraunces", Georgia, serif;
}

.topbar h1 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.02;
}

.user-chip {
  min-height: 34px;
}

.hero h2 {
  font-size: clamp(1.75rem, 3.1vw, 2.9rem);
  line-height: 1.08;
  max-width: 22ch;
  margin-left: auto;
  margin-right: auto;
  text-wrap: balance;
}

.hero-lead,
.field-subtitle,
.empty-state p,
.signal-card p,
.result-banner p {
  color: var(--ink-soft);
}

.eyebrow,
.section-label,
.signal-label,
.field-label {
  margin: 0 0 8px;
  color: var(--teal-deep);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
}

.hero-actions,
.attachment-actions,
.panel-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip,
.result-status,
.history-badge,
.file-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.chip {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
}

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

.chip.accent,
.result-status.planned,
.history-badge.planned {
  background: rgba(15, 124, 120, 0.12);
  color: var(--teal-deep);
}

.chip.success {
  background: rgba(86, 170, 124, 0.16);
  color: #226044;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 960px);
  justify-content: center;
  gap: 18px;
  width: 100%;
  margin: 0 auto 18px;
}

.hero-copy,
.hero-signal,
.panel {
  border: 1px solid rgba(21, 51, 58, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(22px, 4vw, 42px);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(250, 241, 230, 0.88)),
    linear-gradient(180deg, rgba(15, 124, 120, 0.08), transparent);
}

.hero-copy p {
  max-width: 64ch;
  margin-left: auto;
  margin-right: auto;
  text-wrap: pretty;
}

.hero-copy {
  max-width: 100%;
}

.hero-lead {
  font-size: 1.02rem;
  line-height: 1.56;
}

.hero-signal {
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 16px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.8), rgba(247, 240, 228, 0.85));
}

.signal-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--paper);
  border: 1px solid rgba(21, 51, 58, 0.08);
  text-align: center;
}

.signal-card.muted {
  background: linear-gradient(160deg, rgba(219, 238, 231, 0.8), rgba(255, 248, 238, 0.86));
}

.signal-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.02rem;
  text-wrap: balance;
}

.signal-button {
  margin-top: 8px;
  width: 100%;
}

.primary-button,
.secondary-button,
.ghost-button,
.chip-button,
.quick-pill,
.history-item {
  border: 0;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.primary-button,
.secondary-button,
.ghost-button,
.chip-button {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: white;
  box-shadow: 0 12px 28px rgba(15, 124, 120, 0.28);
}

.secondary-button {
  background: white;
  color: var(--ink);
  border: 1px solid rgba(21, 51, 58, 0.11);
}

.ghost-button,
.chip-button {
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink-soft);
  border: 1px solid rgba(21, 51, 58, 0.12);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.chip-button:hover,
.quick-pill:hover,
.history-item:hover {
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.76;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 960px);
  justify-content: center;
  gap: 18px;
  align-items: start;
  width: 100%;
  margin: 0 auto;
}

.stack {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}

.panel {
  padding: 24px;
  background: var(--paper);
}

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

.panel h3 {
  font-size: 1.32rem;
  line-height: 1.1;
  text-wrap: balance;
}

.symptom-input {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  border: 1px solid rgba(21, 51, 58, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  padding: 18px 20px;
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.symptom-input:focus {
  outline: 2px solid rgba(15, 124, 120, 0.24);
  border-color: rgba(15, 124, 120, 0.4);
}

.attachment-zone,
.consent-strip,
.result-banner,
.attachment-item,
.history-item,
.result-card {
  border-radius: var(--radius-lg);
}

.attachment-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  margin: 18px 0 14px;
  background: linear-gradient(135deg, rgba(219, 238, 231, 0.7), rgba(255, 247, 236, 0.9));
  border: 1px solid rgba(15, 124, 120, 0.1);
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.footer-primary-button {
  min-width: 240px;
}

.footer-button {
  min-width: 180px;
}

.attachment-list,
.result-grid,
.history-panel {
  display: grid;
  gap: 12px;
}

.attachment-item,
.history-item,
.result-card {
  padding: 15px 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(21, 51, 58, 0.08);
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.attachment-item strong,
.history-item strong {
  display: block;
  margin-bottom: 4px;
}

.attachment-item span,
.history-item span {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.attachment-note {
  display: block;
  margin-top: 4px;
}

.file-type {
  min-width: 72px;
  background: rgba(15, 124, 120, 0.08);
  color: var(--teal-deep);
}

.consent-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(255, 249, 241, 0.9);
  border: 1px solid rgba(217, 142, 47, 0.12);
  color: var(--ink-soft);
}

.consent-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--amber), #f2b55c);
  box-shadow: 0 0 0 6px rgba(217, 142, 47, 0.12);
}

.result-status,
.history-badge {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(21, 51, 58, 0.08);
}

.result-status.warning,
.result-status.urgent,
.history-badge.urgent {
  background: rgba(217, 142, 47, 0.14);
  color: #8c5415;
}

.result-status.emergency,
.history-badge.emergency {
  background: rgba(181, 87, 87, 0.14);
  color: #8a3434;
}

.result-panel {
  min-height: 320px;
}

.result-banner {
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(21, 51, 58, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 237, 225, 0.88));
}

.result-banner.emergency {
  background: linear-gradient(180deg, rgba(255, 243, 243, 0.96), rgba(255, 232, 232, 0.88));
  border-color: rgba(181, 87, 87, 0.16);
}

.result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-card ul {
  padding-left: 18px;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.result-card.soft {
  background: linear-gradient(160deg, rgba(246, 242, 255, 0.4), rgba(255, 255, 255, 0.85));
}

.history-item {
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.history-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.history-item p,
.empty-state p {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.42;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(21, 51, 58, 0.16);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.46);
}

.empty-state.compact {
  min-height: 86px;
  text-align: left;
  place-items: start;
}

.visually-hidden {
  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: 1060px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }
}

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

  .topbar,
  .attachment-zone,
  .panel-heading,
  .history-topline {
    flex-direction: column;
  }

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

  .panel {
    padding: 16px;
  }

  .hero-copy {
    padding: 20px;
  }

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

  .panel-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-primary-button,
  .footer-button {
    width: 100%;
    min-width: 0;
  }

  .intro-video-shell {
    width: 100%;
  }

  .intro-audio-button {
    width: 100%;
    min-width: 0;
  }

  .hero h2 {
    max-width: 100%;
    font-size: clamp(1.55rem, 8vw, 2.2rem);
  }
}
