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

img {
    max-width: 100%;
    height: auto;
    display: block; /* Prevents bottom margin/space under image */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding-bottom: 100px; /* Space for the fixed banner */
}

.dark-theme {
    background-color: #121212; /* Real dark theme background */
    color: #e0e0e0; /* Light text color for dark theme */
}

.light-theme {
    background-color: #ffffff; /* Page background white */
    color: #000000; /* Default text color black */
}

.container {
    text-align: center;
    padding: 20px;
    max-width: 600px;
    width: 100%;
}

header {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 15px;
    object-fit: cover;
}

header h1 {
    font-size: 2.5em;
    font-weight: 600;
}

.dark-theme header h1 {
    color: #e0e0e0; /* Header text light for dark theme */
}

.light-theme header h1 {
    color: #000000;
}

main .intro {
    font-size: 1.5em;
    line-height: 1.6;
    margin-bottom: 10px;
    font-family: cursive, "Apple Chancery", "URW Chancery L", "Comic Sans MS", sans-serif; /* Added cursive font family */
    font-style: italic; /* Make intro text italic */
}

main .subtitle {
    font-size: 1.1em; /* Increased font size for better readability of cursive */
    margin-bottom: 5px;
    font-family: "Brush Script MT", "Lucida Handwriting", cursive, sans-serif; /* Added cursive font family */
}

.dark-theme main .subtitle {
    color: #bbbbbb; /* Lighter subtitle color for dark theme */
}

.light-theme main .subtitle {
    color: #555;
}

.spinning-cd-container {
    position: relative;
    width: 200px; /* Container size to fit the largest GIF (200x200) */
    height: 200px;
    margin-left: auto; /* Center the container */
    margin-right: auto; /* Center the container */
    margin-bottom: 10px; /* Keep or adjust original margin */
}

#spinning-cd-light,
#spinning-cd-dark {
    position: absolute;
    object-fit: contain; /* Maintain aspect ratio within given dimensions */
    animation: blink-effect 2s infinite alternate;
    transition: transform 0.3s ease-in-out;
    /* Dimensions and positioning (top, left) will be set by JavaScript */
}

#spinning-cd-light:hover,
#spinning-cd-dark:hover {
    transform: scale(1.25);
}

/* Theme-specific sizes are now handled by JavaScript.
   The old .dark-theme #spinning-cd styles are effectively managed by JS.
*/

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes blink-effect {
    0%, 100% {
        opacity: 1;
        filter: brightness(1.2) saturate(1.2);
    }
    50% {
        opacity: 0.8;
        filter: brightness(0.8) saturate(0.8) hue-rotate(20deg);
    }
}

.banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 0;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px; /* Space between links */
}

.dark-theme .banner {
    background-color: #1e1e1e; /* Dark banner background for dark theme */
    box-shadow: 0 -2px 5px rgba(255,255,255,0.05); /* Lighter shadow on dark */
}

.light-theme .banner {
    background-color: #ffffff; /* Banner background white */
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05); /* Softer shadow on white */
}

.banner a {
    text-decoration: none; /* Remove underline by default for banner links */
    font-weight: 500;
    color: #333; /* Default link color */
    transition: color 0.3s;
}

.dark-theme .banner a {
    color: #e0e0e0; /* Light banner links for dark theme */
}

.dark-theme .banner a:hover {
    color: #ffffff; /* White on hover for dark theme */
}

.light-theme .banner a {
    color: #000000; /* Black text for banner links in light theme */
}

.light-theme .banner a:hover {
    color: #555555; /* Darker grey on hover for light theme */
}

/* #theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    z-index: 1001;
}

.dark-theme #theme-toggle {
    background-color: #333;
    color: #e0e0e0;
}

.light-theme #theme-toggle {
    background-color: #ddd;
    color: #333;
} */

