:root {
    --text: #fff;
    --text-soft: rgba(255, 255, 255, 0.7);
    --glass: rgba(15, 15, 20, 0.35);
    --glass-focus: rgba(15, 15, 20, 0.5);
    --line: rgba(255, 255, 255, 0.18);
    --line-focus: rgba(255, 255, 255, 0.55);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "DM Sans", Arial, sans-serif;
    color: var(--text);
    background:
        linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.6)),
        url("images/background.webp") center / cover no-repeat fixed;
}

header {
    padding: 32px 24px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    opacity: 0;
    animation: fade 1.2s var(--ease) 0.2s forwards;
}

main {
    flex: 1;
    width: min(100% - 48px, 720px);
    margin: 0 auto;
    padding: 6vh 0 12vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 28px;
}

#date {
    color: var(--text-soft);
    font-size: 1rem;
    letter-spacing: 0.04em;
    opacity: 0;
    animation: fade 1s var(--ease) 0.4s forwards;
}

#prompt {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 300;
    font-size: clamp(2.2rem, 6vw, 3.8rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-wrap: balance;
    margin-bottom: 12px;
}

#prompt .word {
    display: inline-block;
    opacity: 0;
    filter: blur(10px);
    transform: translateY(0.3em);
    animation: word-in 1s var(--ease) forwards;
    animation-delay: calc(0.7s + var(--i) * 0.09s);
}

#journal {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0;
    animation: rise 1s var(--ease) 1.9s forwards;
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), filter 0.6s var(--ease);
}

.field {
    width: min(100%, 520px);
}

#response {
    display: block;
    width: 100%;
    min-height: 56px;
    max-height: 40vh;
    padding: 16px 28px;
    resize: none;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 28px;
    outline: none;
    font: inherit;
    font-size: 1.05rem;
    line-height: 1.5;
    text-align: center;
    color: var(--text);
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: border-color 0.4s var(--ease), background 0.4s var(--ease),
        box-shadow 0.4s var(--ease), height 0.2s var(--ease);
}

#response::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#response:focus {
    border-color: var(--line-focus);
    background: var(--glass-focus);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.07), 0 20px 50px rgba(0, 0, 0, 0.35);
}

#submit {
    padding: 14px 34px;
    border: none;
    border-radius: 9999px;
    font: inherit;
    font-weight: 500;
    color: #15151a;
    background: #fff;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), box-shadow 0.3s var(--ease);
}

#journal.has-text #submit {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

#submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.25);
}

#submit:active {
    transform: scale(0.97);
}

button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

main.done #prompt,
main.done #journal {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(-12px);
    pointer-events: none;
    animation: none;
}

#thanks {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: thanks-in 1.5s var(--ease) both;
}

#thanks[hidden] {
    display: none;
}

#thanks h2 {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 3.2rem);
}

#thanks p {
    color: var(--text-soft);
    font-size: 1.1rem;
}

@keyframes fade {
    to {
        opacity: 1;
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes word-in {
    to {
        opacity: 1;
        filter: blur(0);
        transform: none;
    }
}

@keyframes thanks-in {
    from {
        opacity: 0;
        filter: blur(10px);
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        filter: blur(0);
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
    }
}