:root {
    --cam-w: 340px; --cam-h: 400px;
    --photo-w: 220px; --photo-h: 280px;
    --bg-color: #777777;
    --cam-body-bg: #ffffff;
    --text-color: #000000;
    --filter-group-border: #000000;
    --group-label-color: #000000;
    --tips-bg: rgba(0,0,0,0.1);
    --tips-color: #ffffff;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --cam-body-bg: #3d3d3d;
    --text-color: #ffffff;
    --filter-group-border: #FFFFFF;
    --group-label-color: #cccccc;
    --tips-bg: rgba(255,255,255,0.1);
    --tips-color: #cccccc;
}

body {
    margin: 0; width: 100vw; height: 100vh; overflow: hidden;
    background-color: var(--bg-color);
    font-family: 'Segoe UI', sans-serif; user-select: none;
    transition: background-color 0.3s;
}

/* 相机主体 */
.camera-container {
    position: fixed; bottom: 50%; right: 50%;
    transform: translate(50%, 50%);
    width: 340px; height: 460px; z-index: 9999;
}
.camera-body {
    width: 100%; height: 100%; background: var(--cam-body-bg);
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
    position: relative; z-index: 10;
    display: flex; flex-direction: column; overflow: hidden;
    padding: 0;
    transition: background 0.3s;
}

/* 顶部装饰条 */
.top-bar {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 280px; height: 8px; background: #000;
    border-radius: 0 0 8px 8px;
}

.viewfinder {
    width: 280px; height: 280px; background: #000000;
    margin: 35px auto 0;
    border: 5px solid #000;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

video { width: auto; height: 100%; object-fit: contain; transform: scaleX(-1); transition: filter 0.3s, transform 0.1s; margin-left: -25px; }

/* 缩放控制 */
.zoom-control {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 30px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    border-radius: 15px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 20;
}
.viewfinder:hover .zoom-control {
    opacity: 1;
}
#zoomRange {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
}
#zoomRange::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}
.zoom-icon {
    font-size: 12px;
    color: #fff;
    pointer-events: none;
}

