:root {
  --ink: #241c24;
  --muted: #6b5c66;
  --paper: #fff9f3;
  --cream: #fff1de;
  --rose: #ff6f91;
  --coral: #ff9671;
  --teal: #1d8a8a;
  --green: #5a9f5d;
  --blue: #4057c9;
  --shadow: 0 24px 70px rgba(58, 38, 52, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 111, 145, 0.2), transparent 28%),
    radial-gradient(circle at 82% 22%, rgba(29, 138, 138, 0.2), transparent 26%),
    linear-gradient(135deg, #fff9f3 0%, #f7fbff 48%, #fff0ea 100%);
  overflow: hidden;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.deck {
  min-height: 100vh;
  position: relative;
}

.page {
  align-items: center;
  display: none;
  inset: 0;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  padding: 32px;
  position: absolute;
}

.page.is-active {
  animation: pageIn 420ms ease both;
  display: flex;
}

.page-hero {
  background:
    linear-gradient(rgba(36, 28, 36, 0.18), rgba(36, 28, 36, 0.05)),
    linear-gradient(125deg, rgba(255, 111, 145, 0.24), transparent 40%),
    linear-gradient(235deg, rgba(29, 138, 138, 0.2), transparent 42%);
}

.hero-content,
.letter-panel {
  max-width: 820px;
  position: relative;
  text-align: center;
  z-index: 2;
}

.hero-content h1,
.page-header h2,
.letter-panel h2 {
  letter-spacing: 0;
  line-height: 1.02;
  margin: 0;
}

.hero-content h1 {
  font-size: clamp(2rem, 8vw, 6.8rem);
}

.hero-content h1 span {
  display: block;
  font-size: clamp(1.35rem, 3vw, 2.4rem);
  margin-top: 12px;
}

.page-header h2,
.letter-panel h2 {
  font-size: clamp(2.3rem, 6vw, 4.8rem);
}

.eyebrow {
  color: var(--teal);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 16px;
  text-transform: uppercase;
}

.subtitle {
  color: #453742;
  font-size: clamp(1.05rem, 2.3vw, 1.45rem);
  line-height: 1.65;
  margin: 24px auto 32px;
  max-width: 650px;
}

.primary-btn,
.ghost-btn {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-weight: 800;
  gap: 10px;
  justify-content: center;
  min-height: 48px;
  padding: 14px 22px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.primary-btn {
  background: var(--ink);
  box-shadow: 0 14px 30px rgba(36, 28, 36, 0.22);
  color: white;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: 1px solid rgba(36, 28, 36, 0.1);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-2px);
}

.code-rain {
  color: rgba(36, 28, 36, 0.18);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(0.85rem, 1.5vw, 1.1rem);
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.code-rain span {
  animation: drift 9s linear infinite;
  position: absolute;
  white-space: nowrap;
}

.code-rain span:nth-child(1) {
  left: 7%;
  top: 18%;
}

.code-rain span:nth-child(2) {
  animation-delay: -4s;
  right: 5%;
  top: 28%;
}

.code-rain span:nth-child(3) {
  animation-delay: -2s;
  bottom: 16%;
  left: 12%;
}

.code-rain span:nth-child(4) {
  animation-delay: -6s;
  bottom: 28%;
  right: 11%;
}

.page-photo,
.page-crying,
.page-quotes,
.page-more-gifs,
.page-roast,
.page-final-gif,
.page-video,
.page-cost-note,
.page-ego-note,
.page-last-image,
.page-tired {
  align-content: center;
  display: none;
  flex-direction: column;
  gap: 24px;
}

.page-quotes {
  align-items: center;
  height: 100vh;
  justify-content: flex-start;
  overflow-y: auto;
  padding-bottom: 28px;
  padding-top: 28px;
}

.page-quotes > * {
  flex-shrink: 0;
}

.page-quotes .page-header {
  max-width: min(100%, 1400px);
  width: 100%;
}

.page-quotes .page-header h2 {
  font-size: clamp(2.2rem, 5vw, 5.2rem);
  white-space: nowrap;
}

.page-photo.is-active,
.page-crying.is-active,
.page-quotes.is-active,
.page-more-gifs.is-active,
.page-roast.is-active,
.page-final-gif.is-active,
.page-video.is-active,
.page-cost-note.is-active,
.page-ego-note.is-active,
.page-last-image.is-active,
.page-tired.is-active,
.page-letter.is-active {
  display: flex;
}

.page-header {
  max-width: 820px;
  text-align: center;
}

.quote-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 1080px;
  width: 100%;
}

.quote-card,
.gif-card,
.photo-panel,
.crying-panel,
.roast-panel,
.cost-note-panel,
.ego-note-panel,
.letter-panel {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(36, 28, 36, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.quote-card {
  min-height: 150px;
  padding: 22px;
}

.quote-card p {
  color: #3f343c;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
}

.apology-message {
  color: #3c3039;
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  font-weight: 600;
  line-height: 1.6;
  max-width: 1320px;
  text-align: left;
  width: 100%;
}

.apology-message.quote-card {
  min-height: auto;
  overflow: visible;
  padding: clamp(18px, 2vw, 28px);
}

.apology-message p {
  margin: 0;
}

.apology-message p + p {
  margin-top: 10px;
}

.photo-panel {
  padding: clamp(16px, 3vw, 28px);
  text-align: center;
  width: min(100%, 780px);
}

.apology-photo {
  border-radius: 8px;
  display: block;
  margin: 0 auto;
  max-height: min(68vh, 640px);
  object-fit: contain;
  width: 100%;
}

.crying-panel {
  padding: clamp(18px, 4vw, 42px);
  width: min(100%, 980px);
}

.crying-content {
  align-items: center;
  display: grid;
  gap: clamp(18px, 4vw, 36px);
  grid-template-columns: minmax(220px, 360px) 1fr;
}

.crying-gif {
  border-radius: 8px;
  display: block;
  object-fit: cover;
  width: 100%;
}

.crying-copy {
  color: #3c3039;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 700;
  line-height: 1.65;
}

.crying-copy p {
  margin: 0;
}

.crying-copy p + p {
  margin-top: 18px;
}

.roast-panel {
  padding: clamp(18px, 4vw, 42px);
  text-align: center;
  width: min(100%, 760px);
}

.roast-image {
  border-radius: 8px;
  display: block;
  margin: 0 auto 22px;
  max-height: min(56vh, 520px);
  object-fit: contain;
  width: 100%;
}

.roast-line {
  color: #3c3039;
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 750;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 660px;
}

.final-gif {
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: block;
  max-height: min(72vh, 620px);
  object-fit: contain;
  width: min(100%, 720px);
}

.last-image {
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: block;
  max-height: min(74vh, 680px);
  object-fit: contain;
  width: min(100%, 720px);
}

.tired-heading {
  font-size: clamp(2rem, 6vw, 5.2rem);
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0;
  text-align: center;
}

.tired-gif {
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: block;
  max-height: min(62vh, 580px);
  object-fit: contain;
  width: min(100%, 720px);
}

.janvi-video {
  background: #241c24;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: block;
  max-height: min(72vh, 680px);
  width: min(100%, 920px);
}

.video-note {
  color: #3c3039;
  font-size: clamp(1rem, 2vw, 1.28rem);
  font-weight: 750;
  line-height: 1.5;
  margin: 0;
  max-width: 760px;
  text-align: center;
}

.cost-note-panel {
  color: #3c3039;
  font-size: clamp(1.05rem, 2.2vw, 1.38rem);
  font-weight: 750;
  line-height: 1.65;
  padding: clamp(24px, 5vw, 54px);
  text-align: left;
  width: min(100%, 860px);
}

.cost-note-panel p {
  margin: 0;
}

.cost-note-panel p + p {
  margin-top: 20px;
}

.ego-note-panel {
  color: #3c3039;
  font-size: clamp(1.05rem, 2.2vw, 1.38rem);
  font-weight: 750;
  line-height: 1.65;
  padding: clamp(24px, 5vw, 54px);
  text-align: left;
  width: min(100%, 860px);
}

.ego-note-panel ul {
  margin: 0;
  padding-left: 24px;
}

.ego-note-panel li + li {
  margin-top: 14px;
}

.ego-note-panel p {
  margin: 0;
}

.ego-note-panel p + p {
  margin-top: 18px;
}

.bold-ending {
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 900;
  line-height: 1.25;
  margin: 28px 0 0;
  text-align: center;
}

.gif-row {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 1080px;
  width: 100%;
}

.gif-card {
  margin: 0;
  overflow: hidden;
}

.gif-image {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #ffffff 0%, #fff0ea 100%);
  display: block;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.bonus-gifs {
  max-width: 980px;
}

.featured-gif .gif-image {
  aspect-ratio: 1 / 1;
}

.page-quotes .gif-card {
  align-self: start;
}

.page-quotes .gif-image {
  aspect-ratio: auto;
  max-height: 270px;
  object-fit: contain;
}

.gif-stage {
  align-items: center;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #ffffff 0%, #fff0ea 100%);
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.gif-card figcaption {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 14px 16px 16px;
}

.cup {
  background: var(--teal);
  border-radius: 0 0 24px 24px;
  height: 54px;
  position: relative;
  width: 86px;
}

.cup::after {
  border: 10px solid var(--teal);
  border-left: 0;
  border-radius: 0 22px 22px 0;
  content: "";
  height: 30px;
  position: absolute;
  right: -24px;
  top: 9px;
  width: 22px;
}

.steam {
  animation: steam 1.7s ease-in-out infinite;
  background: rgba(36, 28, 36, 0.15);
  border-radius: 999px;
  height: 48px;
  position: absolute;
  top: 32px;
  width: 8px;
}

.steam-one {
  left: calc(50% - 18px);
}

.steam-two {
  animation-delay: 0.45s;
  left: calc(50% + 16px);
}

.tiny-sign,
.patch-label,
.sorry-bubble {
  background: var(--rose);
  border-radius: 999px;
  color: white;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 8px 11px;
  position: absolute;
}

.tiny-sign {
  animation: wobble 1.6s ease-in-out infinite;
  right: 22%;
  top: 24%;
}

.bug {
  animation: bugRun 2.2s ease-in-out infinite;
  align-items: center;
  background: var(--coral);
  border-radius: 50%;
  color: white;
  display: flex;
  font-size: 2rem;
  font-weight: 800;
  height: 62px;
  justify-content: center;
  width: 62px;
}

.debug-line {
  background: rgba(36, 28, 36, 0.14);
  border-radius: 999px;
  bottom: 35%;
  height: 8px;
  left: 16%;
  position: absolute;
  right: 16%;
}

.patch-label {
  animation: stamp 2.2s ease-in-out infinite;
  background: var(--green);
  bottom: 20%;
  right: 20%;
}

.heart {
  animation: floatHeart 2s ease-in-out infinite;
  background: var(--rose);
  height: 34px;
  position: absolute;
  transform: rotate(-45deg);
  width: 34px;
}

.heart::before,
.heart::after {
  background: inherit;
  border-radius: 50%;
  content: "";
  height: 34px;
  position: absolute;
  width: 34px;
}

.heart::before {
  left: 0;
  top: -17px;
}

.heart::after {
  left: 17px;
  top: 0;
}

.heart-a {
  left: 28%;
  top: 46%;
}

.heart-b {
  animation-delay: 0.3s;
  background: var(--teal);
  left: 48%;
  top: 30%;
}

.heart-c {
  animation-delay: 0.6s;
  background: var(--coral);
  right: 24%;
  top: 50%;
}

.sorry-bubble {
  animation: wobble 1.4s ease-in-out infinite;
  background: var(--blue);
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
}

.page-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.page-letter {
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  justify-content: flex-start;
  overflow-y: auto;
  padding-bottom: 28px;
  padding-top: 28px;
}

.page-letter > * {
  flex-shrink: 0;
}

.page-letter .page-actions {
  bottom: 0;
  padding: 8px 0;
  position: sticky;
  z-index: 3;
}

.letter-panel {
  padding: clamp(26px, 5vw, 58px);
}

.sorry-line {
  color: #3c3039;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.35;
  margin: 24px auto 14px;
  max-width: 720px;
}

.placeholder {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 auto 24px;
  max-width: 560px;
}

.main-points {
  color: #3c3039;
  font-size: clamp(0.98rem, 1.8vw, 1.18rem);
  font-weight: 650;
  line-height: 1.65;
  margin: 26px auto 0;
  max-width: 760px;
  padding-left: 24px;
  text-align: left;
}

.main-points li + li {
  margin-top: 12px;
}

.code-note {
  background: #241c24;
  border-radius: 8px;
  color: #fff1de;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(0.82rem, 1.8vw, 1rem);
  line-height: 1.65;
  margin: 0 auto;
  max-width: 520px;
  overflow-x: auto;
  padding: 18px;
  text-align: left;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(22px);
  }
}

@keyframes steam {
  0% {
    opacity: 0;
    transform: translateY(16px) scaleY(0.6);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-28px) scaleY(1.25);
  }
}

@keyframes wobble {
  0%,
  100% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(5deg);
  }
}

@keyframes bugRun {
  0%,
  100% {
    transform: translateX(-58px) rotate(-8deg);
  }
  50% {
    transform: translateX(58px) rotate(8deg);
  }
}

@keyframes stamp {
  0%,
  42% {
    opacity: 0;
    transform: scale(1.5) rotate(-10deg);
  }
  55%,
  100% {
    opacity: 1;
    transform: scale(1) rotate(-10deg);
  }
}

@keyframes floatHeart {
  0%,
  100% {
    transform: translateY(8px) rotate(-45deg) scale(0.9);
  }
  50% {
    transform: translateY(-12px) rotate(-45deg) scale(1.05);
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .page {
    min-height: 100svh;
    overflow-y: auto;
    padding: 24px 16px;
  }

  .quote-grid,
  .gif-row {
    grid-template-columns: 1fr;
  }

  .crying-content {
    grid-template-columns: 1fr;
  }

  .crying-gif {
    margin: 0 auto;
    max-width: 340px;
  }

  .quote-card {
    min-height: 0;
  }

  .page-actions {
    position: sticky;
    bottom: 14px;
  }
}

@media (max-width: 460px) {
  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .page-actions {
    width: 100%;
  }

  .code-rain {
    display: none;
  }
}
