/* ============================================
   快手风格短视频播放器 - 样式表
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

/* 状态栏 */
.ks-status-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
    pointer-events: none;
}
.ks-status-bar > * { pointer-events: auto; }
.ks-status-left { display: flex; gap: 12px; align-items: center; }
.ks-live-badge {
    background: linear-gradient(135deg, #ff2d55, #ff6b6b);
    padding: 4px 12px; border-radius: 4px;
    font-size: 12px; font-weight: 700; letter-spacing: 1px;
}
.ks-status-center {
    font-size: 16px; font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.ks-status-right { display: flex; gap: 16px; align-items: center; }
.ks-search-btn { font-size: 20px; cursor: pointer; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }

/* 视频容器 */
.ks-video-container {
    width: 100%; height: 100%;
    position: relative; overflow: hidden;
    background: #000;
}
.ks-video-wrapper {
    width: 100%; height: 100%;
    transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}
.ks-video-item {
    width: 100%; height: 100vh;
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: #000;
}
.ks-video-item video {
    width: 100%; height: 100%;
    object-fit: contain;
    background: #000;
}
.ks-video-item video::-webkit-media-controls { display: none !important; }

/* 双击爱心 */
.ks-double-tap-heart {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none; z-index: 50;
    opacity: 0;
    filter: drop-shadow(0 2px 8px rgba(255,45,85,0.5));
}
.ks-double-tap-heart.animate {
    animation: ksHeartBurst 0.8s ease-out forwards;
}
@keyframes ksHeartBurst {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-15deg); opacity: 1; }
    15% { transform: translate(-50%, -50%) scale(1.3) rotate(5deg); opacity: 1; }
    30% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8) rotate(0deg); opacity: 0; }
}

/* 暂停图标 */
.ks-pause-icon {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none; z-index: 40;
    opacity: 0;
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.5));
}
.ks-pause-icon.show {
    animation: ksPausePop 0.5s ease-out forwards;
}
@keyframes ksPausePop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.9; }
    50% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* 加载动画 */
.ks-loading {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30; pointer-events: none;
    display: none;
}
.ks-loading.show { display: block; }
.ks-loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ksSpin 0.8s linear infinite;
}
@keyframes ksSpin { to { transform: rotate(360deg); } }

/* 进度条 */
.ks-progress-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 3px; z-index: 60;
    background: rgba(255,255,255,0.15);
    cursor: pointer;
    transition: height 0.15s;
}
.ks-progress-bar:hover, .ks-progress-bar.dragging { height: 6px; }
.ks-progress-buffered {
    position: absolute; top: 0; left: 0; height: 100%;
    background: rgba(255,255,255,0.3);
    border-radius: 0 2px 2px 0;
    transition: width 0.3s;
}
.ks-progress-played {
    position: absolute; top: 0; left: 0; height: 100%;
    background: #fff;
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
}
.ks-progress-bar.dragging .ks-progress-played { transition: none; }

