* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f5f8;
    color: #1b1f24;
}

.container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 16px;
}

h1 {
    margin-bottom: 16px;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.hidden {
    display: none;
}

.fieldRow {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.fieldRow select {
    border: 1px solid #c8d0da;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 15px;
    background: #fff;
}

.checkboxRow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
}

label {
    font-weight: 600;
    margin-bottom: 4px;
}

input {
    border: 1px solid #c8d0da;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 15px;
}

button {
    border: none;
    border-radius: 8px;
    padding: 9px 12px;
    background: #2a6adf;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

button:disabled {
    opacity: 0.55;
    cursor: default;
}

.danger {
    background: #d13b3b;
}

.hint {
    color: #59636f;
    margin-top: 10px;
}

.headerRow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.actionButtons {
    display: flex;
    gap: 8px;
}

.statusRow {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 700;
}

.mainGrid {
    display: grid;
    grid-template-columns: minmax(320px, 560px) minmax(250px, 1fr);
    gap: 16px;
}

.board {
    width: min(80vw, 560px);
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    border: 2px solid #263238;
}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(24px, 5vw, 42px);
    user-select: none;
}

.light {
    background: #f0d9b5;
}

.dark {
    background: #b58863;
}

.selected {
    outline: 3px solid #1f7af6;
    outline-offset: -3px;
}

.chatPanel {
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.messages {
    flex: 1;
    border: 1px solid #c8d0da;
    border-radius: 8px;
    padding: 8px;
    background: #fafbfd;
    overflow-y: auto;
    max-height: 420px;
}

.message {
    margin-bottom: 8px;
    line-height: 1.25;
    word-break: break-word;
}

.message .name {
    font-weight: 700;
}

.chatInputRow {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-top: 8px;
}

@media (max-width: 900px) {
    .mainGrid {
        grid-template-columns: 1fr;
    }

    .board {
        width: min(90vw, 560px);
    }
}
