/* 1. Reset and Hide Unwanted Elements */
#imap, br { display: none !important; }

/* 2. Main Form Layout - Forces Buttons to Bottom */
form[action*="quizScore.php"] {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 900px !important;
    margin: 0 auto !important;
    font-family: 'Segoe UI', Arial, sans-serif;
}

/* Reorder: Game (1), Instructions (2), Buttons (3) */
.dragScriptContainer { 
    order: 1 !important; 
    display: flex !important; 
    flex-wrap: wrap !important; 
    gap: 20px; 
    width: 100% !important;
}
p { order: 2 !important; text-align: center; margin: 20px 0; color: #555; }
.myfooter, div[align="center"] { 
    order: 3 !important; 
    display: flex !important; 
    justify-content: center !important; 
    gap: 20px !important; 
    padding-bottom: 40px; 
}

/* 3. The Grid Layout (Perfect Alignment) */
#questionDiv {
    flex: 1 1 450px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

/* Force Year and Target to be ONE solid row */
#questionDiv > div {
    display: grid !important;
    grid-template-columns: 100px 1fr !important; /* Year is 100px, Target is the rest */
    height: 55px !important; /* Fixed height so they never change size */
    align-items: stretch !important;
    margin: 0 !important;
}

/* Year Box */
.dragDropSmallBox[id^="questCont"] {
    grid-column: 1 !important;
    width: 100% !important;
    height: 100% !important;
    background: #222 !important;
    color: #fff !important;
    font-size: 1.2rem !important;
    font-weight: bold;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 4px 0 0 4px;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
}

/* Target Box */
.destinationBox {
    grid-column: 2 !important;
    width: 100% !important;
    height: 100% !important;
    background: #f4f4f4 !important;
    border: 2px dashed #ccc !important;
    border-left: none !important;
    border-radius: 0 4px 4px 0;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
    box-sizing: border-box !important;
}

/* 4. Answer Bank (Right Side) */
#answerDiv {
    flex: 1 1 300px !important;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    height: fit-content !important;
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
}

/* Draggable Items */
.dragDropSmallBox {
    background: #e63946 !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 4px;
    font-weight: 600;
    cursor: grab;
    text-align: center;
    z-index: 1000;
    /* Ensure they don't resize when dropped */
    box-sizing: border-box !important;
    height: auto !important; 
    min-height: 35px !important;
}

/* When inside the destination, force full width/height minus margin */
.destinationBox .dragDropSmallBox {
    width: 96% !important;
    height: 90% !important;
    margin: 2% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* 5. Mobile Fixes */
@media (max-width: 768px) {
    .dragScriptContainer { flex-direction: column !important; }
    #questionDiv, #answerDiv { width: 100% !important; flex: none !important; }
}

/* 6. Button Styling */
input[type="submit"], input[type="button"] {
    padding: 12px 30px !important;
    border-radius: 4px !important;
    border: none !important;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
}
input[type="submit"] { background: #198754 !important; color: white !important; }
input[type="button"] { background: #6c757d !important; color: white !important; }