:root {
  --bg-1: #fff3f6;
  --bg-2: #f8e5ec;
  --pink: #f5a9b8;
  --pink-strong: #ef7f9a;
  --blue: #bdd9f7;
  --brown: #7c5647;
  --brown-soft: #b79280;
  --cream: #fffdfb;
  --shadow: 0 24px 60px rgba(138, 85, 106, 0.18);
  --glass: rgba(255, 255, 255, 0.56);
  --glass-border: rgba(255, 255, 255, 0.42);
  --text: #5a3a46;
  --text-soft: #7f5a69;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Comfortaa', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(189, 217, 247, 0.62), transparent 28%),
    radial-gradient(circle at 80% 15%, rgba(245, 169, 184, 0.5), transparent 26%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, #f7dde6 100%);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.4) 1px, transparent 0);
  background-size: 36px 36px;
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 20%, rgba(255, 255, 255, 0.05));
  pointer-events: none;
  z-index: 0;
}

.password-shell,
.messages-shell {
  position: relative;
  z-index: 1;
}

.password-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.messages-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.glass-card,
.modal-panel,
.footer {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.glass-card {
  border-radius: 30px;
}

.password-card {
  width: min(460px, 100%);
  padding: 34px 28px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.password-card::before {
  content: '';
  position: absolute;
  inset: -30% auto auto -20%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7), transparent 70%);
  filter: blur(4px);
  pointer-events: none;
}

.badge,
.eyebrow,
.hero-note,
.modal-topline,
.image-placeholder-label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--brown-soft);
}

h1,
h2,
.hero-subtitle,
.subtitle,
.modal-subtitle,
.message-modal-text,
.password-message,
.footer {
  margin: 0;
}

h1,
h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  color: var(--brown);
}

.password-card h1 {
  font-size: clamp(2.6rem, 6vw, 4rem);
  margin: 12px 0 8px;
}

.subtitle,
.hero-subtitle,
.modal-subtitle,
.message-modal-text,
.hero-note {
  line-height: 1.75;
}

.subtitle {
  color: var(--text-soft);
  font-size: 1rem;
  margin-bottom: 22px;
}

.password-form {
  display: grid;
  gap: 14px;
}

input[type='password'] {
  width: 100%;
  border: 1px solid rgba(124, 86, 71, 0.12);
  border-radius: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

input[type='password']:focus {
  border-color: rgba(239, 127, 154, 0.55);
  box-shadow: 0 0 0 5px rgba(245, 169, 184, 0.18);
  transform: translateY(-1px);
}

.primary-button,
.modal-close {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.primary-button {
  border-radius: 18px;
  padding: 15px 18px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pink-strong), var(--brown-soft));
  box-shadow: 0 18px 38px rgba(239, 127, 154, 0.32);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.primary-button:hover,
.primary-button:focus-visible,
.glow-button:hover,
.glow-button:focus-visible {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 22px 44px rgba(239, 127, 154, 0.42);
  filter: brightness(1.02);
}

.password-message {
  min-height: 24px;
  margin-top: 10px;
  font-size: 0.94rem;
  color: #ba5877;
}

.wrong-password-popup {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(97, 52, 68, 0.22);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 30;
}

.wrong-password-popup.active {
  opacity: 1;
  pointer-events: auto;
}

.wrong-password-popup__card {
  width: min(420px, 100%);
  padding: 28px 24px 22px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 28px 70px rgba(89, 45, 60, 0.22);
  text-align: center;
  animation: popIn 0.24s ease both;
}

.wrong-password-popup__emoji {
  font-size: 2rem;
  margin-bottom: 10px;
}

.wrong-password-popup__card h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 8px;
}

.wrong-password-popup__card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.popup-dismiss {
  margin-top: 18px;
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--pink-strong), var(--brown-soft));
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@keyframes popIn {
  from {
    transform: translateY(12px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.unlock-animation {
  display: none;
  margin-top: 18px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--brown);
}

.unlock-animation.active {
  display: flex;
  animation: unlockPulse 1s ease-in-out;
}

.lock-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(245, 169, 184, 0.45));
  box-shadow: 0 0 0 10px rgba(245, 169, 184, 0.14);
}

