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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    display: flex;
    height: 100vh;
}


/* Notification Banner */
.notification-banner {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 2000;
    box-shadow: 0 4px 16px rgba(39, 174, 96, 0.4);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease-out;
    backdrop-filter: blur(10px);
}

.notification-banner.show {
    top: 20px;
}

.notification-banner.error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.4);
}

/* Mobile Game Info Panel */
.mobile-game-info {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 8px 15px;
    z-index: 900;
    border-radius: 0 0 8px 8px;
    backdrop-filter: blur(5px);
    display: none;
    min-width: 320px;
    max-width: 90vw;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    pointer-events: auto;
}

.mobile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.mobile-menu-btn {
    background: rgba(52, 152, 219, 0.8);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 14px;
    cursor: pointer;
    min-width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 910;
    position: relative;
}

.mobile-menu-btn:hover {
    background: rgba(41, 128, 185, 0.9);
}

/* Sidebar Collapse Button */
.sidebar-collapse-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 50%;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    z-index: 1010;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    display: none; /* Hidden by default */
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    text-align: center;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-collapse-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
}

.sidebar-collapse-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* Show collapse button during gameplay when sidebar is open */
body.mobile-game-active #sidebar.show .sidebar-collapse-btn {
    display: flex;
}

/* Also show on mobile when sidebar is visible during gameplay */
@media screen and (max-width: 768px) {
    body.mobile-game-active #sidebar.show .sidebar-collapse-btn {
        display: flex !important;
        top: 15px;
        right: 15px;
        padding: 8px;
        font-size: 12px;
        width: 32px;
        height: 32px;
    }
}

/* Small phone adjustments */
@media screen and (max-width: 480px) {
    body.mobile-game-active #sidebar.show .sidebar-collapse-btn {
        top: 10px;
        right: 10px;
        padding: 6px;
        font-size: 11px;
        width: 28px;
        height: 28px;
    }
}

/* Collapsed Mobile Game Info */
.mobile-game-info-collapsed {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(44, 62, 80, 0.9);
    color: white;
    padding: 8px 12px;
    z-index: 900;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    display: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    pointer-events: auto;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    min-width: 200px;
}

.mobile-game-info-collapsed.show {
    display: flex;
}

.mobile-expand-btn {
    background: rgba(46, 204, 113, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    padding: 4px;
    font-size: 10px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    flex-shrink: 0;
}

.mobile-expand-btn:hover {
    background: rgba(39, 174, 96, 0.9);
}

.mobile-collapsed-content {
    flex: 1;
    text-align: center;
    font-weight: bold;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-info-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    gap: 10px;
    flex: 1;
}

.mobile-score {
    font-size: 11px;
    white-space: nowrap;
}

.mobile-street {
    font-weight: bold;
    color: #3498db;
    flex: 1;
    text-align: center;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-remaining {
    font-size: 11px;
    white-space: nowrap;
}

.mobile-controls {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.mobile-control-btn {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: #3498db;
    color: white;
    min-width: 50px;
}

.mobile-control-btn:hover {
    background: #2980b9;
}

/* Sidebar Close Button */
.sidebar-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.sidebar-close:hover {
    color: #e74c3c;
}

#sidebar {
    width: 350px;
    background: #2c3e50;
    color: white;
    padding: 15px;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

#sidebar h1 {
    margin-bottom: 5px;
    font-size: 28px;
    text-align: center;
    color: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.map-pin {
    font-size: 24px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.tagline {
    text-align: center;
    color: #ecf0f1;
    font-size: 12px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.header-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.instructions-button,
.statistics-button {
    background: #2ecc71;
    padding: 8px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.instructions-button:hover {
    background: #27ae60;
}

.statistics-button {
    background: #e67e22;
}

.statistics-button:hover {
    background: #d35400;
}

#sidebar h2 {
    margin-bottom: 8px;
    font-size: 16px;
    color: #ecf0f1;
}

.section {
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.autocomplete-container {
    position: relative;
    width: 100%;
    margin-bottom: 10px;
}

#city-input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    max-height: 135px;  /* Show approximately 3 items with scroll */
    overflow-y: auto;
    display: none;
    z-index: 1000;
    margin-top: 2px;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-dropdown::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    color: #333;
    font-size: 13px;
    border-bottom: 1px solid #eee;
    min-height: 45px;  /* Consistent height for each item */
}

.autocomplete-item:hover {
    background: #3498db;
    color: white;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item-name {
    font-weight: bold;
    margin-bottom: 2px;
}

.autocomplete-item-details {
    font-size: 11px;
    opacity: 0.8;
}

#num-streets {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
}

#game-settings label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #ecf0f1;
}

button {
    width: 100%;
    padding: 8px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.3s;
}

button:hover {
    background: #2980b9;
}

button:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
}

#skip-btn {
    background: #e67e22;
    margin-bottom: 10px;
}

#skip-btn:hover {
    background: #d35400;
}

#next-btn {
    background: #27ae60;
}

