/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #1a1a1a;
    color: #fff;
}

.hidden {
    display: none !important;
}

/* ==================== 启动页 ==================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.splash-content {
    text-align: center;
    padding: 40px 20px;
}

.logo {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #e0e0e0 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    color: #888;
    letter-spacing: 4px;
    margin-bottom: 40px;
}

.splash-tips {
    margin-top: 30px;
}

.splash-tips p {
    font-size: 13px;
    color: #666;
    line-height: 2;
    letter-spacing: 1px;
}

/* ==================== 按钮系统 ==================== */
.btn-primary {
    background: linear-gradient(135deg, #c0c0c0 0%, #808080 100%);
    color: #1a1a1a;
    border: none;
    padding: 14px 48px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 2px;
}

.btn-primary:active {
    transform: scale(0.96);
    opacity: 0.9;
}

.btn-secondary {
    background: transparent;
    color: #aaa;
    border: 1px solid #555;
    padding: 12px 32px;
    border-radius: 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:active {
    background: rgba(255,255,255,0.05);
}

.btn-icon {
    background: none;
    border: none;
    color: #aaa;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

.btn-full {
    width: 100%;
    margin-top: 16px;
}

/* ==================== 主界面 ==================== */
.main-app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
}

/* ==================== 顶部栏 ==================== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 100;
}

.logo-small {
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, #d0d0d0 0%, #909090 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.status-badge {
    font-size: 11px;
    color: #666;
    background: rgba(255,255,255,0.05);
    padding: 4px 12px;
    border-radius: 12px;
    letter-spacing: 1px;
}

.status-badge.active {
    color: #4ade80;
    background: rgba(74,222,128,0.1);
}

/* ==================== 摄像头区域（9:16强制） ==================== */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    max-height: calc(100vh - 220px);
    background: #000;
    overflow: hidden;
    margin: 0 auto;
}

.video-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* 前置摄像头镜像 */
}

.preview-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 2;
}

.face-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    opacity: 0; /* 调试时改为1 */
}

/* ==================== 运镜指示器 ==================== */
.camera-move-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.camera-move-indicator.show {
    opacity: 1;
}

.move-arrow {
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    animation: pulse 1.5s ease infinite;
}

.move-arrow::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
}

/* 推镜 - 向上箭头 */
.move-arrow.push::before {
    border-width: 0 10px 16px 10px;
    border-color: transparent transparent rgba(255,255,255,0.8) transparent;
}

/* 拉镜 - 向下箭头 */
.move-arrow.pull::before {
    border-width: 16px 10px 0 10px;
    border-color: rgba(255,255,255,0.8) transparent transparent transparent;
}

/* 摇镜左 */
.move-arrow.pan-left::before {
    border-width: 10px 16px 10px 0;
    border-color: transparent rgba(255,255,255,0.8) transparent transparent;
}

/* 摇镜右 */
.move-arrow.pan-right::before {
    border-width: 10px 0 10px 16px;
    border-color: transparent transparent transparent rgba(255,255,255,0.8);
}

/* 移镜 */
.move-arrow.track::before {
    width: 20px;
    height: 2px;
    background: rgba(255,255,255,0.8);
    border: none;
}

.move-name {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    letter-spacing: 2px;
    background: rgba(0,0,0,0.4);
    padding: 4px 16px;
    border-radius: 12px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* ==================== 网格线 ==================== */
.grid-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    opacity: 0.3;
}

.grid-line-h {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.3);
}

.grid-line-h:nth-child(1) { top: 33.33%; }
.grid-line-h:nth-child(2) { top: 66.66%; }

.grid-line-v {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(255,255,255,0.3);
}

.grid-line-v:nth-child(3) { left: 33.33%; }
.grid-line-v:nth-child(4) { left: 66.66%; }

