:root {
    --bg-0: #0b1224;
    --bg-1: #111a2e;
    --panel: #18253f;
    --panel-soft: rgba(255, 255, 255, 0.04);
    --panel-border: rgba(148, 163, 184, 0.18);
    --text: #e2e8f0;
    --text-muted: rgba(226, 232, 240, 0.7);
    --accent: #14b8a6;
    --accent-strong: #0ea5a4;
    --accent-warm: #f97316;
    --accent-warm-strong: #ea580c;
    --shadow-lg: 0 20px 40px rgba(6, 12, 24, 0.45);
    --shadow-md: 0 12px 24px rgba(6, 12, 24, 0.35);
    --desktop-sidebar-width: 360px;
    --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

body {
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at top, rgba(20, 184, 166, 0.15), transparent 55%),
        linear-gradient(140deg, var(--bg-0), var(--bg-1));
    color: var(--text);
}

body.content-page {
    height: auto;
    min-height: 100vh;
    overflow: auto;
    background: radial-gradient(circle at top, rgba(20, 184, 166, 0.12), transparent 60%),
        linear-gradient(140deg, var(--bg-0), var(--bg-1));
    color: var(--text);
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
    line-height: 1.7;
}

.content-wrapper h1,
.content-wrapper h2,
.content-wrapper h3 {
    color: var(--accent);
    font-family: var(--font-display);
}

.content-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.content-nav a {
    color: var(--text);
    text-decoration: none;
    background: rgba(20, 184, 166, 0.18);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
}

.content-nav a:hover {
    background: rgba(20, 184, 166, 0.3);
}

.content-footer {
    margin-top: 40px;
    font-size: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.content-footer a {
    color: var(--text);
    text-decoration: none;
}

.content-footer a:hover {
    text-decoration: underline;
}

.intro-blurb {
    background: var(--panel-soft);
    border-radius: 12px;
    padding: 14px;
    margin: 14px 0 18px;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid var(--panel-border);
}

.content-switch-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 10px;
}

.content-switch {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 8px 0 14px;
}

.content-switch .switch-btn {
    grid-column: span 2;
}

.content-switch .switch-btn:nth-child(-n + 2) {
    grid-column: span 3;
}

@media screen and (max-width: 768px) {
    .content-switch {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .content-switch .switch-btn {
        grid-column: auto;
    }
}

.switch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.35);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid var(--panel-border);
    letter-spacing: 0.2px;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
}

.switch-btn.active {
    background: rgba(20, 184, 166, 0.25);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 12px 24px rgba(14, 165, 164, 0.3);
}

.switch-btn:hover {
    background: rgba(15, 23, 42, 0.5);
    transform: translateY(-1px);
}

body[data-content-type="poi"] .mode-buttons.poi-mode-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

body[data-content-type="poi"] #poi-mixed-btn {
    grid-column: 1 / -1;
}

body[data-content-type="poi"] .mode-buttons.poi-mode-buttons .mode-btn {
    padding: 12px 10px;
}

body[data-content-type="poi"] .mode-buttons.poi-mode-buttons .mode-title {
    font-size: 13px;
}

body[data-content-type="poi"] .mode-buttons.poi-mode-buttons .mode-date {
    font-size: 11px;
}

body[data-content-type="poi"] .mode-buttons.poi-play-mode-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.poi-setting-card {
    background: var(--panel-soft);
    border-radius: 14px;
    padding: 14px;
    border: 1px solid var(--panel-border);
}

.poi-setting-card label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

#num-pois {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text);
}

.poi-setting-hint {
    margin-top: 8px;
    font-size: 11px;
    color: rgba(236, 240, 241, 0.7);
}

.mode-btn-disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(0.2);
}

.intro-blurb p {
    margin-bottom: 8px;
}

.intro-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.intro-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.intro-links a:hover {
    text-decoration: underline;
}

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


/* Notification Banner */
.notification-banner {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #10b981, #14b8a6);
    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, #f97316, #ea580c);
    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: calc(8px + env(safe-area-inset-top, 0px)) 15px 8px;
    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(14, 165, 164, 0.9);
}

