/* General Body and Animated Background */
body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column; 
    justify-content: flex-start; 
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #333;
    background: linear-gradient(45deg, #a1c4fd, #c2e9fb, #d4a7f0);
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
}

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

h1 {
    color: #4a6fa5;
    margin-top: 60px; 
    margin-bottom: 20px;
    font-size: 2.2em;
    text-align: center;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
}

/* Main Content Container */
.container {
    background-color: rgba(255, 255, 255, 0.85);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    text-align: center;
    width: 95%;
    max-width: 550px;
    margin-bottom: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dedicated space for the text to appear and rise */
#displayedTextContainer {
    min-height: 120px; 
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
    overflow: visible;
}

/* Line-block wraps each row for smooth vertical collapse */
.line-block {
    display: block;
    width: 100%;
    max-height: 200px;
    opacity: 1;
    transition: max-height 0.8s ease, opacity 0.8s ease, margin 0.8s ease;
}

.line-block.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

/* Individual fading letters */
.submitted-text span {
    display: inline-block;
    white-space: pre; 
    font-size: 2.2em;
    font-weight: bold;
    color: #333;
    opacity: 1;
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.submitted-text span.fade-out {
    opacity: 0;
    transform: translateY(-20px); 
}

/* Input Area */
.input-area {
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 20px;
}

textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #c9d2d9;
    border-radius: 8px;
    font-size: 1.1em;
    height: 100px;
    resize: none;
    box-sizing: border-box;
    background: white;
}

button {
    background-color: #8bbbcc;
    color: white;
    padding: 14px 40px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover { background-color: #72a4b8; }

/* Explainer Text */
.explainer-text {
    color: #555;
    font-size: 0.95em;
    text-align: left;
    max-width: 600px;
    margin-top: 20px;
    padding: 0 20px 20px 20px; 
    line-height: 1.6;
}

/* Subtle Footer Styling */
footer {
    margin-top: auto; /* Pushes footer to bottom of content stack */
    padding: 20px 0 40px 0;
    font-size: 0.8rem;
    color: #888;
    text-align: center;
}

footer a {
    color: inherit;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    h1 { font-size: 1.8em; margin-top: 30px; }
    .submitted-text span { font-size: 1.6em; }
    #displayedTextContainer { min-height: 80px; }
}