/* =========================================
   StitchSMR - Claymorphism 风格样式表
   ========================================= */

/* 1. 核心变量 */
:root {
    /* 背景色 */
    --bg-color: #eef2f5;
    /* 字体色 */
    --text-color: #6c757d;

    /* 装饰球颜色 */
    --blob-pink: #ffafcc;
    --blob-blue: #a2d2ff;

    /* 按钮颜色 */
    --btn-bg: #ffc8dd;
    --btn-text: #d63384;

    /* 核心 Clay 阴影参数 */
    --shadow-outer: 30px 30px 60px #c8d0e7, -30px -30px 60px #ffffff;
    --shadow-inner: inset 4px 4px 8px rgba(255,255,255,0.8), inset -4px -4px 8px rgba(209, 217, 230, 0.2);
    --shadow-btn: 8px 8px 16px #d1b3c0, -8px -8px 16px #ffffff;

    /* 卡片悬停阴影 */
    --shadow-hover: 35px 35px 70px #c0c8dd, -35px -35px 70px #ffffff;
}

/* 2. 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--bg-color);
    font-family: 'Fredoka', sans-serif;
    color: var(--text-color);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
}

/* 3. 通用 Clay 组件 */

/* Clay 卡片 */
.clay-card {
    background: #ffffff;
    border-radius: 30px;
    box-shadow: var(--shadow-outer), var(--shadow-inner);
    padding: 40px;
    position: relative;
    z-index: 10;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.clay-card:hover {
    box-shadow: var(--shadow-hover), var(--shadow-inner);
    transform: translateY(-5px);
}

/* Clay 按钮 */
.clay-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow-btn);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Fredoka', sans-serif;
    display: inline-block;
    text-decoration: none;
}

.clay-btn:hover {
    transform: scale(1.05);
}

.clay-btn:active {
    transform: scale(0.95);
}

/* 小按钮变体 */
.clay-btn-sm {
    padding: 10px 25px;
    font-size: 0.95rem;
}

/* 装饰球 */
.clay-circle {
    position: fixed;
    border-radius: 50%;
    z-index: 1;
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.05),
                inset 10px 10px 20px rgba(255,255,255,0.8),
                10px 20px 30px rgba(0,0,0,0.1);
    animation: float 6s ease-in-out infinite;
    pointer-events: none;
}

.circle-pink {
    background: var(--blob-pink);
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.05),
                inset 10px 10px 20px rgba(255,255,255,0.8),
                10px 20px 30px rgba(255,175,204,0.4);
}

.circle-blue {
    background: var(--blob-blue);
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.05),
                inset 10px 10px 20px rgba(255,255,255,0.8),
                10px 20px 30px rgba(162,210,255,0.4);
}

/* Clay 输入框 */
.clay-input {
    width: 100%;
    background: #eef2f5;
    border: none;
    padding: 15px 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    font-family: 'Fredoka', sans-serif;
    color: var(--text-color);
    outline: none;
    box-shadow: inset 5px 5px 10px #d1d9e6, inset -5px -5px 10px #ffffff;
}

.clay-input::placeholder {
    color: #aab2bd;
}

/* 自定义下拉框 */
.custom-select-wrapper {
    position: relative;
    min-width: 100px;
}

.custom-select {
    position: relative;
    cursor: pointer;
}

.custom-select-trigger {
    padding: 12px 35px 12px 20px;
    border: none;
    border-radius: 20px;
    background: #eef2f5;
    color: var(--text-color);
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 5px 5px 10px #d1d9e6, -5px -5px 10px #ffffff;
    transition: all 0.3s;
    position: relative;
}

.custom-select-trigger::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-color);
    transition: transform 0.3s;
}

.custom-select.open .custom-select-trigger::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-trigger:hover {
    box-shadow: 3px 3px 6px #d1d9e6, -3px -3px 6px #ffffff;
    transform: translateY(-1px);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.1), -5px -5px 15px rgba(255,255,255,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 100;
    overflow: hidden;
}

.custom-select.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    padding: 12px 20px;
    color: var(--text-color);
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-option:hover {
    background: linear-gradient(135deg, var(--blob-pink), var(--blob-blue));
    color: white;
}

.custom-option.selected {
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 600;
}

