:root {
    --bg-color: #f0f2f5;
    --board-bg: #bdbdbd;
    --cell-bg: #e0e0e0;
    --cell-hover: #d4d4d4;
    --cell-revealed: #eecbc;
    --shadow-light: #ffffff;
    --shadow-dark: #a0a0a0;
    --text-color: #333;
    --accent-color: #4a90e2;
    --danger-color: #e74c3c;
    --success-color: #2ecc71;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* 防止双击选中文本 */
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-color);
}

.main-container {
    background: #e0e0e0;
    padding: 20px;
    border-radius: 10px;
    box-shadow:  10px 10px 20px #bebebe,
             -10px -10px 20px #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    max-width: 400px;
    width: 100%;
}

.game-title {
    font-size: 24px;
    margin-bottom: 15px;
    color: #555;
    letter-spacing: 2px;
}

/* 认证面板 */
.auth-panel {
    width: 100%;
    margin-bottom: 15px;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

#login-form-container {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

#login-form-container input {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    width: 80px;
    font-size: 12px;
}

.auth-btns {
    display: flex;
    gap: 5px;
}

.auth-btns button {
    padding: 5px 10px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.auth-btns .secondary-btn {
    background: #999;
}

#user-info-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    font-size: 14px;
}

.logout-btn {
    background: transparent;
    border: 1px solid #999;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.hidden {
    display: none !important;
}

.game-header {
    width: 100%;
    margin-bottom: 15px;
    background: #d4d4d4;
    padding: 10px;
    border-radius: 5px;
    border: 2px solid #a0a0a0;
    border-bottom-color: #ffffff;
    border-right-color: #ffffff;
    border-top-color: #a0a0a0;
    border-left-color: #a0a0a0;
}

.status-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.counter-box {
    background: #333;
    color: red;
    font-family: 'Courier New', monospace;
    font-size: 24px;
    padding: 5px 10px;
    border-radius: 2px;
    min-width: 60px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.counter-box .label {
    font-size: 10px;
    color: #888;
    margin-bottom: 2px;
}

.counter-box .value {
    line-height: 1;
}

.restart-btn {
    font-size: 24px;
    width: 44px;
    height: 44px;
    border: none;
    background: #e0e0e0;
    border-radius: 5px;
    cursor: pointer;
    box-shadow:  3px 3px 6px #bebebe,
             -3px -3px 6px #ffffff;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.restart-btn:active {
    box-shadow: inset 3px 3px 6px #bebebe,
            inset -3px -3px 6px #ffffff;
}

/* 数据看板样式 */
.stats-panel {
    width: 100%;
    margin-bottom: 10px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.1);
    border: 1px solid #dcdcdc;
    font-size: 12px;
}

.stats-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.stats-divider {
    width: 1px;
    background: #ccc;
    height: 40px;
    margin: 0 10px;
}

.stats-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.stats-panel span {
    color: var(--accent-color);
    font-weight: bold;
}

.refresh-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.refresh-btn {
    padding: 5px 20px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}

.refresh-btn:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

.refresh-btn:active {
    transform: translateY(0);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(9, 40px); /* 默认 9x9 */
    grid-template-rows: repeat(9, 40px);
    gap: 4px;
    background: #bbbbbb;
    padding: 4px;
    border-radius: 4px;
    border: 3px solid #999;
}

.cell {
    width: 40px;
    height: 40px;
    background: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    /* 3D 按钮效果 */
    border-top: 3px solid #fff;
    border-left: 3px solid #fff;
    border-bottom: 3px solid #a0a0a0;
    border-right: 3px solid #a0a0a0;
}

.cell:hover:not(.revealed):not(.flagged) {
    background: #dcdcdc;
}

.cell.revealed {
    background: #c0c0c0;
    border: 1px solid #999;
    cursor: default;
}

.cell.flagged {
    color: #e74c3c;
}

.cell.mine {
    background: #e74c3c;
    border: 1px solid #999;
}

.cell.clicked-mine {
    background: #c0392b;
    border: 1px solid #999;
}

/* 数字颜色 */
.num-1 { color: blue; }
.num-2 { color: green; }
.num-3 { color: red; }
.num-4 { color: navy; }
.num-5 { color: maroon; }
.num-6 { color: teal; }
.num-7 { color: black; }
.num-8 { color: gray; }

/* 模态框 */
.game-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    z-index: 10;
}

.game-message.hidden {
    display: none;
}

.message-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.message-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.message-content button {
    padding: 10px 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.message-content button:hover {
    background: #357abd;
}
