:root {
  --bg: #180b10;
  --bg-deep: #0e070b;
  --surface: rgba(255, 246, 239, 0.075);
  --surface-strong: rgba(255, 246, 239, 0.12);
  --ink: #fff8f3;
  --muted: #e9cfc2;
  --soft: #bf8a80;
  --accent: #ff355d;
  --accent-soft: #ff8aa1;
  --line: rgba(255, 210, 205, 0.62);
  --shadow: 0 28px 100px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 86, 119, 0.16), transparent 30rem),
    radial-gradient(circle at 82% 75%, rgba(255, 186, 163, 0.13), transparent 28rem),
    linear-gradient(135deg, var(--bg-deep), var(--bg) 52%, #221016);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  touch-action: manipulation;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  opacity: 0.36;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 46%, #000, transparent 72%);
}

.page {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: clamp(1rem, 4vw, 4rem);
}

.hero {
  position: relative;
  display: grid;
  width: min(94vw, 760px);
  place-items: center;
}

.halo {
  position: absolute;
  border: 1px solid rgba(255, 222, 215, 0.11);
  border-radius: 999px;
  pointer-events: none;
}

.halo-one {
  width: min(86vw, 650px);
  aspect-ratio: 1;
  animation: breathe 9s ease-in-out infinite;
}

.halo-two {
  width: min(70vw, 510px);
  aspect-ratio: 1;
  animation: breathe 9s ease-in-out -2.6s infinite;
}

.card {
  position: relative;
  display: grid;
  width: min(100%, 760px);
  justify-items: center;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1.4rem, 5vw, 4rem);
  overflow: hidden;
  text-align: center;
  border: 1px solid rgba(255, 229, 222, 0.15);
  border-radius: clamp(28px, 5vw, 52px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.045)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card::after {
  position: absolute;
  inset: 1px;
  content: "";
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.12), transparent 42%);
}

.eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 1rem;
  font-size: clamp(0.72rem, 2vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--accent-soft);
  text-transform: uppercase;
}

.line-art {
  position: relative;
  z-index: 1;
  width: min(76vw, 380px);
  margin: 0 auto;
  filter: drop-shadow(0 18px 42px rgba(255, 54, 93, 0.1));
}

.line-art svg {
  display: block;
  width: 100%;
  height: auto;
}

.line-art path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.parent-line {
  stroke: var(--line);
  stroke-width: 5.5;
}

.belly-line {
  stroke: rgba(255, 184, 177, 0.88);
  stroke-width: 6.5;
}

.heart-line {
  stroke: var(--accent-soft);
  stroke-width: 5;
  animation: heartPulse 2.9s ease-in-out infinite;
  transform-origin: 235px 242px;
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 14ch;
  margin: 0;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: clamp(2.35rem, 7.8vw, 5.6rem);
  font-weight: 500;
  letter-spacing: -0.07em;
  line-height: 0.9;
  text-wrap: balance;
}

.calculator-toggle {
  position: relative;
  z-index: 1;
  min-height: 48px;
  margin-top: clamp(1.25rem, 3vw, 1.9rem);
  padding: 0.82rem 1.25rem;
  color: var(--ink);
  font: inherit;
  font-size: clamp(0.92rem, 2.2vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 1px solid rgba(255, 229, 222, 0.24);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 93, 123, 0.22), rgba(255, 255, 255, 0.075));
  box-shadow:
    0 16px 38px rgba(255, 53, 93, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.calculator-toggle:hover,
.calculator-toggle:focus-visible {
  background: linear-gradient(180deg, rgba(255, 93, 123, 0.3), rgba(255, 255, 255, 0.105));
  border-color: rgba(255, 138, 161, 0.56);
  outline: none;
  transform: translateY(-1px);
}

.calculator-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 640px);
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 1.35rem);
  border: 1px solid rgba(255, 229, 222, 0.14);
  border-radius: 28px;
  background: rgba(14, 7, 11, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: panelIn 240ms ease both;
  user-select: text;
}

.calculator-note {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.calculator-form {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  text-align: left;
  border: 1px solid rgba(255, 229, 222, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
}

.calculator-form h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.72rem;
  color: var(--ink);
  font: inherit;
  border: 1px solid rgba(255, 229, 222, 0.16);
  border-radius: 15px;
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

input:focus {
  border-color: rgba(255, 138, 161, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 53, 93, 0.12);
}

.result {
  min-height: 3.25rem;
  padding: 0.75rem;
  color: #ffe7e0;
  font-weight: 760;
  line-height: 1.35;
  border-radius: 16px;
  background: rgba(255, 53, 93, 0.105);
}

.lead {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.8vw, 1.28rem);
  line-height: 1.65;
  text-wrap: pretty;
}

.hint {
  position: relative;
  z-index: 1;
  min-height: 48px;
  margin-top: 1.65rem;
  padding: 0.78rem 1.1rem;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: 1px solid rgba(255, 229, 222, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.hint:hover,
.hint:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 138, 161, 0.5);
  outline: none;
  transform: translateY(-1px);
}

.heart {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10;
  width: var(--size);
  height: var(--size);
  pointer-events: none;
  color: var(--heart-color, #ff315b);
  filter: drop-shadow(0 8px 12px rgba(255, 33, 76, 0.18));
  transform: translate(-50%, -50%) rotate(45deg);
  animation: fly var(--duration) cubic-bezier(0.12, 0.72, 0.2, 1) forwards;
}

.heart::before,
.heart::after,
.heart {
  background: currentColor;
}

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

.heart::before {
  left: -50%;
}

.heart::after {
  top: -50%;
}

@keyframes fly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35) rotate(45deg);
  }
  9% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--x)), calc(-50% + var(--y)))
      scale(var(--scale))
      rotate(calc(45deg + var(--rotate)));
  }
}

@keyframes breathe {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.985);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.035);
  }
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.055); }
}

@keyframes panelIn {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 520px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .page {
    padding: 0.75rem;
  }

  .card {
    min-height: min(86svh, 720px);
    align-content: center;
    padding-block: 1.6rem;
  }

  .line-art {
    width: min(80vw, 270px);
  }

  .fields {
    grid-template-columns: 1fr;
  }
}

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

  .heart {
    animation-duration: 900ms !important;
  }
}