/* 五彩条纹 */
.rainbow-stripe {
    position: absolute; bottom: 0; left: 0;
    width: 100%; height: 10px;
    display: flex;
}
.stripe-seg { flex: 1; height: 100%; }
.s-red { background: #ff4757; }
.s-orange { background: #ffa502; }
.s-yellow { background: #eccc68; }
.s-green { background: #2ed573; }
.s-blue { background: #1e90ff; }

/* 红色快门按钮 (居中底部) */
.shutter-btn {
    width: 48px; height: 48px; background: #FF4D57;
    border-radius: 50%; border: 5px solid #cccccc; cursor: pointer;
    margin: 20px auto 30px auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.1s;
    flex-shrink: 0;
}
.shutter-btn:active { transform: scale(0.95); }

/* 滤镜盒子样式 */
.controls {
    display: flex; justify-content: center; gap: 8px; 
    width: 92%; margin: 15px auto 0;
}
.filter-group {
    border: 2px solid var(--filter-group-border); border-radius: 10px;
    padding: 4px 6px 6px; position: relative;
    display: flex; flex-direction: column; align-items: center;
    transition: border-color 0.3s;
}
.group-label {
    font-size: 9px; color: var(--group-label-color); text-transform: uppercase; 
    font-weight: 900; letter-spacing: 0.5px; margin-bottom: 4px;
    transition: color 0.3s;
}
.f-btn-list {
    display: flex; gap: 7px; width: 100%; justify-content: space-between;
}
.f-btn {
    width: 12px; height: 12px; border-radius: 50%; cursor: pointer;
    border: 1.5px solid #444; transition: transform 0.2s;
}
.f-btn:hover { transform: scale(1.1); }
.f-btn.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #000; }

/* 顶部控制栏布局 */
.top-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
}

/* 增加基础功能样式 */

/* 相纸颜色 */
.p-white { background: #fff !important; }
.p-black { background: #1a1a1a !important; }

.hidden { display: none !important; }

/* 语言选择器 */
.lang-selector select {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 8px 12px;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    outline: none;
    transition: all 0.3s;
}

.lang-selector select:hover {
    background: rgba(255,255,255,0.3);
}

.lang-selector select option {
    background: #333;
    color: #fff;
}

body.dark-mode .lang-selector select {
    background: rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.1);
}

/* 模式切换按钮 */
.mode-toggle {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 8px 16px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: flex; align-items: center; gap: 6px;
}
.mode-toggle:hover {
    background: rgba(255,255,255,0.3);
}
body.dark-mode .mode-toggle {
    background: rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.1);
}

/* 滤镜颜色定义 */
.c-norm { background: #ddd; }
.c-600 { background: #ffeb3b; }
.c-sx70 { background: #ff9800; }
.c-mono { background: #333; }
.c-fade { background: #a1887f; }
.c-blue { background: #2196f3; }
.c-spectra { background: #9c27b0; }

/* 富士胶片系列 */
.c-provia { background: #3498db; }
.c-velvia { background: #2ecc71; }
.c-astia { background: #fab1a0; }
.c-chrome { background: #4b4b4b; }
.c-cneg { background: #2d5a27; }
.c-eterna { background: #7f8c8d; }
.c-acros { background: #000; }

/* 悬停提示增强 */
.f-btn {
    position: relative;
}
.f-btn::after {
    content: attr(title);
    position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.8); color: #fff; padding: 4px 8px;
    border-radius: 4px; font-size: 10px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: 0.2s; z-index: 100;
}
.f-btn:hover::after { opacity: 1; }

/* 照片样式 */
.polaroid {
    position: absolute; width: var(--photo-w); height: var(--photo-h);
    background: #fff; padding: 12px 12px 0 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex; flex-direction: column;
    top: 60px; left: 50%; transform: translateX(-50%); z-index: 1;
    cursor: grab; transition: box-shadow 0.2s;
    box-sizing: border-box;
}
.polaroid:hover { box-shadow: 0 15px 35px rgba(0,0,0,0.25); }
.polaroid:active { cursor: grabbing; }

.p-img-box {
    width: 100%; height: 196px; background: #111; overflow: hidden; pointer-events: none;
}
.p-img-box img {
    width: 100%; height: 100%; object-fit: cover;
    filter: blur(15px) brightness(0.2) grayscale(1);
    transition: filter 5s ease-in-out;
}
.polaroid.developed img { filter: blur(0) brightness(1) grayscale(0); }

/* 手写字区域 */
.p-caption {
    flex: 1; border: none; outline: none; background: transparent;
    font-family: 'Gochi Hand', cursive; font-size: 1.4rem; color: #333;
    text-align: center; line-height: 1.2; padding-top: 25px; cursor: text;
}
.p-caption:empty::before { content: attr(data-placeholder); color: #ccc; font-size: 1rem; }

/* 操作栏 (下载/删除) */
.p-tools {
    position: absolute; top: -30px; right: 0; 
    display: flex; gap: 5px;
    opacity: 0; transform: translateY(5px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none; /* 默认不响应鼠标，避免意外遮挡 */
    padding-bottom: 10px; /* 增加底部透明区域，建立连接桥梁 */
}
.polaroid:hover .p-tools { 
    opacity: 1; transform: translateY(0); 
    pointer-events: auto; /* 悬停时恢复响应 */
}
.tool-btn {
    background: #333; color: #fff; border: none; padding: 4px 8px;
    border-radius: 4px; font-size: 12px; cursor: pointer; opacity: 0.8;
    transition: opacity 0.2s, transform 0.1s;
}
.tool-btn:hover { opacity: 1; transform: scale(1.05); }

/* 动画 */
.ejecting { animation: eject 2.5s cubic-bezier(0.19, 1, 0.22, 1) forwards; }
@keyframes eject { 
    0% { transform: translateX(-50%) translateY(0); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(-300px); } 
}

/* 页脚 */
.footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--tips-color);
    opacity: 0.5;
    z-index: 100;
    pointer-events: none;
    text-transform: uppercase;
}

/* 操作提示 */
.tips {
    position: fixed; top: 20px; left: 20px;
    background: var(--tips-bg);
    color: var(--tips-color);
    padding: 12px 20px; border-radius: 12px;
    font-size: 13px; line-height: 1.6;
    z-index: 100; backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s;
}