#next-btn:hover {
    background: #229954;
}

#game-info p {
    margin-bottom: 10px;
    font-size: 14px;
}

#game-info span {
    font-weight: bold;
    color: #3498db;
}

#current-street {
    color: #f1c40f !important;
    font-size: 16px;
}

#feedback {
    background: rgba(255, 255, 255, 0.1);
    border-left: 4px solid #3498db;
}

#feedback.correct {
    border-left-color: #27ae60;
}

#feedback.incorrect {
    border-left-color: #e74c3c;
}

#feedback-text {
    font-size: 14px;
    line-height: 1.5;
}

#map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Improve map rendering quality for smooth streets */
#map canvas,
#map .leaflet-layer canvas {
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Better antialiasing for vector elements */
.leaflet-zoom-animated {
    -webkit-transform-origin: 0 0;
    -ms-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Smooth rendering for polylines and interactive elements */
.leaflet-interactive {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* SVG elements smooth rendering */
.leaflet-overlay-pane svg {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    shape-rendering: geometricPrecision;
}

/* Specific styling for smooth streets */
.smooth-street {
    vector-effect: non-scaling-stroke;
    shape-rendering: geometricPrecision;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Additional smoothing for all polylines */
.leaflet-interactive path {
    stroke-linecap: round;
    stroke-linejoin: round;
    shape-rendering: geometricPrecision;
    vector-effect: non-scaling-stroke;
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.leaflet-popup-content {
    font-size: 14px;
}

.correct-street {
    color: #27ae60;
    stroke: #27ae60;
    stroke-width: 4;
    opacity: 0.8;
}

.incorrect-guess {
    color: #e74c3c;
    stroke: #e74c3c;
    stroke-width: 3;
    opacity: 0.6;
}

.target-street {
    stroke: #f1c40f;
    stroke-width: 5;
    opacity: 0.9;
}

#game-over {
    background: rgba(52, 152, 219, 0.1);
    border: 2px solid #3498db;
}

#final-score {
    font-size: 24px;
    color: #f1c40f;
}

.final-score-display {
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
}

.score-stats {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 10px;
    margin: 15px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    font-size: 12px;
}

.stat-label {
    color: #95a5a6;
    font-weight: 500;
}

.stat-value {
    color: #3498db;
    font-weight: bold;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.share-btn {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: linear-gradient(135deg, #7d3c98, #8e44ad);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.3);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: none;
    border-radius: 12px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
    max-height: 80vh;
    overflow-y: auto;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover,
.close-modal:focus {
    color: #e74c3c;
}

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 28px;
    text-align: center;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.instructions-section {
    margin-bottom: 25px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.instructions-section h3 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 18px;
}

.instructions-section ol,
.instructions-section ul {
    margin-left: 20px;
    color: #555;
    line-height: 1.8;
}

.instructions-section li {
    margin-bottom: 8px;
}

/* Scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Statistics Modal Styles */
.statistics-modal-content {
    max-width: 800px;
    max-height: 85vh;
}

.statistics-section {
    margin-bottom: 30px;
}

.statistics-section h3 {
    color: #2c3e50;
    font-size: 20px;
    margin-bottom: 15px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.summary-item {
    text-align: center;
    flex: 1;
}

.summary-number {
    display: block;
    font-size: 32px;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.summary-label {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
}

.no-stats-message {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #7f8c8d;
}

.no-stats-message p {
    margin: 10px 0;
    font-size: 16px;
}

.no-stats-message p:first-child {
    font-size: 20px;
    font-weight: bold;
}

#statistics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#statistics-table th {
    background: #34495e;
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

#statistics-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 13px;
}

#statistics-table tr:last-child td {
    border-bottom: none;
}

#statistics-table tr:hover {
    background: #f8f9fa;
}

/* Performance-based row colors */
#statistics-table tr.excellent {
    background: rgba(46, 204, 113, 0.05);
}

#statistics-table tr.excellent:hover {
    background: rgba(46, 204, 113, 0.1);
}

#statistics-table tr.good {
    background: rgba(52, 152, 219, 0.05);
}

#statistics-table tr.good:hover {
    background: rgba(52, 152, 219, 0.1);
}

