body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px 0;
    box-sizing: border-box;
    background-color: #f0e6d2;
    color: #333;
}

#game-container {
    text-align: center;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    padding: 20px;
}

#board {
    display: grid;
    grid-template-columns: repeat(6, 60px);
    grid-template-rows: repeat(6, 60px);
    gap: 4px;
    margin: 20px auto;
    background-color: #5c4033;
    padding: 8px;
    border-radius: 5px;
}

.cell {
    width: 60px;
    height: 60px;
    background-color: #e0c9a6;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 30px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    position: relative;
}

.cell.covered {
    background-color: #8b5a2b;
    color: transparent;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.4);
}

.cell.selected {
    border: 3px solid yellow;
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.7);
}

.cell.valid-move {
    border: 3px dashed green;
    background-color: rgba(0, 255, 0, 0.2);
}

.cell.valid-capture {
    border: 3px dashed red;
    background-color: rgba(255, 0, 0, 0.2);
}

/* ── Burning piece ── */
.cell.burning {
    /* background-color stays as the player's red/blue — only layer an orange tint on top */
    background-image: linear-gradient(rgba(255, 90, 0, 0.22), rgba(255, 60, 0, 0.22)) !important;
    box-shadow: inset 0 0 10px rgba(255, 90, 0, 0.35), 0 0 7px rgba(255, 50, 0, 0.25);
    animation: burn-flicker 0.9s ease-in-out infinite alternate;
}

.cell.burning::after {
    content: '🔥';
    position: absolute;
    font-size: 18px;
    bottom: 1px;
    right: 2px;
    pointer-events: none;
    line-height: 1;
    opacity: 0.9;
}

@keyframes burn-flicker {
    from { box-shadow: inset 0 0 10px rgba(255, 90, 0, 0.35), 0 0 7px rgba(255, 50, 0, 0.25); }
    to   { box-shadow: inset 0 0 16px rgba(255, 50, 0, 0.50), 0 0 12px rgba(255, 20, 0, 0.40); }
}

.cell.push-destination-preview {
    background-color: rgba(230, 126, 34, 0.25) !important;
    border: 2px dashed #e67e22;
}

#turn-indicator {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: #333;
    font-weight: bold;
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.3s;
    border: 2px solid #333;
}

#controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* ── Setup screen ── */
#setup-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.player-config {
    background-color: #f0e6d2;
    border-radius: 8px;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 340px;
}

.player-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-label {
    font-weight: bold;
    width: 70px;
    text-align: right;
    color: #6e583b;
}

.player-row select {
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #aaa;
    font-size: 14px;
    cursor: pointer;
}

.player-row select:disabled {
    opacity: 0.45;
    cursor: default;
}

.speed-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid #d2c1a3;
    font-size: 14px;
    color: #555;
}

.speed-row input[type=range] {
    vertical-align: middle;
    width: 100px;
}

#start-game-btn {
    background-color: #6e583b;
    border: none;
    color: white;
    padding: 12px 36px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
    letter-spacing: 0.5px;
}

#start-game-btn:hover {
    background-color: #5a4530;
}

/* ── Abilities toggle section ── */
.abilities-toggle {
    min-width: 340px;
    max-width: 380px;
    text-align: left;
    background-color: #f0e6d2;
    border-radius: 6px;
    border: 1px solid #d2c1a3;
}

.abilities-toggle summary {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #6e583b;
    user-select: none;
}

.abilities-body {
    padding: 4px 16px 12px;
}

.abilities-hint {
    font-size: 12px;
    color: #888;
    margin: 0 0 8px;
}

.ability-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
}

.ability-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #4a3520;
}

.ability-label input[type=checkbox] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.ability-emoji {
    font-size: 18px;
    line-height: 1;
}

.ability-name {
    font-weight: bold;
    color: #5a3e20;
}

.ability-desc {
    font-size: 12px;
    color: #666;
    padding-left: 28px;
    line-height: 1.4;
}

/* ── Skill tray ── */
#skill-tray {
    display: flex;
    justify-content: center;
    gap: 6px;
    background-color: #d6cfc4;
    border: 1px solid #b0a898;
    border-radius: 8px;
    padding: 8px;
    margin: 8px auto 0;
    width: fit-content;
}

.skill-slot {
    width: 52px;
    height: 52px;
    background-color: #b8b0a4;
    border: 1px solid #9a9088;
    border-radius: 6px;
    color: #9a9088;
    font-size: 20px;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.skill-slot::before {
    content: attr(data-spell-icon);
    position: absolute;
    font-size: 30px;
    opacity: 0.18;
    pointer-events: none;
    line-height: 1;
}

.skill-slot.skill-available::before {
    opacity: 0.35;
}

.skill-slot.skill-available {
    background-color: #e8dfc8;
    border-color: #a07040;
    color: #6e4820;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.skill-slot.skill-available:hover {
    background-color: #f5e8c0;
    border-color: #c87830;
    color: #4a2e08;
}

/* ── Resign button ── */
#resign-button {
    background-color: #c0392b;
    border: none;
    color: white;
    padding: 8px 20px;
    font-size: 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s;
}

#resign-button:hover {
    background-color: #a93226;
}

/* ── Winner overlay ── */
#winner-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.97);
    border: 3px solid #6e583b;
    border-radius: 10px;
    padding: 28px 48px;
    font-size: 22px;
    font-weight: bold;
    color: #6e583b;
    box-shadow: 0 0 30px rgba(0,0,0,0.35);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

#winner-score {
    font-size: 15px;
    font-weight: normal;
    color: #8a6f4e;
    margin-top: -6px;
}

#restart-btn {
    background-color: #6e583b;
    border: none;
    color: white;
    padding: 10px 28px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s;
}

#restart-btn:hover {
    background-color: #5a4530;
}

#new-game-btn {
    background-color: transparent;
    border: 1px solid #b0a090;
    color: #7a6548;
    padding: 8px 20px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s;
}

#new-game-btn:hover {
    background-color: #f0e6d2;
}

/* ── Tagline ── */
.tagline {
    color: #7a6548;
    font-size: 14px;
    margin: 0;
}

/* ── How to Play toggle ── */
.rules-toggle {
    max-width: 380px;
    text-align: left;
    background-color: #f0e6d2;
    border-radius: 6px;
    border: 1px solid #d2c1a3;
}

.rules-toggle summary {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #6e583b;
    user-select: none;
}

.rules-body {
    padding: 4px 16px 12px;
    font-size: 13px;
    color: #444;
    line-height: 1.6;
}

.rules-body p {
    margin: 6px 0;
}

.piece-table {
    border-collapse: collapse;
    margin: 6px 0 8px;
    font-size: 13px;
}

.piece-table td {
    padding: 2px 10px 2px 0;
    vertical-align: middle;
}

.piece-table td:first-child {
    font-size: 18px;
    padding-right: 6px;
}

.piece-table td:last-child {
    color: #888;
}

/* ── Debug log (dev tool, collapsed by default) ── */
#debug-log {
    margin-top: 20px;
    width: 100%;
    max-width: 360px;
    text-align: left;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f8f8f8;
}

#debug-log summary {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    color: #888;
    user-select: none;
}

#debug-content {
    max-height: 150px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.4;
    padding: 6px 10px;
}