/* Sidebar Collapse Button */
.sidebar-collapse-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    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, #ea580c, #c2410c);
    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: calc(10px + env(safe-area-inset-top, 0px));
    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(14, 165, 164, 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: var(--accent);
    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: none;
    gap: 6px;
    justify-content: center;
    flex-direction: column;
    align-items: stretch;
}

.mobile-control-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
}

.mobile-control-btn {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: rgba(20, 184, 166, 0.3);
    color: var(--text);
    min-width: 50px;
}

.mobile-control-btn:hover {
    background: rgba(20, 184, 166, 0.45);
}

.mobile-selection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.28);
    color: var(--text);
    min-width: 0;
}

.mobile-selection-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.mobile-selection-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.mobile-selection-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.35;
}

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

.sidebar-close:hover {
    color: var(--accent-warm);
}

#sidebar {
    width: 360px;
    background: linear-gradient(180deg, rgba(24, 37, 63, 0.96), rgba(17, 26, 46, 0.98));
    color: var(--text);
    padding: 18px 18px 24px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
}

#sidebar h1 {
    margin-bottom: 6px;
    font-size: 30px;
    text-align: center;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-display);
}

.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: var(--text-muted);
    font-size: 12px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.header-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.instructions-button,
.statistics-button {
    background: rgba(20, 184, 166, 0.18);
    padding: 10px;
    font-size: 12px;
    border: none;
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-md);
}

.instructions-button:hover {
    transform: translateY(-1px);
}

.statistics-button {
    background: rgba(249, 115, 22, 0.2);
}

.statistics-button:hover {
    transform: translateY(-1px);
}

#sidebar h2 {
    margin-bottom: 8px;
    font-size: 15px;
    color: var(--text);
    font-family: var(--font-display);
}

.section {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--panel-soft);
    border-radius: 14px;
    border: 1px solid var(--panel-border);
}

.quality-panel {
    background: linear-gradient(160deg, rgba(14, 165, 164, 0.14), rgba(30, 41, 59, 0.55));
    border-color: rgba(14, 165, 164, 0.38);
}

.quality-panel h2 {
    font-size: 14px;
    margin-bottom: 8px;
}

.quality-panel ul {
    margin: 0;
    padding-left: 18px;
}

.quality-panel li {
    margin-bottom: 7px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.35;
}

.city-label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-text);
    font-weight: 600;
}

.explored-city-select {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text);
    font-size: 14px;
    margin-bottom: 10px;
    appearance: none;
}

.city-caption {
    margin: 2px 0 8px;
    font-size: 12px;
    color: var(--muted-text);
}

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

#city-input {
    width: 100%;
    padding: 12px 12px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(15, 23, 42, 0.7);
    color: var(--text);
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #0f172a;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    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: #0b1224;
    border-radius: 4px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 4px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.9);
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    color: var(--text);
    font-size: 13px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    min-height: 45px;  /* Consistent height for each item */
}

.autocomplete-item:hover {
    background: rgba(20, 184, 166, 0.2);
    color: var(--text);
}

.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: 10px 12px;
    margin-top: 6px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(15, 23, 42, 0.7);
    color: var(--text);
}

#game-settings label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--text);
}

button {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: #021316;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 18px rgba(14, 165, 164, 0.25);
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    background: rgba(148, 163, 184, 0.35);
    cursor: not-allowed;
}

#game-controls {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    gap: 6px;
    align-items: center;
}

