/* Basic Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  /* ---- Index page: fun & beautiful ---- */
  body.index-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Nunito", sans-serif;
    background: linear-gradient(135deg, #fff5f7 0%, #ffe4ec 40%, #ffd6e0 100%);
    position: relative;
    overflow-x: hidden;
  }

  .index-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
  }
  .index-bg .bg-heart {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0.12;
    animation: index-float 15s linear infinite;
  }
  .index-bg .bg-heart:nth-child(1) { left: 8%; animation-delay: 0s; animation-duration: 12s; }
  .index-bg .bg-heart:nth-child(2) { left: 28%; animation-delay: 3s; animation-duration: 14s; }
  .index-bg .bg-heart:nth-child(3) { left: 52%; animation-delay: 1s; animation-duration: 16s; }
  .index-bg .bg-heart:nth-child(4) { left: 75%; animation-delay: 4s; animation-duration: 13s; }
  .index-bg .bg-heart:nth-child(5) { left: 90%; animation-delay: 2s; animation-duration: 15s; }
  .index-bg .bg-heart:nth-child(6) { left: 15%; bottom: 20%; animation-delay: 5s; animation-duration: 11s; }
  @keyframes index-float {
    from { bottom: -5%; transform: translateX(0) rotate(0deg); opacity: 0; }
    5% { opacity: 0.12; }
    95% { opacity: 0.08; }
    to { bottom: 105%; transform: translateX(15px) rotate(10deg); opacity: 0; }
  }

  /* Cursor trail hearts (index only) */
  .cursor-hearts {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
  }
  .cursor-heart {
    position: absolute;
    font-size: 0.9rem;
    color: #e91e63;
    animation: cursor-heart-fade 1.2s ease-out forwards;
  }
  @keyframes cursor-heart-fade {
    0% {
      opacity: 0.75;
      transform: translate(-50%, -50%) scale(1);
    }
    to {
      opacity: 0;
      transform: translate(-50%, -50%) scale(0.5);
    }
  }

  /* The card */
  .paper-card {
    position: relative;
    z-index: 2;
    width: min(360px, 92vw);
    min-height: 520px;
    padding: 28px 24px 24px;
    border-radius: 20px;
    background: linear-gradient(160deg, #ffb6c1 0%, #ffc0cb 50%, #ffd1dc 100%);
    box-shadow:
      0 4px 20px rgba(244, 46, 46, 0.15),
      0 10px 40px rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.5);
    animation: card-enter 0.6s ease-out, card-pulse 3s ease-in-out infinite 0.6s;
  }
  @keyframes card-pulse {
    0%, 100% {
      box-shadow:
        0 4px 20px rgba(244, 46, 46, 0.15),
        0 10px 40px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    }
    50% {
      box-shadow:
        0 4px 24px rgba(244, 46, 46, 0.22),
        0 12px 48px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    }
  }
  .no-btn.no-shake {
    animation: no-btn-shake 0.45s ease-out;
  }
  @keyframes no-btn-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
  }
  @keyframes card-enter {
    from {
      opacity: 0;
      transform: scale(0.95) translateY(10px);
    }
    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }

  .paper-corner {
    position: absolute;
    font-size: 1.1rem;
    color: rgba(244, 46, 46, 0.45);
    pointer-events: none;
  }
  .paper-corner-tl { top: 12px; left: 14px; }
  .paper-corner-tr { top: 12px; right: 14px; }
  .paper-corner-bl { bottom: 14px; left: 14px; }
  .paper-corner-br { bottom: 14px; right: 14px; }

  .paper-tagline {
    font-size: 0.85rem;
    color: #c9184a;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  #paper h1 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(2rem, 6vw, 2.75rem);
    font-weight: 600;
    color: #a4133c;
    line-height: 1.2;
    margin: 0 0 12px 0;
    max-width: 280px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    min-height: 1.3em;
  }
  .typewriter-cursor {
    display: inline-block;
    width: 2px;
    margin-left: 2px;
    background: #a4133c;
    animation: typewriter-blink 0.7s step-end infinite;
    vertical-align: text-bottom;
  }
  #question-title.done .typewriter-cursor {
    display: none;
  }
  @keyframes typewriter-blink {
    50% { opacity: 0; }
  }

  .paper-sub {
    font-size: 0.9rem;
    color: #8b2942;
    opacity: 0.85;
    margin-bottom: 24px;
    max-width: 260px;
    line-height: 1.4;
  }

  /* Legacy #paper support when not on index */
  body:not(.index-page) #paper {
    background-color: #ffb6c1;
    width: 350px;
    height: 550px;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  body:not(.index-page) #paper h1 {
    font-size: 45px;
    color: rgb(244, 46, 46);
    font-family: "Lucida Bright", Georgia, serif;
    margin-top: 20px;
    margin-left: 15px;
    margin-right: 100px;
  }

  /* Container for buttons */
  #button-container {
    position: relative;
    width: 100%;
    min-height: 180px;
  }

  /* Buttons */
  .btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-family: "Nunito", sans-serif;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: 0.02em;
  }
  .btn:hover {
    transform: scale(1.03);
  }
  .btn:active {
    transform: scale(0.98);
  }

  .yes-btn {
    font-size: 1.1rem;
    background: linear-gradient(180deg, #e63946 0%, #c1121f 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(229, 57, 70, 0.4);
  }
  .yes-btn:hover {
    box-shadow: 0 6px 20px rgba(229, 57, 70, 0.5);
  }
  .yes-btn.btn-tap,
  .no-btn.okay-fine.btn-tap {
    animation: btn-tap-glow 0.45s ease-out;
  }
  @keyframes btn-tap-glow {
    0% { box-shadow: 0 4px 14px rgba(229, 57, 70, 0.4); }
    40% {
      box-shadow: 0 0 0 8px rgba(229, 57, 70, 0.35), 0 6px 24px rgba(229, 57, 70, 0.5);
    }
    100% { box-shadow: 0 4px 14px rgba(229, 57, 70, 0.4); }
  }

  .no-btn {
    font-size: 0.95rem;
    background: white;
    color: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 2px solid rgba(0, 0, 0, 0.06);
  }
  .no-btn:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  }
  .no-btn {
    z-index: 10;
  }
  .yes-btn {
    z-index: 1;
  }

  /* Open-the-card: closed state */
  .card-closed {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 2rem;
    border-radius: inherit;
    cursor: pointer;
    transition: opacity 0.35s ease;
  }
  .paper-card.card-open .card-closed {
    pointer-events: none;
    opacity: 0;
  }
  .card-closed-heart {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 4px;
  }
  .card-closed-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: #a4133c;
    margin: 0;
  }
  .card-closed-hint {
    font-size: 0.85rem;
    color: #8b2942;
    opacity: 0.8;
    margin: 0;
  }
  .card-inner {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease 0.15s;
  }
  .paper-card.card-open .card-inner {
    opacity: 1;
    pointer-events: auto;
  }
  .paper-card.card-open .card-inner .paper-tagline,
  .paper-card.card-open .card-inner h1,
  .paper-card.card-open .card-inner .paper-sub {
    animation: card-inner-reveal 0.5s ease 0.2s both;
  }
  #button-container {
    animation: card-inner-reveal 0.5s ease 0.35s both;
  }
  @keyframes card-inner-reveal {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Last-chance countdown */
  .countdown-area {
    min-height: 2rem;
    margin-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #a4133c;
    text-align: center;
  }
  .countdown-area .countdown-nums {
    display: inline-block;
    font-size: 1.5rem;
    letter-spacing: 0.1em;
  }

  /* Reason picker overlay */
  .reason-picker {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .reason-picker.visible {
    opacity: 1;
    pointer-events: auto;
  }
  .reason-picker-box {
    background: linear-gradient(160deg, #ffb6c1 0%, #ffd1dc 100%);
    border-radius: 20px;
    padding: 2rem;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.6);
    transform: scale(0.9);
    transition: transform 0.3s ease;
  }
  .reason-picker.visible .reason-picker-box {
    transform: scale(1);
  }
  .reason-picker-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.35rem;
    color: #a4133c;
    margin: 0 0 1.25rem 0;
    text-align: center;
  }
  .reason-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .reason-opt {
    font-family: "Nunito", sans-serif;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid rgba(164, 19, 60, 0.3);
    background: white;
    color: #a4133c;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .reason-opt:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 14px rgba(164, 19, 60, 0.2);
  }
  .reason-custom {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(164, 19, 60, 0.2);
  }
  .reason-custom-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #a4133c;
    margin-bottom: 6px;
  }
  .reason-custom-input {
    width: 100%;
    padding: 10px 12px;
    font-family: "Nunito", sans-serif;
    font-size: 0.95rem;
    border: 2px solid rgba(164, 19, 60, 0.3);
    border-radius: 10px;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 8px;
    box-sizing: border-box;
  }
  .reason-custom-input::placeholder {
    color: rgba(139, 41, 66, 0.6);
  }
  .reason-custom-input:focus {
    outline: none;
    border-color: #a4133c;
    box-shadow: 0 0 0 3px rgba(164, 19, 60, 0.15);
  }
  .reason-custom-btn {
    width: 100%;
    background: rgba(164, 19, 60, 0.12);
    color: #a4133c;
  }

  .no-btn.okay-fine {
    background: linear-gradient(180deg, #e63946 0%, #c1121f 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(229, 57, 70, 0.4);
  }

  /* Hearts/confetti burst overlay */
  .hearts-burst {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
  }
  .hearts-burst.active .heart-piece {
    opacity: 1;
    transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(1);
  }
  .heart-piece {
    position: absolute;
    font-size: 1.25rem;
    color: #e91e63;
    opacity: 0;
    transform: translate(-50%, -50%) translate(0, 0) scale(0);
    transition: none;
    animation: heart-burst 2s ease-out var(--delay, 0s) forwards;
  }
  .heart-piece:nth-child(3n) { color: #ff1744; }
  .heart-piece:nth-child(3n+1) { color: #f50057; }
  .heart-piece:nth-child(5n) { font-size: 1rem; }
  .heart-piece:nth-child(7n) { font-size: 1.5rem; }
  @keyframes heart-burst {
    0% {
      opacity: 1;
      transform: translate(-50%, -50%) translate(0, 0) scale(0.5);
    }
    40% {
      opacity: 1;
      transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(1.2);
    }
    100% {
      opacity: 0;
      transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(0.8);
    }
  }

  .love-page {
    background: linear-gradient(180deg, #ff4d6d 0%, #c9184a 50%, #a4133c 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100vh;
    position: relative;
    overflow: hidden;
  }
  .love-page img {
    width: 100px;
    height: 80px;
    object-fit: contain;
  }
  .love-page .love-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
  }
  .love-page .certificate {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: certificate-pop 0.6s ease-out 0.3s both;
  }
  .love-page .certificate h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
    margin: 0 0 0.5rem 0;
    animation: text-glow 2s ease-in-out infinite alternate;
  }
  .love-page .certificate p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.5;
    opacity: 0.95;
  }
  .love-page .certificate .reason-line {
    display: none;
    margin: 0 0 0.5rem 0;
    font-style: italic;
    font-size: 1.1rem;
  }
  .love-page .certificate .cert-date {
    margin: 0.75rem 0 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
    letter-spacing: 0.03em;
  }
  .love-page .certificate.cert-sparkle-wrap {
    position: relative;
  }
  .love-page .sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    pointer-events: none;
    animation: sparkle-pop 1.8s ease-in-out infinite;
  }
  .love-page .sparkle-1 { top: 15%; left: 10%; animation-delay: 0s; }
  .love-page .sparkle-2 { top: 25%; right: 15%; animation-delay: 0.4s; }
  .love-page .sparkle-3 { bottom: 30%; left: 12%; animation-delay: 0.8s; }
  .love-page .sparkle-4 { bottom: 20%; right: 10%; animation-delay: 1.2s; }
  @keyframes sparkle-pop {
    0%, 100% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1.2); }
  }
  .love-page .sticker-row {
    animation: bounce-in 0.5s ease-out both;
  }
  .copy-moment-btn {
    margin-top: 1.25rem;
    padding: 10px 14px;
    font-family: "Nunito", sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    position: relative;
    z-index: 2;
  }
  .copy-moment-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.03);
  }
  .copy-moment-btn.copied {
    background: rgba(255, 255, 255, 0.4);
  }
  @keyframes certificate-pop {
    from {
      opacity: 0;
      transform: scale(0.8) translateY(20px);
    }
    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }
  @keyframes text-glow {
    from { text-shadow: 0 0 10px rgba(255, 255, 255, 0.4); }
    to { text-shadow: 0 0 20px rgba(255, 255, 255, 0.7); }
  }
  @keyframes bounce-in {
    from {
      opacity: 0;
      transform: scale(0);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }
  /* Floating hearts background on love page */
  .love-page .floating-hearts {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
  }
  .love-page .floating-hearts span {
    position: absolute;
    font-size: 1.25rem;
    opacity: 0.35;
    animation: float-up 8s linear infinite;
  }
  .love-page .floating-hearts span:nth-child(1) { left: 5%; animation-delay: 0s; animation-duration: 7s; }
  .love-page .floating-hearts span:nth-child(2) { left: 15%; animation-delay: 1s; animation-duration: 9s; }
  .love-page .floating-hearts span:nth-child(3) { left: 25%; animation-delay: 2s; animation-duration: 6s; }
  .love-page .floating-hearts span:nth-child(4) { left: 40%; animation-delay: 0.5s; animation-duration: 8s; }
  .love-page .floating-hearts span:nth-child(5) { left: 55%; animation-delay: 2.5s; animation-duration: 7.5s; }
  .love-page .floating-hearts span:nth-child(6) { left: 70%; animation-delay: 1.5s; animation-duration: 9s; }
  .love-page .floating-hearts span:nth-child(7) { left: 85%; animation-delay: 3s; animation-duration: 6.5s; }
  .love-page .floating-hearts span:nth-child(8) { left: 95%; animation-delay: 0.8s; animation-duration: 8s; }
  .love-page .floating-hearts span:nth-child(9) { left: 10%; animation-delay: 4s; animation-duration: 7s; }
  .love-page .floating-hearts span:nth-child(10) { left: 60%; animation-delay: 3.5s; animation-duration: 9s; }
  @keyframes float-up {
    from {
      bottom: -10%;
      transform: translateX(0) rotate(0deg);
      opacity: 0;
    }
    10% { opacity: 0.35; }
    90% { opacity: 0.25; }
    to {
      bottom: 110%;
      transform: translateX(20px) rotate(15deg);
      opacity: 0;
    }
  }

