:root {
    /* 色彩系统 */
    --color-primary: #FF6B35;
    --color-primary-light: #FF8E68;
    --color-primary-dark: #E55A2A;
    --color-secondary: #F7931E;
    --color-background: #FFFFFF;
    --color-surface: #F5F5F7;
    --color-text-primary: #1D1D1F;
    --color-text-secondary: #86868B;
    --color-text-tertiary: #A1A1A6;
    --color-border: #D2D2D7;
    --color-success: #4CAF50;
    --color-warning: #FFC107;
    --color-error: #F44336;
    
    /* 间距系统 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* 圆角系统 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    
    /* 阴影系统 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    
    /* 动画系统 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* 字体系统 */
    --font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 10px;
    --font-size-sm: 12px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 24px;
    
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
}

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

html {
    scroll-behavior: smooth;
}

::selection {
    background: rgba(255, 107, 53, 0.2);
    color: var(--color-text-primary);
}

body {
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    background-color: var(--color-background);
    color: var(--color-text-primary);
}

#title {
    position: fixed;
    top: var(--spacing-md);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    transition: all var(--transition-normal);
}

#title:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary), #FFB347);
    border-radius: 3px 3px 0 0;
}

.logo {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
    transition: transform var(--transition-normal);
}

#title:hover .logo {
    transform: scale(1.05);
}

#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#stats {
    position: fixed;
    bottom: 25px;
    right: 5px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    max-width: 220px;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-left: 3px solid var(--color-success);
    animation: slideLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

#stats:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

#stats.hidden {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    border-left-color: transparent;
    border-color: rgba(255, 255, 255, 0.3);
}

#stats h3 {
    margin-bottom: var(--spacing-md);
    color: var(--color-text-primary);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.3px;
    line-height: 1.3;
}

#total-length {
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

#total-spots {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

#type-stats {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
}

.type-stat-item {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
    user-select: none;
}

.type-stat-item:hover {
    background: rgba(0,0,0,0.06);
    transform: translateX(2px);
}

.type-stat-item.active {
    background: rgba(255, 107, 53, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 107, 53, 0.3);
}

.type-stat-item.active span {
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
}

.type-color {
    width: 10px;
    height: 10px;
    margin-right: var(--spacing-sm);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 0 !important;
    animation: popupFadeIn 0.25s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.leaflet-popup-content {
    min-width: 220px;
    margin: 0 !important;
    padding: 0 !important;
}

.leaflet-popup-tip {
    box-shadow: var(--shadow-md) !important;
}

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

.popup-accent {
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
    position: relative;
}

.popup-accent h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    padding-bottom: var(--spacing-sm);
    padding-right: 28px;
    border-bottom: 1px solid var(--color-border);
    line-height: 1.4;
    word-break: break-word;
}

.popup-accent p {
    margin: var(--spacing-xs) 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    padding-left: 2px;
}

.leaflet-popup-close-button {
    color: var(--color-text-tertiary) !important;
    font-size: 18px !important;
    padding: 8px 10px 4px 8px !important;
    transition: all var(--transition-fast) !important;
    z-index: 100 !important;
    width: auto !important;
    height: auto !important;
    top: 2px !important;
    right: 4px !important;
}

.leaflet-popup-close-button:hover {
    color: var(--color-text-primary) !important;
    background: rgba(0,0,0,0.05) !important;
    border-radius: 50% !important;
}

#github-link {
    position: fixed;
    bottom: var(--spacing-md);
    left: var(--spacing-md);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    max-width: 100px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    animation: slideRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
    transition: all var(--transition-normal);
}

#github-link:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

#github-link a {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    transition: all var(--transition-normal);
}

#github-link a:hover {
    color: var(--color-text-primary);
    transform: translateY(-1px);
}

#github-link svg {
    flex-shrink: 0;
    transition: transform var(--transition-normal);
}

#github-link a:hover svg {
    transform: scale(1.1) rotate(5deg);
}

#github-link #author {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    text-align: center;
}

