body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #ffe0e0; /* 頁面背景色 */
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.container {
    text-align: center;
    background-color: #fff0f5;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    position: relative;
    width: 90%;
    max-width: 500px;
    box-sizing: border-box;
}

#header-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 20px;
    border-radius: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

h1 {
    color: #d14a78;
    font-size: 2.2em;
    margin-bottom: 30px;
    line-height: 1.3;
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

button {
    padding: 15px 25px;
    font-size: 1.1em;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    min-width: 100px;
    flex-grow: 1;
    flex-basis: 120px;
    margin-bottom: 10px;
}

#yesButton {
    background-color: #ff7a9e;
}

#yesButton:hover {
    background-color: #ff638a;
    transform: scale(1.05);
}

#noButton {
    background-color: #ff7a9e;
    position: relative;
}

#noButton:hover {
    background-color: #ff638a;
}

#heartAnimationContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #ffe0e0;
    z-index: 200;
}

#heartAnimationContainer:not(.hidden) {
    display: flex;
    justify-content: center;
    align-items: center;
}

.css-heart {
  position: relative;
  width: 100px;
  height: 90px;
  animation: heartbeat 1.2s cubic-bezier(0.215, 0.610, 0.355, 1.000) 1; /* 播放一次 */
}

/* 桌面版愛心基礎樣式 */
.css-heart:before,
.css-heart:after {
  content: "";
  position: absolute;
  top: 0;
  width: 50px;
  height: 80px;
  background: #e21c1c;
  border-radius: 50px 50px 0 0;
  /* transform and transform-origin are set specifically below */
}

.css-heart:before {
  left: 50px; /* 桌面版 ::before 的 left */
  transform: rotate(-45deg);
  transform-origin: 0 100%;
}

.css-heart:after {
  left: 0; /* 桌面版 ::after 的 left */
  transform: rotate(45deg);
  transform-origin: 100% 100%;
}

@keyframes heartbeat {
  0% { transform: scale(0.95); }
  5% { transform: scale(1.15); }
  39% { transform: scale(0.85); }
  45% { transform: scale(1.05); }
  60% { transform: scale(0.90); }
  100% { transform: scale(0.95); }
}


#resultContainer {
    margin-top: 30px;
}

#resultImage {
    max-width: 100%;
    height: auto;
    margin-top: 20px;
    border-radius: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.hidden {
    display: none;
}

/* 手機版面 Media Queries */
@media (max-width: 600px) {
    body {
        padding: 5px;
    }
    .container {
        padding: 20px;
        width: 95%;
    }

    #header-image {
        margin-bottom: 15px;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    .buttons {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    button {
        font-size: 1em;
        padding: 12px 20px;
        width: 80%;
        max-width: 280px;
        flex-grow: 0;
        flex-basis: auto;
    }

    #resultImage {
        margin-top: 15px;
    }

    /* 手機版愛心樣式修正 */
    .css-heart {
        width: 80px;
        height: 72px;
    }

    /* 手機版愛心兩個半邊的通用尺寸調整 */
    .css-heart:before,
    .css-heart:after {
        width: 40px;  /* 新的半邊寬度 */
        height: 64px; /* 新的半邊高度 */
        border-radius: 40px 40px 0 0; /* 保持頂部圓潤 */
        /* top, background, transform, transform-origin 會從桌面版繼承或已正確設定 */
    }

    /* 手機版愛心左半邊 (::before) 的 left 屬性調整 */
    .css-heart:before {
        left: 40px; /* 80px (新寬度) / 2 */
    }

    /* 手機版愛心右半邊 (::after) 的 left 屬性應保持為 0 */
    /* .css-heart:after 的 left: 0; 會從桌面版規則繼承，此處無需額外設定 left，
       因為上面針對 .css-heart:before, .css-heart:after 的通用規則中不應包含 left 屬性。
       如果之前的通用規則錯誤地設定了 left: 40px，則需要明確地將 ::after 的 left 設回 0，
       但最佳做法是通用規則不包含衝突的 left。
       這裡的結構已經修正了這個問題：通用規則調整尺寸，::before 單獨調整 left。
       ::after 的 left: 0; 將從桌面版繼承且不會被錯誤覆蓋。
    */
}

@media (max-width: 380px) {
    h1 {
        font-size: 1.6em;
    }
    button {
        padding: 10px 18px;
        width: 90%;
    }
    .container {
        padding: 15px;
    }
}