/* US Challenge - Main Styles */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
    line-height: 1.5;
}

/* Header */
.app-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.settings-btn {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-600);
    transition: all 0.15s;
}

.settings-btn:hover {
    border-color: var(--gray-400);
    color: var(--gray-800);
}

/* Main Container */
.main-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Menu */
#menu-container {
    padding: 1rem 0;
}

.mode-category {
    margin-bottom: 2rem;
}

.category-header {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.mode-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.mode-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.15s;
}

.mode-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.mode-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.mode-description {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.mode-progress {
    margin-top: auto;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--gray-500);
    display: block;
    margin-bottom: 0.25rem;
}

.progress-text-small {
    font-size: 0.7rem;
    color: var(--gray-400);
    display: block;
}

.progress-text-small.best-time {
    color: var(--success);
    margin-top: 0.375rem;
    font-weight: 500;
}

.progress-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s;
}

/* Game Container */
#game-container {
    display: none;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.game-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.game-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-score,
.game-progress {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary);
}

.game-timer {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 3rem;
    text-align: right;
}

.game-timer.timer-warning {
    color: var(--danger);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.challenge-timer {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-600);
    font-variant-numeric: tabular-nums;
}

.results-time {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.results-best-time {
    font-size: 1rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.results-best-time.new-record {
    color: var(--success);
    font-weight: 600;
}

.game-prompt {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    color: var(--gray-900);
    padding: 0.5rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 0.25rem;
}

.game-instructions {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.tries-indicator {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    min-height: 1.25rem;
}

.tries-indicator.tries-warning {
    color: var(--warning);
    font-weight: 500;
}

.game-feedback {
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    min-height: 1.25rem;
    margin-bottom: 0.25rem;
}

.feedback-correct {
    color: var(--success);
}

.feedback-incorrect {
    color: var(--danger);
}

/* Map Container */
.map-container {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

.map-container-solo {
    min-height: 350px;
}

.map-container-location {
    min-height: 420px;
}

.map-container-missouri {
    min-height: 550px;
}

/* Missouri Map */
.missouri-map .county {
    transition: fill 0.15s;
}

.county-map .county {
    transition: fill 0.15s;
}

/* Capital Location Mode */
.capital-prompt {
    text-align: center;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
}

.capital-prompt-label {
    font-size: 1rem;
    color: var(--gray-500);
    margin-right: 0.5rem;
}

.capital-prompt-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.distance-info {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.distance-display {
    color: var(--gray-600);
    font-weight: 500;
}

.total-distance {
    color: var(--gray-500);
}

.us-map, .state-map {
    display: block;
}

.state {
    transition: fill 0.15s;
}

/* Input Area */
.input-area {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.answer-input {
    flex: 0 1 300px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s;
}

.answer-input:focus {
    border-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.game-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Text Prompt (for text-only modes) */
.text-prompt-container {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.text-prompt-label {
    font-size: 1rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.text-prompt {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* Distance Display (Mode 8) */
.distance-display {
    text-align: center;
    font-size: 1rem;
    color: var(--gray-600);
    min-height: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Multiple Choice */
.mc-mode-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.mc-tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.mc-tab:hover {
    background: var(--gray-200);
}

.mc-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.choices-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    max-width: 500px;
    margin: 0 auto 1rem;
}

.choice-btn {
    padding: 1rem;
    font-size: 1rem;
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.choice-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--gray-50);
}

.choice-btn:disabled {
    cursor: default;
}

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

.choice-btn.incorrect {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* Results Screen */
.results-container {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.results-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
}

.results-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.results-percentage {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.results-message {
    font-size: 1.25rem;
    color: var(--gray-600);
}

.results-inline {
    font-size: 0.95rem;
    color: var(--gray-700);
    line-height: 1.6;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
}

.modal h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

.setting-group {
    margin-bottom: 1rem;
}

.setting-label {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.setting-group select {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
}

.setting-group select:disabled {
    background: var(--gray-100);
    color: var(--gray-400);
}

.setting-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Loading/Error */
.loading, .error {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.error p {
    margin-bottom: 1rem;
}

/* Capital/User Markers */
.capital-marker, .user-marker {
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

/* Countdown Overlay */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.countdown-number {
    font-size: 8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: countdown-pulse 0.8s ease-in-out infinite;
}

@keyframes countdown-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* State Symbol Prompt */
.symbol-prompt {
    text-align: center;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.symbol-prompt-motto {
    padding: 1.25rem 1.5rem;
}

.symbol-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.symbol-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
}

.symbol-value-motto {
    font-size: 1.25rem;
    font-style: italic;
    line-height: 1.4;
}

/* Symbol Multiple Choice Tabs */
.symbol-mc-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

/* Motto choices - need more space */
.choices-container-motto {
    max-width: 600px;
}

.choice-btn-motto {
    font-size: 0.875rem;
    text-align: left;
    padding: 0.75rem 1rem;
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        padding: 0.75rem 1rem;
    }

    .app-title {
        font-size: 1.25rem;
    }

    .main-container {
        padding: 1rem;
    }

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

    .game-prompt {
        font-size: 1.5rem;
    }

    .text-prompt {
        font-size: 2rem;
    }

    .answer-input {
        flex: 1;
    }

    .choices-container {
        grid-template-columns: 1fr;
    }

    .map-container {
        min-height: 350px;
        padding: 0.25rem;
    }

    .game-controls {
        flex-wrap: wrap;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .mc-mode-tabs,
    .symbol-mc-tabs {
        flex-wrap: wrap;
    }

    .mc-tab {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }

    .symbol-value {
        font-size: 1.5rem;
    }

    .symbol-value-motto {
        font-size: 1rem;
    }
}
