/* ------------------------------------------- */
/* 1. COLOR PALETTE & GLOBAL VARIABLES (NAVAL THEME) */
/* ------------------------------------------- */
:root {
    --cf-blue-navy: #003366;           /* Deep Navy Blue (Primary) */
    --cf-gold-brass: #FFCC00;          /* Gold/Brass (Highlight) */
    --cf-teal-accent: #00A3A3;         /* Bright Teal/Sea Blue (Accent for Action) */
    --cf-light-bg: #f4f4f9;            /* Light Grey/Off-White (Background) */
    --cf-dark-text: #333333;           /* Dark Text */
    --cf-green-success: #3CB371;      /* Medium Sea Green (Correct Answer) */
    --cf-red-error: #DC143C;          /* Crimson Red (Incorrect Answer) */
}

/* ------------------------------------------- */
/* 2. BASE CONTAINER & TYPOGRAPHY */
/* ------------------------------------------- */
#cadet-fleet-game {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 100%;
    min-height: 100vh;
    margin: 0 auto;
    padding: 10px;
    background-color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 51, 102, 0.1);
    color: var(--cf-dark-text);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#cf-main-game, #cf-setup-screen, #cf-game-over {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
}

#cf-quiz-area {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

h3, h4 {
    color: var(--cf-blue-navy);
    text-align: center;
    margin-bottom: 20px;
}

/* ------------------------------------------- */
/* 3. SETUP SCREEN STYLING */
/* ------------------------------------------- */
.cf-setup-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--cf-blue-navy) 0%, var(--cf-teal-accent) 100%);
    border-radius: 15px;
    color: white;
}

.cf-setup-header h2 {
    font-size: clamp(2em, 5vw, 3.5em);
    margin: 0 0 15px 0;
    color: white;
}

.cf-setup-subtitle {
    font-size: clamp(1em, 2.5vw, 1.5em);
    margin: 0;
    opacity: 0.95;
}

.cf-control-group {
    margin-bottom: 40px;
}

.cf-control-group h3 {
    font-size: clamp(1.3em, 3vw, 2em);
    color: var(--cf-blue-navy);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.cf-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(35px, 5vw, 50px);
    height: clamp(35px, 5vw, 50px);
    background-color: var(--cf-gold-brass);
    color: var(--cf-blue-navy);
    border-radius: 50%;
    font-weight: bold;
    font-size: clamp(1em, 2.5vw, 1.5em);
}

/* Setup Button Styling */
.cf-button-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.cf-setup-btn {
    flex: 1 1 calc(25% - 15px);
    min-width: 140px;
    padding: 20px 15px;
    background-color: white;
    border: 3px solid var(--cf-light-bg);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.cf-setup-btn:hover {
    border-color: var(--cf-teal-accent);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 163, 163, 0.25);
}

.cf-setup-btn.active {
    background-color: var(--cf-blue-navy);
    border-color: var(--cf-gold-brass);
    color: white;
}

.cf-setup-btn.active .cf-btn-icon {
    transform: scale(1.2);
}

.cf-btn-icon {
    font-size: clamp(1.8em, 4vw, 2.5em);
    transition: transform 0.2s;
}

.cf-btn-label {
    font-size: clamp(1em, 2vw, 1.2em);
    font-weight: 600;
    color: var(--cf-blue-navy);
}

.cf-setup-btn.active .cf-btn-label {
    color: var(--cf-gold-brass);
}

.cf-btn-desc {
    font-size: clamp(0.75em, 1.5vw, 0.9em);
    color: #666;
    font-weight: 400;
}

.cf-setup-btn.active .cf-btn-desc {
    color: rgba(255, 255, 255, 0.85);
}

/* Mode Group Specific Layout */
.cf-mode-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.cf-mode-btn {
    min-height: 120px;
}

/* Learn Section */
.cf-learn-section {
    text-align: center;
    margin: 40px 0;
}

.cf-learn-divider {
    position: relative;
    margin: 30px 0;
    text-align: center;
}

.cf-learn-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cf-blue-navy), transparent);
    opacity: 0.2;
}

.cf-learn-divider span {
    position: relative;
    display: inline-block;
    padding: 0 20px;
    background: white;
    color: var(--cf-blue-navy);
    font-weight: bold;
    font-size: clamp(1em, 2vw, 1.2em);
    z-index: 1;
}

.cf-learn-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 40px;
    background: linear-gradient(135deg, var(--cf-teal-accent) 0%, var(--cf-blue-navy) 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 163, 163, 0.3);
    min-width: 300px;
}

.cf-learn-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 163, 163, 0.5);
}

.cf-learn-btn .cf-btn-icon {
    font-size: clamp(2em, 4vw, 3em);
    margin-bottom: 10px;
}

.cf-learn-btn .cf-btn-label {
    font-size: clamp(1.2em, 2.5vw, 1.8em);
    font-weight: bold;
    margin-bottom: 8px;
    color: white;
}

.cf-learn-btn .cf-btn-desc {
    font-size: clamp(0.9em, 1.8vw, 1.1em);
    opacity: 0.9;
    color: white;
}