.leaflet-control-zoom {
    border: none !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 16px !important;
    color: var(--color-text-secondary) !important;
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.04) !important;
    transition: all var(--transition-fast) !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--color-text-primary) !important;
    transform: scale(1.05);
}

.leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.55) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--color-text-tertiary) !important;
    font-size: var(--font-size-xs) !important;
    padding: 2px 8px !important;
    border-radius: 4px 0 0 0 !important;
}

.leaflet-control-attribution a {
    color: var(--color-text-tertiary) !important;
    transition: color var(--transition-fast) !important;
}

.leaflet-control-attribution a:hover {
    color: var(--color-text-secondary) !important;
}

.leaflet-interactive {
    cursor: pointer;
}

/* SVG路径上的流动虚线动画 */
.leaflet-overlay-pane path.leaflet-interactive {
    stroke-dasharray: 12;
    animation: dashFlow 1.5s linear infinite;
    stroke-linecap: round;
}

@keyframes dashFlow {
    from {
        stroke-dashoffset: 24;
    }
    to {
        stroke-dashoffset: 0;
    }
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e8e8e8;
    border-top-color: #FF6B35;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#loading p {
    margin-top: 16px;
    color: #888;
    font-size: 14px;
    letter-spacing: 0.5px;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

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

#welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease;
}

#welcome-modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.7);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.close-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--color-text-primary);
    transform: scale(1.1);
}

.modal-body {
    padding: var(--spacing-lg);
}

.welcome-section {
    margin-bottom: var(--spacing-lg);
}

.welcome-section h3 {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.welcome-section p {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0 0 var(--spacing-md) 0;
}

.welcome-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.welcome-section li {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    padding-left: 18px;
    position: relative;
    margin-bottom: var(--spacing-sm);
}

.welcome-section li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    flex-shrink: 0;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: var(--spacing-md);
}

.guide-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    transition: all var(--transition-normal);
}

.guide-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--color-primary);
}

.guide-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--color-text-primary);
    font-weight: var(--font-weight-semibold);
}

.guide-item p {
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: 1.4;
    color: var(--color-text-secondary);
}

.github-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: #24292e;
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.github-btn:hover {
    background: #2b3137;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.2);
}

.github-btn svg {
    transition: transform var(--transition-normal);
}

.github-btn:hover svg {
    transform: scale(1.1) rotate(5deg);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg) var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--color-success);
}

.primary-btn {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 4px rgba(255, 107, 53, 0.2);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
}

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

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

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 16px 20px 12px;
    }
    
    .modal-header h2 {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 16px 20px;
    }
    
    .welcome-section {
        margin-bottom: 16px;
    }
    
    .modal-footer {
        padding: 12px 20px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .checkbox-label {
        justify-content: center;
    }
    
    .primary-btn {
        width: 100%;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    #title {
        font-size: 14px;
        padding: 8px 16px;
        top: 5px;
        gap: 8px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.9);
    }

    #title::after {
        left: 15%;
        right: 15%;
        height: 2px;
    }

    .logo {
        width: 22px;
        height: 22px;
    }

    #stats {
        bottom: 25px;
        right: 5px;
        left: auto;
        max-width: 220px;
        padding: 10px 12px;
        background: rgba(255, 255, 255, 0.85);
        border-radius: 10px;
    }

    #stats.hidden {
        background: rgba(255, 255, 255, 0.15);
        box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    }

    #github-link {
        bottom: 10px;
        left: 10px;
        padding: 6px 10px;
        max-width: 80px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.85);
    }

    #github-link a {
        font-size: 10px;
    }

    #github-link svg {
        width: 20px;
        height: 20px;
    }

    #github-link #author {
        font-size: 9px;
    }

    .leaflet-control-zoom a {
        width: 30px !important;
        height: 30px !important;
        line-height: 30px !important;
        font-size: 14px !important;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    #title {
        font-size: 14px;
        padding: 6px 16px;
        top: 3px;
    }

    #stats {
        bottom: 15px;
        padding: 10px 12px;
        max-width: 180px;
    }

    #github-link {
        bottom: 5px;
        padding: 4px 8px;
    }

    .modal-content {
        max-height: 70vh;
    }
}
