* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: radial-gradient(1200px 800px at 20% 10%, #ffd7e2, transparent 60%),
              radial-gradient(1000px 700px at 80% 20%, #ffc2d6, transparent 60%),
              radial-gradient(900px 700px at 50% 90%, #ffb3c6, transparent 60%),
              #fff5f8;
  color: #3b0f22;
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(1000px 700px at 50% 0%, #ffd7e2, transparent 60%),
              radial-gradient(900px 600px at 50% 100%, #ffc2d6, transparent 60%),
              #fff5f8;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.auth-box {
  background: linear-gradient(180deg, #ffffff, #fff5f8);
  border: 2px solid #ff8aa3;
  border-radius: 22px;
  padding: 32px 26px 30px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(189, 36, 84, 0.28);
  position: relative;
  overflow: hidden;
  animation: authSlideIn 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes authSlideIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.heart-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.mini-heart {
  font-size: 1.4rem;
  color: #ff4d6d;
  filter: drop-shadow(0 3px 6px rgba(255, 77, 109, 0.35));
  animation: heartPulse 1.6s ease-in-out infinite;
}

.mini-heart:nth-child(2) {
  animation-delay: 0.2s;
}

.mini-heart:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes heartPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

.auth-box h1 {
  font-size: 1.95rem;
  margin-bottom: 12px;
  color: #bd2454;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-shadow: 0 3px 12px rgba(189, 36, 84, 0.25);
}

.auth-box p {
  font-size: 1rem;
  margin-bottom: 22px;
  line-height: 1.55;
  color: #5a1b36;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#auth-input {
  padding: 13px 18px;
  border-radius: 16px;
  border: 2px solid #ff8aa3;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  background: #fffafc;
}

#auth-input:focus {
  border-color: #bd2454;
  box-shadow: 0 0 0 4px rgba(189, 36, 84, 0.18);
}

.auth-box button {
  padding: 13px 22px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #bd2454, #e03a6a);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.02rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.22s ease, filter 0.22s ease;
  box-shadow: 0 12px 32px rgba(189, 36, 84, 0.38);
}

.auth-box button:active {
  transform: scale(0.95);
  box-shadow: 0 6px 18px rgba(189, 36, 84, 0.32);
}

.auth-box button:hover {
  filter: brightness(1.07);
  box-shadow: 0 14px 36px rgba(189, 36, 84, 0.42);
}

.error {
  color: #b71c1c;
  font-size: 0.92rem;
  margin-top: 14px;
  min-height: 1.2em;
  font-weight: 700;
}

#main {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px 120px;
}

.slide {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 24px;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 1s cubic-bezier(0.22, 0.61, 0.36, 1);
  position: relative;
}

.slide.visible {
  opacity: 1;
  transform: translateY(0);
}

.intro-slide .big-text {
  font-size: 3.2rem;
  font-weight: 900;
  color: #bd2454;
  letter-spacing: 0.5px;
  text-shadow: 0 6px 24px rgba(189, 36, 84, 0.28);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.1s ease 0.1s, transform 1.1s ease 0.1s;
}

.slide.visible .intro-slide .big-text {
  opacity: 1;
  transform: translateY(0);
}

.intro-slide .small-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #7a2246;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.1s ease 0.5s, transform 1.1s ease 0.5s;
}

.intro-slide.visible .small-text {
  opacity: 1;
  transform: translateY(0);
}

.time-title {
  font-size: 2.4rem;
  font-weight: 900;
  color: #bd2454;
  text-shadow: 0 5px 20px rgba(189, 36, 84, 0.26);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 1.15s ease 0.1s, transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s;
}

.slide.visible .time-title {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.minutes-card,
.messages-card,
.reasons-card,
.final-card {
  background: linear-gradient(180deg, #ffffff, #fff4f7);
  border: 2px solid #ff8aa3;
  border-radius: 22px;
  padding: 28px 24px;
  max-width: 580px;
  width: 100%;
  box-shadow: 0 16px 44px rgba(189, 36, 84, 0.22);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 1.1s ease 0.1s, transform 1.15s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s;
}

.minutes-card::before,
.messages-card::before,
.reasons-card::before,
.final-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 138, 163, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 138, 163, 0.16) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.45;
  pointer-events: none;
}

.slide.visible .minutes-card,
.slide.visible .messages-card,
.slide.visible .reasons-card,
.slide.visible .final-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.minutes-intro,
.minutes-label,
.days-text,
.messages-intro,
.messages-title,
.reasons-title,
.reason-item,
.final-intro,
.note-prompt {
  font-size: 1.12rem;
  line-height: 1.65;
  color: #5a1b36;
  opacity: 0;
  transform: translateY(14px);
}

.minutes-count {
  font-size: 3.2rem;
  font-weight: 900;
  color: #e03a6a;
  text-shadow: 0 6px 26px rgba(224, 58, 106, 0.32);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
}

.slide.visible .minutes-intro,
.slide.visible .minutes-label,
.slide.visible .days-text {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 1.05s ease 0.25s, transform 1.05s ease 0.25s;
}

.slide.visible .minutes-count {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 1.1s ease 0.35s, transform 1.15s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s;
}

.days-text {
  margin-top: 8px;
  font-weight: 700;
  color: #7a2246;
}

.messages-intro,
.messages-title,
.final-intro,
.note-prompt {
  transition: opacity 1.05s ease 0.25s, transform 1.05s ease 0.25s;
}

.slide.visible .messages-intro,
.slide.visible .messages-title,
.slide.visible .final-intro,
.slide.visible .note-prompt {
  opacity: 1;
  transform: translateY(0);
}

.ranking {
  list-style: none;
  text-align: left;
  margin-top: 14px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1s ease 0.4s, transform 1s ease 0.4s;
}

.slide.visible .ranking {
  opacity: 1;
  transform: translateY(0);
}

.ranking-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff, #fff4f7);
  border: 1.5px solid #ff8aa3;
  box-shadow: 0 8px 22px rgba(189, 36, 84, 0.16);
  color: #3b0f22;
  font-size: 1.05rem;
  opacity: 0;
  transform: translateX(-14px);
  transition: opacity 0.95s ease, transform 0.95s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ranking-item.show {
  opacity: 1;
  transform: translateX(0);
}

.ranking-item:last-child {
  margin-bottom: 0;
}

.rank-number {
  font-weight: 900;
  color: #bd2454;
  font-size: 1.15rem;
}

.rank-text {
  font-weight: 700;
  color: #5a1b36;
}

.rank-count {
  font-weight: 700;
  color: #e03a6a;
  white-space: nowrap;
}

.reasons-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #bd2454;
  margin-bottom: 14px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.1s ease 0.15s, transform 1.1s ease 0.15s;
}

.slide.visible .reasons-title {
  opacity: 1;
  transform: translateY(0);
}

.reasons-list {
  list-style: none;
  text-align: left;
}

.reason-item {
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #fff4f7);
  border: 1.5px solid #ff8aa3;
  box-shadow: 0 6px 18px rgba(189, 36, 84, 0.14);
  font-weight: 700;
  color: #5a1b36;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reason-item.show {
  opacity: 1;
  transform: translateY(0);
}

.reason-item:last-child {
  margin-bottom: 0;
}

.note-trigger-text {
  font-size: 1.35rem;
  color: #7a2246;
  font-weight: 800;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.05s ease 0.1s, transform 1.05s ease 0.1s;
}

.slide.visible .note-trigger-text {
  opacity: 1;
  transform: translateY(0);
}

.envelope-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  width: 130px;
  height: 130px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.9) translateY(12px);
  transition: opacity 1s ease 0.3s, transform 1s ease 0.3s;
}

