:root {
    --text-color: #ffffff;
    --bubble-bg: rgba(255, 255, 255, 0.1);
    --bubble-border: rgba(255, 255, 255, 0.2);
    --footer-bg: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    /* Default to Night */
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    background-size: 400% 400%;
    animation: gradientBG 60s ease infinite;
    transition: background 3s ease-in-out;
    will-change: transform;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Background Noise Texture for stylish feel */
body::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Subtle noise data URI */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}

/* Time-based Gradients */
body.bg-morning {
    background: linear-gradient(135deg, #4b6cb7, #182848);
    background-size: 400% 400%;
}

body.bg-day {
    background: linear-gradient(135deg, #2c3e50, #4ca1af);
    background-size: 400% 400%;
}

body.bg-sunset {
    background: linear-gradient(135deg, #4568DC, #B06AB3);
    background-size: 400% 400%;
}

body.bg-night {
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#countdown-container {
    flex-grow: 1;
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 1000px;
    /* For potential 3D feel */
}

/* Timer Bubble Styles - Enhanced */
.timer-bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.2),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    transition: opacity 0.5s ease;
    cursor: pointer;
    user-select: none;
    padding: 1.5rem;
    color: #fff;
    overflow: hidden;
}

/* Subtle inner glow/shine */
.timer-bubble::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    width: 20%;
    height: 10%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    filter: blur(8px);
    transform: rotate(-45deg);
    pointer-events: none;
}

.timer-bubble h3 {
    font-size: 0.95rem;
    font-weight: 300;
    margin-bottom: 0.8rem;
    opacity: 0.9;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.timer-bubble .time {
    font-size: 1.4rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    font-family: 'Inter', sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Help Bubble */
.help-bubble {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    top: 0;
    left: 0;
    /* JS will set translate */
    transition: transform 0.1s linear;
    /* Faster/linear for physics, or remove transition for pure physics? */
    /* Actually we need to match timer-bubble's transition or lack thereof for smooth physics */
    /* timer-bubble has transition opacity only. Transform is direct. */
    z-index: 900;
}

.help-bubble:hover {
    background: rgba(255, 255, 255, 0.3);
    /* Remove scale transform on hover because it conflicts with physics translate */
    /* scale can be done via internal element or separate property if needed, but let's keep simple */
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(30, 30, 40, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    color: #fff;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 500;
}

#close-modal-btn,
#close-help-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#search-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1rem;
    outline: none;
}

#timer-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}

#timer-list li {
    padding: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 4px;
}

#timer-list li:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Scrollbar for modal */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.help-body {
    line-height: 1.8;
}

.help-body ul {
    margin: 1rem 0;
    padding-left: 1.2rem;
    list-style: none;
}

.help-body li {
    margin-bottom: 0.8rem;
}

.footer-note {
    text-align: right;
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 2rem;
}