@media screen and (min-width: 769px) {
    body.desktop-game-active #sidebar {
        width: 308px;
        padding: 14px 14px 18px;
    }

    body.desktop-game-active .content-switch-label,
    body.desktop-game-active .content-switch,
    body.desktop-game-active .intro-blurb,
    body.desktop-game-active .header-buttons,
    body.desktop-game-active #city-selection,
    body.desktop-game-active #game-mode,
    body.desktop-game-active #game-settings,
    body.desktop-game-active .footer-links {
        display: none !important;
    }

    body.desktop-game-active #sidebar h1 {
        font-size: 24px;
        margin-bottom: 4px;
    }

    body.desktop-game-active .tagline {
        font-size: 12px;
        margin-bottom: 10px;
    }

    body.desktop-game-active #game-info {
        display: block !important;
        margin-bottom: 10px;
        padding: 10px 12px;
        border-radius: 12px;
        background: rgba(15, 23, 42, 0.58);
        border: 1px solid rgba(148, 163, 184, 0.2);
    }

    body.desktop-game-active #game-info h2 {
        display: none;
    }

    body.desktop-game-active #game-info p {
        display: flex;
        justify-content: space-between;
        gap: 8px;
        margin: 0 0 8px;
        font-size: 13px;
    }

    body.desktop-game-active #game-info p:last-of-type {
        margin-bottom: 0;
    }

    body.desktop-game-active #game-info span {
        color: #f8fafc;
    }

    body.desktop-game-active .quit-game-btn {
        margin-top: 10px;
    }

    body.desktop-game-active #game-controls {
        position: fixed;
        left: calc((100% + var(--desktop-sidebar-width, 360px)) / 2);
        bottom: max(14px, calc(env(safe-area-inset-bottom, 0px) + 8px));
        top: auto;
        transform: translateX(-50%);
        z-index: 982;
        width: min(340px, calc(100vw - var(--desktop-sidebar-width, 360px) - 38px));
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 6px;
        padding: 6px;
        border-radius: 12px;
        background: rgba(15, 23, 42, 0.84);
        border: 1px solid rgba(148, 163, 184, 0.38);
        box-shadow: 0 8px 18px rgba(2, 6, 23, 0.42);
        backdrop-filter: blur(6px);
        overflow: hidden;
    }

    body.desktop-game-active #game-controls button {
        height: 36px;
        border-radius: 8px;
        box-shadow: none;
        border: 1px solid rgba(148, 163, 184, 0.35);
        font-weight: 600;
    }

    body.desktop-game-active #feedback {
        display: none !important;
    }

    body.desktop-game-active #prev-btn,
    body.desktop-game-active #next-btn {
        background: rgba(51, 65, 85, 0.85);
        border-color: rgba(148, 163, 184, 0.36);
        color: #f8fafc;
        font-size: 18px;
    }

    body.desktop-game-active #prev-btn:hover,
    body.desktop-game-active #next-btn:hover {
        background: rgba(71, 85, 105, 0.92);
        transform: none;
    }

    body.desktop-game-active #dont-know-btn {
        background: #f59e0b;
        border-color: #fbbf24;
        color: #1f2937;
        font-size: 12px;
        letter-spacing: 0;
        text-transform: none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.desktop-game-active #dont-know-btn:hover {
        background: #d97706;
        transform: none;
    }

    body.desktop-game-active #dont-know-btn:disabled,
    body.desktop-game-active #dont-know-btn.dont-know-disabled {
        background: rgba(71, 85, 105, 0.55);
        border-color: rgba(148, 163, 184, 0.35);
        color: rgba(226, 232, 240, 0.7);
        transform: none;
    }

    body.desktop-game-active .map-goal-overlay {
        top: 14px;
        width: min(620px, calc(100vw - var(--desktop-sidebar-width, 360px) - 46px));
        min-width: 0;
        max-width: min(620px, calc(100vw - var(--desktop-sidebar-width, 360px) - 46px));
        padding: 8px 12px;
        border-radius: 999px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background: rgba(2, 6, 23, 0.74);
        border-color: rgba(14, 165, 164, 0.42);
    }

    body.desktop-game-active .map-goal-label {
        font-size: 10px;
        margin-top: 1px;
    }

    body.desktop-game-active .map-goal-text {
        min-width: 0;
        max-width: 100%;
        font-size: 16px;
        line-height: 1.15;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.desktop-game-active .map-feedback-overlay {
        top: 22%;
        width: min(700px, calc(100vw - var(--desktop-sidebar-width, 360px) - 52px));
    }
}

#game-controls button {
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#start-game-btn {
    width: 100%;
}