/* Responsive adjustments */
@media (max-width: 600px) {
    header h1 {
        font-size: 2em;
    }
    main .intro {
        font-size: 1.2em;
    }
    .banner {
        flex-direction: column;
        gap: 10px;
        padding: 10px 0;
        padding-bottom: 10px; /* Adjust if overlapping with content on small screens */
    }
    body {
        padding-bottom: 150px; /* Adjust for taller banner on mobile */
    }
    /* #theme-toggle {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
    } */
}



/* Ensure banner itself can accommodate square buttons */
/* .banner align-items: center; is already present and correct */

.banner-button {
    width: 50px; /* 确保按钮是正方形 */
    height: 50px; /* 确保按钮是正方形 */
    display: inline-flex; /* 用于垂直和水平居中文本 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    padding: 10px; /* 设置合适的内边距 */
    margin: 0 10px; /* 设置合适的外边距 */
    background-color: #FFFFFF; /* 白色背景 */
    color: #000000; /* 纯黑色文字，确保默认状态 */
    border: 1px solid #000000; /* 深色边框 */
    text-decoration: none; /* 移除链接下划线，确保默认状态 */
    text-align: center; /* Fallback for non-flex browsers */
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease; /* 平滑过渡效果 */
}

.light-theme .banner-button {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #000000 !important;
}

.light-theme .banner-button:hover {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important; /* 明确应用规则，边框在悬停时也为黑色 */
}

.dark-theme .banner-button {
    background-color: #000000; /* Black background for button in dark theme */
    color: #ffffff; /* White text for button in dark theme */
    border: 1px solid #ffffff; /* White border for button in dark theme */
}

.dark-theme .banner-button:hover {
    background-color: #ffffff; /* White background on hover in dark theme */
    color: #000000 !important; /* Black text on hover in dark theme, ensure override */
    border-color: #000000; /* Black border on hover in dark theme */
}

/* Calendar Styles */
#calendar-container {
    margin: 5px auto;
    width: 100%;
    max-width: 300px; /* Adjust as needed based on image */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #a0a0a0; /* Light gray for most text, similar to image */
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h2 {
    font-size: 1.5em; /* Larger font for Month Year */
    font-weight: 500;
    color: #555555; /* Darker gray for Month Year - Restored from debug red */
    margin: 0;
}

.calendar-header button {
    background: none;
    border: none;
    font-size: 1.5em; /* Match month-year size or adjust */
    color: #a0a0a0; /* Light gray for arrows */
    cursor: pointer;
    padding: 4px 8px;
}

.calendar-header button:hover {
    color: #555555; /* Darker on hover */
}

#calendar {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

#calendar th {
    font-weight: normal;
    font-size: 0.8em;
    color: #b0b0b0; /* Slightly lighter gray for day names */
    padding-bottom: 8px;
}

#calendar td {
    padding: 8px 4px;
    font-size: 0.9em;
    color: #888888; /* Date number color */
    cursor: default; /* Default cursor for dates */
}

#calendar td.today {
    font-weight: bold;
    color: #333333; /* Darker color for today's date text */
    border: 1.5px solid #888888; /* Gray border for today */
    border-radius: 50%; /* Circular border */
    background-color: transparent; /* Ensure no conflicting background */
    /* display: inline-block; Removed to maintain table cell behavior */
    /* width and height on td might not work as expected with border-radius for perfect circle without inline-block or block */
    /* Instead, we rely on padding and text-align for appearance */
    padding: 6px; /* Adjust padding for circle appearance */
    line-height: 1.1em; /* Adjust line-height */
    box-sizing: border-box;
    /* To make it more circular, ensure width/height are somewhat equal. */
    /* This is tricky with table cells. A span inside might be better. */
    /* For now, let's see if removing inline-block helps display. */
}

#calendar td.other-month {
    color: #d0d0d0; /* Even lighter for dates not in current month */
    opacity: 0.6;
}

#calendar td:hover:not(.today):not(.other-month) {
    background-color: #f0f0f0; /* Slight hover effect for other dates */
    border-radius: 50%;
}

