body {
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.hidden {
    display: none !important;
}

header {
    margin-bottom: 20px;
}

.mode-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 50px 0;
}

.mode-button {
    padding: 15px 30px;
    font-size: 18px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    width: 250px;
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.status {
    font-size: 20px;
    font-weight: bold;
}

.timer {
    font-size: 18px;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.action-button {
    padding: 8px 15px;
    cursor: pointer;
    background-color: #ddd;
    border: none;
    border-radius: 5px;
}

.action-button.active {
    background-color: #4CAF50;
    color: white;
}

.board-container {
    position: relative;
    margin: 0 auto;
    max-width: 500px;
}

.board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 5px;
    width: 100%;
    aspect-ratio: 1/1;
}

.cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    font-size: 24px;
    cursor: pointer;
    user-select: none;
    aspect-ratio: 1/1;
    min-height: 50px;
}

.cell.active-grid {
    background-color: rgba(204, 255, 204, 0.5);
    box-shadow: inset 0 0 5px rgba(0, 255, 0, 0.3);
}

.cell.selected {
    border: 2px solid #ff0000;
}

.grid-controls {
    margin-top: 20px;
}

.direction-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 5px;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.direction-button {
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.direction-button:hover {
    background-color: #e0e0e0;
}

.center-button {
    background-color: #d0d0d0;
    cursor: default;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.control-button {
    padding: 10px 20px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
}

.messages {
    min-height: 30px;
    color: #ff0000;
    margin-top: 10px;
}

.cell.x {
    color: blue;
}

.cell.o {
    color: red;
}

.game-result {
    color: #4CAF50;
    font-weight: bold;
    font-size: 18px;
}