/* --- CONFIGURATION GLOBALE --- */
:root {
    --bg-color: #121812;      /* Noir forêt très sombre */
    --panel-bg: rgba(27, 36, 27, 0.72); /* Panneau laissant mieux voir le fond */
    --primary: #4e6e4e;       /* Vert kaki militaire */
    --accent: #7ca97c;        /* Vert lumineux / Vision nocturne */
    --text: #e2e8e2;          /* Blanc cassé */
    --correct: #2e6930;       /* Vert succès tactique */
    --incorrect: #7a2424;     /* Rouge alerte */
    --disabled: #2d382d;
}

body {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--bg-color);
    

    background-image: url('../public/images/45666.jpg');
    background-size: COVER;                /* L'image s'ajuste à tout l'écran */
    background-position: center;           /* L'image reste centrée */
    background-repeat: no-repeat;          /* Empêche l'image de se répéter */
    background-attachment: fixed;          /* L'image reste fixe lors du défilement */

    
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 800px;
    background: var(--panel-bg);
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(78, 110, 78, 0.4);
    border-radius: 8px;
    padding: 30px;
    box-sizing: border-box;
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.close-app {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 32px;
    height: 32px;
    padding: 0;
    background: red;
    border: 1px solid var(--primary);
    border-radius: 4px;
    color: var(--accent);
    font: bold 1.1rem/1 inherit;
    cursor: pointer;
}

.close-app:hover,
.close-app:focus-visible {
    background: red;
    border-color: #ff4d4d;
    color: #fff;
}

.admin-access {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 2;
    width: 32px;
    height: 32px;
    box-sizing: border-box;
    padding: 0;
    background: red;
    border: 1px solid var(--primary);
    border-radius: 4px;
    color: var(--accent);
    font: 1.2rem/1 sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-access:hover,
.admin-access:focus-visible {
    background: red;
    color: #000;
}

.app-closed {
    color: red;
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
    padding-top: 20vh;
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 25px;
    width: 100%;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.auth-tab,
.account-bar button {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--text);
    font: inherit;
    padding: 10px;
    cursor: pointer;
}

.auth-tab.active,
.auth-tab:hover,
.account-bar button:hover {
    background: var(--primary);
    color: #000;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.auth-form label {
    color: var(--accent);
    margin-top: 8px;
}

.auth-form input,
.auth-form select,
.auth-form textarea {
    width: 100%;
    box-sizing: border-box;
    background: #000;
    border: 1px solid var(--primary);
    color: var(--text);
    font: inherit;
    padding: 12px;
}

.auth-form textarea {
    min-height: 80px;
    resize: vertical;
}

.auth-form input::placeholder {
    color: #899489;
    opacity: 1;
}

.auth-form .btn-main {
    margin-top: 15px;
}

.auth-message {
    min-height: 1.4em;
    color: #ff8585;
    margin: 8px 0 0;
}

.hidden {
    display: none;
}

.account-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: var(--accent);
    font-size: 0.8rem;
    margin-bottom: 18px;
}

.account-bar button {
    padding: 6px 10px;
    white-space: nowrap;
}

#theme-screen .account-bar #logout-btn {
    transform: translateY(12px);
}

.account-summary-under {
    color: var(--accent);
    font-size: 0.8rem;
    margin: -18px 0 24px;
    text-align: center;
    overflow-wrap: anywhere;
}

.screen {
    display: none;
}
.screen.active {
    display: block;
}

h1 {
    color: var(--accent);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0;
    border-bottom: 2px dashed var(--primary);
    padding-bottom: 15px;
}

.brand-lockup {
    text-align: center;
}

.brand-lockup img {
    display: block;
    height: auto;
    margin: 0 auto 8px;
}

#auth-screen h1,
#theme-screen h1 {
    font-size: 1.5rem;
}

#question {
    font-size: 1.25rem;
    line-height: 1.5;
    margin-bottom: 25px;
    color: var(--text);
}

.subtitle {
    text-align: center;
    line-height: 1.6;
    margin-bottom: 30px;
    font-style: italic;
    color: var(--accent);
}

