/* =========================================
   Base Styles & Resets
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f7f6; /* Light, soft background */
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* =========================================
   Shared Elements (Header, Footer, Buttons)
   ========================================= */
header {
    background-color: #a8d8ea; /* Soft blue */
    color: #fff;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

main {
    flex-grow: 1; /* Pushes footer down */
    padding: 2rem 1rem;
    max-width: 900px;
    margin: 0 auto; /* Center content */
    width: 100%;
}

.intro-text {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    color: #555;
}

footer {
    background-color: #e0e0e0; /* Light grey */
    color: #555;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem; /* Space above footer */
    font-size: 0.9rem;
}

.disclaimer {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #777;
}
.disclaimer strong {
    color: #555;
}

.button {
    display: inline-block;
    background-color: #3498db; /* Primary button blue */
    color: #fff;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
    margin-top: auto; /* Pushes button to bottom in flex container (default) */
}

.button:hover {
    background-color: #2980b9; /* Darker blue on hover */
}

.back-button {
    background-color: #aaa;
    margin-top: 2rem;
    display: block; /* Make it block level for centering */
    width: fit-content; /* Size to content */
    margin-left: auto;
    margin-right: auto;
}
.back-button:hover {
    background-color: #888;
}

/* =========================================
   Front Page Specific Styles
   ========================================= */
.front-page-main .choice-container {
    display: flex;
    justify-content: space-around; /* Adjust to space-evenly or space-between if preferred */
    gap: 1.5rem;
    flex-wrap: wrap;
}

.choice-box {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    /* Default to 2 columns, adjusted by media queries */
    flex-basis: calc(50% - 1.5rem);
    min-width: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.choice-box h2 {
    color: #3498db;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.choice-box p {
    margin-bottom: 1.5rem;
    flex-grow: 1;
    color: #555;
}

.choice-icon {
    width: 50px;
    height: 50px;
    background-color: #eee;
    border-radius: 50%;
    margin-bottom: 1rem;
}
.comfort-icon { background-color: #eaf6fa; }
.rate-icon { background-color: #fdebd0; }
.release-icon { background-color: #d5e8d4; }
.generator-icon { background-color: #fff0b3; }
.arcade-icon { background-color: #ffd966; /* Retro gold/yellow */ }

.external-resources {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.external-resources h3 {
    margin-bottom: 1rem;
    font-weight: 500;
    color: #555;
    font-size: 1.2rem;
}

.external-resources ul {
    list-style: none;
    padding: 0;
}

.external-resources li {
    margin-bottom: 0.5rem;
}

.external-resources a {
    color: #3498db;
    text-decoration: none;
    font-size: 1.1rem;
}

.external-resources a:hover {
    text-decoration: underline;
}


/* =========================================
   Comfort Page Specific Styles
   ========================================= */
.comfort-main {
    text-align: center;
}

#visual-element {
    height: 350px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background-color: #333;
}

#visual-element video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(-50%, -50%);
    z-index: 1;
}

#audio-controls h2, #affirmations h2, #extra-comfort-links h2 {
    margin-bottom: 1rem;
    color: #555;
    font-weight: 400;
    font-size: 1.4rem;
}

#audio-controls audio {
    width: 100%;
    max-width: 400px;
    margin-bottom: 1rem;
}
.audio-buttons button {
    margin: 0.3rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border: 1px solid #ccc;
    background-color: #fff;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.audio-buttons button:hover {
    background-color: #eee;
}

#affirmations {
    margin: 2.5rem 0;
    min-height: 3em;
}

#affirmation-text {
    font-size: 1.3rem;
    color: #6a7a8a;
    font-style: italic;
    transition: opacity 0.3s ease-in-out;
}

#extra-comfort-links ul {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}
#extra-comfort-links li {
    margin-bottom: 0.5rem;
}
#extra-comfort-links a {
    color: #3498db;
    text-decoration: none;
}
#extra-comfort-links a:hover {
    text-decoration: underline;
}

/* =========================================
   Rate Cry Page Specific Styles
   ========================================= */
.rate-cry-main fieldset {
    margin-bottom: 1.5rem;
    border: 1px solid #ccc;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    background-color: #fff;
}

.rate-cry-main legend {
    font-weight: bold;
    padding: 0 0.5rem;
    color: #333;
    font-size: 1.1rem;
}

.rate-cry-main label {
    display: block;
    margin-bottom: 0.7rem;
    cursor: pointer;
}
.rate-cry-main input[type="radio"],
.rate-cry-main input[type="checkbox"] {
    margin-right: 0.5rem;
    vertical-align: middle;
}
.rate-cry-main select {
    padding: 0.5rem;
    margin-top: 0.3rem;
    min-width: 200px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

#results-area {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #eaf6fa;
    border: 1px solid #a8d8ea;
    border-radius: 4px;
    text-align: center;
}
#results-area h2 {
    margin-bottom: 0.7rem;
    color: #2c7aa5;
}
#results-area p strong {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

/* =========================================
   Release Page Specific Styles
   ========================================= */
.release-main {
    text-align: center;
}

#release-area {
    max-width: 600px;
    margin: 1rem auto 2rem auto;
}

#release-text {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 1rem;
    line-height: 1.5;
    resize: vertical;
    transition: opacity 0.7s ease-out,
                transform 0.7s ease-in-out,
                filter 0.7s ease-in-out;
    opacity: 1;
    transform: scale(1) translateY(0) rotate(0deg);
    filter: blur(0px);
}