/* 4. 导航栏 */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    position: relative;
    z-index: 20;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-dot {
    width: 18px;
    height: 18px;
    background: var(--blob-pink);
    border-radius: 50%;
    display: inline-block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: nowrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 400;
    transition: color 0.3s;
    font-size: 0.95rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-links a:hover {
    color: var(--btn-text);
}

/* 汉堡菜单按钮 */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text-color);
    border-radius: 3px;
    transition: all 0.3s;
}

/* 移动端菜单 */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    padding: 80px 30px 30px;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu a {
    display: block;
    padding: 15px 0;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--bg-color);
    transition: color 0.3s;
}

.mobile-menu a:hover {
    color: var(--btn-text);
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.mobile-overlay.active {
    display: block;
}

/* 5. 首页视频网格 */
.container {
    padding: 20px 5%;
    position: relative;
    z-index: 10;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #555;
    text-align: center;
}

/* 搜索框 */
.search-wrapper {
    max-width: 600px;
    margin: 0 auto 30px;
    position: relative;
}

.search-box {
    width: 100%;
    background: #ffffff;
    border: none;
    padding: 15px 50px 15px 20px;
    border-radius: 25px;
    font-family: 'Fredoka', sans-serif;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    box-shadow: 15px 15px 30px #d1d9e6, -15px -15px 30px #ffffff;
    transition: box-shadow 0.3s;
}

.search-box:focus {
    box-shadow: 20px 20px 40px #c8d0e7, -20px -20px 40px #ffffff;
}

.search-box::placeholder {
    color: #aab2bd;
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--btn-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 5px 5px 10px #d1b3c0, -5px -5px 10px #ffffff;
    transition: transform 0.2s;
}

.search-btn:hover {
    transform: translateY(-50%) scale(1.1);
}

.search-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 10px 30px;
    border: none;
    border-radius: 50px;
    background: #ffffff;
    color: var(--text-color);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 8px 8px 16px #d1d9e6, -8px -8px 16px #ffffff;
    transition: all 0.3s ease;
    font-family: 'Fredoka', sans-serif;
}

.filter-tab:hover {
    transform: translateY(-2px);
}

.filter-tab.active {
    background: var(--btn-bg);
    color: var(--btn-text);
    box-shadow: var(--shadow-btn);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
}

.video-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 12px 12px 24px #d1d9e6, -12px -12px 24px #ffffff;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.video-card:hover {
    box-shadow: 15px 15px 30px #c8d0e7, -15px -15px 30px #ffffff;
    transform: translateY(-5px);
}

.video-cover {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, var(--blob-pink), var(--blob-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    position: relative;
}

.video-info {
    padding: 12px 15px;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-color);
}

.video-type {
    padding: 4px 12px;
    border-radius: 15px;
    background: var(--bg-color);
    font-size: 0.75rem;
}

.video-episodes {
    font-size: 0.75rem;
}

/* 6. 播放器页面 */
.player-container {
    padding: 40px 5%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden;
}

.player-wrapper {
    background: #ffffff;
    border-radius: 30px;
    box-shadow: var(--shadow-outer), var(--shadow-inner);
    padding: 30px;
    margin-bottom: 30px;
}

.video-player {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    position: relative;
}

.video-player video {
    width: 100%;
    display: block;
}

/* 自定义控制栏 */
.custom-controls {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 20px;
    margin-top: 15px;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.05);
}

.control-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-btn {
    background: var(--btn-bg);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 5px 5px 10px #d1b3c0, -5px -5px 10px #ffffff;
    transition: transform 0.2s;
    font-size: 1.2rem;
}

.control-btn:hover {
    transform: scale(1.1);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-color);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    box-shadow: inset 2px 2px 4px #d1d9e6, inset -2px -2px 4px #ffffff;
}

.progress-filled {
    height: 100%;
    background: linear-gradient(90deg, var(--blob-pink), var(--blob-blue));
    border-radius: 10px;
    width: 0%;
    transition: width 0.1s;
}

.control-slider {
    flex: 1;
    max-width: 150px;
}

.control-slider input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 10px;
    background: var(--bg-color);
    outline: none;
    box-shadow: inset 2px 2px 4px #d1d9e6, inset -2px -2px 4px #ffffff;
    -webkit-appearance: none;
    appearance: none;
}

