:root {
    --bg-color: #2b2b2b;
    --wood-color: #3b2818;
    --metal-color: #7d7d7d;
    --lamp-off: #2c2c2c;
    --lamp-on: #fffb99;
    --key-color: #1f1f1f;
    --text-color: #e0e0e0;
}

body {
    background: radial-gradient(circle at center, #3b443c 0%, #0d100e 100%);
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    position: relative;
    padding-bottom: 40px; /* 为署名留出空间 */
}

body::before {
    content: "";
    position: fixed;
    top: 50%; 
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background-image: url('images/铁十字.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.15; /* 作为一个大标志放在中间背后 */
    pointer-events: none;
    z-index: 0;
}

/* 阵营切换按钮 */
.switch-camp-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: linear-gradient(to bottom, #8b0000, #4a0000);
    border: 2px solid #ff4500;
    border-radius: 5px;
    padding: 10px 20px;
    color: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.8);
    transition: transform 0.1s, box-shadow 0.1s;
}

.switch-camp-btn:hover {
    background: linear-gradient(to bottom, #a00000, #600000);
}

.switch-camp-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.8);
}

.switch-camp-btn .cn-text {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.switch-camp-btn .foreign-text {
    font-size: 12px;
    color: #ccc;
}

.back-menu-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: linear-gradient(to bottom, #444, #222);
    border: 2px solid #666;
    border-radius: 5px;
    padding: 10px 20px;
    color: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.8);
    transition: transform 0.1s, box-shadow 0.1s;
}

.back-menu-btn:hover {
    background: linear-gradient(to bottom, #555, #333);
}

.back-menu-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.8);
}

