:root {
  --pink: #ff5fa8;
  --pink-soft: #ffd2e8;
  --ink: #6a2d4c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

body { background: #ff5555; }

.app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: #ff5555;
}

.panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.panel.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.panel-1 {
  background: #ff5555;
}

.panel-0 {
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 210, 232, 0.45), rgba(255, 210, 232, 0) 36%),
    radial-gradient(circle at 90% 86%, rgba(255, 191, 220, 0.4), rgba(255, 191, 220, 0) 42%),
    linear-gradient(180deg, #fff7fc 0%, #ffe8f4 100%);
}

.gate-card {
  width: min(92vw, 390px);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 34px rgba(224, 83, 152, 0.18);
  padding: 20px 16px 18px;
}

.gate-title {
  text-align: center;
  color: #ef4d99;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 14px;
}

.gate-label {
  display: block;
  color: #ca4f88;
  font-size: 14px;
  margin: 10px 4px 6px;
}

.gate-input {
  width: 100%;
  border: 1px solid #ffc3df;
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  color: #8c3761;
  background: #fffafd;
  outline: none;
}

.gate-input:focus {
  border-color: #ff7ab7;
  box-shadow: 0 0 0 3px rgba(255, 122, 183, 0.14);
}

.gate-error {
  min-height: 20px;
  margin-top: 8px;
  color: #ea3f7f;
  font-size: 13px;
  text-align: center;
}

.gate-btn {
  width: 100%;
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(160deg, #ff83bc 0%, #ff5fa8 55%, #ff4f94 100%);
  box-shadow: 0 8px 20px rgba(224, 72, 140, 0.35);
}

.heart-stage {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  height: auto;
  background: #ff5555;
}

.heart-stage canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  background: #ff5555;
}

.cute-btn,
.fresh-btn {
  position: absolute;
  bottom: 9%;
  left: 50%;
  transform: translateX(-50%);
  border: none;
  cursor: pointer;
}

.cute-btn {
  padding: 12px 36px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(160deg, #ff6868 0%, #ff5555 60%, #ff4f73 100%);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow:
    0 8px 18px rgba(197, 58, 92, 0.35),
    0 0 18px rgba(255, 255, 255, 0.78),
    0 0 34px rgba(255, 175, 203, 0.64);
  z-index: 10;
  animation: btnPulse 1.2s ease-in-out infinite;
}

.cute-btn::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.95);
  opacity: 0.92;
  animation: btnRing 1.2s ease-out infinite;
}

.cute-btn::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 4px;
  height: 38%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.04));
  pointer-events: none;
}

.cute-btn:active {
  transform: translateX(-50%) scale(0.98);
}

.panel-2 {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 216, 236, 0.75), rgba(255, 216, 236, 0) 42%),
    radial-gradient(circle at 85% 80%, rgba(255, 194, 225, 0.55), rgba(255, 194, 225, 0) 48%),
    linear-gradient(180deg, #fff8fc 0%, #ffeef7 100%);
}

.ekg-stage {
  width: min(90vw, 340px);
  margin-top: -34px;
}

.ekg {
  width: 100%;
}

#ekgTrack {
  fill: none;
  stroke: rgba(255, 105, 178, 0.26);
  stroke-width: 4;
}

#ekgPath {
  fill: none;
  stroke: #ff4ea2;
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(255, 97, 172, 0.95));
  stroke-dasharray: 760;
  stroke-dashoffset: 760;
  animation: ekgRun 3.1s linear infinite;
}

#ekgDot {
  fill: #ff4ca3;
  filter: drop-shadow(0 0 5px rgba(255, 76, 163, 1)) drop-shadow(0 0 14px rgba(255, 165, 216, 1));
}

.line {
  color: #ff4ea2;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 0 8px rgba(255, 199, 226, 0.7);
}

.particle-line {
  width: min(94vw, 380px);
  position: relative;
}

.particle-line canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0 6px rgba(255, 170, 218, 0.75));
}

.line-1 {
  margin-top: 2px;
  height: 56px;
}

.line-2 {
  height: 48px;
}

.fresh-btn {
  bottom: 8%;
  padding: 11px 40px;
  border-radius: 14px;
  color: #ff3f96;
  font-size: 18px;
  font-weight: 700;
  border: 1px solid #ffc5e3;
  background: linear-gradient(180deg, #fff9fd 0%, #ffdced 100%);
  box-shadow: 0 10px 20px rgba(255, 120, 186, 0.34);
}

.fresh-btn.is-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(-50%) translateY(10px) !important;
  animation: none !important;
}