#release-text.effect-fade {
    opacity: 0;
    transform: scale(0.95);
}
#release-text.effect-fly {
    opacity: 0;
    transform: translateY(-150px) rotate(15deg) scale(0.7);
}
#release-text.effect-crumple {
    opacity: 0;
    transform: scale(0.1);
    filter: blur(5px);
}

.release-button-style {
    background-color: #5cb85c;
    margin-top: 0;
}
.release-button-style:hover {
    background-color: #4cae4c;
}
.release-button-style:disabled {
    background-color: #9add9a;
    cursor: not-allowed;
}

.confirmation-message {
    color: #5cb85c;
    font-weight: bold;
    margin-top: -1rem;
    margin-bottom: 1rem;
    transition: opacity 0.5s ease-in-out;
}

/* =========================================
   Generator Page Specific Styles
   ========================================= */
.generator-main {
    text-align: center;
}

#generator-area {
    margin: 2rem auto;
}

.generate-button-style {
    background-color: #f0ad4e;
    margin-bottom: 1.5rem;
    margin-top: 0;
}
.generate-button-style:hover {
    background-color: #ec971f;
}

#reason-display {
    min-height: 5em;
    padding: 1.5rem;
    background-color: #fff9e6;
    border: 1px dashed #f0ad4e;
    border-radius: 4px;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#reason-display p {
    font-size: 1.2rem;
    color: #555;
    font-style: italic;
}

/* =========================================
   Arcade Page Specific Styles
   ========================================= */
.arcade-main {
    text-align: center;
}

.game-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 2rem;
    margin-top: 2rem;
}

.game-item {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    flex-basis: calc(33.333% - 2rem); /* Default to 3 columns */
    min-width: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-item h2 {
    color: #3498db;
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
}

.game-item p {
    margin-bottom: 1.5rem;
    flex-grow: 1;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

.game-icon {
    width: 50px;
    height: 50px;
    background-color: #eee;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.minesweeper-icon { background-color: #c0c0c0; }
.snake-icon { background-color: #90ee90; }
.tetris-icon { background-color: #add8e6; }

.game-button {
    background-color: #5cb85c;
    width: 80%;
    max-width: 250px;
    margin-top: auto; /* Ensure button is at the bottom */
}
.game-button:hover {
    background-color: #4cae4c;
}

/* =========================================
   Contact Page Styles
   ========================================= */
.contact-main {
    max-width: 700px;
    margin: 0 auto;
}

#contact-form {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #444;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.recaptcha-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

#submit-button { /* For contact form */
    background-color: #5cb85c;
    width: 100%;
    padding: 0.9rem 1.5rem;
    font-size: 1.1rem;
    margin-top: 0; /* Override general button margin-top:auto */
}
#submit-button:hover {
    background-color: #4cae4c;
}
#submit-button:disabled {
    background-color: #a3d3a3;
    cursor: not-allowed;
}

.form-status-message {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    /* display: none; JS will handle display */
}
.form-status-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    /* display: block; JS will handle display */
}
.form-status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    /* display: block; JS will handle display */
}

.footer-link {
    color: #555;
    text-decoration: none;
}
.footer-link:hover {
    text-decoration: underline;
    color: #3498db;
}


/* =========================================
   Utility Classes
   ========================================= */
.hidden { /* For quiz results area, handled by JS */
    display: none;
}
.visually-hidden { /* For JS-controlled opacity hiding like release confirmation */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out; /* Added transition here for consistency */
}

/* =========================================
   Responsive Styles
   ========================================= */

/* Index Page Choice Boxes Layout */
@media (min-width: 1200px) {
    .front-page-main .choice-container {
        justify-content: center;
    }
    .front-page-main .choice-box {
        flex-basis: calc(20% - 1.5rem);
        min-width: 200px;
    }
}
@media (min-width: 900px) and (max-width: 1199.98px) {
     .front-page-main .choice-box {
        flex-basis: calc(33.333% - 1.2rem);
    }
}

/* General Responsive */
@media (max-width: 899.98px) { /* This will make it 2 columns before 768px stacks them */
    .front-page-main .choice-box {
        flex-basis: calc(50% - 1.5rem);
    }
}

@media (max-width: 768px) {
    .front-page-main .choice-container {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    .front-page-main .choice-box { /* Now this applies when stacked */
        flex-basis: 90%;
        max-width: 400px;
    }
    main {
        padding: 1.5rem 0.5rem;
    }
    #visual-element {
        height: 250px;
    }
    .external-resources {
        margin-top: 2.5rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Arcade Page Game List Responsive */
@media (max-width: 960px) {
    .game-item {
        flex-basis: calc(50% - 1.5rem);
    }
}
@media (max-width: 600px) {
    .game-item {
        flex-basis: 90%;
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    .button, .game-button, #submit-button { /* Ensure all main action buttons are included */
        padding: 0.7rem 1.3rem;
        font-size: 1rem;
        width: 90%;
        max-width: 300px;
    }
    .back-button {
         width: auto;
         max-width: 200px;
    }
    #visual-element {
        height: 200px;
    }
    .choice-box h2, .game-item h2 {
        font-size: 1.2rem;
    }
    .rate-cry-main fieldset {
        padding: 1rem 1rem;
    }
    #reason-display p {
        font-size: 1.1rem;
    }
}