.badge {
    display: inline-block;
    background: var(--disabled);
    border: 1px solid var(--primary);
    padding: 5px 10px;
    font-size: 0.9rem;
    margin-bottom: 15px;
    color: var(--accent);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.theme-card {
    display: flex;
    flex-direction: column;
}

.theme-card input[type="number"] {
    background: #000;
    border: 1px solid var(--primary);
    color: var(--accent);
    font-family: inherit;
    padding: 5px;
    text-align: center;
    border-radius: 0 0 4px 4px;
    margin-top: -1px;
}

.global-card {
    grid-column: auto;
}

.btn-theme {
    background: rgba(45, 56, 45, 0.5);
    border: 1px solid var(--primary);
    color: var(--text);
    padding: 15px;
    font-family: inherit;
    font-size: 0.95rem;
    text-align: center;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: all 0.2s ease;
    width: 100%;
    flex-grow: 1;
}

.btn-theme:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 10px var(--accent);
}

.btn-theme.selected {
    background: var(--accent);
    color: var(--bg-color);
    font-weight: bold;
    border-color: #fff;
    box-shadow: 0 0 15px var(--accent);
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 25px;
}

.options-grid .btn {
    background: rgba(45, 56, 45, 0.5);
    border: 1px solid var(--primary);
    color: var(--text);
    padding: 15px 20px;
    font-family: inherit;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 100%;
}

.options-grid .btn:hover:not(:disabled) {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 10px var(--accent);
}

.options-grid .btn:disabled {
    cursor: not-allowed;
}

.options-grid .btn.correct {
    background: var(--correct) !important;
    color: #fff !important;
    border-color: #4ef054;
}

.options-grid .btn.incorrect {
    background: var(--incorrect) !important;
    color: #fff !important;
    border-color: #ff4d4d;
}

.btn-skip {
    margin-top: 15px;
    padding: 12px;
    background: transparent;
    color: #aaa;
    border: 1px dashed var(--primary);
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-skip:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-main {
    background: var(--accent);
    color: var(--bg-color);
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    letter-spacing: 1px;
    width: 100%; 
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-main:not(:disabled) {
    animation: clignotement 1.5s infinite ease-in-out;
}

.btn-main:hover:not(:disabled) {
    filter: brightness(1.2);
    animation-play-state: paused; 
    box-shadow: 0 0 20px var(--accent);
}

.btn-main:disabled {
    background: var(--disabled);
    color: #556655;
    cursor: not-allowed;
    animation: none; 
    box-shadow: none;
}

.result-box {
    text-align: center;
    padding: 25px;
    border: 2px solid var(--accent);
    background: rgba(124, 169, 124, 0.1);
    border-radius: 4px;
    margin-bottom: 25px;
}

.score-large {
    font-size: 3.5rem;
    font-weight: bold;
    color: #4ef054;
    margin: 15px 0;
    text-shadow: 0 0 15px rgba(78, 240, 84, 0.4);
}

.details-list {
    text-align: left;
    font-size: 1rem;
    margin: 20px auto;
    max-width: 400px;
    line-height: 1.8;
    border-top: 1px dashed var(--primary);
    padding-top: 15px;
}

.global-ranking {
    border: 1px solid var(--accent);
    background: rgba(124, 169, 124, 0.08);
    margin: 24px auto;
    padding: 16px 20px;
    max-width: 520px;
    color: #FFF;
    text-align: center;
}

.global-ranking h2 {
    color: #FFF;
    font-size: 1.1rem;
    margin: 0 0 12px;
}

.global-ranking ol {
    margin: 0;
    padding: 0;
    line-height: 1.8;
    list-style: none;
}

.global-ranking li {
    color: #FFF;
    font-weight: bold;
}

.review-section {
    border-top: 1px dashed var(--primary);
    margin: 24px auto;
    padding-top: 18px;
    text-align: left;
}

.review-section h2 {
    color: var(--accent);
    font-size: 1.1rem;
    margin: 0 0 14px;
}

.review-item {
    border-left: 4px solid var(--primary);
    background: rgba(0, 0, 0, 0.25);
    margin-bottom: 10px;
    padding: 10px 12px;
    line-height: 1.5;
}

.review-item strong {
    display: block;
    margin-bottom: 4px;
}

.review-item.wrong {
    border-left-color: var(--incorrect);
}

.review-item.skipped {
    border-left-color: #d2ad4f;
}

.admin-summary {
    border: 1px solid var(--primary);
    color: var(--accent);
    padding: 12px;
    margin-bottom: 18px;
}

.admin-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 22px;
}

.admin-nav-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--text);
    font: inherit;
    padding: 11px 8px;
    cursor: pointer;
}

