/* =========================================
   1. 全局重置与基础样式
   ========================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background-color: #121212; 
    color: #fff; 
    padding-bottom: 70px; 
    overscroll-behavior-y: none;
}

/* =========================================
   视频分类导航栏 (吸顶)
   ========================================= */
.category-nav {
    position: sticky;
    top: 55px; 
    z-index: 45;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 15px;
    background: rgba(31, 31, 31, 0.95); 
    backdrop-filter: blur(8px);
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid #333;
    scrollbar-width: none; 
    -ms-overflow-style: none;
}
.category-nav::-webkit-scrollbar { display: none; }

.cat-item {
    font-size: 0.95rem;
    color: #888;
    cursor: pointer;
    padding: 5px 0;
    position: relative;
    transition: color 0.2s;
    flex-shrink: 0; 
}

.cat-item.active {
    color: #fff;
    font-weight: bold;
    font-size: 1.05rem;
}

.cat-item.active::after {
    content: '';
    position: absolute;
    bottom: -5px; 
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: #e50914; 
    border-radius: 2px;
}

/* =========================================
   应用内提示 (Toast)
   ========================================= */
#toast-container {
    position: fixed;
    top: 75px; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
    width: 90%; max-width: 400px;
}
.toast-msg {
    background: rgba(31, 31, 31, 0.95);
    border: 1px solid #444; color: #fff; padding: 12px 20px;
    border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    font-size: 0.95rem; text-align: center; pointer-events: auto;
    animation: slideDown 0.3s ease-out forwards;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}
