.math-game-container {
    max-width: 500px;
    margin: 0 auto;
    font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
    text-align: center;
    padding: 20px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.target-display {
    font-size: 1.5rem;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.game-instructions {
    font-size: 0.8rem;
    color: #787c7e;
    margin-bottom: 20px;
    line-height: 1.3;
}

.calculator-screen {
    min-height: 120px;
    border: 2px solid #d3d6da;
    padding: 15px;
    margin-bottom: 20px;
    text-align: right;
    background: white;
    border-radius: 8px;
}

.calculation-history {
    font-size: 1rem;
    color: #787c7e;
    min-height: 20px;
    margin-bottom: 10px;
}

.current-expression {
    font-size: 1.5rem;
    min-height: 30px;
    margin-bottom: 10px;
    color: #333;
}

.current-result {
    font-size: 2rem;
    font-weight: bold;
    min-height: 40px;
    color: #333;
}

.input-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.number-keys {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap; /* 禁止换行 */
    gap: 4px; /* 缩小间距以适应一行 */
    margin-bottom: 8px;
    overflow-x: auto; /* 如果屏幕太小允许横向滚动 */
    padding-bottom: 5px; /* 为滚动条留空间 */
}

.operator-keys {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 调整按钮大小以适应一行 */
.game-btn {
    width: 50px; /* 缩小宽度 */
    height: 50px; /* 缩小高度 */
    font-size: 1.3rem;
}

.game-btn:hover {
    transform: scale(1.05);
}

.num-btn {
    background-color: #d3d6da;
    color: #333;
}

.op-btn {
    background-color: #c9b458;
    color: white;
}

.bracket-btn {
    background-color: #c9b458;
    color: white;
}

.enter-btn {
    background-color: #6aaa64;
    color: white;
    width: 100px;
}

.special-btn {
    background-color: #787c7e;
    color: white;
}

.confirm-btn {
    background-color: #6aaa64;
    color: white;
    width: 100px;
    height: 40px;
    font-size: 1rem;
    margin-top: 10px;
}

#game-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.dialog-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 300px;
    text-align: center;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.dialog-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#restart-btn {
    background-color: #6aaa64;
    color: white;
}

#newgame-btn {
    background-color: #787c7e;
    color: white;
}

.hidden {
    display: none !important;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.mode-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.mode-buttons .game-btn {
    width: 120px;
    height: 60px;
    font-size: 1.2rem;
}

.back-to-menu-btn {
    display: block;
    margin-bottom: 15px;
    background: none;
    border: none;
    color: #4a4a4a;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
}

.back-to-menu-btn:hover {
    color: #000;
}

#battle-lobby, #game-board {
    position: relative;
}

.battle-actions .game-btn {
    width: auto;
    padding: 10px 20px;
    height: auto;
    font-size: 1rem;
}

#game-board-overlay {
    position: absolute; /* 覆盖在游戏面板上 */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85); /* 半透明白色背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10; /* 确保在最上层 */
}

#game-board-overlay-message {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    padding: 20px;
}

.player-list-container h4 {
    font-size: 14px;
}

.player-list-container li {
    font-size: 14px;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.lobby-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: #333;
}

#create-battle-btn {
    width: auto;
    height: auto;
    padding: 10px 20px;
    font-size: 1rem;
}

#battle-list-container {
    margin-top: 15px;
}

#lobby-status-message {
    color: #787c7e;
    font-size: 1rem;
    padding: 20px;
    text-align: center;
}

#battle-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.battle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #d3d6da;
    border-radius: 8px;
    transition: box-shadow 0.2s;
}

.battle-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.battle-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.battle-creator {
    font-weight: bold;
    color: #333;
}

.battle-players {
    font-size: 0.9rem;
    color: #787c7e;
}

.join-game-btn {
    width: auto;
    height: auto;
    padding: 8px 18px;
    font-size: 0.9rem;
}

.battle-item-status-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.battle-item-status {
    font-size: 0.8rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    color: white;
}

.battle-item-status.waiting {
    background-color: #6aaa64;
}

.battle-item-status.counting-down {
    background-color: #c9b458;
}

#player-in-game-view {
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-top: 15px;
    text-align: center;
    background-color: #f8f9fa;
}

#player-in-game-view h3 {
    margin-top: 0; color: #333;
}

#player-in-game-view ul {
    list-style: none;
    padding: 0;
}

#player-in-game-view li {
    padding: 5px 0;
    font-size: 1rem;
    color: #4a4a4a;
}