.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    touch-action: manipulation;
}

#stats-board {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #38B48B;
}

#sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: 330px;
    height: 330px;
    border: 3px solid #333;
    background-color: #fff;
    margin-bottom: 20px;
    box-sizing: content-box;
    /* To ensure cells fit perfectly inside */
}

.cell {
    border: 1px solid #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.1s;
    box-sizing: border-box;
}

/* 3x3ブロックの境界線を強調 */
.cell:nth-child(3n) {
    border-right: 2px solid #333;
}

.cell:nth-child(9n) {
    border-right: none;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #333;
}

.cell.given {
    font-weight: bold;
    color: #000;
    background-color: #f0f0f0;
}

.cell.user {
    color: #1e90ff;
    font-weight: bold;
}

.cell.error-text {
    color: #ff4757;
}

.cell.selected {
    background-color: #bbdefb !important;
}

.cell.highlight {
    background-color: #e3f2fd;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 330px;
}

.num-btn,
.action-btn {
    padding: 15px 0;
    font-size: 1.5rem;
    background-color: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px #bdc3c7;
    transition: background-color 0.1s, transform 0.1s;
    user-select: none;
}

.num-btn:active,
.action-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 #bdc3c7;
}

.action-btn {
    grid-column: span 5;
    /* フル幅 */
    background-color: #ffb8b8;
    color: #c0392b;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 4px #e74c3c;
}

/* スマホ向け調整 */
@media (max-width: 400px) {

    #sudoku-board,
    .numpad {
        width: 300px;
    }

    #sudoku-board {
        height: 300px;
    }

    .cell {
        font-size: 1.3rem;
    }
}

.controls-hint {
    margin-top: 20px;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

.back-link {
    display: inline-block;
    color: #666;
    margin-top: 15px;
}

#newGameBtn {
    padding: 10px 20px;
    font-size: 1.1rem;
    background-color: #38B48B;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 0 #2a8f6d;
}

#newGameBtn:active {
    transform: translateY(4px);
    box-shadow: none;
}