/* Ready Area */
.cf-ready-area {
    text-align: center;
    margin-top: 40px;
    padding: 30px;
    background-color: var(--cf-light-bg);
    border-radius: 15px;
}

.cf-settings-display {
    font-size: clamp(1em, 2vw, 1.2em);
    color: var(--cf-dark-text);
    margin-bottom: 25px;
    font-weight: 500;
}

.cf-settings-display span {
    color: var(--cf-blue-navy);
    font-weight: 700;
}

.cf-start-btn {
    background: linear-gradient(135deg, var(--cf-blue-navy) 0%, var(--cf-teal-accent) 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: clamp(1.2em, 2.5vw, 1.8em);
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 51, 102, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.cf-start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 163, 163, 0.4);
}

.cf-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cf-start-icon {
    font-size: 1.3em;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ------------------------------------------- */
/* 4. GAME SCREEN STYLING */
/* ------------------------------------------- */
#cf-round-info {
    text-align: center;
    padding: 15px;
    background-color: var(--cf-blue-navy);
    color: white;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: clamp(1em, 2vw, 1.3em);
    font-weight: 600;
}

#cf-scoreboard {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--cf-light-bg);
    border-radius: 10px;
}

.cf-team-score {
    flex: 1 1 calc(25% - 15px);
    min-width: 150px;
    text-align: center;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.cf-team-score.cf-active-team {
    border-color: var(--cf-gold-brass);
    background-color: #fffef7;
    box-shadow: 0 4px 12px rgba(255, 204, 0, 0.3);
}

.cf-team-name {
    font-size: clamp(1em, 2vw, 1.2em);
    color: var(--cf-blue-navy);
    font-weight: 700;
    margin-bottom: 8px;
}

.cf-score-display {
    font-size: clamp(1.5em, 3vw, 2em);
    color: var(--cf-teal-accent);
    font-weight: 900;
}

/* Quiz Area */
.cf-question-container {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.cf-question-text {
    font-size: clamp(1.2em, 2.5vw, 1.8em);
    color: var(--cf-blue-navy);
    text-align: center;
    margin-bottom: 25px;
    font-weight: 600;
}

.cf-ship-image-container {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.cf-ship-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.cf-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.cf-option-btn {
    padding: 20px;
    background-color: white;
    border: 3px solid var(--cf-light-bg);
    border-radius: 10px;
    font-size: clamp(1em, 2vw, 1.2em);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--cf-dark-text);
    font-weight: 600;
}

.cf-option-btn:hover:not(:disabled) {
    border-color: var(--cf-teal-accent);
    background-color: #f0f9ff;
    transform: translateY(-2px);
}

.cf-option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.cf-option-btn.cf-correct {
    background-color: var(--cf-green-success);
    border-color: var(--cf-green-success);
    color: white;
}

.cf-option-btn.cf-incorrect {
    background-color: var(--cf-red-error);
    border-color: var(--cf-red-error);
    color: white;
}

/* Feedback Overlay */
#cf-feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#cf-feedback-message {
    padding: 40px 60px;
    border-radius: 20px;
    font-size: clamp(1.5em, 3vw, 2.5em);
    font-weight: bold;
    color: white;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* ------------------------------------------- */
/* 5. GAME OVER SCREEN */
/* ------------------------------------------- */
#cf-game-over {
    text-align: center;
    padding: 40px 20px;
}

#cf-game-over h2 {
    font-size: clamp(2em, 4vw, 3em);
    color: var(--cf-blue-navy);
    margin-bottom: 30px;
}

#cf-final-scores {
    background-color: var(--cf-light-bg);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.cf-final-team {
    padding: 20px;
    margin-bottom: 15px;
    background-color: white;
    border-radius: 10px;
    border-left: 5px solid var(--cf-teal-accent);
}

.cf-final-team.cf-winner {
    border-left-color: var(--cf-gold-brass);
    background-color: #fffef7;
    box-shadow: 0 6px 20px rgba(255, 204, 0, 0.3);
}

.cf-final-team-name {
    font-size: clamp(1.2em, 2.5vw, 1.8em);
    color: var(--cf-blue-navy);
    font-weight: 700;
    margin-bottom: 10px;
}

.cf-final-score {
    font-size: clamp(1.5em, 3vw, 2.2em);
    color: var(--cf-teal-accent);
    font-weight: 900;
}

.cf-new-challenge-btn {
    background: linear-gradient(135deg, var(--cf-blue-navy) 0%, var(--cf-teal-accent) 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: clamp(1.2em, 2.5vw, 1.5em);
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 51, 102, 0.3);
}

.cf-new-challenge-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 163, 163, 0.4);
}

/* ------------------------------------------- */
/* 6. RESPONSIVE DESIGN */
/* ------------------------------------------- */
@media (max-width: 768px) {
    .cf-button-row {
        flex-direction: column;
    }

    .cf-setup-btn {
        min-width: 100%;
    }

    .cf-mode-group {
        grid-template-columns: 1fr;
    }

    #cf-scoreboard {
        flex-direction: column;
    }

    .cf-options-grid {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------- */
/* 7. LOADER STYLING */
/* ------------------------------------------- */
#cf-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    font-size: clamp(1.2em, 2.5vw, 1.8em);
    color: var(--cf-blue-navy);
}
