:root {
    --primary-color: #1e4d6b;
    --secondary-color: #3a7ca5;
    --accent-color: #81c3d7;
    --text-color: #2c3e50;
    --light-bg: #f5f6fa;
    --header-height: 70px;
}

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

body {
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    color: var(--text-color);
}

header {
    background-color: var(--primary-color);
    color: white;
    position: fixed;
    width: 100%;
    height: var(--header-height);
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header h1 {
    float: left;
    padding: 15px 30px;
    font-size: 1.8em;
}

nav {
    float: right;
    padding: 20px 30px;
}

nav ul {
    list-style: none;
}

nav ul li {
    display: inline;
    margin-left: 30px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-size: 1.1em;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: var(--accent-color);
}

main {
    padding-top: var(--header-height);
}

section {
    padding: 40px 20px;
}

#hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    background-size: 400% 100%;
    animation: gradientAnimation 15s ease infinite;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

.hero-content h2 {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.map-music-wrapper {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background-color: var(--light-bg);
    align-items: flex-start;
    max-width: 1200px;
    height: 650px;
    margin: 0 auto;
    margin-bottom: 2rem;
}

.map-section {
    flex: 2;
    background-color: var(--light-bg);
    max-width: 700px;
    margin-top: 0;
}

.map-container {
    width: 100%;
    position: relative;
}

#canal-map {
    width: 100%;
    height: 400px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.map-controls {
    margin-top: 0.5rem;
    text-align: center;
}

.music-section {
    flex: 1;
    min-width: 280px;
    max-width: 320px;
    background-color: var(--light-bg);
    padding: 0;
    display: flex;
    flex-direction: column;
    max-height: 200px;
}

.player-container {
    background: white;
    padding: 0.8rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.music-section h3 {
    margin-bottom: 0.3rem;
    text-align: center;
    color: var(--primary-color);
    font-size: 1rem;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: #ddd;
    border-radius: 3px;
    cursor: pointer;
    margin: 0.2rem 0;
}

#progress {
    width: 0;
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.1s linear;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.volume-control input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 2px;
    outline: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.volume-control i {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.control-btn {
    padding: 8px 15px;
    background-color: #1e4d6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 0 5px;
    transition: all 0.3s;
}

.control-btn:hover {
    background-color: #2c6d9c;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.control-btn.active {
    background-color: #f39c12;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.history-section {
    background-color: white;
    padding: 60px 20px;
}

.history-intro {
    max-width: 800px;
    margin: 0 auto 40px;
    text-align: center;
    font-size: 1.2em;
    line-height: 1.6;
    color: var(--text-color);
}

.timeline {
    width: 100%;
    margin: 40px auto;
    position: relative;
    padding: 20px 0;
    overflow: hidden;
    background: linear-gradient(90deg, 
        var(--light-bg) 0%, 
        rgba(245, 246, 250, 0.5) 10%,
        rgba(245, 246, 250, 0.5) 90%,
        var(--light-bg) 100%
    );
}

.timeline::-webkit-scrollbar {
    height: 6px;
}

.timeline::-webkit-scrollbar-track {
    background: #ddd;
    border-radius: 3px;
}

.timeline::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 3px;
}

.timeline-container {
    display: inline-flex;
    padding: 20px 0;
    animation: autoScroll 60s linear infinite;
    transition: all 0.3s ease;
    will-change: transform;
    gap: 30px;
    position: relative;
}

.timeline-container::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -20px;
    height: 3px;
    background: linear-gradient(90deg,
        var(--primary-color),
        var(--secondary-color),
        var(--accent-color)
    );
    opacity: 0.7;
    border-radius: 3px;
    filter: blur(1px);
}

.timeline-container:hover {
    animation-play-state: paused;
}

@keyframes autoScroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-350px * 3));
    }
}

@keyframes timelineGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(30, 77, 107, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(30, 77, 107, 0.6));
    }
}

.timeline-item {
    opacity: 0.85;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 350px;
    transform-origin: center center;
    position: relative;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.timeline-item:hover {
    opacity: 1;
    transform: translateY(-5px) scale(1.05);
    z-index: 1;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--accent-color);
}

.timeline-item.active {
    opacity: 1;
    transform: translateY(-10px) scale(1.1);
    z-index: 2;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    border-color: var(--primary-color);
    background: white;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    bottom: 0;
    background: linear-gradient(to right,
        var(--primary-color),
        var(--secondary-color),
        var(--accent-color));
    border-radius: 3px;
    animation: timelineGlow 2s ease-in-out infinite;
}

@keyframes timelineGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(30, 77, 107, 0.3); }
    50% { box-shadow: 0 0 15px rgba(30, 77, 107, 0.6); }
}

.timeline-item {
    display: inline-block;
    margin: 20px 15px;
    position: relative;
    padding: 20px;
    background: var(--light-bg);
    border-radius: 12px;
    width: 350px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    vertical-align: top;
    white-space: normal;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    bottom: -26px;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
}