/* ==================== 录制倒计时 ==================== */
.record-timer {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    background: rgba(255,0,0,0.6);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.record-timer.show {
    opacity: 1;
    animation: timerPulse 1s ease infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== 水印 ==================== */
.watermark {
    position: absolute;
    bottom: 60px;
    right: 16px;
    z-index: 10;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    letter-spacing: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.watermark.show {
    opacity: 1;
}

/* ==================== 语音指令显示 ==================== */
.voice-command {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    background: rgba(0,0,0,0.5);
    padding: 8px 24px;
    border-radius: 20px;
    letter-spacing: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.voice-command.show {
    opacity: 1;
}

/* ==================== 底部控制面板 ==================== */
.control-panel {
    flex: 1;
    background: #1a1a1a;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.duration-control,
.mode-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.duration-control .label,
.mode-control .label {
    font-size: 12px;
    color: #888;
    min-width: 36px;
    letter-spacing: 1px;
}

.duration-options,
.mode-options {
    display: flex;
    gap: 8px;
    flex: 1;
}

.dur-btn,
.mode-btn {
    flex: 1;
    padding: 8px 0;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.dur-btn.active,
.mode-btn.active {
    background: rgba(192,192,192,0.2);
    color: #d0d0d0;
    border-color: #888;
}

/* ==================== 拍摄按钮 ==================== */
.shoot-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 8px 0;
}

.btn-shoot {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    background: transparent;
    position: relative;
    cursor: pointer;
    padding: 0;
}

.shoot-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid #c0c0c0;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.shoot-inner {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #e0e0e0 0%, #a0a0a0 100%);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-shoot.recording .shoot-ring {
    border-color: #ff4444;
    animation: ringPulse 1s ease infinite;
}

.btn-shoot.recording .shoot-inner {
    background: #ff4444;
    border-radius: 4px;
    top: 20px;
    left: 20px;
    width: 32px;
    height: 32px;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.shoot-label {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
    letter-spacing: 2px;
}

/* ==================== 成片预览区 ==================== */
.preview-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.result-video {
    width: 100%;
    aspect-ratio: 9/16;
    background: #000;
    border-radius: 8px;
    object-fit: cover;
}

.preview-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ==================== 弹窗系统 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: #222;
    border-radius: 16px;
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #333;
}

.modal-small {
    max-width: 320px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #e0e0e0;
}

.btn-close {
    background: none;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

/* ==================== 套餐卡片 ==================== */
.plan-card {
    background: #2a2a2a;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #333;
    position: relative;
}

.plan-card.featured {
    border-color: #888;
    background: linear-gradient(135deg, #2a2a2a 0%, #333 100%);
}

.plan-badge {
    position: absolute;
    top: -1px;
    right: 16px;
    background: linear-gradient(135deg, #c0c0c0 0%, #808080 100%);
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 0 0 8px 8px;
    letter-spacing: 1px;
}

.plan-title {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 4px;
}

.plan-price {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #e0e0e0 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.plan-desc {
    font-size: 12px;
    color: #888;
    margin-bottom: 12px;
}

.btn-plan {
    width: 100%;
    padding: 10px;
    border: 1px solid #555;
    background: transparent;
    color: #ccc;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.btn-plan:active {
    background: rgba(255,255,255,0.05);
}

/* ==================== 邀请区域 ==================== */
.invite-section {
    border-top: 1px solid #333;
    padding-top: 16px;
    margin-top: 4px;
    text-align: center;
}

.invite-title {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.btn-invite {
    background: linear-gradient(135deg, #444 0%, #333 100%);
    color: #ccc;
    border: none;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    letter-spacing: 1px;
}

/* ==================== 解锁码输入 ==================== */
.code-input {
    width: 100%;
    padding: 14px 16px;
    background: #333;
    border: 1px solid #444;
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
    outline: none;
    transition: border-color 0.3s ease;
}

.code-input:focus {
    border-color: #888;
}

.code-hint {
    font-size: 11px;
    color: #666;
    margin-top: 8px;
    text-align: center;
}

.buy-link {
    text-align: center;
    margin-top: 16px;
}

.buy-link a {
    color: #888;
    font-size: 13px;
    text-decoration: none;
}

/* ==================== 购买引导 ==================== */
.buy-step {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #666 0%, #444 100%);
    color: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.step-text {
    font-size: 14px;
    color: #aaa;
}

.copy-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #333;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 8px;
}

.copy-box span {
    font-size: 13px;
    color: #aaa;
}

.copy-box button {
    background: #444;
    color: #ccc;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* ==================== Toast提示 ==================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}

/* ==================== 响应式微调 ==================== */
@media (max-height: 700px) {
    .camera-container {
        max-height: calc(100vh - 200px);
    }
    
    .control-panel {
        padding: 12px 16px;
        gap: 8px;
    }
}