/* 问题4修复：优化滑块样式，增大触摸区域 */
.control-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--btn-bg);
    cursor: pointer;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.control-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--btn-bg);
    cursor: pointer;
    border: none;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.control-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.control-slider input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* 移动端优化：增大触摸区域 */
@media (max-width: 768px) {
    .control-slider input[type="range"] {
        height: 8px;
        padding: 10px 0;
    }

    .control-slider input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }

    .control-slider input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}

.control-label {
    font-size: 0.9rem;
    color: var(--text-color);
    min-width: 60px;
}

.time-display {
    font-size: 0.9rem;
    color: var(--text-color);
    min-width: 100px;
    text-align: center;
}

/* 视频源标签页 */
.source-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.source-tab {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    background: #ffffff;
    color: var(--text-color);
    font-weight: 500;
    cursor: pointer;
    box-shadow: 8px 8px 16px #d1d9e6, -8px -8px 16px #ffffff;
    transition: all 0.3s;
    font-family: 'Fredoka', sans-serif;
}

.source-tab.active {
    background: var(--btn-bg);
    color: var(--btn-text);
    box-shadow: var(--shadow-btn);
}

.source-content {
    display: none;
}

.source-content.active {
    display: block;
}

.source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.source-item {
    padding: 10px 20px;
    border-radius: 20px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.source-item:hover {
    background: var(--btn-bg);
    color: var(--btn-text);
}

.source-item.active {
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 600;
}

/* 选集功能 */
.episodes-section {
    background: #ffffff;
    border-radius: 30px;
    box-shadow: var(--shadow-outer), var(--shadow-inner);
    padding: 30px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.5rem;
    color: #555;
    margin-bottom: 20px;
    font-weight: 600;
}

.season-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.season-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 20px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Fredoka', sans-serif;
}

.season-btn.active {
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 600;
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.episode-btn {
    padding: 12px;
    border: none;
    border-radius: 15px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
}

.episode-btn:hover {
    background: #dde5ee;
}

.episode-btn.active {
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 600;
}

/* 视频详情 */
.video-details {
    background: #ffffff;
    border-radius: 30px;
    box-shadow: var(--shadow-outer), var(--shadow-inner);
    padding: 30px;
}

.video-details h2 {
    font-size: 2rem;
    color: #555;
    margin-bottom: 15px;
}

.video-details p {
    line-height: 1.8;
    color: var(--text-color);
}

/* 7. 动画 */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* 8. 响应式设计 */
@media (max-width: 900px) {
    .nav-links {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .mobile-menu {
        display: block;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    .player-container {
        padding: 20px 5%;
    }

    .control-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .control-label {
        min-width: 50px;
        font-size: 0.85rem;
    }

    .episodes-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .filter-tabs {
        gap: 10px;
    }

    .filter-tab {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 600px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        position: relative;
    }

    * {
        max-width: 100%;
    }

    .container, .player-container {
        padding: 15px 3%;
        width: 100%;
        overflow-x: hidden;
    }

    nav {
        padding: 15px 3%;
        width: 100%;
    }

    .logo {
        font-size: 1.3rem;
    }

    .logo-dot {
        width: 15px;
        height: 15px;
    }

    .page-title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .search-wrapper {
        margin-bottom: 20px;
    }

    .search-box {
        padding: 12px 45px 12px 15px;
        font-size: 0.9rem;
    }

    .search-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
        width: 100%;
        max-width: 100%;
    }

    .video-cover {
        height: 120px;
        font-size: 2rem;
    }

    .video-info {
        padding: 10px 12px;
    }

    .video-title {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .video-meta {
        font-size: 0.75rem;
    }

    .video-type {
        padding: 3px 10px;
        font-size: 0.7rem;
    }

    .filter-tabs {
        gap: 8px;
        padding: 0 5px;
    }

    .filter-tab {
        padding: 6px 15px;
        font-size: 0.85rem;
    }

    .player-wrapper {
        padding: 15px;
    }

    .custom-controls {
        padding: 10px 15px;
    }

    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .time-display {
        font-size: 0.8rem;
        min-width: 80px;
    }

    .control-slider {
        max-width: 100px;
    }

    .episodes-section {
        padding: 20px;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .video-details {
        padding: 20px;
    }

    .video-details h2 {
        font-size: 1.5rem;
    }

    .video-details p {
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .container {
        padding: 15px 3%;
    }
}