/* 右侧操作栏 */
.ks-action-bar {
    position: fixed; right: 10px; bottom: 140px;
    z-index: 50;
    display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.ks-action-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.ks-action-icon {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s;
}
.ks-action-item:active .ks-action-icon { transform: scale(0.85); }
.ks-action-count {
    font-size: 12px; color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    font-weight: 500;
}

/* 头像 */
.ks-action-avatar {
    position: relative; width: 48px; height: 48px;
    margin-bottom: 6px; cursor: pointer;
}
.ks-action-avatar img {
    width: 48px; height: 48px;
    border-radius: 50%; border: 2px solid #fff;
    object-fit: cover;
}
.ks-avatar-follow {
    position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 20px;
    background: #ff2d55; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.ks-avatar-follow.followed {
    background: #888;
}

/* 点赞激活 */
.ks-action-item.liked .ks-action-icon svg path {
    fill: #ff2d55 !important;
    stroke: #ff2d55 !important;
}
.ks-action-item.liked { animation: ksLikeJump 0.4s ease; }
@keyframes ksLikeJump {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* 收藏激活 */
.ks-action-item.collected .ks-action-icon svg path {
    fill: #ffc107 !important;
    stroke: #ffc107 !important;
}

/* 音乐唱片 */
.ks-music-disc {
    width: 44px; height: 44px;
    position: relative;
    animation: ksDiscSpin 4s linear infinite;
    animation-play-state: paused;
}
.ks-music-disc.playing { animation-play-state: running; }
@keyframes ksDiscSpin { to { transform: rotate(360deg); } }
.ks-music-cover {
    width: 44px; height: 44px;
    border-radius: 50%; overflow: hidden;
    border: 8px solid #333;
    background: #111;
}
.ks-music-cover img {
    width: 100%; height: 100%; object-fit: cover;
}

/* 底部信息区 */
.ks-info-area {
    position: fixed; bottom: 60px; left: 0; right: 80px;
    z-index: 50; padding: 0 16px;
    pointer-events: none;
}
.ks-info-username {
    font-size: 16px; font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.ks-info-desc {
    font-size: 13px; line-height: 1.5;
    color: rgba(255,255,255,0.9);
    margin-bottom: 10px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.ks-info-tags {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 10px;
}
.ks-info-tags span {
    font-size: 12px; color: #ffe0b2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.ks-info-music {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: rgba(255,255,255,0.8);
    overflow: hidden;
}
.ks-music-icon { font-size: 14px; flex-shrink: 0; }
.ks-music-name {
    white-space: nowrap; overflow: hidden;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.marquee-text {
    display: inline-block;
    animation: ksMarquee 8s linear infinite;
}
@keyframes ksMarquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* 底部导航 */
.ks-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 100;
    display: flex; align-items: center; justify-content: space-around;
    height: 56px;
    background: rgba(0,0,0,0.95);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-bottom: env(safe-area-inset-bottom);
}
.ks-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10px; color: rgba(255,255,255,0.5);
    cursor: pointer; padding: 4px 12px;
    transition: color 0.2s;
}
.ks-nav-item.active { color: #fff; }
.ks-nav-item svg { width: 22px; height: 22px; }
.ks-nav-publish {
    position: relative; top: -12px;
}
.ks-publish-btn {
    width: 44px; height: 32px;
    background: linear-gradient(135deg, #ff2d55, #ff6b6b);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 300; color: #fff;
    box-shadow: 0 2px 8px rgba(255,45,85,0.4);
}

/* 评论面板 */
.ks-comment-panel {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 65vh; z-index: 200;
    background: #1a1a1a;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
    display: flex; flex-direction: column;
}
.ks-comment-panel.show { transform: translateY(0); }
.ks-comment-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 15px; font-weight: 600;
}
.ks-comment-close {
    width: 28px; height: 28px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer;
}
.ks-comment-list {
    flex: 1; overflow-y: auto; padding: 12px 20px;
    -webkit-overflow-scrolling: touch;
}
.ks-comment-item {
    display: flex; gap: 12px; margin-bottom: 20px;
}
.ks-comment-avatar {
    width: 36px; height: 36px;
    border-radius: 50%; object-fit: cover;
    flex-shrink: 0;
}
.ks-comment-body { flex: 1; }
.ks-comment-name {
    font-size: 13px; color: rgba(255,255,255,0.5);
    margin-bottom: 4px;
}
.ks-comment-text {
    font-size: 14px; line-height: 1.5;
    color: rgba(255,255,255,0.9);
    margin-bottom: 4px;
}
.ks-comment-time {
    font-size: 12px; color: rgba(255,255,255,0.3);
}
.ks-comment-input-area {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,0.08);
}
.ks-comment-input {
    flex: 1; height: 38px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 0 16px;
    color: #fff; font-size: 14px;
    outline: none;
}
.ks-comment-input::placeholder { color: rgba(255,255,255,0.3); }
.ks-comment-input:focus { border-color: rgba(255,45,85,0.5); }
.ks-comment-send {
    height: 38px; padding: 0 20px;
    background: #ff2d55; border: none;
    border-radius: 20px;
    color: #fff; font-size: 14px; font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.ks-comment-send:disabled { background: #555; cursor: not-allowed; }

/* 搜索面板 */
.ks-search-panel {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 300;
    background: #111;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}
.ks-search-panel.show { transform: translateY(0); }
.ks-search-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.ks-search-input {
    flex: 1; height: 38px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 0 16px;
    color: #fff; font-size: 14px;
    outline: none;
}
.ks-search-input::placeholder { color: rgba(255,255,255,0.3); }
.ks-search-cancel {
    color: #fff; font-size: 14px;
    cursor: pointer; white-space: nowrap;
}
.ks-search-body {
    padding: 16px;
    overflow-y: auto;
    height: calc(100% - 70px);
}

/* Toast */
.ks-toast {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 999;
    background: rgba(0,0,0,0.8);
    color: #fff; font-size: 14px;
    padding: 12px 24px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s;
    text-align: center;
    max-width: 80%;
}
.ks-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* 遮罩 */
.ks-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 190;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.ks-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* 滑动提示 */
.ks-swipe-hint {
    position: fixed; bottom: 80px; left: 50%;
    transform: translateX(-50%);
    z-index: 55;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    animation: ksSwipeHint 2s ease-in-out infinite;
    pointer-events: none;
    opacity: 0;
}
.ks-swipe-hint.show { opacity: 1; }
.ks-swipe-hint-arrow {
    font-size: 24px;
    animation: ksSwipeArrow 1.5s ease-in-out infinite;
}
@keyframes ksSwipeArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes ksSwipeHint {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 0.6; }
}

/* 搜索结果 */
.ks-search-result-item {
    display: flex; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
}
.ks-search-result-item img {
    width: 100px; height: 140px;
    border-radius: 8px; object-fit: cover;
    flex-shrink: 0;
}
.ks-search-result-info {
    flex: 1; display: flex; flex-direction: column; justify-content: center;
}
.ks-search-result-title {
    font-size: 14px; font-weight: 600;
    margin-bottom: 6px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.ks-search-result-meta {
    font-size: 12px; color: rgba(255,255,255,0.4);
}

/* 横屏适配 */
@media (min-width: 768px) {
    .ks-video-container {
        max-width: 420px;
        margin: 0 auto;
        border-left: 1px solid rgba(255,255,255,0.05);
        border-right: 1px solid rgba(255,255,255,0.05);
    }
    .ks-bottom-nav { max-width: 420px; left: 50%; transform: translateX(-50%); }
    .ks-status-bar { max-width: 420px; left: 50%; transform: translateX(-50%); }
    .ks-comment-panel { max-width: 420px; left: 50%; transform: translateX(-50%) translateY(100%); }
    .ks-comment-panel.show { transform: translateX(-50%) translateY(0); }
    .ks-search-panel { max-width: 420px; left: 50%; transform: translateX(-50%) translateY(-100%); }
    .ks-search-panel.show { transform: translateX(-50%) translateY(0); }
}
