:root {
    --primary-color: #ff6b81;
    --primary-gradient: linear-gradient(135deg, #ff6b81 0%, #ff8c94 100%);
    --secondary-color: #8a63ff;
    --secondary-gradient: linear-gradient(135deg, #8a63ff 0%, #6b5ce7 100%);
    --dark-color: #2d3436;
    --light-color: #f5f6fa;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --error-color: #d63031;
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 45px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --border-radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'SF Pro Display', -apple-system, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
}

.app-container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    gap: 30px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    position: relative;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.player-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
}

.video-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    background: #000;
    width: 100%;
    max-width: 518px;
    aspect-ratio: 9/16;
    max-height: 85vh;
    transition: var(--transition);
}

.video-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
}

.video-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
}

video {
    background: #000;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 15;
    border-radius: var(--border-radius);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 107, 129, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

.loading-text {
    font-size: 1.2rem;
    color: white;
    font-weight: 500;
    letter-spacing: 1px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}

.progress-container {
    position: absolute;
    bottom: 15px;
    left: 15px;
    right: 15px;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
    z-index: 15;
    display: none;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.controls {
    display: flex;
    flex-direction: row;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(255, 107, 129, 0.3);
    min-width: 150px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(255, 107, 129, 0.4);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 3px 10px rgba(255, 107, 129, 0.3);
}

#autoPlayBtn.enabled {
    background: linear-gradient(135deg, var(--success-color), #00d2a4);
}

#toggleMuteBtn.muted {
    background: linear-gradient(135deg, var(--secondary-color), #7b6eff);
}

#favoriteBtn.favorited {
    background: linear-gradient(135deg, var(--warning-color), #ffb142);
}

.sidebar {
    width: 350px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 25px;
    max-height: 85vh;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sidebar-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--dark-color);
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 107, 129, 0.2);
    position: relative;
}

.sidebar-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 3px;
}

.video-info {
    background: rgba(255, 107, 129, 0.05);
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 107, 129, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
}

.video-info-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.video-info-content {
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-line;
    color: var(--dark-color);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: white;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
}

.history-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.history-item.active {
    border-color: var(--primary-color);
    background: rgba(255, 107, 129, 0.05);
}

.history-item-date {
    font-weight: 600;
    margin-bottom: 5px;
}

.history-item-source {
    font-size: 0.85rem;
    opacity: 0.7;
    color: var(--dark-color);
}

.settings-group {
    margin-bottom: 20px;
}

.settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.settings-option span {
    font-weight: 500;
}

.switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background: var(--primary-gradient);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.api-status {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.status-label {
    font-weight: 500;
}

.status-value {
    font-weight: 600;
}

.status-working {
    color: var(--success-color);
}

.status-error {
    color: var(--error-color);
}

.status-timeout {
    color: var(--warning-color);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        gap: 25px;
    }
    
    .sidebar {
        width: 100%;
        max-height: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .app-container {
        padding: 20px;
        border-radius: 14px;
    }
    
    .video-container {
        max-width: 100%;
        max-height: 75vh;
        border-radius: 14px;
    }
    
    .controls {
        gap: 12px;
    }
    
    button {
        padding: 12px 20px;
        min-width: 130px;
        font-size: 0.95rem;
    }
    
    .sidebar {
        padding: 20px;
    }
    
    .sidebar-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 100%;
        max-width: 280px;
    }
    
    .video-info {
        padding: 15px;
    }
}

/* 滚动条美化 */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #ff5252;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* 视频控制覆盖层 */
.video-controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    display: flex;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.video-container:hover .video-controls-overlay {
    opacity: 1;
}

.overlay-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition);
}

.overlay-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.overlay-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}
