/* --- CUSTOMTKINTER DARK THEME EMULATION --- */
:root {
    --zoom: 1.0; /* Controlled dynamically by JavaScript later */
    --bg-color: #1a1a1a;
    --card-bg: #242424;
    --btn-default: #333333;
    --btn-selected: #5a5a5a;
    --btn-primary: #1f538d;
    --btn-primary-hover: #2a69a0;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    -webkit-user-select: none;
    user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollable main panel container */
.main-scroll {
    width: 100%;
    max-width: 800px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.screen-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* --- SETUP SCREEN ELEMENTS --- */
h1 {
    font-family: Georgia, serif;
    font-size: 32px;
    font-weight: bold;
    margin-top: 40px;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.logo-placeholder {
    width: 140px;
    height: 140px;
    margin-bottom: 20px;
    background-image: url('Bible_Data/logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.form-group label {
    font-size: 16px;
    margin-bottom: 8px;
}

select {
    background-color: var(--card-bg);
    color: var(--text-main);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    width: 200px;
    cursor: pointer;
    outline: none;
}

/* --- STANDARD CUSTOMTKINTER BUTTONS --- */
.ctk-btn {
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.primary-btn {
    background-color: var(--btn-primary);
    color: white;
    font-size: 16px;
    height: 50px;
    width: 200px;
    margin-bottom: 10px;
}
.primary-btn:hover { background-color: var(--btn-primary-hover); }

.secondary-btn {
    background-color: #3e3e3e;
    color: white;
    font-size: 14px;
    height: 40px;
    width: 200px;
}
.secondary-btn:hover { background-color: #4f4f4f; }

/* --- GAME SCREEN ELEMENTS --- */
h2 {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 2px;
}

.hint-text {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Solved Category Boxes (grow in height if zoomed text needs more room) */
#solved-frame {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 5px;
}

.solved-box {
    width: calc(590px * var(--zoom));
    min-height: calc(90px * var(--zoom));
    border-radius: 6px;
    color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

.solved-text-content {
    font-size: calc(14px * var(--zoom));
    text-align: center;
    width: 100%;
    line-height: 1.3;
    overflow: hidden;
}

/* 4x4 Interactive Grid */
#grid-frame {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 5px 0;
}

.grid-btn {
    width: calc(140px * var(--zoom));
    height: calc(90px * var(--zoom));
    font-size: calc(14px * var(--zoom));
    font-weight: bold;
    background-color: var(--btn-default);
    color: var(--text-main);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    transition: background-color 0.1s;
}
@media (hover: hover) {
.grid-btn:hover { background-color: #404040; } }
.grid-btn.selected { background-color: var(--btn-selected); }

/* Bottom Control Row */
.ctrl-frame {
    display: flex;
    gap: 20px;
    margin: 10px 0;
}

.action-btn {
    background-color: var(--btn-primary);
    color: white;
    width: 90px;
    height: 35px;
    font-size: 14px;
}
.action-btn:hover:not(:disabled) { background-color: var(--btn-primary-hover); }
.action-btn:disabled {
    background-color: #2e3b4e;
    color: #707070;
    cursor: not-allowed;
}

/* Message Feedback & Lives Display */
.msg-text {
    font-size: 16px;
    font-weight: bold;
    height: 24px;
    margin-bottom: 4px;
}
.status-green { color: #2ecc71; }
.status-orange { color: #e67e22; }
.status-red { color: #e74c3c; }

.lives-text {
    font-size: 16px;
    margin-bottom: 15px;
}

/* Zoom Adjustments */
.zoom-frame {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.zoom-btn {
    background-color: #333;
    color: white;
    width: 70px;
    height: 30px;
    font-size: 13px;
}
.zoom-btn:hover { background-color: #444; }

/* Hint text (plain: no box, no color coding) */
#hint-area {
    width: calc(590px * var(--zoom));
    max-width: 100%;
    font-size: calc(14px * var(--zoom));
    line-height: 1.4;
    text-align: center;
    color: var(--text-main);
    margin-bottom: 20px;
}
#hint-area:empty { display: none; }

/* --- Fluid Grid Controls (Triggers whenever the window gets narrow) --- */
@media (max-width: 650px) {
    #grid-frame {
        gap: 6px; /* Tighter gaps when small */
    }

    .grid-btn {
        height: auto !important;     /* Unlocks the rigid desktop height */
        aspect-ratio: 1 / 1;         /* Forces the boxes to become perfectly square */

        /* Scales with the zoom buttons: 20px * 0.7 default zoom = 14px */
        font-size: calc(20px * var(--zoom)) !important;
        padding: 4px;

        /* Forces text to wrap if it hits the wall */
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
}

@media (max-width: 650px) {
    /* Make room for the 4th control button */
    .ctrl-frame { gap: 8px; }
    .action-btn { width: auto; min-width: 70px; padding: 0 10px; font-size: 13px; }
}

/* --- How To Play Modal --- */
#how-to-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #2b2b2b;
    color: #ffffff;
    padding: 30px 40px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    text-align: left;
}

.modal-content h2 { margin-bottom: 15px; }

.close-btn {
    position: absolute;
    top: 15px; right: 20px;
    color: #aaaaaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-btn:hover { color: #ffffff; }

.modal-content ul { padding-left: 20px; line-height: 1.6; font-size: 1.05rem; }
.modal-content li { margin-bottom: 12px; }

.credits { margin-top: 25px; font-style: italic; color: #aaaaaa; font-size: 0.9rem; }

a.ctk-btn {
    text-decoration: none;
}

#other-games-btn {
    margin-top: 30px;
}