@font-face {
  font-family: 'MyHandwriting';
  src: url('Myfont-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nunito', sans-serif;
  background-color: #0c0b22;
  color: #fff9f0;
  overflow-x: hidden;
  background-image: url('bg-pattern.png');
  background-repeat: repeat;
  background-position: center top;
  background-size: 420px auto;
}

::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #0c0b22;
}
::-webkit-scrollbar-thumb {
  background-color: #ffe600;
  border-radius: 8px;
  border: 2px solid #0c0b22;
}
html {
  background-color: #0c0b22;
  scrollbar-color: #ffe600 #0c0b22;
  scrollbar-width: thin;
  overflow-x: hidden;
}

.memphis-bg {
  background: transparent;
}

.accent {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}
.circle-yellow { top: 2.5rem; left: 2.5rem; width: 5rem; height: 5rem; border-radius: 50%; border: 4px solid #ffe600; opacity: 0.4; }
.diamond-pink { top: 6rem; left: 8rem; width: 1.5rem; height: 1.5rem; background: #ff0090; transform: rotate(45deg); opacity: 0.6; }
.circle-blue { bottom: 5rem; right: 4rem; width: 7rem; height: 7rem; border-radius: 50%; border: 4px solid #1a1aff; opacity: 0.3; }
.diamond-coral { bottom: 10rem; right: 10rem; width: 2rem; height: 2rem; background: #ff5c3a; transform: rotate(12deg); opacity: 0.5; }
.pill-mint { top: 33%; right: 2rem; width: 1rem; height: 4rem; background: #00e5a0; opacity: 0.4; border-radius: 9999px; }
.pill-yellow { top: 50%; left: 2rem; width: 4rem; height: 1rem; background: #ffe600; opacity: 0.3; border-radius: 9999px; }

.envelope-section {
  min-height: 100dvh;          /* ✅ fixed for Safari */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 5rem 1.5rem;
}

/* ✅ NEW: less vertical padding on desktop so the pill isn't cut */
@media (min-width: 768px) {
  .envelope-section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
}

.header-pill {
  position: relative;
  z-index: 5;
  margin-bottom: 1.25rem;
  padding: 0.4rem 1.4rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: #ff0090;
  color: #fff9f0;
  border: 2px solid #0d0d2b;
  box-shadow: 4px 4px 0px #ffe600;
  display: inline-block;
}

.main-title {
  position: relative;
  z-index: 5;
  text-align: center;
  margin: 0 auto 5.5rem auto;
  line-height: 1.25;
  font-family: 'Fraunces', serif;
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  font-weight: 900;
  color: #fff9f0;
  background: #0d0d2b;
  padding: 1.5rem 2.2rem;
  border-radius: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 8px 8px 0px #ff0090;
  max-width: 90vw;
  width: fit-content;
}

.highlight-yellow { color: #ffe600; font-style: italic; }
.highlight-pink { color: #ff0090; }

.envelope-container {
  position: relative;
  cursor: pointer;
  user-select: none;
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.note-slide {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%) translateY(30px);
  width: calc(100% - 24px);
  min-height: 260px;
  height: auto;
  max-height: 335px;
  background: #fff9f0;
  color: #0d0d2b;
  border-radius: 1.25rem;
  border-top: 1.5rem solid #fff9f0;
  border-bottom: 1.5rem solid #fff9f0;
  border-left: 0.5rem solid #fff9f0;
  border-right: 0.5rem solid #fff9f0;
  padding: 0.25rem 0.5rem;
  box-shadow: inset 0 0 0 2px #fff9f0, 0 15px 40px rgba(0,0,0,0.7);
  text-align: center;
  opacity: 0;
  z-index: 25;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: none;
  transition: transform 0.5s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s 0.2s ease;
  scrollbar-color: #ffe600 transparent;
  scrollbar-width: thin;
}

.envelope-open .note-slide {
  transform: translateX(-50%) translateY(-65px);
  opacity: 1;
  pointer-events: auto;
}

.note-pill {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #ff0090;
  margin-bottom: 0.75rem;
  display: inline-block;
}

.note-message {
  font-family: 'MyHandwriting', 'Fraunces', serif;
  font-size: 1.45rem;
  line-height: 1.5;
  color: #0d0d2b;
  margin: 0.5rem 0;
  word-break: break-word;
}

.note-author {
  margin-top: 0.75rem;
  font-family: 'MyHandwriting', 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: normal;
  color: #1a1aff;
  display: block;
  margin-bottom: 1.5rem;
}

.envelope-body {
  position: relative;
  width: 100%;
  border-radius: 1rem;
  overflow: hidden;
  background: #1a1aff;
  border: 3px solid #ffe600;
  padding-top: 70%;
  box-shadow: 8px 8px 0px #ffe600;
}

.env-back {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  background: #1230cc;
  clip-path: polygon(0 100%, 50% 0%, 100% 100%);
}

.env-crease {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  background: transparent;
  border-left: 3px solid rgba(255,230,0,0.3);
  clip-path: polygon(0 100%, 50% 0%, 0 0);
}

.env-left-triangle {
  position: absolute;
  left: 0; bottom: 0;
  width: 50%;
  height: 55%;
  background: #0d1fb5;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.env-right-triangle {
  position: absolute;
  right: 0; bottom: 0;
  width: 50%;
  height: 55%;
  background: #0d1fb5;
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

.envelope-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 55%;
  background: #2233ff;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform-style: preserve-3d;
  border-bottom: 2px solid rgba(255,230,0,0.4);
  z-index: 20;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.envelope-open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 5;
}

.flap-heart {
  position: absolute;
  left: 50%;
  top: 1.5rem;
  transform: translateX(-50%);
}

.click-hint {
  text-align: center;
  margin-top: 1.75rem;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #ffe600;
  background: #0d0d2b;
  border: 2px solid #ffe600;
  padding: 0.45rem 1.4rem;
  border-radius: 9999px;
  display: inline-block;
  position: relative;
  z-index: 5;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.envelope-open .click-hint {
  opacity: 0;
  pointer-events: none;
}

.countdown-section {
  background: #ff0090;
  min-height: 45vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 5rem 1.5rem;
}

.ct-diamond-yellow { top: 1.5rem; left: 1.5rem; width: 3rem; height: 3rem; background: #ffe600; transform: rotate(45deg); opacity: 0.6; }
.ct-circle-navy { bottom: 1.5rem; right: 1.5rem; width: 4rem; height: 4rem; border-radius: 50%; border: 4px solid #0d0d2b; opacity: 0.4; }
.ct-diamond-white { top: 50%; right: 3rem; width: 1rem; height: 1rem; background: #fff9f0; transform: rotate(12deg); opacity: 0.5; }

.countdown-title {
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #0d0d2b;
  margin-bottom: 1.5rem;
}

.countdown-timer-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
}

.time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.time-box {
  background: #0d0d2b;
  color: #ffe600;
  width: clamp(72px, 18vw, 110px);
  height: clamp(72px, 18vw, 110px);
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 700;
  border-radius: 0.75rem;
  border: 3px solid #ffe600;
  box-shadow: 4px 4px 0 #ffe600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.time-label {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #0d0d2b;
}

.colon {
  font-weight: 700;
  padding-bottom: 1.5rem;
  color: #0d0d2b;
  font-size: clamp(2rem, 7vw, 3.5rem);
}

.calendar-section {
  background: transparent;
  min-height: 80vh;
  position: relative;
  overflow: hidden;
  padding: 6rem 1.5rem;
}

.cal-circle-pink { top: 2rem; right: 2rem; width: 6rem; height: 6rem; border-radius: 50%; border: 4px solid #ff0090; opacity: 0.25; }
.cal-diamond-yellow { bottom: 3rem; left: 2rem; width: 2.5rem; height: 2.5rem; background: #ffe600; transform: rotate(45deg); opacity: 0.3; }

.calendar-inner {
  max-width: 650px;
  margin: 0 auto;
}

.calendar-header-block {
  text-align: center;
  margin-bottom: 2.5rem;
}

.header-pill-yellow {
  padding: 0.25rem 1rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: #ffe600;
  color: #0d0d2b;
  box-shadow: 0 4px 15px rgba(255, 230, 0, 0.4);
  display: inline-block;
}

.calendar-heading {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  color: #fff9f0;
  line-height: 1.25;
  background: #0d0d2b;
  padding: 1.5rem 2.2rem;
  border-radius: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 8px 8px 0px #ff0090;
  display: block;
  width: fit-content;
  margin: 1.5rem auto 0;
  max-width: 90vw;
}

.calendar-card {
  border-radius: 1rem;
  overflow: hidden;
  background: #13134a;
  border: 3px solid #1a1aff;
  box-shadow: 8px 8px 0 #1a1aff;
}

.calendar-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid #1a1aff;
}

.calendar-month-nav button {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  background: #ff0090;
  color: #fff9f0;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.calendar-month-nav button:hover {
  transform: scale(1.1);
}

#calendar-month-title {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff9f0;
}

.weekdays-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  padding: 1rem 1rem 0.25rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #ffe600;
  font-family: 'JetBrains Mono', monospace;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  padding: 0.5rem 1rem 1.5rem 1rem;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: rgba(255,249,240,0.3);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.calendar-day.empty {
  opacity: 0;
  pointer-events: none;
}

.calendar-day.unlocked {
  background: #ff0090;
  color: #fff9f0;
  cursor: pointer;
}

.calendar-day.unlocked:hover {
  background: #ff33a8;
  transform: scale(1.08);
}

.calendar-day.today {
  border: 2px solid #ffe600;
}

.calendar-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  border-top: 2px solid #1a1aff;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,249,240,0.6);
}

.legend-box {
  width: 1rem;
  height: 1rem;
  border-radius: 2px;
}
.unlocked-box { background: #ff0090; }
.today-box { border: 2px solid #ffe600; background: transparent; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 43, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #fff9f0;
  color: #0d0d2b;
  border-radius: 1.25rem;
  border-top: 1.5rem solid #fff9f0;
  border-bottom: 1.5rem solid #fff9f0;
  border-left: 0.5rem solid #fff9f0;
  border-right: 0.5rem solid #fff9f0;
  padding: 1rem 1.5rem 0.5rem 1.5rem;
  box-shadow: inset 0 0 0 2px #fff9f0, 0 0 0 3px #ff0090, 8px 8px 0px #ff0090;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 80vh;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #ffe600 transparent;
  scrollbar-width: thin;
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #ff0090;
  color: #fff9f0;
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  z-index: 50;
}

.modal-close:hover {
  transform: scale(1.1);
}

.modal-pill {
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #ff0090;
  margin-bottom: 1rem;
}

.modal-message {
  font-family: 'MyHandwriting', 'Fraunces', serif;
  font-size: 1.45rem;
  line-height: 1.55;
  color: #0d0d2b;
  margin-bottom: 1rem;
}

.modal-author {
  font-family: 'MyHandwriting', 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: normal;
  color: #1a1aff;
}

.note-slide::-webkit-scrollbar,
.modal-card::-webkit-scrollbar {
  width: 6px;
}
.note-slide::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track {
  background: transparent;
}
.note-slide::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb {
  background-color: #ffe600;
  border-radius: 10px;
}

.falling-heart {
  position: fixed;
  top: -10vh;
  z-index: 1000;
  pointer-events: none;
  user-select: none;
  animation: fall linear forwards;
  text-shadow: 2px 2px 0px #0d0d2b;
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(360deg);
    opacity: 0;
  }
}
