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

/* Define the XiaolaiMono font */
@font-face {
    font-family: 'XiaolaiMono';
    src: url('../font/XiaolaiMono-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Ensures text remains visible while font is loading */
}

body {
    font-family: 'XiaolaiMono', Arial, sans-serif;
    background: url('/img/philia093.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: white;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.4), rgba(235, 126, 163, 0.3)); /* 紫粉色渐变遮罩 */
    z-index: -1;
}

.container {
    max-width: 800px;
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: relative; /* 为返回顶部按钮定位做准备 */
}

.home-link {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.home-btn {
    display: inline-flex;
    align-items: center;
    background: rgba(235, 126, 163, 0.8);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 20px;
    padding: 8px 12px; /* Reduced horizontal padding */
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease;
    position: relative; /* Ensure proper positioning */
    width: auto; /* Allow width to adjust to content */
    justify-content: flex-start; /* Align content to the start */
    align-items: center;
}

/* Reduce gap between icon and text */
.home-btn svg {
    margin-right: 4px; /* Reduced gap between icon and text */
}

/* The text elements have been removed from HTML, so these styles are no longer needed */

.home-btn:hover {
    background: rgba(235, 126, 163, 1);
}

/* The text elements have been removed from HTML, so these styles are no longer needed */

.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.lang-toggle-btn {
    background: rgba(235, 126, 163, 0.8);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 12px; /* Consistent padding with home button */
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease;
    width: auto; /* Allow width to adjust to content */
    font-family: 'XiaolaiMono', Arial, sans-serif;
    height: 36px; /* Fixed height for consistent alignment */
    display: -webkit-inline-flex; /* WebKit prefix */
    display: inline-flex;
    -webkit-align-items: center; /* WebKit prefix */
    align-items: center;
    -webkit-justify-content: center; /* WebKit prefix */
    justify-content: center;
}

.lang-toggle-btn:hover {
    background: rgba(235, 126, 163, 1);
}

.audio-toggle-btn {
    background: rgba(235, 126, 163, 0.8);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 12px; /* Consistent padding with other buttons */
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease;
    width: auto; /* Allow width to adjust to content */
    font-family: 'XiaolaiMono', Arial, sans-serif;
    display: -webkit-inline-flex; /* WebKit prefix */
    display: inline-flex;
    -webkit-align-items: center; /* WebKit prefix */
    align-items: center;
    -webkit-justify-content: center; /* WebKit prefix */
    justify-content: center;
}

.audio-toggle-btn:hover {
    background: rgba(235, 126, 163, 1);
}

/* Style the SVG icon inside the button */
.audio-toggle-btn svg {
    width: 16px;
    height: 16px;
    display: inline-block; /* Better compatibility with WebKit */
    margin-right: 4px; /* Add space between icon and number */
    vertical-align: middle; /* Align properly with text/number */
    -webkit-flex-shrink: 0; /* Prevent shrinking in WebKit */
    flex-shrink: 0;
}

/* Style for the audio number that appears to the right of the icon */
.audio-number {
    font-size: 14px;
    font-weight: bold;
    color: white;
    margin-left: 6px; /* Space between icon and number */
    display: none; /* Initially hidden, will be shown when needed */
    vertical-align: middle; /* Align with the SVG icon */
    line-height: 1; /* Prevent extra spacing */
    -webkit-font-smoothing: antialiased; /* Better font rendering in WebKit browsers */
}

/* WebKit-specific styling for the audio button */
.audio-toggle-btn {
    -webkit-appearance: none; /* Remove default WebKit styling */
    appearance: none;
    -webkit-user-select: none; /* Prevent text selection in WebKit */
    user-select: none;
    outline: none; /* Prevent default outline */
}

.calendar-switcher {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.calendar-toggle-btn {
    display: -webkit-inline-flex; /* WebKit prefix */
    display: inline-flex;
    -webkit-align-items: center; /* WebKit prefix */
    align-items: center;
    background: rgba(235, 126, 163, 0.8);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 20px;
    padding: 8px 12px; /* Consistent padding with language button */
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease;
    width: auto; /* Allow width to adjust to content */
    font-family: 'XiaolaiMono', Arial, sans-serif;
    height: 36px; /* Fixed height for consistent alignment */
    -webkit-justify-content: center; /* WebKit prefix */
    justify-content: center;
}

/* Align all top right buttons in a consistent group */
.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: -webkit-flex; /* WebKit prefix */
    display: flex;
    -webkit-flex-direction: row; /* WebKit prefix */
    flex-direction: row;
    gap: 10px; /* Consistent spacing between buttons */
    -webkit-align-items: flex-start; /* WebKit prefix */
    align-items: flex-start; /* Align buttons to the top */
}

/* Ensure all buttons in the language switcher group have consistent styling */
.language-switcher .lang-toggle-btn,
.language-switcher .audio-toggle-btn {
    display: -webkit-inline-flex; /* WebKit prefix */
    display: inline-flex;
    -webkit-align-items: center; /* WebKit prefix */
    align-items: center;
    -webkit-justify-content: center; /* WebKit prefix */
    justify-content: center;
    -webkit-flex-shrink: 0; /* WebKit prefix */
    flex-shrink: 0; /* Prevent buttons from shrinking */
    height: 36px; /* Fixed height for consistent alignment */
}

.calendar-toggle-btn:hover {
    background: rgba(235, 126, 163, 1);
}

.calendar-toggle-icon {
    margin-right: 6px; /* Space between icon and text */
}

/* On narrow screens, hide text and only show icon */
@media (max-width: 480px) {
    .calendar-toggle-text-zh,
    .calendar-toggle-text-en {
        display: none !important;
    }

    .calendar-toggle-icon {
        margin-right: 0;
    }

    /* Make both buttons consistent in size and shape on mobile */
    .calendar-toggle-btn {
        padding: 8px !important; /* Force consistent padding */
        min-width: 40px; /* Consistent minimum width */
        min-height: 40px; /* Consistent minimum height */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center;
    }

    .lang-toggle-btn {
        padding: 8px !important; /* Force consistent padding */
        min-width: 40px; /* Consistent minimum width */
        min-height: 40px; /* Consistent minimum height */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center;
    }

    .audio-toggle-btn {
        padding: 8px !important; /* Force consistent padding */
        min-width: 40px; /* Consistent minimum width */
        min-height: 40px; /* Consistent minimum height */
        display: -webkit-flex !important; /* WebKit prefix */
        display: flex !important;
        -webkit-align-items: center !important; /* WebKit prefix */
        align-items: center !important;
        -webkit-justify-content: center !important; /* WebKit prefix */
        justify-content: center !important;
        text-align: center;
    }

    /* Align both buttons to the same height and position */
    .calendar-switcher,
    .language-switcher {
        top: 10px; /* Ensure consistent top positioning */
    }
}

/* Combined footer styling */
.font-credit {
    text-align: center;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

.font-credit p {
    margin: 5px 0; /* Add spacing between copyright lines */
}

.font-credit a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.font-credit a:hover {
    color: white;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 45px; /* Reduced padding to move content up approximately one line */
    padding-left: 60px; /* Add padding to prevent content overlap with home button */
    padding-right: 60px; /* Add padding to prevent content overlap with language button */
}

.content {
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.8;
    font-size: 1.2em;
    color: white; /* 使用白色提高可读性 */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7); /* 添加文字阴影以增强可读性 */
}

.content p {
    margin: 10px 0;
}

.countdown-container {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 100%;
}

.countdown-main-text {
    margin-bottom: 15px;
    font-size: 1.5em;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.countdown-sub-text {
    margin-top: 15px;
    font-size: 1em;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.countdown {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.countdown-item span {
    display: block;
}

#days, #hours, #minutes, #seconds {
    font-size: 2em;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 5px;
    min-width: 60px;
    text-align: center;
    color: white; /* 使用白色提高可读性 */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7); /* 添加文字阴影以增强可读性 */
}

.label {
    font-size: 0.9em;
    margin-top: 5px;
}

.video-container {
    width: 100%;
    margin-top: 20px;
}

.video-container iframe {
    width: 100%;
    height: 400px;
    border-radius: 10px;
    border: none;
}

/* Font credit footer */
.font-credit {
    text-align: center;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

.font-credit a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.font-credit a:hover {
    color: white;
}

/* Statistics container styling */
.statistics-container {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

.statistics-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.statistics-item span[style*="display: none"] {
    display: none !important;
}

.separator {
    color: rgba(255, 255, 255, 0.5);
}

/* 返回顶部按钮 */
.back-to-top-btn {
    position: fixed;  /* Changed from absolute to fixed to position relative to viewport */
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(235, 126, 163, 0.8); /* 主题色，半透明 */
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 9999; /* Increased z-index to ensure it's above all other elements */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

.back-to-top-btn:hover {
    background: rgba(235, 126, 163, 1); /* 主题色，完全不透明 */
    transform: translateY(-2px);
}

.back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    main {
        padding-top: 90px; /* Increased adjustment for mobile screen with positioned buttons */
        padding-left: 20px; /* Reduce left padding on mobile */
        padding-right: 20px; /* Reduce right padding on mobile */
    }

    /* Hide text in home button on mobile screens, keep only the icon */
    .home-text-zh,
    .home-text-en {
        display: none !important;
    }

    /* Make the home button smaller when only showing icon */
    .home-btn {
        padding: 8px; /* More compact button when only icon is shown */
        min-width: auto;
    }

    .content {
        font-size: 1em;
    }

    .video-container iframe {
        height: 250px;
    }

    #days, #hours, #minutes, #seconds {
        font-size: 1.5em;
        min-width: 45px;
        padding: 5px;
    }

    .back-to-top-btn {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
    }
}

/* Extra small screens adjustments */
@media (max-width: 480px) {
    .home-link {
        position: absolute;
        top: 10px;
        left: 10px;
    }

    .language-switcher {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    main {
        padding-top: 100px; /* Increased padding to prevent overlap on small screens */
        padding-left: 15px;
        padding-right: 15px;
    }

    .home-btn {
        padding: 8px; /* Make the home button smaller when only showing icon */
        min-width: auto;
    }

    .lang-toggle-btn {
        font-size: 12px; /* Smaller font */
    }
}

/* For very narrow screens (like portrait mode on some phones), stack buttons vertically */
@media (max-width: 360px) {
    .language-switcher {
        position: absolute;
        top: 50px; /* Position below the home button */
        right: 10px;
    }

    main {
        padding-top: 120px; /* Increased top padding to account for vertically stacked buttons */
    }
}
