* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4eaf5 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
}

.animation-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    position: relative;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subtitle-container {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    margin: 5px 0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subtitle {
    color: black;
    border-radius: 30px;
    font-size: 1.4rem;
    max-width: 80%;
    text-align: center;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.subtitle.active {
    opacity: 1;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 5px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: #3498db;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.control-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

.progress-container {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
    display: flex;
    align-items: center;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s ease;
}

.progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #3498db;
    border-radius: 50%;
    cursor: grab;
    left: 0%;
}

.progress-handle:active {
    cursor: grabbing;
}

.time-display {
    min-width: 100px;
    text-align: center;
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 500;
}

.footer {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(52, 152, 219, 0.2);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-size: 1.2rem;
    color: #3498db;
}

.cache-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(46, 204, 113, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: none;
}

.cache-indicator.active {
    display: block;
}

.scene-number {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(52, 152, 219, 0.8);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.trig-scene {
    width: 100%;
    height: 100%;
    position: relative;
}

.scene-title {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.8rem;
    color: #2c3e50;
    font-weight: 300;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.scene-title.active {
    opacity: 1;
}

@media (max-width: 768px) {
    .animation-container {
        padding: 20px;
        min-height: 300px;
    }

    .subtitle {
        font-size: 1rem;
        padding: 12px 20px;
    }

    .control-btn {
        width: 45px;
        height: 45px;
    }

    .scene-title {
        font-size: 1.4rem;
    }

    .scene-number {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }

    .time-display {
        min-width: 80px;
        font-size: 0.8rem;
    }
}

/* === Loading 进度条 === */
.loading-progress {
    width: 320px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.loading-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(52, 152, 219, 0.15);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.loading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 999px;
    transition: width 0.15s ease;
}

.loading-progress-text {
    font-size: 0.95rem;
    color: #2c3e50;
    font-weight: 500;
}

.scene-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.scene-btn {
    padding: 5px 10px;
    border: 1px solid #3498db;
    border-radius: 5px;
    background: #ecf0f1;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.scene-btn:hover {
    background: #3498db;
    color: #fff;
}

.scene-btn.active {
    background: #3498db;
    color: #fff;
    border-color: #2980b9;
}

@media (max-width: 768px) {
    .controls > *:not(.scene-buttons) {
        order: 1; /* 第一行：播放、静音、进度条 */
    }

    .scene-buttons {
        order: 2; /* 第二行：场景按钮 */
        flex: 1 0 100%; /* 占满整行 */
        justify-content: center; /* 居中 */
        display: flex;
        gap: 8px;
    }
}

