@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=IBM+Plex+Mono:wght@500&display=swap");

:root {
  --bg: #f8f8f8;
  --bg-soft: #ededed;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-solid: #ffffff;
  --text: #111111;
  --muted: #5f5f5f;
  --line: #dedede;
  --line-strong: #bdbdbd;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at 12% 18%, #ffffff, transparent 32%),
    radial-gradient(circle at 82% 82%, #e4e4e4, transparent 36%),
    linear-gradient(160deg, var(--bg), var(--bg-soft));
  position: relative;
  -webkit-text-size-adjust: 100%;
}

html {
  touch-action: manipulation;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 16px 46px;
  position: relative;
  z-index: 1;
}

.hero {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

h1 {
  margin: 10px 0;
  font-size: clamp(2.1rem, 5.8vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.hero-title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
}

.hero-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  text-decoration: none;
  transform: translateY(0.12em);
}

.hero-logo img {
  width: 1em;
  height: 1em;
  display: block;
}

.subtitle {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.06rem;
}

.chat-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  background: var(--surface);
}

.form {
  display: grid;
  gap: 10px;
}

.input-actions {
  display: block;
}

label {
  font-weight: 700;
  font-size: 1.05rem;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px;
  font: inherit;
  min-height: 120px;
  background: var(--surface-solid);
  color: var(--text);
}

textarea:focus {
  outline: none;
  border-color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

button {
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  border: 1px solid #111111;
  background: #111111;
  color: #ffffff;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

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

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

#submit-btn {
  white-space: nowrap;
}

.ghost-btn,
.branch-btn {
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: #111111;
  padding: 8px 13px;
  font-size: 0.9rem;
  font-weight: 600;
}

.ghost-btn:hover,
.branch-btn:hover {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.chat-window {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.chat-window-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.action-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.random-btn {
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: #111111;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.random-btn:hover {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.mode-tab {
  border: 1px solid transparent;
  background: transparent;
  color: #111111;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.mode-tab:hover {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
  transform: none;
}

.mode-tab.is-active {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.mode-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}

.mode-tab:disabled {
  opacity: 0.5;
  cursor: wait;
}

.provider-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.provider-pill {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: #f4f4f4;
  color: #6a6a6a;
  white-space: nowrap;
  opacity: 0.8;
}

.messages {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.message {
  border-radius: 15px;
  padding: 11px 12px;
  border: 1px solid var(--line);
}

.message.user {
  background: #f1f1f1;
}

.message.assistant {
  background: #ffffff;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 7px;
  color: var(--muted);
}

.body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.section-title {
  margin: 12px 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.year-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.year-item {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  align-items: start;
}

.year-badge {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #f5f5f5;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  padding: 5px 8px;
  color: #161616;
  font-family: "IBM Plex Mono", monospace;
}

.year-content {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 12px;
  padding: 8px 10px;
}

.year-title {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 700;
}

.year-details {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #262626;
}

.branch-box {
  margin-top: 8px;
}

.branch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.branch-btn:disabled {
  opacity: 0.55;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.image-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.image-card img {
  width: 100%;
  height: 176px;
  object-fit: cover;
  display: block;
  filter: grayscale(100%) contrast(1.06);
}

.image-caption {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.77rem;
  color: var(--muted);
  line-height: 1.35;
}

.share-card {
  margin: 12px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.share-card-frame {
  width: min(100%, 360px);
  aspect-ratio: 9 / 16;
  border-radius: 22px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 34px;
  padding-bottom: 28px;
  color: #f7f7f7;
  background:
    radial-gradient(circle at 20% 12%, rgba(124, 225, 217, 0.22), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(87, 208, 198, 0.18), transparent 40%),
    linear-gradient(160deg, #0a0a0a, #121212);
  border: 1px solid rgba(124, 225, 217, 0.3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.share-card-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.5;
  pointer-events: none;
}

.share-card-eyebrow {
  margin: 28px 0 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: #7ce1d9;
  position: relative;
  z-index: 1;
}

.share-card-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.share-card-subtitle {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.35;
  position: relative;
  z-index: 1;
}

.share-card-list {
  display: grid;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.share-card-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(10, 10, 10, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.share-card-year {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #7ce1d9;
}

.share-card-text {
  font-size: 0.82rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.86);
}

.share-card-footer {
  margin-top: auto;
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.share-card-tag {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #7ce1d9;
  color: #061413;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  box-shadow:
    0 6px 20px rgba(124, 225, 217, 0.35);
}

.share-card-domain {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 0 14px rgba(124, 225, 217, 0.55);
}

.share-card-cta {
  display: block;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.share-card-download {
  border-radius: 999px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 700;
  border: 1px solid rgba(124, 225, 217, 0.6);
  background: rgba(10, 10, 10, 0.55);
  color: #f7f7f7;
  cursor: pointer;
  font-size: 0.8rem;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.share-card-download:hover {
  background: #7ce1d9;
  color: #061413;
  border-color: #7ce1d9;
}

.history-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  background: var(--surface);
}

.donate-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px 18px 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(234, 248, 246, 0.95));
  display: grid;
  gap: 14px;
}

.donate-eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: #1d6f6a;
}

.donate-card h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.donate-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 520px;
}

.donate-list {
  margin: 0;
  padding-left: 18px;
  color: #203a39;
  font-size: 0.95rem;
  display: grid;
  gap: 6px;
}

.donate-note + .donate-list {
  margin-top: 10px;
}

.donate-list li::marker {
  color: #1d6f6a;
}

.donate-list + .donate-note {
  margin-top: 10px;
}

.donate-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  border: 1px solid #111111;
  background: #111111;
  color: #ffffff;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
  width: fit-content;
}

.donate-cta:hover {
  transform: translateY(-1px);
  background: #7ce1d9;
  color: #061413;
  border-color: #7ce1d9;
}

.history-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.history-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #ffffff;
}

.history-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.history-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.history-preview {
  margin: 8px 0;
  color: #2a2a2a;
  font-size: 0.93rem;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-empty {
  margin: 0;
  color: var(--muted);
}

.note {
  margin: 14px 2px 0;
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 760px) {
  .page {
    padding: 20px 12px 34px;
  }

  .chat-card,
  .donate-card,
  .history-card {
    padding: 14px;
  }

  .action-group {
    width: 100%;
    flex-direction: column;
    align-items: center;
  }

  .mode-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    justify-items: stretch;
  }

  .mode-tab {
    width: 100%;
    text-align: center;
    white-space: normal;
    line-height: 1.15;
  }

  .random-btn {
    width: 100%;
    max-width: 320px;
  }

  textarea,
  button,
  .mode-tab,
  .random-btn,
  #submit-btn {
    font-size: 16px;
  }

  #submit-btn {
    width: 100%;
  }

  .history-actions .ghost-btn,
  .history-head .ghost-btn,
  .branch-btn {
    width: 100%;
  }

  .year-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .share-card-frame {
    padding: 18px 16px 20px;
    gap: 8px;
  }

  .share-card-eyebrow {
    margin: 22px 0 0;
    font-size: 0.68rem;
  }

  .share-card-title {
    font-size: 1.18rem;
  }

  .share-card-subtitle {
    font-size: 0.84rem;
  }

  .share-card-list {
    gap: 5px;
  }

  .share-card-item {
    padding: 6px 8px;
    gap: 8px;
  }

  .share-card-year {
    font-size: 0.74rem;
  }

  .share-card-text {
    font-size: 0.78rem;
  }
}