#statistics-table tr.average {
    background: rgba(241, 196, 15, 0.05);
}

#statistics-table tr.average:hover {
    background: rgba(241, 196, 15, 0.1);
}

#statistics-table tr.needs-improvement {
    background: rgba(231, 76, 60, 0.05);
}

#statistics-table tr.needs-improvement:hover {
    background: rgba(231, 76, 60, 0.1);
}

.city-name {
    font-weight: 600;
    color: #2c3e50;
}

.date {
    color: #7f8c8d;
    font-size: 12px;
}

.score {
    font-weight: 600;
    font-family: monospace;
}

.best-score {
    color: #27ae60;
}

.attempts {
    text-align: center;
    font-weight: 600;
    color: #3498db;
}

/* Ad Container Styles */
#ad-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder {
    text-align: center;
    padding: 20px;
    color: #95a5a6;
}

/* Game Mode Selection Styles */
.mode-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.mode-btn {
    flex: 1;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: rgba(52, 152, 219, 0.2);
    border-color: #3498db;
}

.mode-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.mode-title {
    font-size: 13px;
    font-weight: bold;
    color: #ecf0f1;
    margin-bottom: 4px;
}

.mode-desc {
    font-size: 10px;
    color: #95a5a6;
    line-height: 1.2;
}

.mode-date {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 4px;
}

.challenge-info {
    text-align: center;
    color: #3498db;
    font-size: 13px;
    margin: 8px 0;
    font-weight: 500;
}

/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
    #game-container {
        flex-direction: column;
        position: relative;
    }
    
    
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh; /* Use dynamic viewport height on modern browsers */
        z-index: 1000;
        transform: translateX(0); /* Show by default on mobile */
        padding: 10px;
        padding-top: 10px;
        padding-bottom: 60px; /* Extra bottom padding for mobile */
        /* Improve touch scrolling */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        /* Prevent viewport bounce */
        overscroll-behavior-y: contain;
    }
    
    #sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: none; /* Never show close button - only use mobile game menu button */
    }
    
    #map-container {
        width: 100%;
        height: 100vh;
    }
    
    /* Adjust map when mobile game info is visible */
    body.mobile-game-active #map-container {
        padding-top: 70px;
        height: calc(100vh - 70px);
    }
    
    body.mobile-game-active .mobile-game-info {
        display: block !important;
    }
    
    
    /* Auto-hide sidebar when game starts on mobile */
    body.mobile-game-active #sidebar:not(.show) {
        transform: translateX(-100%);
    }
    
    /* Ensure sidebar shows when explicitly shown during gameplay */
    body.mobile-game-active #sidebar.show {
        transform: translateX(0);
    }
    
    /* Show collapse button only when sidebar is open during gameplay */
    body.mobile-game-active #sidebar.show .sidebar-collapse-btn {
        display: block;
    }
    
    /* Hide ALL map controls when sidebar is showing on mobile */
    #sidebar.show ~ #map-container .leaflet-control-container {
        display: none !important;
    }
    
    #sidebar.show ~ #map-container .leaflet-control-attribution {
        display: none !important;
    }
    
    /* Hide zoom controls specifically */
    #sidebar.show ~ #map-container .leaflet-control-zoom {
        display: none !important;
    }
    
    /* Disable map interaction when sidebar is open */
    #sidebar.show ~ #map-container {
        pointer-events: none;
        touch-action: none;
    }
    
    /* But allow scrolling on the map container itself for sidebar */
    #sidebar.show {
        pointer-events: auto;
        touch-action: auto;
    }
    
    /* Prevent body scroll when sidebar is open on mobile */
    body:has(#sidebar.show) {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    /* Fallback for browsers that don't support :has() */
    body.sidebar-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Adjust sidebar content for mobile */
    #sidebar h1 {
        font-size: 22px;
        margin-bottom: 5px;
    }
    
    .map-pin {
        font-size: 20px;
    }
    
    .tagline {
        font-size: 11px;
        margin-bottom: 8px;
    }
    
    .section {
        margin-bottom: 8px;
        padding: 8px;
    }
    
    .instructions-button {
        margin-bottom: 8px;
        padding: 6px;
        font-size: 12px;
    }
    
    #sidebar h2 {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    button {
        padding: 6px;
        font-size: 12px;
    }
    
    #game-info p {
        margin-bottom: 6px;
        font-size: 12px;
    }
    
    #game-settings label {
        font-size: 12px;
        margin-bottom: 3px;
    }
    
    #num-streets,
    #city-input {
        padding: 6px;
        font-size: 12px;
    }
    
    .mode-btn {
        padding: 8px 4px;
    }
    
    .mode-icon {
        font-size: 20px;
    }
    
    .mode-title {
        font-size: 11px;
    }
    
    .mode-desc {
        font-size: 9px;
    }
    
    .challenge-info {
        font-size: 11px;
        margin: 5px 0;
    }
    
    .autocomplete-dropdown {
        max-height: 120px;
    }
    
    /* Modal adjustments for mobile */
    .modal-content {
        width: 95%;
        margin: 2% auto;
        padding: 20px;
        max-height: 90vh;
    }
    
    .modal-content h2 {
        font-size: 24px;
    }
    
    .instructions-section h3 {
        font-size: 16px;
    }
}