#prev-btn,
#next-btn {
    background: rgba(20, 184, 166, 0.28);
    color: var(--text);
    font-size: 16px;
}

#prev-btn:hover,
#next-btn:hover {
    background: rgba(20, 184, 166, 0.45);
}

#dont-know-btn {
    background: var(--accent-warm);
    color: #1b1204;
    font-size: 12px;
    white-space: nowrap;
}

#dont-know-btn:hover {
    background: var(--accent-warm-strong);
}

#dont-know-btn:disabled,
#mobile-dont-know-btn:disabled {
    background: rgba(148, 163, 184, 0.3);
    color: rgba(226, 232, 240, 0.6);
    cursor: not-allowed;
    opacity: 0.85;
}

#dont-know-btn.dont-know-disabled,
#mobile-dont-know-btn.dont-know-disabled {
    background: rgba(148, 163, 184, 0.3);
    color: rgba(226, 232, 240, 0.6);
    cursor: not-allowed;
    opacity: 0.85;
}

.quit-game-btn {
    margin-top: 10px;
    width: 100%;
    height: 34px;
    background: rgba(71, 85, 105, 0.32);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text);
    box-shadow: none;
    font-size: 12px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.quit-game-btn:hover {
    background: rgba(71, 85, 105, 0.45);
}

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

#game-info span {
    font-weight: bold;
    color: var(--accent);
}

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

#feedback {
    background: rgba(15, 23, 42, 0.6);
    border-left: 4px solid var(--accent);
    transition: transform 0.18s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

#feedback.feedback-pop {
    animation: feedback-pop 0.28s ease-out;
}

#feedback.correct {
    border-left-color: #22c55e;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35), 0 10px 24px rgba(34, 197, 94, 0.16);
}

#feedback.incorrect {
    border-left-color: #ef4444;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35), 0 10px 24px rgba(239, 68, 68, 0.16);
}

#feedback.neutral {
    border-left-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.28), 0 10px 24px rgba(245, 158, 11, 0.12);
}

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

@keyframes feedback-pop {
    0% {
        transform: scale(0.98);
        opacity: 0.4;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#map-container {
    flex: 1;
    position: relative;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.8), rgba(2, 6, 23, 0.9));
    border-radius: 16px 0 0 0;
    overflow: hidden;
}

.map-goal-overlay {
    position: absolute;
    top: 14%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 980;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: min(520px, 86%);
    max-width: min(820px, 90%);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(14, 165, 164, 0.45);
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45);
    pointer-events: none;
    text-align: center;
}

.map-goal-label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.75);
}

.map-goal-text {
    font-size: 19px;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.25;
}

.map-feedback-overlay {
    position: absolute;
    top: 28%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 980;
    width: min(920px, 92%);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.84);
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.48);
    pointer-events: none;
    text-align: center;
}

.map-feedback-overlay p {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: #f8fafc;
    word-break: break-word;
}

.map-feedback-overlay.correct {
    border-color: rgba(34, 197, 94, 0.65);
    box-shadow: 0 10px 28px rgba(21, 128, 61, 0.35);
}

.map-feedback-overlay.incorrect {
    border-color: rgba(239, 68, 68, 0.65);
    box-shadow: 0 10px 28px rgba(185, 28, 28, 0.35);
}

.map-feedback-overlay.neutral {
    border-color: rgba(245, 158, 11, 0.65);
    box-shadow: 0 10px 28px rgba(180, 83, 9, 0.35);
}

.answer-tag {
    background: transparent;
    border: none;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.answer-tag-connector {
    stroke-linecap: butt;
    stroke-linejoin: round;
    opacity: 0.95;
    filter: drop-shadow(0 0 1.5px rgba(15, 23, 42, 0.5));
}

.answer-tag-text {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-width: 250px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(51, 65, 85, 0.96);
    background: rgba(2, 6, 23, 0.9);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 6px 14px rgba(2, 6, 23, 0.42);
    box-sizing: border-box;
}

#map-container::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
}

