:root {
    --bombe-bg: #2d3032;
    --bombe-panel: #4a4d4a;
    --drum-bg: #1a1a1a;
    --drum-edge: #d4af37; /* 黄铜色 */
    --text-color: #dcdcdc;
    --highlight: #ff4500;
    --success: #32cd32;
}

body {
    margin: 0;
    padding: 0;
    background-color: #1a1512;
    background-image: 
        url('images/英国国旗.png'),
        url('images/queen.jpg');
    background-position: 
        right -50px top -50px,
        right 5% bottom 5%;
    background-repeat: no-repeat, no-repeat;
    background-size: 500px, 250px;
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* 防止照片背景造成滚动 */
    padding-bottom: 40px; /* 为署名留出空间 */
}

body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 21, 18, 0.7); /* 暗化背景图片，突出机器主体 */
    pointer-events: none;
    z-index: 0;
}

/* 阵营切换按钮 */
.switch-camp-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: linear-gradient(to bottom, #1e3a8a, #00004a); /* 英军深蓝色 */
    border: 2px solid #00bfff;
    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, #274b9f, #000066);
}

.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;
}

/* 图灵照片背景 */
.turing-background {
    position: absolute;
    top: 5%;
    left: 5%;
    z-index: 0;
    filter: sepia(0.3) contrast(1.1) brightness(1.1); /* 降低淡化，提高亮度和对比度 */
    opacity: 0.9;
}

.picture-frame {
    border: 15px solid #3e2723;
    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: #111;
    padding: 10px;
    position: relative;
}

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

.name-plate {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #d4af37; /* 铜牌 */
    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;
}

/* Bombe 机器主体 */
.bombe-container {
    position: relative;
    z-index: 1;
    background: linear-gradient(to bottom, #404446 0%, #222 100%);
    width: 900px;
    padding: 30px;
    border-radius: 10px;
    border: 10px solid #1f2220;
    box-shadow: 0 30px 60px rgba(0,0,0,0.9), inset 0 0 20px #000;
    margin-left: 150px; /* 避开左侧图灵照片 */
}

.title {
    text-align: center;
    margin: 0;
    font-size: 32px;
    color: var(--drum-edge);
    letter-spacing: 8px;
    text-shadow: 2px 2px 4px #000;
}

.subtitle {
    text-align: center;
    margin: 5px 0 20px 0;
    font-size: 14px;
    color: #aaa;
    letter-spacing: 2px;
}

/* 控制面板 */
.control-panel {
    display: flex;
    justify-content: space-between;
    background: var(--bombe-panel);
    padding: 20px;
    border: 2px solid #222;
    border-radius: 5px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
    margin-bottom: 30px;
}

.input-section, .status-section {
    width: 48%;
}

.input-section h3, .status-section h3 {
    margin-top: 0;
    border-bottom: 1px solid #777;
    padding-bottom: 5px;
}

.input-group {
    margin-bottom: 10px;
}

.input-group label {
    display: inline-block;
    width: 140px;
}

.input-group input {
    background: #111;
    color: #fff;
    border: 1px solid #888;
    padding: 5px;
    font-family: inherit;
    text-transform: uppercase;
    width: 150px;
    letter-spacing: 2px;
}

button {
    background: linear-gradient(to bottom, #8a2be2, #4a0000);
    color: #fff;
    border: 2px solid #111;
    padding: 10px 20px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.stop-btn {
    background: linear-gradient(to bottom, #d32f2f, #8b0000);
}

.status-box, .result-box {
    background: #000;
    color: var(--success);
    padding: 10px;
    border: 2px inset #555;
    height: 40px;
    display: flex;
    align-items: center;
    font-size: 16px;
    margin-bottom: 10px;
    overflow: hidden;
}

.result-box {
    color: var(--drum-edge);
    height: 60px;
    white-space: pre-wrap;
    font-size: 14px;
}

/* 鼓矩阵 */
.drums-matrix {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 20px;
    background: #111;
    border-radius: 5px;
    box-shadow: inset 0 0 20px #000;
    border: 2px solid #333;
}

.drum-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #2a2a2a;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #444;
}

.column-label {
    color: #888;
    font-size: 12px;
}

/* 单个转鼓 */
.drum {
    width: 60px;
    height: 80px;
    background: linear-gradient(to right, #222 0%, #444 50%, #222 100%);
    border: 4px solid var(--drum-edge);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 15px rgba(0,0,0,0.8), inset 0 0 10px rgba(0,0,0,0.8);
    position: relative;
    overflow: hidden;
}

.drum::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    background: repeating-linear-gradient(to bottom, transparent, transparent 18px, rgba(0,0,0,0.4) 19px, rgba(0,0,0,0.4) 20px);
}

.drum-char {
    font-size: 28px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 5px #fff;
    z-index: 2;
}

/* 旋转动画类 */
.spinning .drum-char {
    animation: spin-blur 0.1s infinite;
    color: transparent;
    text-shadow: 0 0 10px rgba(255,255,255,0.8);
}

@keyframes spin-blur {
    0% { transform: translateY(-10px); }
    50% { transform: translateY(10px); }
    100% { transform: translateY(-10px); }
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        background-size: 200px, 150px !important;
        background-position: right -20px top -20px, right 5% bottom 5%;
    }
    
    .turing-background {
        position: fixed;
        top: auto;
        left: auto;
        right: 5%;
        bottom: 5%;
        z-index: 0;
        opacity: 0.3;
    }
    
    .picture-frame img {
        width: 120px;
    }
    
    .bombe-container {
        width: 95%;
        padding: 20px;
        margin-left: 0;
        margin: 20px auto;
    }
    
    .title {
        font-size: 24px;
        letter-spacing: 4px;
    }
    
    .subtitle {
        font-size: 12px;
        margin-bottom: 15px;
    }
    
    .control-panel {
        flex-direction: column;
        gap: 20px;
        padding: 15px;
    }
    
    .input-section, .status-section {
        width: 100%;
    }
    
    .input-group {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .input-group label {
        display: block;
        width: auto;
        font-size: 14px;
    }
    
    .input-group input {
        width: 100%;
        max-width: 200px;
        font-size: 14px;
        padding: 6px;
    }
    
    .status-box, .result-box {
        font-size: 14px;
        padding: 8px;
    }
    
    .result-box {
        height: 80px;
    }
    
    .drums-matrix {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        padding: 15px;
    }
    
    .drum-column {
        padding: 10px;
        gap: 8px;
    }
    
    .column-label {
        font-size: 10px;
    }
    
    .drum {
        width: 50px;
        height: 60px;
        border: 3px solid var(--drum-edge);
    }
    
    .drum-char {
        font-size: 20px;
    }
    
    .switch-camp-btn {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
    }
    
    .switch-camp-btn .cn-text {
        font-size: 12px;
    }
    
    .switch-camp-btn .foreign-text {
        font-size: 9px;
    }
    
    button {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .back-menu-btn {
        top: 10px;
        left: 10px;
        right: auto;
    }
    
    .footer-credit {
        font-size: 12px;
        bottom: 10px;
    }
}