.timeline-item:hover::after {
    transform: translateX(-50%) scale(1.5);
    box-shadow: 0 0 15px rgba(30, 77, 107, 0.6);
}

.timeline-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.era-marker {
    position: absolute;
    top: -30px;
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    transform: translateY(-50%);
    z-index: 1;
    transition: all 0.3s ease;
}

.timeline-item:hover .era-marker {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
}

.timeline-item[data-era="pre-qin"] { border-left: 4px solid #8b4513; }
.timeline-item[data-era="qin-han"] { border-left: 4px solid #a0522d; }
.timeline-item[data-era="sui-tang"] { border-left: 4px solid #6b8e23; }
.timeline-item[data-era="song-yuan"] { border-left: 4px solid #4682b4; }
.timeline-item[data-era="ming-qing"] { border-left: 4px solid #800080; }
.timeline-item[data-era="modern"] { border-left: 4px solid #2f4f4f; }

.historical-fact {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255,255,255,0.7);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transform-origin: left center;
    transition: all 0.3s ease;
}

.timeline-item:hover .historical-fact {
    transform: scale(1.05);
    background: rgba(255,255,255,0.9);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.historical-fact i {
    transition: transform 0.3s ease;
}

.timeline-item:hover .historical-fact i {
    transform: rotate(360deg);
}

.historical-fact i {
    color: var(--primary-color);
    font-size: 1.2em;
}

.historical-fact span {
    font-size: 0.9em;
    color: var(--text-color);
    font-style: italic;
}

.culture-section {
    background-color: var(--light-bg);
}

.culture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.culture-item {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.culture-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.culture-icon {
    margin-top: 20px;
    font-size: 2em;
    color: var(--primary-color);
    opacity: 0.8;
    transition: all 0.3s ease;
}

.culture-item:hover .culture-icon {
    transform: scale(1.2);
    opacity: 1;
    color: var(--accent-color);
}

.map-container {
    position: relative;
    margin: 20px auto;
    max-width: 800px;
    height: 500px;
}

.boat-icon {
    position: relative;
    transform-origin: center;
    animation: boatFloat 3s infinite ease-in-out;
}

.small-boat-icon {
    position: relative;
    transform-origin: center;
    animation: boatFloat 2.5s infinite ease-in-out;
    animation-delay: 0.5s;
}

.boat-shadow {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 6px;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
    filter: blur(2px);
}

.water-ripple {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(30, 77, 107, 0.2);
    animation: ripple 2s infinite;
}

.start-ripple {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid #1e4d6b;
    animation: startRipple 2s ease-out;
}

.city-info-window {
    padding: 10px;
    max-width: 250px;
}

.city-info-window h3 {
    margin: 0 0 8px 0;
    color: #1e4d6b;
    border-bottom: 2px solid #f39c12;
    padding-bottom: 5px;
}

.city-description {
    font-weight: bold;
    margin-bottom: 8px;
}

.city-history {
    font-size: 0.9em;
    line-height: 1.5;
    color: #555;
}

.city-marker {
    position: relative;
    text-align: center;
}

.city-name {
    font-size: 12px;
    color: #333;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 5px;
    border-radius: 2px;
    margin-bottom: 5px;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.marker-dot {
    width: 10px;
    height: 10px;
    background-color: #e74c3c;
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.6);
    animation: pulseDot 2s infinite;
}

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

@keyframes ripple {
    0% { transform: scale(0.5); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes startRipple {
    0% { transform: scale(0); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0; }
}

@keyframes pulseDot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.sub-hero {
    height: 40vh;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
                url('https://images.unsplash.com/photo-1506158669146-619067262a00') center/cover;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    margin-bottom: 50px;
}

.heritage-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.heritage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.heritage-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.heritage-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.heritage-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.heritage-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.heritage-item:hover .heritage-image img {
    transform: scale(1.1);
}

.heritage-desc {
    padding: 20px;
}

.heritage-desc h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

.feature-list li {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    color: var(--text-color);
}

.feature-list i {
    margin-right: 10px;
    color: var(--accent-color);
    width: 20px;
    text-align: center;
}

@media (max-width: 768px) {
    .heritage-grid {
        grid-template-columns: 1fr;
    }

    .culture-grid {
        grid-template-columns: 1fr;
    }

    .sub-hero {
        height: 30vh;
    }
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-content {
    animation: fadeInUp 1.5s ease-out;
}

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

.info-window {
    padding: 10px;
    max-width: 200px;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.info-window h3 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.2em;
}

.info-window p {
    color: var(--text-color);
    font-size: 0.9em;
    line-height: 1.4;
    margin: 0;
}

footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

@media (max-width: 768px) {
    header h1 {
        float: none;
        text-align: center;
        padding: 10px;
    }

    nav {
        float: none;
        text-align: center;
        padding: 10px;
    }

    nav ul li {
        margin: 0 10px;
    }

    .timeline::before {
        left: 20px;
    }

    .timeline-item {
        width: calc(100% - 50px);
        float: right;
        margin-left: 50px;
    }
}
