/* 2024-08-03: Overhauled stylesheet for responsive layout as per Task 4.3. */

/* --- General Body and Structure (Mobile-First) --- */
body {
    font-family: 'Courier New', Courier, monospace;
    background-color: #000;
    color: #00ff00;
    margin: 0;
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 900px;
}

.header-image {
    width: 60%;
    max-width: 250px;
    height: auto;
    margin-bottom: 1rem;
}

.game-container {
    border: 2px solid #00ff00;
    padding: 1.5rem;
    width: 100%;
    margin-bottom: 2rem;
    box-sizing: border-box;
}

h1 { text-transform: uppercase; letter-spacing: 3px; }

/* --- Buttons --- */
.game-selection, .nav-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.button, button {
    background-color: transparent;
    border: 1px solid #00ff00;
    color: #00ff00;
    padding: 12px 25px;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    margin: 5px;
    min-width: 200px;
}

.button:hover, button:hover { background-color: #00ff00; color: #000; }

/* --- Game-Specific --- */
#hangman-image-container{width:150px;height:150px;margin:1rem auto;border:1px dashed #00ff00}
#hangman-image-container img{width:100%;height:100%;object-fit:contain}
#word-display{letter-spacing:10px;font-size:1.5rem;margin:1rem 0;min-height:50px}
#keyboard{display:grid;grid-template-columns:repeat(auto-fit,minmax(40px,1fr));gap:5px;max-width:600px;margin:1rem auto}
#keyboard button {min-width: unset;padding: 10px 5px;font-size: 1.2rem;}
#ttt-grid{display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);width:80vw;max-width:300px;aspect-ratio:1/1;gap:5px;margin:1rem auto}
#ttt-grid .cell{border:2px solid #00ff00;display:flex;justify-content:center;align-items:center;font-size:clamp(2rem,10vw,4rem);cursor:pointer}
#c4-grid{display:grid;grid-template-columns:repeat(7,1fr);grid-template-rows:repeat(6,1fr);aspect-ratio:7/6;width:90vw;max-width:400px;background-color:#00008b;border:5px solid #0000cd;gap:5px;margin:1rem auto;padding:5px}
#c4-grid .cell{background-color:#000;border-radius:50%;cursor:pointer}

/* --- Signal/Instruction Images --- */
.instruction-image-container {
    width: 100%;
    max-width: 450px;
    margin: 1.5rem auto;
    border: 1px dashed #00ff00;
    padding: 5px;
    box-sizing: border-box;
}
.instruction-image-container img {width: 100%;height: auto;display: block;}

/* --- Microwave Steganography Tool --- */
#microwave-container {display: flex;flex-direction: column;gap: 1.5rem;}

/* FIXED: Box tightly hugs the canvas and removes the top margin */
.image-container {max-width: 100%;width: fit-content;margin: 0 auto 1rem auto;border: 2px dashed #00ff00;box-sizing: border-box;padding: 0;}

.image-container canvas {
    max-width: 100%;
    max-height: 50vh; /* Stops it from being taller than 50% of the screen */
    width: auto;
    height: auto;
    object-fit: contain; /* Ensures the whole image stays visible */
    display: none;
    margin: 0 auto; /* Centers it nicely */
}
#microwave-controls {display: flex;flex-direction: column;gap: 1rem;width: 100%;}
.control-group {display: flex;flex-direction: column;text-align: left;gap: 0.5rem;}
.control-group label {font-size: 1.1rem;font-weight: bold;}
#microwave-controls input[type="file"],#microwave-controls input[type="number"],#microwave-controls textarea {background-color: #111;border: 1px solid #00ff00;color: #00ff00;font-family: 'Courier New', Courier, monospace;font-size: 1.1rem;padding: 10px;width: 100%;box-sizing: border-box;}
#microwave-controls textarea {min-height: 150px;resize: vertical;}
#microwave-controls #process-button {margin-top: 1rem;padding: 15px;font-size: 1.2rem;font-weight: bold;}

/* --- Support Images (General) --- */
.support-images-container {display: flex;flex-wrap: wrap;justify-content: center;gap: 1rem;margin-top: 2rem;}
.support-image {width: 100px;height: auto;object-fit: contain;border: 1px dashed #00ff00;padding: 5px;box-sizing: border-box;}

/*
==============================================
--- CREATE PAGE OVERRIDE STYLES ---
==============================================
*/
.create-page .header-frame {
    width: 50vw;
    max-width: 170px;
    /* --- BORDER AND PADDING PURGED --- */
    padding: 0;
    border: none;
    background-color: transparent;
    margin: 0 auto 1.5rem auto; /* Tightened margin */
}

.create-page .header-picture {
    width: 100%;
    height: auto;
    display: block;
}

.create-page h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 5px #00ff00;
}

.create-page .game-container {
    border: 2px solid #00ff00;
    padding: 1.5rem;
    max-width: 800px; 
    margin: 0 auto;
    background-color: #0a0a0a;
}

.create-page #create-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.create-page #create-form input[type="text"],
.create-page #create-form textarea {
    width: 100%;
    background-color: #111; 
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 15px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 1.3rem; 
}

/* --- Split Layout for Burn and Message --- */
.split-layout {
    display: flex;
    flex-direction: column; 
    gap: 15px;
    width: 100%;
}

.create-page #create-form textarea {
    min-height: 120px;
    resize: vertical;
    height: 100%;
}

/* --- New Burn Section UI --- */
.burn-section {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    border: 2px dashed #00ff00;
    padding: 15px;
    box-sizing: border-box;
    background-color: #050505;
}

.burn-label {
    font-size: 3em;
    font-weight: bold;
    margin-right: 25px;
}

.burn-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

.radio-label {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid #00ff00;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    cursor: pointer;
    background-color: #000;
}

.radio-label input[type="radio"]:checked::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background-color: #00ff00;
    border-radius: 50%;
}

.inline-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.create-page #create-form .inline-input-row input[type="number"] {
    width: 80px;
    background-color: #111;
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 8px;
    text-align: center;
    font-family: inherit;
    font-size: 1.2rem;
}

/* --- Button Container to Prevent Full Width --- */
.button-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

.create-page #create-form button {
    width: auto;
    min-width: 250px; 
    background-color: #000;
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 15px 30px;
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s;
}

.create-page .support-images-container {
    margin-top: 1rem;
}

/* --- DESKTOP RULES (min-width: 769px) --- */
@media (min-width: 769px) {
    /* General Desktop Layout */
    .game-selection, .nav-buttons {
        flex-direction: row;
        justify-content: center;
    }

    /* Create Page Desktop Overrides */
    .create-page .header-frame {
        max-width: 220px;
    }

    /* SIDE BY SIDE BURN AND MESSAGE */
    .split-layout {
        flex-direction: row;
        align-items: stretch;
    }

    .burn-section {
        flex: 1; /* Takes half the space */
    }

    .create-page #create-form textarea {
        flex: 1; /* Takes the other half */
    }

    /* !! GLOBAL SUPPORT IMAGE FIX !! */
    /* This forces them to the top corners on ANY page using this CSS */
    .support-images-container {
        position: static; 
    }

    .support-image {
        position: fixed; 
        top: 20px;
        width: 250px; 
        border: 2px solid #00ff00;
        background-color: #000;
        z-index: 9999;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .support-image:hover {
        transform: scale(1.4); 
        box-shadow: 0 0 25px #00ff00;
    }

    /* Left Image (Chime) */
    .support-image:first-child {
        left: 20px;
        right: auto;
    }

    /* Right Image (CashApp) */
    .support-image:last-child {
        right: 20px;
        left: auto;
    }
}