.panel-3 {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  background: linear-gradient(180deg, #ffd3e8 0%, #ffc4df 40%, #fff 40%, #fff 100%);
  padding-top: 0;
}

.people-stage {
  width: 100%;
  flex: 0 0 40%;
  height: 40%;
  display: flex;
  align-items: flex-end;
  justify-content: space-evenly;
  z-index: 1;
  position: relative;
  padding: 0;
}

.avatar {
  width: clamp(164px, 45vw, 215px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(255, 103, 176, 0.2));
  position: relative;
  z-index: 2;
}

.avatar.left {
  position: absolute;
  left: 0;
  bottom: 0;
  top: auto;
  transform: translateY(0);
}

.avatar.right {
  position: absolute;
  right: 0;
  bottom: 0;
  top: auto;
  transform: translateY(0);
}

.tiny-heart-stage {
  width: clamp(280px, 72vw, 480px);
  height: clamp(280px, 72vw, 480px);
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 220, 240, 0.55), rgba(255, 220, 240, 0) 70%);
  filter: drop-shadow(0 0 18px rgba(120, 255, 238, 0.55));
  overflow: hidden;
}

.tiny-heart-stage.is-bg {
  position: absolute;
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 0;
  opacity: 0.72;
  pointer-events: none;
}

.tiny-heart-stage canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  filter:
    drop-shadow(0 0 10px rgba(124, 255, 239, 0.55))
    drop-shadow(0 0 22px rgba(255, 95, 214, 0.35));
}

.time-stage {
  width: 100%;
  margin-top: 0;
  z-index: 1;
  text-align: center;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 24px 36px 24px;
  box-shadow: 0 -2px 16px rgba(255, 130, 187, 0.12);
  flex: 0 0 60%;
  height: 60%;
}

.time-title {
  color: #f34f9d;
  font-size: 24px;
  font-weight: 700;
}

.time-value {
  margin-top: 10px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.35;
}

.flip-countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.flip-unit {
  border-radius: 12px;
  background: linear-gradient(180deg, #fff4fa 0%, #ffddeb 100%);
  border: 1px solid #ffc4df;
  padding: 8px 4px 7px;
  box-shadow: 0 8px 14px rgba(240, 106, 168, 0.16);
}

.flip-num {
  display: block;
  font-size: 31px;
  line-height: 1;
  color: #ef4d99;
  font-weight: 800;
  transform-origin: 50% 50%;
}

.flip-num.flip {
  animation: flipTick 0.45s ease;
}

.flip-label {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #b85a87;
}

.special-dates {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.special-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #fff8fc 0%, #ffeef6 100%);
  border: 1px solid #ffd2e7;
}

.special-label {
  color: #ba5886;
  font-size: 13px;
}

.special-value {
  color: #ef4d99;
  font-size: 16px;
  font-weight: 700;
}

.fade-in-up {
  opacity: 0;
  animation: fadeInUp 0.95s ease forwards;
}

.delay {
  animation-delay: 0.45s;
}

@keyframes heroBeat {
  0%,
  100% {
    transform: rotate(-45deg) scale(1);
  }
  25% {
    transform: rotate(-45deg) scale(1.1);
  }
  45% {
    transform: rotate(-45deg) scale(1.03);
  }
  68% {
    transform: rotate(-45deg) scale(1.14);
  }
}

@keyframes ringSpread {
  0% {
    transform: scale(0.72);
    opacity: 0.86;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes glowBreath {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes btnPulse {
  0%,
  100% {
    box-shadow:
      0 8px 18px rgba(197, 58, 92, 0.32),
      0 0 16px rgba(255, 255, 255, 0.76),
      0 0 30px rgba(255, 176, 203, 0.58);
    transform: translateX(-50%) scale(1);
  }
  30% {
    box-shadow:
      0 10px 22px rgba(197, 58, 92, 0.42),
      0 0 24px rgba(255, 255, 255, 0.96),
      0 0 40px rgba(255, 214, 229, 0.88);
    transform: translateX(-50%) scale(1.06);
  }
  55% {
    box-shadow:
      0 8px 18px rgba(197, 58, 92, 0.34),
      0 0 16px rgba(255, 255, 255, 0.74),
      0 0 30px rgba(255, 176, 203, 0.58);
    transform: translateX(-50%) scale(1.01);
  }
  75% {
    box-shadow:
      0 11px 24px rgba(197, 58, 92, 0.44),
      0 0 25px rgba(255, 255, 255, 0.94),
      0 0 38px rgba(255, 214, 229, 0.86);
    transform: translateX(-50%) scale(1.05);
  }
}

@keyframes btnRing {
  0% {
    transform: scale(0.92);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.1);
    opacity: 0;
  }
}

@keyframes ekgRun {
  from {
    stroke-dashoffset: 760;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes flipTick {
  0% { transform: rotateX(0deg); opacity: 1; }
  45% { transform: rotateX(-85deg); opacity: 0.5; }
  100% { transform: rotateX(0deg); opacity: 1; }
}

@keyframes tinyPulse {
  0%,
  100% {
    transform: rotate(-45deg) scale(1);
  }
  50% {
    transform: rotate(-45deg) scale(1.2);
  }
}

@keyframes tinyRing {
  from {
    transform: scale(0.5);
    opacity: 0.9;
  }
  to {
    transform: scale(1.4);
    opacity: 0;
  }
}

@media (max-width: 370px) {
  .line-1 {
    font-size: 18px;
  }
  .line-2 {
    font-size: 17px;
  }
  .time-value {
    font-size: 20px;
  }
}