#map-container.result-flash-correct::after {
    background: radial-gradient(circle at center, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0));
    animation: result-flash 0.6s ease-out;
}

#map-container.result-flash-incorrect::after {
    background: radial-gradient(circle at center, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0));
    animation: result-flash 0.6s ease-out;
}

#map-container.result-flash-neutral::after {
    background: radial-gradient(circle at center, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0));
    animation: result-flash 0.6s ease-out;
}

@keyframes result-flash {
    0% {
        opacity: 0.95;
    }
    100% {
        opacity: 0;
    }
}

#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: butt;
    stroke-linejoin: miter;
}

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

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: #0f172a;
    padding: 30px;
    border-radius: 14px;
    color: var(--text);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(148, 163, 184, 0.3);
    border-top: 4px solid var(--accent);
    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: #22c55e;
    stroke: #22c55e;
    stroke-width: 4;
    opacity: 0.8;
}

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

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

#game-over {
    background: rgba(20, 184, 166, 0.12);
    border: 2px solid rgba(20, 184, 166, 0.5);
}

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

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

.game-over-hint {
    display: none;
    margin: -6px 0 12px;
    text-align: center;
    font-size: 12px;
    color: rgba(226, 232, 240, 0.9);
}

.game-over-secondary {
    margin: -6px 0 12px;
    text-align: center;
    font-size: 12px;
    color: rgba(226, 232, 240, 0.75);
}

.score-stats {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    padding: 10px;
    margin: 15px 0;
    border: 1px solid var(--panel-border);
}

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

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    color: var(--accent);
    font-weight: bold;
}

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

.share-btn {
    background: linear-gradient(135deg, #0ea5a4, #14b8a6);
    color: #04141a;
    border: none;
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: linear-gradient(135deg, #0f766e, #0ea5a4);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(14, 165, 164, 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(6, 12, 24, 0.75);
    animation: fadeIn 0.3s;
}

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

.modal-content {
    background-color: #0f172a;
    margin: 5% auto;
    padding: 30px;
    border: none;
    border-radius: 16px;
    width: 80%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    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: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--accent-warm);
}

.modal-content h2 {
    color: var(--accent);
    margin-bottom: 25px;
    font-size: 28px;
    text-align: center;
    border-bottom: 2px solid rgba(20, 184, 166, 0.4);
    padding-bottom: 10px;
}

.instructions-section {
    margin-bottom: 25px;
    background: rgba(15, 23, 42, 0.7);
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid var(--accent);
}

.instructions-section h3 {
    color: var(--accent);
    margin-bottom: 12px;
    font-size: 18px;
}

.instructions-section ol,
.instructions-section ul {
    margin-left: 20px;
    color: var(--text);
    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: #0b1224;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.9);
}

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

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

.statistics-section h3 {
    color: var(--accent);
    font-size: 20px;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(20, 184, 166, 0.4);
    padding-bottom: 8px;
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--panel-border);
}

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

.summary-number {
    display: block;
    font-size: 32px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 5px;
}

.summary-label {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}

.no-stats-message {
    text-align: center;
    padding: 40px 20px;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 12px;
    color: var(--text);
}

.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;
    color: #1f2937;
    font-weight: 600;
}

#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(251, 191, 36, 0.08);
}

#statistics-table tr.average:hover {
    background: rgba(251, 191, 36, 0.16);
}

#statistics-table tr.needs-improvement {
    background: rgba(239, 68, 68, 0.08);
}

#statistics-table tr.needs-improvement:hover {
    background: rgba(239, 68, 68, 0.16);
}

.city-name {
    font-weight: 600;
    color: var(--text);
}

.date {
    color: #334155;
    font-size: 12px;
    font-weight: 600;
}

.score {
    font-weight: 700;
    font-family: var(--font-mono);
}

.best-score {
    color: #22c55e;
}

.attempts {
    text-align: center;
    font-weight: 700;
    color: #0f766e;
}

/* Ad Container Styles */
#ad-container {
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed rgba(148, 163, 184, 0.35);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

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