.toast-success { border-left: 4px solid #2ea44f; }
.toast-error { border-left: 4px solid #e50914; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.toast-hide { animation: fadeOut 0.3s ease-in forwards; }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* =========================================
   2. 顶部状态栏
   ========================================= */
header { 
    padding: 0 15px; background-color: #1f1f1f; 
    position: sticky; top: 0; z-index: 50; 
    border-bottom: 1px solid #333; height: 55px;
    display: flex; align-items: center;
}
.header-content { width: 100%; display: flex; justify-content: space-between; align-items: center; }
h1 { font-size: 1.2rem; font-weight: 500; }
.user-status { font-size: 0.85rem; color: #aaa; }

/* 视图容器 */
.view-section { width: 100%; min-height: 80vh; }
.hidden { display: none !important; }
.loading { grid-column: span 2; text-align: center; padding: 20px; color: #888; }

/* =========================================
   3. 列表卡片样式
   ========================================= */
.grid-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px; }

.video-card { 
    background-color: #1e1e1e; 
    border-radius: 8px; 
    overflow: hidden; 
    cursor: pointer; 
    position: relative; 
    width: 100%; /* 确保卡片自身有宽度限制 */
}

.media-container { 
    position: relative; 
    width: 100%; 
    aspect-ratio: 16 / 9; /* 强制固定 16:9 比例 */
    background: #000; 
    overflow: hidden;
}

.thumbnail-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 2rem; color: rgba(255,255,255,0.8); background: rgba(0,0,0,0.4); border-radius: 50%; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; z-index: 5; pointer-events: none; }
.preview-player { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; background: #000; z-index: 6; }
.spinner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; border: 3px solid rgba(255,255,255,0.3); border-top: 3px solid #e50914; border-radius: 50%; animation: spin 1s linear infinite; z-index: 10; }
@keyframes spin { 0% {transform:translate(-50%,-50%) rotate(0deg);} 100% {transform:translate(-50%,-50%) rotate(360deg);} }

.video-info { padding: 8px; }

.video-title { 
    font-size: 15px; /* 调整为 10px */
    line-height: 1.4;
    color: #fff;
    /* 多行省略核心代码 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    height: 2.8em; /* 固定高度防止抖动 */
}

.video-size { font-size: 0.7rem; color: #aaa; margin-top: 4px; }

.grid-container-vertical { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px; }
.vertical-card { background: #1e1e1e; border-radius: 8px; overflow: hidden; cursor: pointer; }

.vertical-img-box { 
    width: 100%; 
    aspect-ratio: 9 / 16; /* 竖向保持 9:16 统一 */
    background: #000; 
    position: relative; /* 为标签定位做准备 */
}

.vertical-img-box img { width: 100%; height: 100%; object-fit: cover; }
.vertical-info { padding: 8px; }

.vertical-title { 
    font-size: 15px; /* 调整为 10px */
    line-height: 1.4;
    color: #fff; 
    font-weight: bold; 
    text-align: center; 
    margin-top: 5px; 
    /* 多行省略核心代码 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; 
    overflow: hidden; 
    text-overflow: ellipsis;
    white-space: normal;
}

.vertical-price { color: #e50914; font-weight: bold; margin-top: 5px; font-size: 0.9rem; text-align: center;}

/* Virgin 标签样式 */
.tag-virgin {
    position: absolute;
    top: 5px;
    right: 5px;
    background: linear-gradient(45deg, #ff00cc, #333399);
    color: #fff;
    font-size: 15px;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    z-index: 10;
    pointer-events: none; /* 防止遮挡点击 */
}

/* =========================================
   详情页通用与布局
   ========================================= */
.detail-modal { position: fixed; top: 0; bottom: 60px; left: 0; right: 0; background: #121212; z-index: 80; display: flex; flex-direction: column; }
.detail-header { height: 50px; background: rgba(31, 31, 31, 0.95); backdrop-filter: blur(10px); display: flex; align-items: center; padding: 0 15px; border-bottom: 1px solid #333; position: relative; justify-content: space-between; flex: none; }
.back-btn { z-index: 20; position: relative; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 20px; color: #eee; padding: 6px 16px; font-size: 0.85rem; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 4px; }
#detail-title-text { 
    position: absolute; 
    left: 90px;  
    right: 90px; 
    text-align: center; 
    font-weight: 600; 
    font-size: 1rem; 
    color: #fff; 
    pointer-events: none; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    z-index: 1; 
}
.detail-content { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; }

/* 轮播图 */
.carousel-container { width: 100%; height: 100%; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel-item { min-width: 100%; scroll-snap-align: center; position: relative; }
.carousel-img { width: 100%; height: auto; max-height: 50vh; object-fit: cover; }
.carousel-indicator { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.6); color: white; padding: 2px 8px; border-radius: 10px; font-size: 0.8rem; pointer-events: none; }

/* 聊天室详情页专用布局 (整体滚动) */
.scrollable-content {
    flex: 1; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
}

.layout-chat-top { flex: none; width: 100%; background: #000; }
.layout-chat-mid { flex: none; padding: 20px; background: #1a1a1a; border-top: 1px solid #333; }
.layout-chat-bot { flex: none; height: 70px; display: flex; gap: 15px; padding: 0 20px; align-items: center; border-top: 1px solid #333; background: #1f1f1f; z-index: 10; }

/* 聊天室文本美化 */
.info-row {
    display: flex;
    align-items: flex-start; /* 顶部对齐 */
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    line-height: 1.5;
    font-size: 0.95rem;
}
.info-row:last-child {
    border-bottom: none;
}
.info-key {
    color: #9aa0a6;        /* 灰色 */
    font-weight: 400;
    font-size: 0.9rem;
    
    flex: 0 0 40%;         
    width: 40%;            
    padding-right: 15px;   /* 右侧留出间隙 */
    box-sizing: border-box;
}
.info-val {
    color: #fff;           /* 白色 */
    font-weight: 500;
    
    flex: 1;               
    width: 0;              
    word-wrap: break-word; 
    overflow-wrap: break-word;
}
.info-val-highlight {
    color: #ff4d4f;        /* 红色 */
    font-size: 1.15rem;    /* 加大 */
    font-weight: 700;      /* 加粗 */
    
    flex: 1;
    width: 0;
    word-wrap: break-word;
}

/* 商城详情页布局 */
.layout-mall-top { 
    flex: none; 
    width: 100%; 
    background: #000; 
}

.layout-mall-desc { 
    flex: none; 
    padding: 20px; 
    background: #1a1a1a; 
    border-top: 1px solid #333; 
}
.layout-mall-opt { 
    flex: none; 
    padding: 20px; 
    background: #222; 
    border-top: 1px solid #333; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    gap: 8px; 
}

.layout-mall-bot { 
    flex: none; 
    height: 70px; /* 统一高度 */
    display: flex; 
    gap: 15px; 
    padding: 0 20px; 
    align-items: center; 
    border-top: 1px solid #333; 
    background: #1f1f1f; 
    z-index: 10;
}

.price-row { display: flex; justify-content: space-between; align-items: center; }
.price-label { font-size: 0.9rem; color: #aaa; }
.price-val { font-size: 1.4rem; color: #e50914; font-weight: bold; }
.detail-main-img { width: 100%; height: 100%; object-fit: cover; }
.detail-full-text { font-size: 0.95rem; color: #ddd; line-height: 1.6; white-space: pre-wrap; }

/* 按钮通用 */
.action-btn { flex: 1; height: 40px; border-radius: 20px; font-weight: bold; font-size: 0.95rem; border: none; cursor: pointer; }
.btn-buy { background: #e50914; color: white; }
.btn-chat { background: #2196F3; color: white; }
.btn-tail { background: #2ea44f; color: white; }

/* =========================================
   6. 个人中心
   ========================================= */
.full-view { padding: 20px; color: #fff; }
.uc-card { max-width: 100%; margin: 0 auto; padding: 20px 0; display: flex; flex-direction: column; align-items: center; }

.profile-tray { width: 90%; aspect-ratio: 2 / 1; background: linear-gradient(135deg, #2b2b2b 0%, #1f1f1f 100%); border-radius: 12px; border: 1px solid #333; padding: 15px; display: flex; flex-direction: column; justify-content: center; align-items: center; box-shadow: 0 4px 15px rgba(0,0,0,0.3); margin-bottom: 15px; text-align: center; }
.profile-phone { font-size: 1rem; color: #bbb; margin-bottom: 8px; font-weight: 500; }
.profile-balance { width: 100%; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; }
.balance-num { font-size: 2.4rem; font-weight: bold; color: #e50914; line-height: 1.1; }
.balance-unit { font-size: 1rem; color: #e50914; margin-top: 2px; font-weight: bold; }
.profile-time { font-size: 0.85rem; color: #666; margin-bottom: 20px; }

/* 菜单 */
.fund-menu { width: 90%; display: flex; justify-content: center; gap: 15px; margin: 0 auto 20px auto; }
.fund-btn { flex: 1; background: #333; color: #fff; padding: 15px; border-radius: 8px; text-align: center; cursor: pointer; font-weight: bold; border: 1px solid #444; }
.fund-btn:active { background: #444; }

#uc-menu-list { width: 100%; display: flex; flex-direction: column; align-items: center; }
.menu-btn { width: 90%; margin: 0 auto 10px auto; background: #333; border: 1px solid #444; text-align: center; padding: 15px; font-size: 1rem; color: white; border-radius: 8px; }
.logout-btn { background: #444; margin-top: 15px; }

.menu-group { width: 90%; margin: 0 auto 20px auto; background: #2b2b2b; padding: 15px; border-radius: 8px; }
.menu-group h3 { font-size: 1rem; margin-bottom: 10px; border-bottom: 1px solid #444; padding-bottom: 5px; text-align: center; }
.btn-secondary { background: #444; margin-top: 10px; }

/* 助记词 */
.mnemonic-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 10px; width: 100%; aspect-ratio: 2 / 1; background: #1a1a1a; border: 1px solid #444; border-radius: 8px; padding: 10px; margin-bottom: 15px; }
.mnemonic-item { display: flex; align-items: center; justify-content: center; background: #2b2b2b; border-radius: 6px; color: #ffd700; font-weight: bold; font-size: 0.95rem; border: 1px solid #333; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* =========================================
   7. 充值与提现 / 表单
   ========================================= */
.fund-section { width: 100%; padding: 10px 20px; }
.card-tray { background: #1e1e1e; border-radius: 10px; padding: 20px; margin-bottom: 15px; border: 1px solid #333; }
.recharge-card { display: flex; flex-direction: column; align-items: center; }
.btn-page-back { display: block; width: 100%; padding: 12px; margin-bottom: 15px; background: #333; border: 1px solid #444; border-radius: 8px; color: #ccc; text-align: center; font-size: 0.9rem; cursor: pointer; }
.btn-page-back:active { background: #444; }

.form-group { margin-bottom: 15px; width: 100%; }
.form-group label { display: block; margin-bottom: 8px; color: #aaa; font-size: 0.9rem; }
input[type="text"], input[type="password"], input[type="number"], textarea { display: block; width: 100%; padding: 12px; margin-bottom: 10px; background: #2b2b2b !important; border: 1px solid #444 !important; color: #fff; border-radius: 6px; outline: none; font-size: 0.95rem; box-sizing: border-box; }
input:focus, textarea:focus { border-color: #e50914 !important; }

.btn-submit { background: #2ea44f !important; color: white; font-weight: bold; font-size: 1rem; height: 45px; width: 100%; border: none; border-radius: 6px; cursor: pointer; box-sizing: border-box; }
.btn-submit:active { opacity: 0.8; }

.qr-container { padding: 10px; background: #fff; border-radius: 8px; margin-bottom: 20px; }
.admin-qr { width: 180px; height: 180px; object-fit: contain; display: block; }
.address-box { width: 100%; background: #252525; border: 1px dashed #555; border-radius: 8px; padding: 15px; text-align: center; cursor: pointer; margin-bottom: 20px; position: relative; box-sizing: border-box; }
.addr-text { font-size: 0.95rem; color: #fff; word-break: break-all; font-family: monospace; margin-bottom: 5px; }
.addr-label { font-size: 0.75rem; color: #666; }
.calc-box { background: #1f2a1f; border: 1px solid #2e4a2e; border-radius: 8px; padding: 15px; margin-top: 15px; margin-bottom: 20px; width: 100%; box-sizing: border-box; }
.calc-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.9rem; color: #aaa; }
.main-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.1); }
.highlight-amount { color: #fff; font-size: 1.4rem; font-weight: bold; }
.unit { color: #aaa; font-size: 0.9rem; margin-left: 5px; }
.calc-tip { font-size: 0.75rem; color: #4caf50; margin-top: 10px; text-align: right; }
.warn-text { color: #f0ad4e; font-size: 0.9rem; line-height: 1.5; margin-bottom: 0; }

.history-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.history-table th, .history-table td { text-align: left; padding: 8px; border-bottom: 1px solid #333; }
.history-table th { color: #888; }
.status-success { color: #2ea44f; }
.status-fail { color: #cb2431; }
.status-pending { color: #f0ad4e; }

/* =========================================
   8. 订单与弹窗
   ========================================= */
.order-list { max-height: 400px; overflow-y: auto; margin-bottom: 15px; }
.order-item { background: #1a1a1a; border: 1px solid #333; border-radius: 6px; padding: 12px; margin-bottom: 10px; position: relative; }
.order-header { display: flex; justify-content: space-between; font-size: 0.8rem; color: #888; margin-bottom: 5px; }
.order-body { display: flex; justify-content: space-between; align-items: center; }
.order-title { font-weight: bold; color: #ddd; font-size: 0.95rem; }
.order-amount { color: #e50914; font-weight: bold; }
.order-footer { margin-top: 8px; padding-top: 8px; border-top: 1px solid #333; display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.status-tag { font-size: 0.8rem; padding: 2px 6px; border-radius: 4px; }
.st-pending { background: #332b00; color: #ffdd57; }
.st-paid { background: #1f2a1f; color: #2ea44f; }
.st-shipped { background: #002b36; color: #2aa198; }
.st-completed { background: #1a1a1a; color: #888; border: 1px solid #444; }
.st-refunded { background: #2a1f1f; color: #cb2431; }
.btn-pay-sm { padding: 4px 12px; background: #e50914; color: #fff; border: none; border-radius: 15px; font-size: 0.8rem; }
.order-tabs { display: flex; gap: 10px; margin-bottom: 15px; justify-content: center; }
.tab-btn { background: #333; border: none; padding: 5px 15px; border-radius: 15px; font-size: 0.85rem; color: #aaa; }
.tab-btn.active { background: #eee; color: #111; font-weight: bold; }

/* Modal 基础 */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); z-index: 100; display: flex; justify-content: center; align-items: center; }
.modal-content { position: relative; background: #1f1f1f; padding: 25px; border-radius: 12px; width: 85%; max-width: 360px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.modal-content h2 { margin-bottom: 20px; text-align: center; color: #fff; }
.auth-links { display: flex; justify-content: space-between; margin-top: 10px; font-size: 0.8rem; }
.auth-links a { color: #aaa; cursor: pointer; text-decoration: underline; }
.close-auth { background: transparent; border: 1px solid #555; margin-top: 20px; font-size: 0.8rem; color: #ccc; }
.hint-text { font-size: 0.8rem; color: #aaa; margin-bottom: 10px; text-align: center; }
button { width: 100%; padding: 10px; background: #e50914; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9rem; }
button:active { opacity: 0.8; }
.autocomplete-wrapper { position: relative; width: 100%; }
#mnemonic-suggestions { position: absolute; bottom: 100%; left: 0; right: 0; background: #333; border: 1px solid #555; border-radius: 4px; max-height: 150px; overflow-y: auto; list-style: none; z-index: 200; margin-bottom: 2px; }
#mnemonic-suggestions li { padding: 10px; cursor: pointer; border-bottom: 1px solid #444; color: #ddd; }
#mnemonic-suggestions li:hover { background: #e50914; color: #fff; }

/* 底部 Dock */
.dock-bar { position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: #1f1f1f; border-top: 1px solid #333; display: flex; justify-content: space-around; align-items: center; z-index: 90; }
.dock-item { display: flex; flex-direction: column; align-items: center; color: #888; font-size: 0.75rem; cursor: pointer; flex: 1; padding: 5px 0; }
.dock-item.active { color: #e50914; }
.dock-item .icon { font-size: 1.4rem; margin-bottom: 2px; }

/* 全屏播放器 */
#player-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; z-index: 2000; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.video-wrapper { width: 100%; max-width: 100%; padding: 0; position: relative; }
video#main-player { width: 100%; height: auto; max-height: 100vh; background: #000; display: block; }
#close-btn { margin-top: 20px; background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; width: auto; padding: 8px 30px; border-radius: 20px; cursor: pointer; font-size: 0.9rem; transition: all 0.2s; }
#close-btn:active { background: rgba(255, 255, 255, 0.4); }
video::-webkit-media-controls-enclosure { overflow: hidden; }
video::-webkit-media-controls-panel { width: calc(100% + 30px); }

/* --- 支付成功专用模态框 (新增) --- */
.pay-success-card { text-align: center; padding: 30px 20px; }
.pay-success-icon { font-size: 4rem; color: #2ea44f; margin-bottom: 15px; display: block; }
.pay-success-title { font-size: 1.2rem; font-weight: bold; color: #fff; margin-bottom: 20px; }
.pay-success-info { background: #2b2b2b; border-radius: 8px; padding: 15px; margin-bottom: 25px; text-align: left; border: 1px solid #333; }
.pay-info-row { margin-bottom: 8px; font-size: 0.95rem; color: #aaa; display: flex; justify-content: space-between; }
.pay-info-val { color: #fff; font-weight: bold; }
.pay-amount-val { color: #e50914; font-size: 1.1rem; font-weight: bold; }
/* 右上角关闭 X */
.modal-close-x {
    position: absolute; top: 10px; right: 15px; 
    font-size: 1.5rem; color: #888; cursor: pointer;
    font-weight: 300; line-height: 1;
}
.modal-close-x:hover { color: #fff; }