:root {
  --ink: #fff8f5;
  --line: rgba(255, 255, 255, 0.13);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: #040405;
}

body {
  margin: 0;
  overflow: hidden;
  background: #040405;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, canvas { -webkit-tap-highlight-color: transparent; }

.page-shell {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 53%, rgba(132, 8, 29, 0.18), transparent 46%),
    linear-gradient(145deg, #020203, #090608 52%, #030303);
}

.ambient {
  position: absolute;
  z-index: -1;
  width: 46rem;
  height: 46rem;
  border-radius: 999px;
  filter: blur(150px);
  opacity: 0.14;
  background: #b70d2b;
}

.ambient-one { top: -34rem; right: -24rem; }
.ambient-two { bottom: -35rem; left: -23rem; }

.love-card {
  position: relative;
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
  text-align: center;
}

.intro {
  position: absolute;
  z-index: 4;
  top: clamp(24px, 4.5vh, 54px);
  left: 50%;
  width: min(94vw, 760px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-shadow: 0 3px 24px #000;
}

.eyebrow {
  margin: 0 0 10px;
  color: #df8d9b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

h1 {
  max-width: 700px;
  margin: 0;
  color: #fffaf8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 4.5vw, 3rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.equation {
  margin-top: clamp(14px, 2.4vh, 25px);
  padding: 10px 21px 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(4, 4, 5, 0.68);
  backdrop-filter: blur(8px);
  color: #ddd4d4;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.95rem, 3vw, 1.3rem);
  letter-spacing: 0.035em;
  box-shadow: 0 7px 30px rgba(0, 0, 0, 0.4);
}

.equation sup { font-size: 0.6em; }

.graph {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: clamp(34px, 5vmin, 62px) clamp(34px, 5vmin, 62px);
  mask-image: radial-gradient(circle at center, black 0, rgba(0, 0, 0, 0.88) 44%, transparent 78%);
}

.axis {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  background: var(--line);
}

.axis-x { top: 54%; left: 3%; width: 94%; height: 1px; }
.axis-y { top: 15%; left: 50%; width: 1px; height: 78%; }

.heart-stage {
  position: absolute;
  z-index: 2;
  top: 54%;
  left: 50%;
  width: min(104vmin, 940px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.heart-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  filter:
    drop-shadow(0 0 7px rgba(255, 40, 0, 0.88))
    drop-shadow(0 0 36px rgba(255, 40, 0, 0.38));
}

.message {
  position: absolute;
  z-index: 5;
  top: 55%;
  left: 50%;
  width: min(82vw, 520px);
  padding: 18px 22px 20px;
  transform: translate(-50%, -43%);
  opacity: 0;
  text-shadow: 0 2px 16px rgba(63, 0, 10, 0.95);
  transition: opacity 1.3s ease, transform 1.3s ease;
  pointer-events: none;
}

.message.is-visible { opacity: 1; transform: translate(-50%, -50%); }

.message p {
  margin: 3px 0;
  color: #fff8f6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 4.2vw, 2rem);
  line-height: 1.38;
}

.message .name {
  margin-bottom: 10px;
  font-size: clamp(1.42rem, 4.8vw, 2.35rem);
}

.message .signature {
  margin-top: 14px;
  color: #ffd3d9;
  font-style: italic;
}

.controls {
  position: absolute;
  z-index: 6;
  bottom: clamp(18px, 3.5vh, 38px);
  left: 50%;
  transform: translateX(-50%);
}

.controls button {
  appearance: none;
  white-space: nowrap;
  border: 1px solid rgba(255, 145, 161, 0.42);
  border-radius: 999px;
  padding: 10px 18px;
  background: rgba(25, 2, 6, 0.62);
  backdrop-filter: blur(8px);
  color: #f0bdc5;
  font: 0.78rem/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.controls button:hover:not(:disabled),
.controls button:focus-visible {
  border-color: rgba(255, 145, 161, 0.82);
  background: rgba(92, 5, 20, 0.62);
  color: #fff7f8;
  outline: none;
}

.controls button:disabled { cursor: default; opacity: 0.62; }

@media (max-width: 560px) {
  .intro { top: 24px; }
  .heart-stage { top: 55%; width: 118vmin; }
  .axis-x { top: 55%; }
  .message { top: 55%; width: 88vw; }
}

@media (min-width: 800px) and (min-aspect-ratio: 4/3) {
  .heart-stage { top: 62%; width: min(70vmin, 720px); }
  .axis-x, .message { top: 62%; }
}

@media (max-height: 700px) {
  .intro { top: 18px; }
  .eyebrow { margin-bottom: 6px; }
  .equation { margin-top: 10px; }
  .heart-stage { top: 57%; width: min(92vmin, 760px); }
  .axis-x { top: 57%; }
  .message { top: 58%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