.mode-btn {
    flex: 1;
    padding: 12px 10px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mode-btn:hover {
    background: rgba(15, 23, 42, 0.7);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: rgba(20, 184, 166, 0.2);
    border-color: rgba(20, 184, 166, 0.8);
    box-shadow: 0 10px 18px rgba(14, 165, 164, 0.2);
}

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

.mode-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 4px;
}

.mode-desc {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.2;
}

.mode-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.challenge-info {
    text-align: center;
    color: var(--accent);
    font-size: 13px;
    margin: 8px 0;
    font-weight: 500;
}

/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
    body {
        --mobile-hud-height: 70px;
        --mobile-hud-gap: 12px;
        --mobile-controls-height: 112px;
    }

    #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;
        height: 100dvh;
    }

    .map-goal-overlay {
        top: 16%;
        min-width: min(94%, 94%);
        padding: 8px 10px;
    }

    .map-goal-label {
        font-size: 10px;
    }

    .map-goal-text {
        font-size: 16px;
    }

    .map-feedback-overlay {
        top: 32%;
        width: 94%;
        padding: 10px 12px;
    }

    .map-feedback-overlay p {
        font-size: 13px;
    }

    .answer-tag-text {
        max-width: 190px;
        font-size: 11px;
        padding: 3px 7px;
    }
    
    /* Adjust map when mobile game info is visible */
    body.mobile-game-active #map-container {
        padding-top: var(--mobile-hud-height, 70px);
        padding-bottom: calc(var(--mobile-controls-height, 64px) + env(safe-area-inset-bottom, 0px) + 12px);
        height: calc(100vh - var(--mobile-hud-height, 70px));
        height: calc(100dvh - var(--mobile-hud-height, 70px));
    }
    
    body.mobile-game-active .mobile-game-info {
        display: block !important;
    }

    /* Keep overlays clear of the fixed mobile control bar. */
    body.mobile-game-active .map-goal-overlay {
        display: none !important;
    }

    body.mobile-game-active .map-feedback-overlay {
        position: fixed;
        top: calc(var(--mobile-hud-height, 70px) + var(--mobile-hud-gap, 12px));
    }
    
    
    /* 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;
    }

    body.mobile-game-over #sidebar {
        transform: translateX(0);
        padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    }

    body.mobile-game-over #sidebar > :not(#game-over) {
        display: none !important;
    }

    body.mobile-game-over #game-over {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 28px);
        margin: 0;
    }

    body.mobile-game-over #map-container {
        pointer-events: none;
    }

    body.mobile-game-over #map-container .leaflet-control-container {
        display: none !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,
    #num-pois,
    #city-input {
        padding: 8px;
        font-size: 16px;
    }

    body.mobile-game-active .mobile-controls {
        display: flex;
        position: fixed;
        left: 50%;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
        top: auto;
        right: auto;
        transform: translateX(-50%);
        z-index: 950;
        width: min(380px, 94vw);
        padding: 10px 12px;
        border-radius: 22px;
        border: 1px solid rgba(148, 163, 184, 0.35);
        background: rgba(15, 23, 42, 0.92);
        box-shadow: 0 10px 24px rgba(2, 6, 23, 0.45);
        justify-content: center;
        gap: 8px;
        pointer-events: auto;
    }

    .mobile-control-btn {
        flex: 1;
        min-width: 0;
        padding: 10px 10px;
        font-size: 12px;
        border-radius: 999px;
        background: rgba(20, 184, 166, 0.22);
    }

    .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;
    }

    .map-goal-overlay {
        top: 18%;
    }

    .map-feedback-overlay {
        top: 35%;
    }

    body.mobile-game-active .map-goal-overlay {
        display: none !important;
    }

    body.mobile-game-active .map-feedback-overlay {
        position: fixed;
        top: calc(var(--mobile-hud-height, 70px) + var(--mobile-hud-gap, 10px));
    }
    
    #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));
        }
    }
}
    .mobile-game-info {
        left: 0;
        right: 0;
        transform: none;
        margin: 0 auto;
        width: min(420px, 94vw);
    }
