:root {
    --nyc-yellow: #f7b731;
    --nyc-blue: #0652dd;
    --nyc-dark: #2f3640;
    --glass: rgba(255, 255, 255, 0.95);
}

body, html {
    margin: 0;
    padding: 0;
    min-height: 100%;
    width: 100%;
    background: #f0f0f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#game-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
}

#map-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    flex-shrink: 0;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Position the zoom control so it doesn't overlap with our top header */
.leaflet-top.leaflet-left {
    top: 100px;
}

#header-group {
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

#header-group > * {
    pointer-events: auto;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Itinerary Section Styles */
#itinerary-section {
    background: white;
    padding: 25px 20px 40px;
    border-top: 6px solid var(--nyc-yellow);
    box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
    position: relative;
    width: 100%;
    z-index: 20;
    box-sizing: border-box;
}

#itinerary-section.itinerary-hidden {
    display: none;
}

.itinerary-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

#close-list-btn {
    background: #eee;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.itinerary-title {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    color: var(--nyc-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.itinerary-title::before {
    content: '📍';
}

.itinerary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.itinerary-item {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 10px;
    font-size: 0.95rem;
    color: #444;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.item-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-desc {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
    padding-left: 36px;
    margin-bottom: 8px;
}

.street-view-btn {
    align-self: flex-start;
    margin-left: 36px;
    background: #4285F4;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.street-view-btn:hover {
    background: #3367D6;
}

.itinerary-item.active {
    background: #fff9e6;
    border-color: var(--nyc-yellow);
    color: var(--nyc-dark);
    font-weight: bold;
    transform: translateX(5px);
    box-shadow: 2px 2px 10px rgba(247, 183, 49, 0.2);
}

.itinerary-item .step-num {
    background: #ddd;
    color: #666;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.itinerary-item.active .step-num {
    background: var(--nyc-yellow);
    color: var(--nyc-dark);
}

@media (min-width: 600px) {
    .itinerary-grid {
        grid-template-columns: 1fr 1fr;
    }
}

#status-bar {
    background: rgba(47, 54, 64, 0.9);
    backdrop-filter: blur(5px);
    color: white;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    box-shadow: 0 2px 15px rgba(0,0,0,0.4);
    font-weight: bold;
    border-bottom: 3px solid #666;
}

.team-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.3s;
    opacity: 0.6;
    border: 2px solid transparent;
}

.team-stat.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

#team-a-stats.active { border-color: var(--nyc-yellow); }
#team-b-stats.active { border-color: #3498db; }

.team-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#team-a-stats .team-label { color: var(--nyc-yellow); }
#team-b-stats .team-label { color: #3498db; }

.team-details {
    font-size: 0.85rem;
}

.race-vs {
    padding: 0 10px;
    font-style: italic;
    color: #999;
}

#turn-announcer {
    font-size: 0.8rem;
    font-weight: 900;
    margin-bottom: 10px;
    text-align: center;
    letter-spacing: 2px;
    padding: 4px;
    border-radius: 4px;
}

.turn-a { background: var(--nyc-yellow); color: var(--nyc-dark); }
.turn-b { background: #3498db; color: white; }



#controls {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.primary-btn {
    background: var(--nyc-yellow);
    color: var(--nyc-dark);
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.1s, background 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn:hover {
    background: #ffc247;
}

.primary-btn:active {
    transform: scale(0.95);
}

.secondary-btn {
    background: var(--nyc-dark);
    color: white;
    border: 2px solid var(--nyc-yellow);
    padding: 10px 25px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.secondary-btn:hover {
    background: #404b5a;
}

.auxiliary-controls {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 350px;
    justify-content: center;
}

.tertiary-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    flex: 1;
}

.tertiary-btn:hover {
    background: #c0392b;
}

.secondary-btn {
    flex: 1;
}

.hidden {
    display: none !important;
}

#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--nyc-dark);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--nyc-yellow);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.landmark-pin {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 1000 !important;
}

.street-view-circle {
    position: absolute;
    top: -45px;
    right: -25px;
    width: 42px;
    height: 42px;
    background: #ff3f34;
    color: white;
    border: 2.5px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 0 3px 8px rgba(0,0,0,0.5);
    line-height: 1;
    z-index: 5;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 63, 52, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 63, 52, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 63, 52, 0); }
}

.pin-point {
    width: 14px;
    height: 14px;
    background: #ff3f34; /* Bright red pinpoint */
    border: 2.5px solid white;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0,0,0,0.8);
    z-index: 2;
}

.landmark-label {
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
    text-shadow: 
        -1px -1px 0 #000,  
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000,
         0 0 5px #000;
    margin-top: 2px;
    width: 140px;
    line-height: 1.2;
    letter-spacing: 0.5px;
}