/* Ensure the td.today style is specific enough */
#calendar tbody td.today {
    position: relative; /* For potential pseudo-elements if needed */
}

.dark-theme #calendar td.today {
    color: #e0e0e0; /* Lighter text color for today in dark theme */
    border-color: #e0e0e0; /* Lighter border color for today in dark theme */
}

/* Audio Visualizer Styles - Reverted to two-sided layout */
.visualizer-container { /* This is for .left and .right containers */
    position: fixed;
    bottom: 0;
    height: 100vh; /* Max height of the visualizer area */
    display: flex;
    align-items: flex-end; /* Columns align to their bottom within this container */
    gap: 10px; /* Space between columns */
    padding: 0 15px; /* Padding from screen edges */
    pointer-events: none;
    z-index: 5;
}

.visualizer-container.left {
    left: 0; /* Align to the very left */
}

.visualizer-container.right {
    right: 0; /* Align to the very right */
}
/* Styles for .visualizer-column, .stripe-group, .v-stripe follow and should be correct */

.visualizer-column {
    width: 30px; /* Narrower columns */
    height: 100%; /* Takes full height of .visualizer-container (50vh) */
    display: flex;
    flex-direction: column-reverse; /* New stripes added at bottom appear to grow upwards */
    /* background-color: rgba(255,0,0,0.1); */ /* Debugging background */
    overflow: hidden; /* Crucial for "reducing" stripes from top */
    /* border: 1px solid rgba(128,128,128,0.2); */ /* Optional: faint border for columns */
}

.stripe-group { /* This div contains the stripes within a column */
    width: 100%;
    display: flex;
    flex-direction: column-reverse;
    overflow: hidden;
    height: 100%; /* Stripe group should fill the column */
}

.v-stripe {
    width: 100%;
    height: 4px;         /* Increased height for each stripe */
    margin-top: 2px;     /* Fixed spacing (use margin-top with column-reverse) */
    flex-shrink: 0;      /* Prevent stripes from shrinking */
    /* background-color is set by JS initially, will be overridden by theme */
}

.light-theme .v-stripe {
    background-color: #000000; /* Black stripes in light theme */
}

.dark-theme .v-stripe {
    background-color: #e0e0e0; /* Light stripes in dark theme */
}

/* Theme Toggle Button Styles */
.theme-toggle-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: transparent; /* Default, will be overridden by theme */
    border: 1px solid #000000; /* Default, will be overridden by theme */
    color: #000000; /* Default, will be overridden by theme */
    border-radius: 50%; /* Make it circular */
    width: 40px; /* Adjust size as needed */
    height: 40px; /* Adjust size as needed */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    font-size: 20px; /* Adjust icon size */
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.light-theme .theme-toggle-button {
    border: 1px solid #000000 !important;
    color: #000000 !important;
    background-color: #ffffff !important; /* White background for light theme toggle */
}

.light-theme .theme-toggle-button:hover {
    background-color: #f0f0f0 !important; /* Light grey on hover */
    border-color: #000000;
}

.dark-theme .theme-toggle-button {
    border: 1px solid #e0e0e0;
    color: #e0e0e0;
    background-color: #2c2c2c; /* Dark grey background for dark theme toggle */
}

.dark-theme .theme-toggle-button:hover {
    background-color: #444444;
    border-color: #e0e0e0;
}

#theme-icon {
    display: inline-flex; /* Use inline-flex to allow align-items/justify-content */
    align-items: center;
    justify-content: center;
    width: 100%; /* Ensure span takes full width of button for centering */
    height: 100%; /* Ensure span takes full height of button for centering */
}

.theme-icon-svg {
    display: block; /* Helps with consistent rendering and alignment */
    margin: auto; /* Additional centering for block element if needed */
}


/* Responsive adjustments for theme toggle button */
@media (max-width: 600px) {
    .theme-toggle-button {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}
