* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #134e5e 0%, #71b280 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.game-container {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid #2ecc71;
    max-width: 100%;
    width: fit-content;
}

.game-header {
    text-align: center;
    margin-bottom: 12px;
}

.game-header h1 {
    font-size: clamp(20px, 5vw, 28px);
    color: #2ecc71;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(46, 204, 113, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #2ecc71;
}

.stat-label {
    font-size: 11px;
    color: #b8c0ff;
}

.stat-value {
    font-size: clamp(18px, 5vw, 24px);
    font-weight: bold;
    color: #2ecc71;
}

/* 尺寸选择 */
.size-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.size-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.size-btn:hover {
    background: rgba(46, 204, 113, 0.3);
}

.size-btn.active {
    background: #2ecc71;
    border-color: #2ecc71;
}

/* 游戏棋盘 */
.game-board {
    display: grid;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.tile {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(20px, 6vw, 32px);
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.tile:not(.empty) {
    background: linear-gradient(145deg, #27ae60, #1e8449);
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tile:not(.empty):hover {
    transform: scale(1.05);
    background: linear-gradient(145deg, #2ecc71, #27ae60);
}

.tile:not(.empty):active {
    transform: scale(0.95);
}

.tile.empty {
    background: rgba(0, 0, 0, 0.3);
    cursor: default;
}

.tile.movable {
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.6);
}

/* 控制区 */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.control-btn {
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.2s;
}

.control-btn:hover {
    transform: translateY(-2px);
}

.game-footer {
    text-align: center;
    color: #b8c0ff;
    font-size: clamp(11px, 3vw, 13px);
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-box {
    background: linear-gradient(160deg, #1e1e3f 0%, #2a1040 100%);
    border: 2px solid #2ecc71;
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 320px;
    width: 100%;
    text-align: center;
}

.modal-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 24px;
    color: #2ecc71;
    margin-bottom: 20px;
}

.modal-stats {
    background: rgba(46, 204, 113, 0.15);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    color: #fff;
    font-size: 16px;
    margin-bottom: 8px;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
}

.modal-btn.primary:hover {
    transform: translateY(-2px);
}

/* 移动端适配 */
@media (max-width: 600px) {
    body {
        padding: 0;
    }
    
    .game-container {
        border-radius: 0;
        border: none;
        padding: 10px;
    }
}
