/* 防止页面滚动 */
body {
    height: 100vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    width: 1024px;
    margin: 0 auto;
    min-width: 1024px;
}

header {
    flex-shrink: 0;  /* 防止header被压缩 */
    width: 100%;
    box-sizing: border-box;
    min-width: 1024px;
}

main {
    flex: 1;
    overflow: auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    min-width: 1024px;
}

.game-container {
    width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(17, 34, 64, 0.95);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}

.game-container h1 {
    color: #64ffda;
    text-align: center;
    margin-bottom: 30px;
    font-family: 'Cinzel', serif;
}

.game-board {
    width: 400px;
    height: 400px;
    margin: 0 auto;
    flex-shrink: 0;
    position: relative;
    background: #DEB887;
    border: 2px solid #8B4513;
}

/* 五子棋棋盘 */
#gobangBoard {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
}

#gobangBoard::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(#8B4513 1px, transparent 1px),
        linear-gradient(90deg, #8B4513 1px, transparent 1px);
    background-size: 6.67% 6.67%;
    pointer-events: none;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.game-controls .buttons {
    display: flex;
    gap: 20px;
}

.game-status {
    color: #64ffda;
    font-size: 14px;
    text-align: center;
    margin: 8px 0;
}

.piece {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.piece.black {
    background: radial-gradient(circle at 30% 30%, #444, #000);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.piece.white {
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.liberty-marker {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(255, 0, 0, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* 贪吃蛇特有样式 */
#snakeCanvas {
    width: 400px;
    height: 400px;
    margin: 20px auto;
    flex-shrink: 0;
    border: 2px solid #64ffda;
    border-radius: 5px;
    background: #0a192f;
}

/* 方向键控制样式 */
.direction-controls {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 6px;
    margin-top: 15px;
    justify-content: center;
}

.direction-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(100, 255, 218, 0.2);
    background: rgba(17, 34, 64, 0.95);
    color: #64ffda;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    padding: 0;
}

.direction-btn:hover {
    background: rgba(100, 255, 218, 0.1);
    transform: translateY(-2px);
    border-color: #64ffda;
}

.direction-btn:active {
    transform: translateY(0);
}

.direction-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 方向键布局 */
.direction-btn.up { grid-area: 1 / 2 / 2 / 3; }
.direction-btn.left { grid-area: 2 / 1 / 3 / 2; }
.direction-btn.right { grid-area: 2 / 3 / 3 / 4; }
.direction-btn.down { grid-area: 3 / 2 / 4 / 3; }

/* 移动端适配 */
@media (max-width: 768px) {
    #snakeCanvas {
        width: 300px;
        height: 300px;
    }

    .direction-controls {
        grid-template-columns: repeat(3, 45px);
        grid-template-rows: repeat(3, 45px);
        gap: 8px;
    }

    .direction-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
}

@media (max-width: 320px) {
    #snakeCanvas {
        width: 280px;
        height: 280px;
    }

    .direction-controls {
        grid-template-columns: repeat(3, 35px);
        grid-template-rows: repeat(3, 35px);
        gap: 5px;
    }

    .direction-btn {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }
}

/* 基础按钮样式 */
button {
    padding: 10px 20px;
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 5px;
    background: rgba(17, 34, 64, 0.95);
    color: #64ffda;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background: rgba(100, 255, 218, 0.1);
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 计算器特有样式 */
.calculator {
    background: rgba(17, 34, 64, 0.95);
    border-radius: 10px;
    width: 300px;
    margin: 20px auto;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.calculator .display {
    background: #0a192f;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: right;
    border: 1px solid rgba(100, 255, 218, 0.2);
}

.calculator .previous-operand {
    color: rgba(100, 255, 218, 0.6);
    font-size: 1.2rem;
    min-height: 1.5rem;
}

.calculator .current-operand {
    color: #64ffda;
    font-size: 2rem;
    min-height: 2.4rem;
}

.calculator .buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.calculator button {
    width: 100%;
    height: 50px;
    border: 1px solid rgba(100, 255, 218, 0.2);
    background: rgba(17, 34, 64, 0.95);
    color: #64ffda;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calculator button:hover {
    background: rgba(100, 255, 218, 0.1);
    transform: translateY(-2px);
}

.calculator button:active {
    transform: translateY(0);
}

.calculator button.operator {
    background: rgba(100, 255, 218, 0.1);
}

.calculator button.span-two {
    grid-column: span 2;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .calculator {
        width: 280px;
        padding: 15px;
    }

    .calculator .display {
        padding: 15px;
    }

    .calculator .buttons {
        gap: 8px;
    }

    .calculator button {
        height: 45px;
        font-size: 1.1rem;
    }
}

@media (max-width: 320px) {
    .calculator {
        width: 260px;
        padding: 10px;
    }

    .calculator .display {
        padding: 10px;
    }

    .calculator .buttons {
        gap: 6px;
    }

    .calculator button {
        height: 40px;
        font-size: 1rem;
    }
} 