:root {
  --ink: #243028;
  --ink-soft: #44554c;
  --muted: #6a7a71;
  --paper: #f5f6f4;
  --surface: #ffffff;
  --line: #d8ded9;
  --accent: #3a5f4c;
  --accent-soft: #e8efe9;
  --danger: #8a3b2b;
  --nav-h: 4rem;
  --radius: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

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

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

button,
a.btn {
  font: inherit;
}

.app-shell {
  width: min(560px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #f8f9f7 0%, var(--paper) 40%);
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.35rem calc(var(--nav-h) + 1.5rem);
  min-height: 0;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  gap: 1.25rem;
  animation: rise 320ms ease both;
}

.screen--active {
  display: flex;
}

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

.brand,
.screen-kicker {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.landing {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  gap: 2rem;
  padding-bottom: 1rem;
}

/* Proximity: headline + support read as one message block */
.landing__copy {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 18rem;
}

.affordance {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 6.5vw, 2.45rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.landing__support {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 32ch;
}

.landing__actions,
.fact__actions,
.interests__actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.75rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.btn--primary {
  background: var(--accent);
  color: #f7faf8;
  font-weight: 600;
}

.btn--primary:hover {
  background: #2f4e3f;
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-soft);
  font-weight: 500;
}

.btn--secondary:hover {
  border-color: #b9c5bc;
  color: var(--ink);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* Common region: fact content stays visually one unit */
.fact {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.15rem;
  flex: 1;
}

.fact__status {
  margin: 0 0 0.75rem;
  color: var(--danger);
  font-size: 0.95rem;
}

.fact__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4.2vw, 1.7rem);
  font-weight: 600;
  line-height: 1.25;
}

.fact__body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.65;
}

.fact__source {
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

/* Proximity: Read more + Next fact sit together under the fact */
.fact__actions {
  margin-top: 0.15rem;
}

.interests__copy {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.interests__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 4.5vw, 1.85rem);
  font-weight: 600;
  line-height: 1.2;
}

.interests__support {
  margin: 0;
  color: var(--muted);
  max-width: 36ch;
}

/* Similarity + proximity: topic chips as one choice set */
.topic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.topic {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.topic:hover {
  border-color: #b9c5bc;
}

.topic--selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.interests__actions {
  margin-top: auto;
}

/* Common region: screen navigation only lives here */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 0.5rem env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
  background: rgba(245, 246, 244, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.nav-item {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.35rem;
}

.nav-item:hover {
  color: var(--ink-soft);
}

.nav-item.is-active {
  color: var(--accent);
  font-weight: 600;
}

.nav-item__label {
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
}

.nav-item.is-active .nav-item__label {
  background: var(--accent-soft);
}

@media (min-width: 560px) {
  .fact__actions {
    flex-direction: row;
  }

  .fact__actions .btn {
    flex: 1;
  }
}
