:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #4caf50;
    --notification-bar-height: 30px;
    --countdown-container-height: 60px;
    --wrapper-margin-top: calc(var(--notification-bar-height) + var(--countdown-container-height));
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    font-family: 'Noto Serif SC', serif;
    overflow-x: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.scrolling-notification-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #3498db;
    color: white;
    text-align: center;
    padding: 5px 0;
    z-index: 1000;
    font-size: 0.9em;
}

.scrolling-text-wrapper {
    overflow: hidden;
    white-space: nowrap;
}

.scrolling-text {
    display: inline-block;
    padding-left: 100%;
    animation: scrollText 20s linear infinite;
}

@keyframes scrollText {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-100%);
    }
}

.wrapper {
    height: 100%;
    width: 100%;
    overflow-y: auto;
    scroll-snap-type: y proximity;
    -webkit-overflow-scrolling: touch;
    margin-top: var(--notification-bar-height);
    box-sizing: border-box;
}

.countdown-container.show+.wrapper {
    margin-top: var(--wrapper-margin-top);
}

.section {
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 16px;
    color: var(--primary-color);
    padding: 2rem;
    scroll-snap-align: start;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.section.loaded {
    opacity: 1;
    transform: translateY(0);
}

h1 {
    font-family: 'Noto Serif SC', serif;
    font-size: 2em;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

#greeting-section {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

#countdown-section {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
}

#capsule-section {
    background: repeating-linear-gradient(45deg,
            #f0f0f0,
            #f0f0f0 10px,
            #ffffff 10px,
            #ffffff 20px);
}

#congrats-section {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: white;
}

.countdown-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.75rem;
    font-size: 1rem;
    color: var(--primary-color);
    z-index: 100;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    transform: translateY(-100%);
}

.countdown-container.show {
    transform: translateY(0);
}

.countdown-timer {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    line-height: 1.5;
    padding: 0.5rem;
}

.countdown-timer span {
    display: inline-block;
    min-width: 50px;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.9em;
    box-sizing: border-box;
}

#capsule-form {
    max-width: 500px;
    width: 90%;
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-sizing: border-box;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: bold;
    color: var(--primary-color);
}

input,
textarea {
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

input:focus,
textarea:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
    outline: none;
}

button[type="submit"] {
    background: var(--secondary-color);
    color: white;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

button[type="submit"]:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.success-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    z-index: 1000;
    display: none;
    max-width: 90%;
    width: auto;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.success-modal.show {
    display: block;
    opacity: 1;
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.320, 1.275);
}

.checkmark {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--success-color);
    margin: 0 auto 1rem;
    position: relative;
    box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.2);
}

.checkmark::after {
    content: '';
    position: absolute;
    left: 23px;
    top: 35px;
    width: 18px;
    height: 35px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
    animation: drawCheck 0.4s cubic-bezier(0.650, 0.000, 0.450, 1.000) forwards;
}

.modal-button {
    background: var(--success-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.modal-button:hover {
    background: #43a047;
    transform: translateY(-2px);
}

@keyframes slideIn {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes drawCheck {
    0% {
        height: 0;
        width: 0;
        opacity: 1;
    }

    20% {
        height: 0;
        width: 15px;
        opacity: 1;
    }

    100% {
        height: 30px;
        width: 15px;
        opacity: 1;
    }
}

@media (min-width: 769px) {
    h1 {
        font-size: 2.5rem;
    }

    .countdown-timer span {
        min-width: 60px;
        padding: 0.8rem;
        font-size: 1.2em;
    }

    .success-modal {
        max-width: 400px;
        width: 90%;
    }

    .checkmark {
        width: 80px;
        height: 80px;
    }

    .checkmark::after {
        left: 25px;
        top: 40px;
        width: 25px;
        height: 50px;
    }
}

#hitokoto {
    font-size: 1.4rem;
    /* Larger font size */
    font-style: italic;
    margin-bottom: 0.5rem;
    min-height: 2.4em;
    word-wrap: break-word;
    /* Allow line breaks */
}

#hitokoto-english {
    font-size: 1.2rem;
    /* Larger font size */
    font-style: italic;
    color: #777;
    margin-bottom: 1rem;
    min-height: 1.8em;
    word-wrap: break-word;
    /* Allow line breaks */
}

.capsule-saved-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    z-index: 1001;
    display: none;
    max-width: 90%;
    width: auto;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.capsule-saved-modal.show {
    display: block;
    opacity: 1;
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.320, 1.275);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.overlay.show {
    display: block;
}