.back-menu-btn .cn-text {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.back-menu-btn .foreign-text {
    font-size: 12px;
    color: #ccc;
}

/* 希特勒照片背景 */
.hitler-background {
    position: absolute;
    top: 5%;
    left: 3%;
    z-index: 0;
    filter: sepia(0.5) contrast(1.2) brightness(0.7);
    opacity: 0.7;
}

.picture-frame {
    border: 15px solid #1a1a1a;
    border-radius: 2px;
    box-shadow: 10px 10px 30px rgba(0,0,0,0.8), inset 0 0 10px rgba(0,0,0,0.5);
    background: #000;
    padding: 10px;
    position: relative;
}

.picture-frame img {
    width: 200px;
    height: auto;
    display: block;
    border: 2px solid #333;
}

.name-plate {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #a89a80; /* 旧金属色 */
    color: #000;
    padding: 3px 15px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid #000;
    border-radius: 2px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.machine-container {
    background: linear-gradient(135deg, #2b302c 0%, #151816 100%);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 
        0 40px 80px rgba(0,0,0,0.9), 
        inset 0 0 30px rgba(0,0,0,0.8),
        0 0 0 10px #3b2818, /* 木质内边框 */
        0 0 0 16px #1c1109; /* 木质外边框，形成木盒质感 */
    border: 2px solid #5a665b; /* 金属面板的接缝 */
    width: 800px;
    max-width: 95%;
    position: relative;
    z-index: 1;
    transform: scale(0.85); /* 缩小显示以适应屏幕 */
    transform-origin: center center;
}

.machine-container::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    height: 450px;
    background-image: url('images/铁十字.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.2; /* 提高面板上水印的可见度 */
    pointer-events: none;
    z-index: 0;
}

.title, .rotors-section, .lampboard, .keyboard, .plugboard-section, .text-log {
    position: relative;
    z-index: 1;
}

.title {
    text-align: center;
    margin-top: 0;
    color: #a89a80;
    letter-spacing: 5px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

/* 转子区域 */
.rotors-section {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 30px;
    margin-bottom: 40px;
    background-color: #1c1c1c;
    padding: 20px;
    border-radius: 5px;
    border: 2px solid #333;
    box-shadow: inset 0 0 10px #000;
}

.rotor-box, .reflector-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.rotor-window {
    background-color: #000;
    border: 3px solid var(--metal-color);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
}

.rotor-char {
    font-size: 28px;
    font-weight: bold;
    color: #fff;
    background-color: #111;
    padding: 5px 10px;
    margin: 5px 0;
    border: 1px solid #444;
    text-align: center;
    min-width: 30px;
    user-select: none;
}

.rotor-btn {
    background: linear-gradient(to bottom, #555, #333);
    border: 1px solid #222;
    color: #ccc;
    cursor: pointer;
    border-radius: 3px;
    padding: 2px 10px;
    font-size: 12px;
}

.rotor-btn:active {
    background: #222;
}

select, input[type="number"] {
    background-color: #222;
    color: #ddd;
    border: 1px solid #555;
    padding: 3px;
    font-family: inherit;
    border-radius: 3px;
}

/* 键盘和灯板排布 */
.lampboard, .keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.row {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* 灯板样式 */
.lamp {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--lamp-off);
    border: 3px solid #1a1a1a;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8), 0 2px 4px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255,255,255,0.3);
    font-size: 18px;
    font-weight: bold;
    transition: all 0.05s ease;
}

.lamp.active {
    background-color: var(--lamp-on);
    color: #000;
    box-shadow: 0 0 15px 5px rgba(255,251,153,0.7), inset 0 0 5px rgba(255,255,255,1);
    text-shadow: 0 0 5px #fff;
}

/* 键盘样式 */
.key {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #444, #111);
    border: 2px solid #000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.6), inset 0 2px 3px rgba(255,255,255,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: transform 0.05s, box-shadow 0.05s;
}

.key:active, .key.pressed {
    transform: translateY(4px);
    box-shadow: 0 0px 2px rgba(0,0,0,0.8), inset 0 2px 5px rgba(0,0,0,0.8);
    background: radial-gradient(circle at 30% 30%, #333, #0a0a0a);
}

/* 插线板 */
.plugboard-section {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #333;
    margin-bottom: 20px;
}

.plugboard-section h3 {
    margin-top: 0;
    font-size: 16px;
    color: #a89a80;
}

#plugboard-input {
    width: 100%;
    padding: 8px;
    background-color: #111;
    color: #fff;
    border: 1px solid #555;
    font-size: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.error {
    color: #ff5555;
    font-size: 12px;
    min-height: 15px;
    margin: 5px 0 0 0;
}

/* 记录区域 */
.text-log {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.log-box {
    flex: 1;
    display: flex;
    flex-direction: column;
}

textarea {
    width: 100%;
    height: 60px;
    background-color: #111;
    color: #0f0;
    border: 1px solid #333;
    padding: 5px;
    font-family: inherit;
    resize: none;
}

button {
    margin-top: 10px;
    padding: 8px 15px;
    background-color: #444;
    color: #fff;
    border: 1px solid #222;
    cursor: pointer;
    border-radius: 3px;
}

button:hover {
    background-color: #555;
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .hitler-background {
        position: fixed;
        top: auto;
        left: auto;
        right: 5%;
        bottom: 5%;
        z-index: 0;
        opacity: 0.3;
    }
    
    .picture-frame img {
        width: 120px;
    }
    
    .machine-container {
        width: 95%;
        padding: 20px;
        transform: scale(1);
        margin: 20px auto;
    }
    
    .machine-container::before {
        width: 200px;
        height: 200px;
        opacity: 0.1;
    }
    
    .title {
        font-size: 24px;
        letter-spacing: 3px;
    }
    
    .rotors-section {
        flex-wrap: wrap;
        gap: 20px;
        padding: 15px;
    }
    
    .rotor-box, .reflector-box {
        min-width: 80px;
    }
    
    .rotor-window {
        padding: 3px;
    }
    
    .rotor-char {
        font-size: 20px;
        padding: 3px 8px;
        min-width: 25px;
    }
    
    .rotor-btn {
        padding: 2px 8px;
        font-size: 10px;
    }
    
    select, input[type="number"] {
        font-size: 12px;
        padding: 2px;
    }
    
    .lampboard, .keyboard {
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .row {
        gap: 8px;
    }
    
    .lamp {
        width: 30px;
        height: 30px;
        font-size: 14px;
        border: 2px solid #1a1a1a;
    }
    
    .key {
        width: 35px;
        height: 35px;
        font-size: 14px;
        border: 2px solid #000;
    }
    
    .plugboard-section {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .plugboard-section h3 {
        font-size: 14px;
    }
    
    #plugboard-input {
        font-size: 14px;
        padding: 6px;
    }
    
    .text-log {
        flex-direction: column;
        gap: 10px;
    }
    
    .log-box {
        width: 100%;
    }
    
    textarea {
        height: 50px;
        font-size: 14px;
    }
    
    button {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .switch-camp-btn {
        top: 10px;
        right: 10px;
        padding: 8px 15px;
    }
    
    .switch-camp-btn .cn-text {
        font-size: 14px;
    }
    
    .switch-camp-btn .foreign-text {
        font-size: 10px;
    }
    
    .back-menu-btn {
        top: 10px;
        left: 10px;
        right: auto;
    }
    
    .footer-credit {
        font-size: 12px;
        bottom: 10px;
    }
}