:root {
  --cream: #fff4df;
  --cream-deep: #f4dcb6;
  --brown: #7d4f31;
  --brown-dark: #5a3925;
  --orange: #f2a65a;
  --tea: #b86a36;
  --shadow: rgba(80, 45, 24, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--brown-dark);
  background:
    radial-gradient(70rem 50rem at 12% -8%, #ffdca2 0%, transparent 50%),
    radial-gradient(60rem 40rem at 90% 112%, #f8be7d 0%, transparent 40%),
    linear-gradient(160deg, #fffbf2 0%, var(--cream) 45%, #ffe6c6 100%);
}

.scene {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow: hidden;
}

.glow {
  position: absolute;
  width: min(70vw, 32rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 66%);
  filter: blur(2px);
  animation: pulse 4.5s ease-in-out infinite;
}

.card {
  width: min(92vw, 30rem);
  text-align: center;
  padding: clamp(1rem, 2.8vw, 1.8rem);
  border-radius: 1.2rem;
  background: rgba(255, 248, 235, 0.78);
  backdrop-filter: blur(4px);
  box-shadow: 0 14px 35px var(--shadow);
  position: relative;
  z-index: 2;
}

.landing {
  width: min(92vw, 30rem);
  text-align: center;
  padding: clamp(1rem, 2.8vw, 1.8rem);
  border-radius: 1.2rem;
  background: rgba(255, 248, 235, 0.86);
  backdrop-filter: blur(4px);
  box-shadow: 0 14px 35px var(--shadow);
  position: relative;
  z-index: 3;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.hidden {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
}

.card {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.name-form {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.name-form input {
  width: 100%;
  border: 2px solid #e4bc8e;
  border-radius: 999px;
  padding: 0.72rem 1rem;
  font-size: 1rem;
  font-family: "Nunito", sans-serif;
  color: var(--brown-dark);
  background: rgba(255, 255, 255, 0.92);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.name-form input:focus {
  border-color: #d89253;
  box-shadow: 0 0 0 3px rgba(216, 146, 83, 0.2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

h1 {
  margin: 0;
  font-family: "Baloo 2", cursive;
  font-size: clamp(1.7rem, 6vw, 2.3rem);
  color: var(--brown);
}

.subtitle {
  margin: 0.2rem 0 1.1rem;
  color: #946447;
  font-weight: 600;
  font-size: clamp(0.9rem, 3.7vw, 1rem);
}

.cup-wrap {
  position: relative;
  width: clamp(11rem, 52vw, 14.5rem);
  margin: 0 auto 1.2rem;
  height: clamp(10rem, 44vw, 12.5rem);
}

.cup {
  position: absolute;
  left: 50%;
  bottom: 1.7rem;
  transform: translateX(-50%);
  width: 70%;
  height: 56%;
  border: 0.32rem solid #9f6440;
  border-top: 0.45rem solid #b57950;
  border-radius: 0 0 2.2rem 2.2rem;
  background: linear-gradient(to bottom, #fffdf8 0%, #ffeeda 100%);
  overflow: hidden;
  box-shadow: inset 0 -0.4rem 0 rgba(157, 98, 59, 0.15);
}

.cup-highlight {
  position: absolute;
  right: 0.5rem;
  top: 0.8rem;
  width: 18%;
  height: 55%;
  border-radius: 1rem;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
}

.tea {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0%;
  border-radius: 0.3rem 0.3rem 0 0;
  background: linear-gradient(to top, #99572d, var(--tea));
  transition: height 1.6s cubic-bezier(0.33, 1, 0.68, 1);
}

.filled .tea {
  height: 72%;
}

.cup-handle {
  position: absolute;
  right: 11%;
  bottom: 4.4rem;
  width: 20%;
  height: 29%;
  border: 0.34rem solid #9f6440;
  border-left: none;
  border-radius: 0 1.8rem 1.8rem 0;
}

.saucer {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 86%;
  height: 1rem;
  border-radius: 999px;
  background: linear-gradient(to bottom, #ecc08c, #d49458);
  box-shadow: 0 0.38rem 0.6rem rgba(125, 79, 49, 0.22);
}

.pour-stream {
  position: absolute;
  left: 50%;
  top: -0.5rem;
  transform: translateX(-50%);
  width: 0.62rem;
  height: 0;
  border-radius: 999px;
  background: linear-gradient(to bottom, #dd8d52, #b76436);
  box-shadow: 0 0 8px rgba(183, 100, 54, 0.4);
  opacity: 0;
}

.pouring .pour-stream {
  animation: pour 1.5s ease-in forwards;
}

.steam {
  position: absolute;
  top: 0.95rem;
  left: 50%;
  width: 0.66rem;
  height: 2.2rem;
  opacity: 0;
  border-radius: 999px;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
}

.steam::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  filter: blur(2px);
  background: rgba(255, 255, 255, 0.62);
}

.steam-1 {
  transform: translate(-1.7rem, 0);
}

.steam-2 {
  transform: translate(-0.1rem, 0);
  animation-delay: 0.3s;
}

.steam-3 {
  transform: translate(1.4rem, 0);
  animation-delay: 0.6s;
}

.steaming .steam {
  animation: steam 2.2s ease-in-out infinite;
}

button {
  border: none;
  background: linear-gradient(135deg, var(--orange), #e98b45);
  color: #4f2d1f;
  font-family: "Baloo 2", cursive;
  font-size: clamp(1.06rem, 4vw, 1.22rem);
  font-weight: 700;
  border-radius: 999px;
  padding: 0.72rem 1.35rem;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(201, 120, 64, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 20px rgba(201, 120, 64, 0.4);
}

button:active {
  transform: translateY(0) scale(0.99);
}

button:disabled {
  cursor: default;
  opacity: 0.78;
  filter: grayscale(0.12);
}

.message {
  min-height: 1.8rem;
  margin: 0.8rem 0 0;
  font-weight: 700;
  color: #8f4f2d;
  letter-spacing: 0.02em;
  font-size: clamp(1rem, 3.5vw, 1.1rem);
}

.sender-greeting {
  min-height: 1.3rem;
  margin: 0.25rem 0 0;
  color: #9a6748;
  font-weight: 700;
  font-size: clamp(0.92rem, 3.1vw, 0.98rem);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.sender-greeting.show {
  opacity: 1;
  transform: translateY(0);
}

.heart-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.heart {
  position: absolute;
  width: 0.95rem;
  height: 0.95rem;
  background: #ff8e78;
  transform: rotate(45deg);
  opacity: 0.85;
  animation: floatUp linear forwards;
}

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

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

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

@keyframes pour {
  0% {
    height: 0;
    opacity: 0;
  }
  12% {
    opacity: 0.95;
  }
  70% {
    height: 8.1rem;
    opacity: 0.95;
  }
  100% {
    height: 0;
    opacity: 0;
  }
}

@keyframes steam {
  0% {
    opacity: 0;
    transform: translate(var(--x, 0), 0) scale(0.9);
  }
  35% {
    opacity: 0.55;
  }
  70% {
    opacity: 0.2;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--x, 0) + 0.25rem), -2.4rem) scale(1.2);
  }
}

.steam-1 { --x: -1.7rem; }
.steam-2 { --x: -0.1rem; }
.steam-3 { --x: 1.4rem; }

@keyframes floatUp {
  0% {
    transform: translateY(0) rotate(45deg) scale(0.7);
    opacity: 0;
  }
  15% {
    opacity: 0.9;
  }
  100% {
    transform: translateY(-13rem) rotate(45deg) scale(1.2);
    opacity: 0;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.85;
  }
}

@media (max-width: 420px) {
  .card {
    width: 95vw;
    padding: 0.95rem;
  }

  .cup-wrap {
    margin-bottom: 0.95rem;
  }
}

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