.slide.visible .envelope-btn {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.env-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff, #fff4f7);
  border: 2px solid #ff8aa3;
  border-radius: 50%;
  box-shadow: 0 14px 36px rgba(189, 36, 84, 0.28);
  transition: transform 0.28s ease, box-shadow 0.28s ease, filter 0.28s ease;
}

.envelope-btn:hover .env-inner,
.envelope-btn:focus .env-inner {
  transform: scale(1.06);
  box-shadow: 0 18px 44px rgba(189, 36, 84, 0.38);
  filter: brightness(1.03);
  outline: none;
}

.envelope-btn:active .env-inner {
  transform: scale(1.02);
  box-shadow: 0 10px 24px rgba(189, 36, 84, 0.3);
}

.env-icon {
  font-size: 3rem;
  line-height: 1;
}

.env-seal {
  position: absolute;
  right: 18%;
  bottom: 18%;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b8a, #bd2454);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 6px 16px rgba(189, 36, 84, 0.45);
  border: 2px solid #fff;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.envelope-btn:hover .env-seal,
.envelope-btn:focus .env-seal {
  transform: scale(1.12);
  box-shadow: 0 8px 20px rgba(189, 36, 84, 0.55);
}

.envelope-btn:active .env-seal {
  transform: scale(1.06);
  box-shadow: 0 5px 14px rgba(189, 36, 84, 0.45);
}

.final-intro,
.note-prompt {
  max-width: 580px;
}

.note-prompt {
  margin-top: 12px;
  font-weight: 800;
  color: #bd2454;
  font-size: 1.1rem;
}

#note-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  width: 100%;
  margin-top: 18px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.05s ease 0.3s, transform 1.05s ease 0.3s;
}