/* Small phone screens */
@media screen and (max-width: 480px) {
    
    #sidebar {
        padding: 8px;
        padding-top: 8px;
    }
    
    #sidebar h1 {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .map-pin {
        font-size: 18px;
    }
    
    .tagline {
        font-size: 10px;
        margin-bottom: 6px;
    }
    
    .section {
        padding: 6px;
        margin-bottom: 6px;
    }
    
    button {
        padding: 5px;
        font-size: 11px;
    }
    
    .instructions-button {
        padding: 5px;
        margin-bottom: 6px;
    }
    
    #sidebar h2 {
        font-size: 13px;
        margin-bottom: 5px;
    }
    
    #game-info p {
        margin-bottom: 5px;
        font-size: 11px;
    }
    
    .modal-content {
        padding: 15px;
    }
    
    .header-buttons {
        flex-direction: row;
        gap: 6px;
    }
    
    .instructions-button,
    .statistics-button {
        font-size: 11px;
        padding: 6px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        box-sizing: border-box;
    }
    
    .statistics-button {
        font-size: 10px; /* Slightly smaller to accommodate emoji */
    }
    
    .statistics-modal-content {
        max-width: 95%;
        max-height: 90vh;
    }
    
    .summary-stats {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .summary-number {
        font-size: 24px;
    }
    
    .summary-label {
        font-size: 12px;
    }
    
    #statistics-table {
        font-size: 11px;
    }
    
    #statistics-table th,
    #statistics-table td {
        padding: 8px 4px;
    }
    
    #statistics-table th {
        font-size: 10px;
    }
    
    .city-name {
        font-size: 10px;
    }
    
    .date {
        font-size: 9px;
    }
    
    /* Mobile game over section fixes */
    #game-over {
        margin-bottom: 20px; /* Extra margin at bottom */
    }
    
    .game-over-buttons {
        margin-top: 20px;
        margin-bottom: 20px; /* Extra bottom margin */
    }
    
    /* Ensure buttons are always clickable on mobile */
    .game-over-buttons button {
        margin-bottom: 8px;
        min-height: 44px; /* iOS recommended touch target size */
        font-size: 12px;
    }
    
    /* Add safe area padding for devices with home indicators */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        #sidebar {
            padding-bottom: calc(60px + env(safe-area-inset-bottom));
        }
    }
}