.lock-icon {
  font-size: 1.8rem;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes unlockPulse {
  0% { transform: scale(0.96); opacity: 0; }
  50% { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.reveal-on-load {
  animation: fadeUp 0.9s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(24px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

.ambient-one {
  width: 280px;
  height: 280px;
  background: rgba(245, 169, 184, 0.28);
  top: -40px;
  right: -60px;
}

.ambient-two {
  width: 220px;
  height: 220px;
  background: rgba(189, 217, 247, 0.24);
  bottom: -30px;
  left: -40px;
}

.floating-layer,
.heart-trail {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.flower,
.petals,
.sparkle,
.heart-float {
  position: absolute;
  pointer-events: none;
  user-select: none;
}

.flower {
  font-size: 1.15rem;
  animation: floatUp linear infinite;
  opacity: 0.7;
}

.petal {
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 0;
  background: rgba(245, 169, 184, 0.6);
  transform: rotate(45deg);
  animation: drift linear infinite;
}

.sparkle {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.95);
  animation: twinkle ease-in-out infinite;
}

.heart-float {
  color: rgba(239, 127, 154, 0.75);
  font-size: 1rem;
  animation: heartRise 4.5s ease-in forwards;
}

@keyframes floatUp {
  from {
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  to {
    transform: translateY(-120vh) translateX(40px) rotate(360deg);
  }
}

@keyframes drift {
  from {
    transform: translateY(0) rotate(45deg);
  }
  to {
    transform: translateY(-100vh) rotate(405deg);
  }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

@keyframes heartRise {
  from {
    transform: translateY(0) scale(0.9);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  to {
    transform: translateY(-120px) scale(1.2);
    opacity: 0;
  }
}

.messages-page {
  padding-bottom: 32px;
}

.hero {
  position: relative;
  padding: 30px 28px 26px;
  text-align: center;
  margin: 18px auto 24px;
  max-width: 900px;
  border-radius: 34px;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: '';
  position: absolute;
  inset: 16px;
  border-radius: 28px;
  pointer-events: none;
}

.hero::before {
  border: 1px solid rgba(124, 86, 71, 0.12);
}

.hero::after {
  inset: 8px;
  border: 1px solid rgba(245, 169, 184, 0.16);
}

.hero h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(2.2rem, 4.4vw, 4rem);
  line-height: 1.08;
  letter-spacing: 0.01em;
  margin: 8px auto 10px;
  cursor: pointer;
  max-width: 12ch;
}

.hero-subtitle {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  max-width: 720px;
  margin: 0 auto;
  color: var(--text-soft);
}

.hero-note {
  position: relative;
  z-index: 1;
  margin-top: 16px;
}

.eyebrow {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.55);
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: 0.84rem;
  color: var(--brown);
}

.mail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.mail-item {
  position: relative;
  min-height: 230px;
  border-radius: 26px;
  padding: 18px 18px 22px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 251, 252, 0.5));
  border: 1px solid rgba(255, 255, 255, 0.54);
  box-shadow: 0 18px 36px rgba(122, 82, 96, 0.12);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: fadeUp 0.85s ease both;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
}

.mail-item:hover,
.mail-item:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 24px 46px rgba(122, 82, 96, 0.18);
}

.envelope {
  position: absolute;
  inset: auto 0 0;
  height: 140px;
  background: linear-gradient(135deg, #ffd9e4 0%, #fff 50%, #dfefff 100%);
  border-top: 1px solid rgba(124, 86, 71, 0.09);
}

.envelope::before,
.envelope::after {
  content: '';
  position: absolute;
  inset: 0;
}

.envelope::before {
  clip-path: polygon(0 100%, 50% 54%, 100% 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 169, 184, 0.58));
  transform-origin: top center;
  transition: transform 0.35s ease;
}

.envelope::after {
  clip-path: polygon(0 0, 50% 46%, 100% 0, 100% 100%, 0 100%);
  background: rgba(255, 255, 255, 0.6);
}

.mail-item:hover .envelope::before,
.mail-item:focus-visible .envelope::before {
  transform: rotateX(24deg) translateY(-5px);
}

.mail-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--brown);
  font-size: 0.78rem;
  font-weight: 700;
}

.mail-title {
  position: relative;
  z-index: 1;
  font-size: clamp(1.05rem, 2.4vw, 1.22rem);
  line-height: 1.35;
  margin-top: 12px;
  max-width: 14ch;
  color: var(--brown);
}

.mail-mini-note {
  position: absolute;
  z-index: 1;
  bottom: 20px;
  left: 20px;
  right: 20px;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.6;
}

.mail-item .mail-title,
.mail-item .mail-mini-note,
.mail-item .mail-label {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.footer {
  margin: 20px auto 0;
  padding: 16px 20px;
  width: fit-content;
  border-radius: 999px;
  text-align: center;
  color: var(--brown);
}

.modal-root {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 20;
}

.modal-root.active {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(97, 52, 68, 0.28);
  backdrop-filter: blur(10px);
}

.modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(760px, calc(100vw - 28px));
  max-height: min(88vh, 900px);
  overflow: auto;
  border-radius: 28px;
  padding: 26px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.modal-root.active .modal-panel.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal-panel h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin: 6px 0 10px;
}

.modal-subtitle {
  margin-bottom: 18px;
  color: var(--text-soft);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  font-size: 1.4rem;
  color: var(--brown);
  box-shadow: 0 8px 20px rgba(122, 82, 96, 0.16);
}

.message-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.message-card {
  border: 1px solid rgba(124, 86, 71, 0.09);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(251, 243, 246, 0.6));
  border-radius: 20px;
  padding: 16px;
  min-height: 120px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.message-card:hover,
.message-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 18px 26px rgba(122, 82, 96, 0.12);
}

.message-card h3 {
  margin: 0 0 10px;
  color: var(--brown);
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: 1.3rem;
}

.message-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
  font-size: 0.92rem;
}

.message-detail-image-wrap {
  margin: 8px 0 16px;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(245, 169, 184, 0.18));
  border: 1px solid rgba(124, 86, 71, 0.08);
  padding: 14px;
}

.message-detail-image-wrap img {
  display: none;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 18px;
}

.message-detail-image-wrap.has-image img {
  display: block;
}

.image-placeholder-label {
  margin-bottom: 10px;
}

.message-modal-text {
  color: var(--text);
  line-height: 1.9;
  font-size: 1rem;
  white-space: pre-wrap;
}

.secret-modal {
  max-width: 520px;
  text-align: center;
}

.secret-modal h2 {
  margin-top: 18px;
}

.noscript-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.88);
  color: var(--brown);
  padding: 12px 16px;
  border-radius: 999px;
  z-index: 30;
}

.error-shake {
  animation: shake 0.38s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@media (max-width: 720px) {
  .password-card,
  .hero,
  .modal-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .messages-shell {
    width: min(100vw - 18px, 1180px);
  }

  .hero {
    margin-top: 12px;
  }

  .mail-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
  }

  .mail-item {
    min-height: 210px;
  }

  .modal-panel {
    width: calc(100vw - 18px);
    max-height: 90vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
