* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    overflow: hidden;
}

.page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    background: white;
}

.page.active {
    opacity: 1;
    visibility: visible;
}

.container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ===== 设置菜单 ===== */
.settings-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.settings-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #333;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-btn:hover {
    background: #555;
    transform: scale(1.1);
}

.settings-menu {
    position: absolute;
    top: 70px;
    right: 0;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    width: 300px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.settings-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.settings-header h3 {
    font-size: 16px;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.settings-content {
    padding: 15px 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.setting-item select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.setting-item select:hover {
    border-color: #333;
}

/* ===== 页面1: 开始拍摄 ===== */
#start-page .container {
    gap: 30px;
}

.title {
    font-size: 48px;
    font-weight: bold;
    letter-spacing: 2px;
    text-align: center;
}

.subtitle {
    font-size: 14px;
    color: #666;
    text-align: center;
}

.camera-frame {
    position: relative;
    width: 300px;
    height: 300px;
    border: 2px solid #333;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #333;
    z-index: 10;
}

.corner.top-left {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
}

.corner.top-right {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
}

.corner.bottom-left {
    bottom: -3px;
    left: -3px;
    border-right: none;
    border-top: none;
}

.corner.bottom-right {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
}

.camera-preview {
    width: 100%;
    height: 100%;
}

.btn-primary,
.btn-secondary,
.btn-print {
    padding: 12px 40px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #333;
    color: white;
}

.btn-primary:hover {
    background: #555;
    transform: scale(1.05);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #ccc;
}

/* 模板选择器 */
.template-selector {
    display: flex;
    gap: 20px;
    margin: 30px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.template-option {
    padding: 20px 30px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 200px;
}

.template-option:hover {
    border-color: #999;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.template-option.active {
    border-color: #333;
    background: #333;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.template-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.template-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
}

.template-desc {
    font-size: 14px;
    opacity: 0.8;
}

.btn-print {
    background: #f0ad4e;
    color: white;
}

.btn-print:hover {
    background: #ec971f;
    transform: scale(1.05);
}

/* ===== 页面2: 倒计时拍摄 (完全重新设计) ===== */
#shooting-page {
    background: white;
    overflow: hidden;
}

.shooting-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: stretch;
}

.shooting-left {
    flex: 0 0 auto;
    width: 25%;
    background: white;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 40px;
    border-right: 1px solid #e0e0e0;
}

.shooting-left .title {
    font-size: 24px;
    margin: 0;
}

.shooting-left .subtitle {
    margin: 0;
    font-size: 12px;
}

.countdown-box {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-number {
    font-size: 180px;
    font-weight: bold;
    color: #333;
    line-height: 1;
    min-width: 150px;
}

.pose-info {
    font-size: 18px;
    color: #666;
}

.pose-num {
    font-weight: bold;
    font-size: 24px;
}

.pose-total {
    margin-left: 10px;
    color: #999;
    font-size: 16px;
}

.shooting-right {
    flex: 1;
    overflow: hidden;
    background: #000;
    position: relative;
}

.camera-frame-large {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
}

.camera-frame-large video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-frame-large canvas {
    display: none;
}

/* ===== 页面3: 滤镜选择 ===== */
#filter-page .container {
    padding: 20px;
}

.header {
    width: 100%;
    padding: 20px 0;
    text-align: center;
}

.brand {
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 1px;
}

.brand small {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.page-title {
    font-size: 24px;
    font-weight: bold;
    margin: 20px 0;
    text-align: center;
}

.filter-layout {
    display: flex;
    gap: 30px;
    margin: 20px 0;
    width: 100%;
    max-width: 1200px;
}

.photo-strips {
    flex: 2;
    display: flex;
    gap: 20px;
}

.photo-strip {
    flex: 1;
}

.strip-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.strip-photos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.strip-photos img {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    object-fit: cover;
}

.filter-options {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.filter-btn {
    padding: 12px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 14px;
}

.filter-btn:hover {
    border-color: #333;
}

.filter-btn.active {
    border-color: #333;
    background: #f5f5f5;
}

.filter-preview {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #666, #999);
    margin-bottom: 8px;
    border-radius: 2px;
}

.filter-preview.grayscale {
    filter: grayscale(100%);
    background: linear-gradient(135deg, #666, #999);
}

.filter-preview.sepia {
    filter: sepia(80%);
    background: linear-gradient(135deg, #d4a574, #c8956e);
}

.filter-preview.vintage {
    filter: sepia(40%) contrast(1.1) brightness(0.9);
    background: linear-gradient(135deg, #8b7355, #6b5344);
}

.filter-preview.bright {
    filter: brightness(1.3);
    background: linear-gradient(135deg, #aaa, #ccc);
}

.filter-preview.warm {
    filter: sepia(30%) hue-rotate(-20deg);
    background: linear-gradient(135deg, #d9a07b, #d47d3d);
}

.action-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* ===== 页面4: 预览 (黑白对比效果) ===== */
#preview-page {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 50%, #ffffff 50%, #f0f0f0 100%);
}

#preview-page .container {
    justify-content: space-between;
}

.preview-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    flex: 1;
    margin: 20px 0;
}

.final-photo-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 500px;
    padding: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.final-photo-strip img {
    width: 100%;
    height: auto;
    border: 2px solid #333;
    object-fit: cover;
}

.preview-right-panel {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 20px;
}

.filter-selection-display {
    text-align: center;
}

.selected-filter {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.qrcode-section {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.qrcode-label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

#qrcode-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 220px;
}

#qrcode-container canvas,
#qrcode-container img {
    max-width: 200px;
    height: auto;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .shooting-container {
        flex-direction: column;
    }

    .shooting-left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 30px 20px;
        gap: 20px;
    }

    .shooting-right {
        flex: 1;
    }

    .filter-layout {
        flex-direction: column;
        gap: 20px;
    }

    .photo-strips {
        flex-direction: column;
    }

    .preview-layout {
        flex-direction: column;
    }

    .title {
        font-size: 36px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px 10px;
    }

    .camera-frame-large {
        height: 300px;
    }

    .title {
        font-size: 28px;
    }

    .countdown-number {
        font-size: 120px;
    }

    .filter-options {
        grid-template-columns: repeat(2, 1fr);
        max-height: none;
    }

    .final-photo-strip {
        max-width: 100%;
    }

    .settings-menu {
        width: 250px;
    }
}