.slide.visible #note-form {
  opacity: 1;
  transform: translateY(0);
}

#note-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 16px;
  border: 2px solid #ff8aa3;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  background: #fffafc;
}

#note-input:focus {
  border-color: #bd2454;
  box-shadow: 0 0 0 4px rgba(189, 36, 84, 0.18);
}

#note-form button {
  padding: 13px 22px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #bd2454, #e03a6a);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.02rem;
  cursor: pointer;
  align-self: flex-start;
  transition: transform 0.2s ease, box-shadow 0.22s ease, filter 0.22s ease;
  box-shadow: 0 12px 32px rgba(189, 36, 84, 0.38);
}

#note-form button:hover {
  filter: brightness(1.07);
  box-shadow: 0 14px 36px rgba(189, 36, 84, 0.42);
}

#note-form button:active {
  transform: scale(0.95);
  box-shadow: 0 6px 18px rgba(189, 36, 84, 0.32);
}

.status {
  margin-top: 14px;
  font-size: 0.95rem;
  min-height: 1.2em;
  font-weight: 700;
}

.status.success {
  color: #2e7d32;
}

.status.error {
  color: #b71c1c;
}

/* Note modal (custom, not <dialog>) */

.note-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.note-modal.open {
  display: flex;
}

.note-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(70, 15, 35, 0.65);
  backdrop-filter: blur(2px);
}

.note-modal-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.note-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 80vh;
  border-radius: 20px;
  overflow: hidden;
  background: #fff6f9;
  box-shadow: 0 30px 80px rgba(189, 36, 84, 0.45);
  animation: notePopIn 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes notePopIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.note-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 16px 10px;
  background: linear-gradient(180deg, #fff0f4, #fff6f9);
  border-bottom: 2px solid #ff8aa3;
}

.note-heart {
  font-size: 1.4rem;
  color: #ff4d6d;
  filter: drop-shadow(0 3px 8px rgba(255, 77, 109, 0.4));
}

.note-title {
  font-weight: 900;
  font-size: 1.1rem;
  color: #bd2454;
  letter-spacing: 0.3px;
}

.note-content {
  flex: 1 1 auto;
  position: relative;
  padding: 18px 20px 10px;
  text-align: left;
  overflow-y: auto;
  font-size: 0.98rem;
  line-height: 1.85;
  color: #2f0e1e;
  background:
    linear-gradient(#ffffff 0%, #fff3f6 45%, #fff0f3 100%);
  -webkit-overflow-scrolling: touch;
}

.note-content::before {
  content: "";
  position: absolute;
  inset: 8px 10px;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 138, 163, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 138, 163, 0.18) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.45;
  border-radius: 10px;
}

.note-line {
  position: relative;
  margin-bottom: 12px;
  padding-left: 6px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}

.note-line.show {
  opacity: 1;
  transform: translateY(0);
}

.note-signature-block {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1.5px dashed #ff8aa3;
}

.note-signature {
  margin-bottom: 6px;
  font-weight: 800;
  color: #bd2454;
  font-size: 1.02rem;
}

#close-note-btn {
  flex: 0 0 auto;
  align-self: flex-end;
  margin: 12px 16px 16px;
  padding: 10px 20px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #bd2454, #e03a6a);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(189, 36, 84, 0.4);
  transition: transform 0.18s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

#close-note-btn:hover,
#close-note-btn:focus {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(189, 36, 84, 0.48);
  filter: brightness(1.06);
  outline: none;
}

#close-note-btn:active {
  transform: translateY(0);
  box-shadow: 0 7px 18px rgba(189, 36, 84, 0.38);
}

@media (max-width: 480px) {
  .intro-slide .big-text {
    font-size: 2.2rem;
  }
  .time-title,
  .messages-title,
  .reasons-title {
    font-size: 1.7rem;
  }
  .minutes-count {
    font-size: 2.2rem;
  }
  .envelope-btn {
    width: 110px;
    height: 110px;
  }
  .env-icon {
    font-size: 2.6rem;
  }
  .env-seal {
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }
  .ranking-item {
    grid-template-columns: 28px 1fr auto;
    padding: 12px 10px;
    font-size: 0.96rem;
  }
  .note-modal {
    padding: 12px;
  }
  .note-modal-container {
    max-height: 75vh;
  }
  .note-header {
    padding: 14px 14px 8px;
  }
  .note-content {
    padding: 14px 16px 8px;
    font-size: 0.94rem;
  }
  #close-note-btn {
    margin: 10px 14px 14px;
    padding: 9px 18px;
    font-size: 0.92rem;
  }
}