.character-marker-map {
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

/* Quiz Styles */
#quiz-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
}

#quiz-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 400px;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    pointer-events: auto;
    border: 3px solid var(--nyc-yellow);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

#quiz-question {
    margin-top: 0;
    color: var(--nyc-dark);
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 20px;
}

#quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.option-btn {
    background: white;
    border: 2px solid #ddd;
    padding: 12px 10px;
    border-radius: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.option-btn:hover {
    border-color: var(--nyc-yellow);
    background: #fffcf0;
}

.option-btn.correct {
    background: #2ecc71;
    color: white;
    border-color: #27ae60;
}

.option-btn.wrong {
    background: #e74c3c;
    color: white;
    border-color: #c0392b;
}

#quiz-feedback {
    margin-top: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 0.9rem;
}

#quiz-feedback.success { color: #27ae60; }
#quiz-feedback.error { color: #c0392b; }

/* Final Challenge Styles */
#final-challenge-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    z-index: 100;
    padding: 20px;
    pointer-events: auto;
}

#final-challenge-card {
    background: white;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    border: 5px solid var(--nyc-yellow);
}

#final-announcer {
    background: var(--nyc-dark);
    color: var(--nyc-yellow);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 0.8rem;
    margin-bottom: 15px;
}

.challenge-desc {
    color: #444;
    margin-bottom: 25px;
    font-size: 1.1rem;
    line-height: 1.5;
}

.blank-row {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.blank-text {
    font-weight: 600;
    color: var(--nyc-dark);
    font-size: 0.95rem;
}

.blank-select {
    padding: 10px;
    border-radius: 8px;
    border: 2px solid #ddd;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.blank-select:focus {
    border-color: var(--nyc-yellow);
}

.blank-select.is-wrong {
    border-color: #e74c3c;
    background: #fff5f5;
}

#submit-challenge-btn {
    width: 100%;
    margin-top: 20px;
}

#challenge-feedback {
    margin-top: 20px;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    border-radius: 10px;
}

#challenge-feedback.error { background: #fff5f5; color: #c0392b; }

/* Matching Challenge Styles */
#matching-challenge-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    z-index: 101;
    padding: 10px;
    pointer-events: auto;
}

#matching-challenge-card {
    background: white;
    width: 100%;
    max-width: 650px;
    max-height: 95vh;
    overflow-y: auto;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    border: 5px solid var(--nyc-blue);
}

#matching-announcer {
    background: var(--nyc-blue);
    color: white;
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.matching-game {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.matching-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.matching-item {
    padding: 8px 12px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.matching-item:hover {
    border-color: var(--nyc-blue);
    background: #f0f7ff;
}

.matching-item.selected {
    background: var(--nyc-blue);
    color: white;
    border-color: #004085;
}

.matching-item.matched {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    cursor: default;
    opacity: 0.8;
}

#submit-matching-btn {
    width: 100%;
    background: var(--nyc-blue);
    color: white;
}

#matching-feedback {
    margin-top: 15px;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    border-radius: 10px;
}
#matching-feedback.error { background: #fff5f5; color: #c0392b; }
#matching-feedback.success { background: #d4edda; color: #155724; }

/* Name Entry Modal */
#name-entry-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#name-entry-card {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    border: 5px solid var(--nyc-yellow);
    text-align: center;
}

#name-entry-card h2 {
    margin-top: 0;
    color: var(--nyc-dark);
}

.rules-box {
    text-align: left;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 12px;
    margin: 15px 0;
    font-size: 1.1rem;
    border-left: 5px solid var(--nyc-yellow);
    line-height: 1.4;
}
.rules-box p { margin: 0 0 8px 0; color: #333; }
.rules-box ul { margin: 0; padding-left: 18px; color: #555; }
.rules-box li { margin-bottom: 4px; }

.instruction-bar {
    background: var(--nyc-yellow);
    color: var(--nyc-dark);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: auto;
    font-size: 1.05rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-weight: 700;
    border-bottom: 2px solid rgba(0,0,0,0.1);
}
.instruction-text strong {
    text-transform: uppercase;
    background: var(--nyc-dark);
    color: var(--nyc-yellow);
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 4px;
}
#close-instr-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    font-weight: 900;
    color: var(--nyc-dark);
    padding: 0 4px;
    line-height: 1;
}

.name-inputs {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 25px 0;
}

.input-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 5px;
}

.input-group label {
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
}

.input-group input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
}

.input-group input:focus {
    border-color: var(--nyc-yellow);
}

#team-a-name { border-left: 8px solid var(--nyc-yellow); }
#team-b-name { border-left: 8px solid #3498db; }