:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f1e7;
  color: #141414;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(246, 241, 231, 0.75)),
    #f6f1e7;
}

.app-shell {
  width: min(900px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  font-weight: 800;
  color: #171717;
}

.home-link {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #050505;
  color: #d6a741;
  text-decoration: none;
  font-size: 34px;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.generate-button,
.nav-button {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.generate-button {
  min-height: 68px;
  border-radius: 8px;
  background: #151515;
  color: #f6d58a;
  font-size: clamp(1.25rem, 3vw, 2rem);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
}

.generate-button:hover:not(:disabled),
.nav-button:hover:not(:disabled),
.home-link:hover {
  transform: translateY(-1px);
}

.generate-button:disabled,
.nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status-text {
  min-height: 24px;
  margin: 0;
  color: #6b5f4a;
  font-weight: 700;
}

.date-nav {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  align-items: center;
  gap: 12px;
}

.nav-button {
  min-height: 48px;
  border-radius: 8px;
  background: #ffffff;
  color: #151515;
  border: 2px solid #151515;
}

.date-label {
  text-align: center;
  font-weight: 900;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
}

.empty-date-hint {
  min-height: 20px;
  text-align: center;
  color: #816f52;
  font-size: 0.95rem;
}

.fact-card {
  min-height: 330px;
  border-radius: 8px;
  padding: clamp(24px, 5vw, 48px);
  background: #ffffff;
  border: 2px solid rgba(21, 21, 21, 0.12);
  box-shadow: 0 20px 48px rgba(34, 25, 12, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.fact-card.is-empty {
  background: rgba(255, 255, 255, 0.62);
  border-style: dashed;
}

.category-label {
  align-self: flex-start;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #151515;
  color: #f6d58a;
  font-weight: 900;
  font-size: 0.9rem;
}

.category-label:empty {
  display: none;
}

h2 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 3rem);
  line-height: 1.05;
}

#factText {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  line-height: 1.55;
}

.source-link {
  color: #6d4b00;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.source-link:empty {
  display: none;
}

.footer-note {
  margin-top: auto;
  color: #6b5f4a;
  font-size: 0.95rem;
  text-align: center;
}

@media (max-width: 640px) {
  .date-nav {
    grid-template-columns: 1fr 1fr;
  }

  .date-nav > div {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .nav-button {
    grid-row: 2;
  }
}