.admin-nav-btn:hover,
.admin-nav-btn.active {
    background: var(--primary);
    color: #000;
}

.admin-table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th,
.admin-table td {
    border-bottom: 1px solid var(--primary);
    padding: 10px 8px;
    vertical-align: middle;
}

.admin-table th {
    color: var(--accent);
    font-size: 0.85rem;
}

.admin-table td {
    overflow-wrap: anywhere;
}

.admin-section {
    margin-top: 30px;
    border-top: 1px dashed var(--primary);
    padding-top: 22px;
}

.admin-section h2 {
    color: var(--accent);
    font-size: 1.2rem;
    margin: 0 0 18px;
}

.admin-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-actions .btn-main {
    width: auto;
    flex: 1;
}

.admin-edit-btn,
.admin-delete-btn {
    font: inherit;
    padding: 6px 8px;
    cursor: pointer;
}

.admin-edit-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--accent);
    margin-right: 6px;
}

.admin-edit-btn:hover {
    background: var(--primary);
    color: #000;
}

.question-table {
    min-width: 680px;
    margin-top: 24px;
}

.admin-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.admin-results-header h2 {
    margin-bottom: 0;
}

.admin-delete-btn {
    background: transparent;
    border: 1px solid var(--incorrect);
    color: #ff8585;
    font: inherit;
    padding: 6px 8px;
    cursor: pointer;
}

.admin-delete-btn:hover {
    background: var(--incorrect);
    color: #fff;
}

@keyframes clignotement {
    0% { box-shadow: 0 0 5px rgba(124, 169, 124, 0.4); }
    50% { box-shadow: 0 0 20px rgba(124, 169, 124, 0.8); }
    100% { box-shadow: 0 0 5px rgba(124, 169, 124, 0.4); }
}

@media (max-width: 600px) {
    body {
        align-items: flex-start;
        padding: 10px;
    }

    .container {
        padding: 20px 14px;
        border-radius: 6px;
    }

    h1 {
        font-size: 1.35rem;
        letter-spacing: 1px;
        padding-bottom: 10px;
    }

    #auth-screen h1,
    #theme-screen h1 {
        font-size: 1.3rem;
    }

    #auth-screen .brand-lockup img {
        width: 84px;
    }

    #theme-screen .brand-lockup img {
        width: 110px;
    }

    h1 img {
        width: 52px;
        height: auto;
        vertical-align: middle;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .account-bar {
        align-items: flex-start;
        font-size: 0.7rem;
    }

    .account-bar span {
        max-width: 65%;
        overflow-wrap: anywhere;
    }

    .auth-tabs {
        gap: 5px;
    }

    .auth-tab {
        font-size: 0.78rem;
        padding: 10px 6px;
    }

    .theme-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 22px;
    }

    .global-card {
        grid-column: auto;
    }

    .btn-theme {
        min-height: 52px;
        padding: 12px 10px;
        font-size: 0.82rem;
    }

    .theme-card input[type="number"] {
        padding: 9px 5px;
    }

    .stats-grid {
        gap: 6px;
    }

    .badge {
        min-width: 0;
        padding: 5px 6px;
        font-size: 0.7rem;
    }

    #question {
        font-size: 1.05rem;
    }

    .options-grid .btn {
        padding: 14px 12px;
        font-size: 0.9rem;
    }

    .score-large {
        font-size: 2.7rem;
    }

    .result-box {
        padding: 18px;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    body {
        padding: 18px;
    }

    .container {
        max-width: 920px;
        padding: 28px;
    }

    .theme-grid {
        grid-template-columns: repeat(2, minmax(250px, 1fr));
        gap: 16px;
    }

    .btn-theme {
        min-height: 62px;
        font-size: 1rem;
    }

    .theme-card input[type="number"] {
        padding: 9px 6px;
        font-size: 1rem;
    }

    .auth-form,
    .auth-tabs {
        max-width: 700px;
    }

    #auth-screen h1,
    #theme-screen h1 {
        font-size: 1.65rem;
    }

    #auth-screen .brand-lockup img {
        width: 90px;
    }

    #theme-screen .brand-lockup img {
        width: 120px;
    }
}
