:root {
    --gold: #d4af37;
    --cream: #fceea7;
    --glass: rgba(255, 255, 255, 0.05);
    --border: rgba(212, 175, 55, 0.3);
}

body { 
    margin: 0; 
    overflow: hidden; 
    background-color: #000; 
    font-family: 'Times New Roman', serif;
    user-select: none;
}

/* Loader */
#loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}
.spinner {
    width: 40px; height: 40px;
    border: 2px solid rgba(212, 175, 55, 0.1);
    border-top: 2px solid var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
.loader-text {
    color: var(--gold);
    font-family: 'Cinzel', serif;
    letter-spacing: 2px;
    font-size: 14px;
}

/* UI Overlay */
#ui-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.5s ease;
}

h1 {
    position: absolute;
    top: 20px;
    width: 100%;
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 56px;
    margin: 0;
    background: linear-gradient(to bottom, #fff, var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    pointer-events: auto;
}

.controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.upload-wrapper input[type="file"] {
    display: none;
}

.btn {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 12px 30px;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

.btn:hover {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.3);
}

.hint {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    margin-top: 5px;
    letter-spacing: 1px;
}

.status-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    color: var(--gold);
    padding: 5px 15px;
    font-size: 12px;
    font-family: 'Cinzel', serif;
    border-radius: 20px;
}

.ui-hidden {
    opacity: 0;
    pointer-events: none !important;
}

/* Hidden CV Elements */
#webcam-container {
    position: absolute;
    bottom: 10px;
    right: 10px;
    opacity: 0; /* Hidden but active */
    pointer-events: none;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* css/style.css 添加在末尾 */

.mode-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    pointer-events: auto;
}

.switch-label {
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 12px;
    letter-spacing: 1px;
}

/* The Switch Container */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

/* The Slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--gold);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--gold);
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* Checked state (Hand Mode) */
input:checked + .slider {
    background-color: rgba(212, 175, 55, 0.2);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* css/style.css */

/* 蒙版容器 */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.8s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 指南卡片 */
.instruction-card {
    background: rgba(15, 18, 21, 0.95);
    border: 1px solid var(--gold);
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    max-width: 600px;
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.2);
    transform: translateY(0);
    transition: transform 0.8s ease;
}

.hidden .instruction-card {
    transform: translateY(20px);
}

.instruction-card h2 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 2rem;
    margin-bottom: 30px;
    letter-spacing: 2px;
}

/* 两列布局 */
.instruction-grid {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    text-align: left;
}

.inst-col {
    flex: 1;
}

.inst-col h3 {
    color: #fff;
    font-size: 14px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.inst-col .note {
    font-size: 10px;
    color: #666;
    margin-top: -10px;
    margin-bottom: 15px;
    font-style: italic;
}

.inst-col ul {
    list-style: none;
    padding: 0;
}

.inst-col li {
    margin-bottom: 12px;
    color: #ccc;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.inst-col li span {
    color: var(--gold);
    font-weight: bold;
    min-width: 120px;
}

.inst-col li small {
    color: #888;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 1px;
}

/* 开始按钮 */
.btn-start {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 12px 40px;
    font-family: 'Cinzel', serif;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 2px;
}

.btn-start:hover {
    background: var(--gold);
    color: #000;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
}

/* 移动端适配 */
@media (max-width: 600px) {
    .instruction-grid {
        flex-direction: column;
        gap: 20px;
    }
}

/* css/style.css 末尾 - 替换之前的 instruction-card 相关样式 */

/* 1. 卡片变窄，不再那么宽大松散 */
.instruction-card {
    max-width: 600px !important; /* 从 900px 改为 700px */
    width: 90%; /* 移动端适配 */
    padding: 50px 40px !important; /* 调整内边距 */
    background: rgba(10, 12, 15, 0.95);
    border: 1px solid var(--gold);
    box-shadow: 0 0 60px rgba(212, 175, 55, 0.15);
}

/* 2. 标题微调 */
.instruction-card h2 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 3.2rem !important; /*稍微调小一点点，更精致 */
    margin-bottom: 30px;
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* 3. 布局调整：两列更紧凑，中间加个分割线 */
.instruction-grid {
    display: flex;
    justify-content: center; /* 整体居中 */
    gap: 40px; /* 减小间距 */
    margin-bottom: 30px;
    position: relative;
}

/* 给两列中间加一条细微的分割线，增加对齐感 */
.instruction-grid::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 10px;
    bottom: 10px;
    width: 1px;
    background: rgba(212, 175, 55, 0.2);
}

.inst-col {
    flex: 1;
    display: flex; /* 使用 flex 让内部元素对齐 */
    flex-direction: column;
    align-items: center; /* 让标题和列表整体在列内居中 */
}

.inst-col h3 {
    text-align: center;
    width: 100%;
}

.inst-col ul {
    padding: 0;
    margin: 0;
    /* 列表左对齐，但在列中居中，这样最好看 */
    display: inline-block; 
}

/* 4. 列表项对齐 */
.inst-col li {
    white-space: nowrap !important;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 内部内容左对齐 */
    gap: 15px;
    margin-bottom: 12px;
    width: 100%;
}

.inst-col li span {
    color: var(--gold);
    font-weight: bold;
    /* 固定宽度缩小一点，因为卡片变窄了 */
    min-width: 140px; 
    text-align: right; /* [关键] 标签右对齐，说明左对齐，形成中缝对齐效果 */
    font-size: 13px;
}

.inst-col li small {
    color: #999;
    font-size: 11px;
    letter-spacing: 1px;
    text-align: left;
}

/* 移动端去分割线 */
@media (max-width: 768px) {
    .instruction-grid::after { display: none; }
    .inst-col li span { text-align: left; }
}


/* === 移动端 UI 专属优化 === */
@media (max-width: 600px) {
    /* 1. 整体容器大幅下移 */
    .controls {
        bottom: 15px !important; /* 原来是 40px，现在贴底，留一点呼吸感即可 */
        gap: 8px; /* 减小控件之间的垂直间距 */
    }

    /* 2. 隐藏手机端无效的提示 (手机没有键盘H键) */
    /* 这一步非常关键，隐藏它之后，按钮就能自然地坐下来了 */
    .hint {
        display: none !important; 
    }

    /* 3. 按钮极致瘦身 */
    .btn {
        padding: 6px 16px !important; /* 上下压扁，左右收窄 */
        font-size: 11px !important;   /* 字号调小 */
        line-height: 1.2;             /* 防止行高撑大 */
        letter-spacing: 1px;          /* 保持一点高级感 */
        background: rgba(255, 255, 255, 0.08); /* 稍微调淡背景，显得更轻盈 */
    }

    /* 4. 针对刷新按钮的微调 */
    #refresh-btn {
        width: auto; /* 防止它撑满屏幕 */
        min-width: 120px;
    }

    /* 5. 标题也稍微改小并上移，避免遮挡树顶的星星 */
    h1 {
        font-size: 32px !important;
        top: 30px; /* 稍微往上提 */
    }
    
    /* 6. 状态文字改小 */
    .status-badge {
        font-size: 10px;
        padding: 2px 8px;
        top: 15px;
        right: 15px;
    }
    
    /* 7. 开关控件也缩小一点 */
    .switch {
        transform: scale(0.8); /* 整体缩放开关 */
    }
    .switch-label {
        font-size: 10px;
    }
}

/* css/style.css 末尾新增 */

.intro-subtitle {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: #ccc;
    font-size: 1.2rem;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

/* 简单的淡入淡出动画类 */
.fade-in {
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}