/* --- Local Font Definitions --- */

/* Cinzel Bold (for titles) */
@font-face {
    font-family: 'Cinzel';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/cinzel-v26-latin-700.woff2') format('woff2');
}

/* Cinzel Regular */
@font-face {
    font-family: 'Cinzel';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/cinzel-v26-latin-regular.woff2') format('woff2');
}

/* Inter Regular (for body text) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2');
}

/* Inter Medium (for subtitles, etc.) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/inter-v20-latin-500.woff2') format('woff2');
}

/* Inter Semi-Bold (for buttons, etc.) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/inter-v20-latin-600.woff2') format('woff2');
}
/* --- Woody Theme: General Styles --- */
body {
    font-family: 'Inter', sans-serif;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dHTZ2dnu7u7X19f8/PzKysrBwcGtra2np6eqqqrg4ODi4uLw8PDz8/P09PTMzc3p6enW1tbj4+Orq6uxt7dYWFhgYGDyoCYdAAAAQUlEQVR42uzVBRADIAwEwf897x9tNhpAFVLS1tZ2b3PBBhd4JQ64oA48uP8k5/kMi5/k28/Honv7+Pj++v0BqCTzS+kAAAAASUVORK5CYII=");
    background-color: #d7c7a9;
    color: #5c3d2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.game-container, .main-menu {
    background-color: #f5f5dc;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 90%;
    max-width: 800px;
    border: 1px solid rgba(0,0,0,0.1);
}

h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.8rem;
    color: #5c3d2e;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

h2 {
    color: #5c3d2e;
}

/* Subtitle style for game mode text */
.game-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: #8b5a2b;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}
@keyframes glow-animation {
    0% {
        box-shadow: 0 0 5px #ffd700, inset 0 0 5px rgba(255, 215, 0, 0.5);
        border-color: #fff;
    }
    50% {
        box-shadow: 0 0 25px #ffd700, inset 0 0 15px rgba(255, 215, 0, 0.5);
        border-color: #fff;
    }
    100% {
        box-shadow: 0 0 5px #ffd700, inset 0 0 5px rgba(255, 215, 0, 0.5);
        border-color: #fff;
    }
}

/* This class will be added by JavaScript to the last-played pit */
.last-move .pit {
    animation: glow-animation 1.5s ease-in-out;
}

/* --- Woody Theme: Board Styles --- */
.mancala-board {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 4px solid #5c3d2e;
    border-radius: 20px;
    box-shadow:
            inset 0 0 1px 1px rgba(255, 255, 255, 0.1),
            inset 0 0 30px rgba(0, 0, 0, 0.6),
            0 10px 25px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    background-color: #8b5a2b;
    background-image:
            radial-gradient(ellipse at top, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 40%),
            url('data:image/jpeg;base64,/9j/r4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxISEhUSEhIVFRUVFRUVFRUVFRUVFRUVFRUWFhUVFRUYHSggGBolHRUVITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OFw8PFS0ZFR0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/A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+Y63R26e2Vd0XGUXhoqPQvUHpH+sr5wXw3Lhqv4fVHCgAAAAAAAAA6voPQfrtQqck/08Nyl+r8kdJ0boctbfGEXhR8U36RPRqaKqqa6qa+GMIqMYrySA+wAAAAAAAAAAAAAAAAAAAAACEHUPp9dJXOmS4X8UfRlEAPlGq0lmnslTdBxlF4aZVHfeqfT/DUV/qK4/mqXdL3XqjwsAAAAAAAAAAB3Ppxof0un5pr8934p+y8kcX0LoP12pSmn+nhuUv1fkj0pJLCSSSWEl4ID0AAAAAAAAAAAAAAAAAAAAAAIMADgPVno/8Am/W0xX5v54r+6PPWfVTDevNFjrdPOlrbXD0YHxsHTdY6HJpb50S3LymvNEAAAAAAAAAAAAAAAB6Z6c0P6XSqU1+e78U/ZeEcR0Pof1mqjCS/JH80/ZLv8A7PSwAAAAAAAAAAAAAAAAAAAAAAAADDAPAfVmhfR6qUor8lv8UfY+Zgd76j0Ktbp7KbFv8UPRl8cAAAAAAAAAAAAAAPSPTnQ/pdPzTX57/xS9l4RwPQmhfX6qNNn8MNzl+r8kempJJLCSSWEkAAAAAAAAAAAAAAAAAAAAAAAAAAADDAPAPV+hfR6pzhHhtX44+z9UcDPSfUWhVrNNOmXmvia9GR8dAAAAAAAAAAAAAAB6f6c0L6XTKU1+e78U/ZeEcB0Hof1+qhBr8lP8U/ZLv/s9LSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//2Q==');
    background-size: cover;
    background-position: center;
}

/* How to Play Modal Enhancements */
.modal-content h4 {
    color: #5c3d2e;
    margin-bottom: 0.5rem;
    font-family: 'Cinzel', serif;
}

.rule-example {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
    border-top: 2px solid #d7c7a9;
    margin-top: 1rem;
}

.rule-text {
    flex: 1;
    text-align: left;
}

.rule-diagram {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.diagram-label {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-style: italic;
    color: #654321;
}

.mini-board {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: repeat(2, 1fr);
    gap: 5px;
    width: 200px;
    height: 90px;
    background-color: #d7c7a9;
    padding: 10px;
    border: 2px solid #a0703c;
    border-radius: 10px;
}

.mini-pit, .mini-store {
    border: 2px solid #a0703c;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #5c3d2e;
    font-size: 1rem;
    background-color: #f5f5dc;
}

.mini-store {
    border-radius: 10px;
}

.mini-store.p1 { grid-column: 3 / 4; grid-row: 1 / 3; }
.mini-store.p2 { grid-column: 1 / 2; grid-row: 1 / 3; }

.mini-pit.p1 { grid-column: 2 / 3; grid-row: 2 / 3; }
.mini-pit.p2 { grid-column: 2 / 3; grid-row: 1 / 2; }
.mini-pit.start-pit { background-color: #f0e68c; } /* Khaki to show starting point */

.mini-stone {
    width: 8px;
    height: 8px;
    background: #6d5d53;
    border-radius: 50%;
    margin: 1px;
}

.highlight {
    border-color: #d32f2f;
    box-shadow: 0 0 10px rgba(211, 47, 47, 0.7);
}

.highlight.empty {
    background-color: #fffacd; /* LemonChiffon to show it's empty */
}

.last-stone {
    background-color: #d32f2f; /* Red to show it's the last stone */
}

.capture-target {
    border-style: dashed;
    border-color: #556b2f;
}
.player-pits {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.4s ease-in-out;
}

.player-pits.active-turn {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.pit-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pit {
    background-color: rgba(0,0,0,0.1);
    border: none;
    box-shadow: inset 0 3px 10px rgba(0,0,0,0.4);
    border-radius: 50%;
    width: 65px;
    height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pit button {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.2);
    background: transparent;
    box-shadow: 0 3px 5px rgba(0,0,0,0.25);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    padding: 5px;
}

.pit button:disabled {
    cursor: not-allowed;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.pit button.active-pit {
    box-shadow: 0 0 15px #ffd700;
    border-color: #fff;
}

.pit button.active-pit:hover {
    transform: scale(1.05);
}

.stone {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #e0e0e0, #b0b0b0);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.4), 0 1px 1px rgba(255,255,255,0.5);
    align-self: center;
    justify-self: center;
}

.top-row .stone {
    background: radial-gradient(circle, #a58e80, #6d5d53);
}

.pit-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: #654321;
    background-color: rgba(245, 245, 220, 0.5);
    padding: 0 6px;
    border-radius: 4px;
}

.stores-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.store {
    background-color: rgba(0,0,0,0.1);
    box-shadow: inset 0 3px 10px rgba(0,0,0,0.4);
    border: none;
    border-radius: 1rem;
    width: 130px;
    height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.store-label {
    font-size: 0.9rem;
    color: #f5f5dc;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.store-stones {
    font-size: 1.8rem;
    color: #ffffff;
    font-weight: 700;
}

.board-spacer {
    flex-grow: 1;
}

.status-message {
    margin-top: 1.5rem;
    font-size: 1.2rem;
    font-weight: 500;
    color: #5c3d2e;
}

.error-message {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: #d32f2f;
}

/* --- Woody Theme: Main Menu & Control Buttons --- */
.main-menu button, .main-menu a.home-button {
    display: block;
    width: 250px;
    padding: 15px;
    margin: 1rem auto;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 2px solid #5c3d2e;
    color: #f5f5dc !important;
    text-decoration: none;
    font-family: 'Cinzel', serif;
}

.main-menu .play-button { background-color: #5c3d2e; }
.main-menu .play-button:hover {
    background-color: #4a3025;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(92, 61, 46, 0.4);
}

.main-menu .info-button { background-color: #8b5a2b; }
.main-menu .info-button:hover {
    background-color: #7a4f25;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.main-menu a.home-button { background-color: #8b5a2b; }
.main-menu a.home-button:hover {
    background-color: #7a4f25;
    transform: translateY(-3px);
}

.game-controls {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.game-controls button, .game-controls .home-button {
    width: 150px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #f5f5dc;
    border: 2px solid #5c3d2e;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.game-controls button { background-color: #5c3d2e; }
.game-controls button:hover {
    background-color: #4a3025;
    transform: translateY(-2px);
}

.game-controls .home-button { background-color: #8b5a2b; }
.game-controls .home-button:hover {
    background-color: #7a4f25;
    transform: translateY(-2px);
}

/* --- Online Game Menu Styles --- */
#gameOptions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#gameOptions input[type="text"] {
    width: 250px;
    padding: 15px;
    font-size: 1.1rem;
    text-align: center;
    border: 2px solid #5c3d2e;
    border-radius: 10px;
    background-color: #f5f5dc;
    color: #5c3d2e;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

#gameOptions input[type="text"]::placeholder { color: #a0703c; }

#gameOptions .play-button, #gameOptions .info-button {
    width: 250px; padding: 15px; margin: 0; font-size: 1.2rem;
    font-weight: 600; border-radius: 10px; cursor: pointer;
    transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 2px solid #5c3d2e; color: #f5f5dc;
}
#gameOptions .play-button { background-color: #5c3d2e; }
#gameOptions .play-button:hover { background-color: #4a3025; }
#gameOptions .info-button { background-color: #8b5a2b; }
#gameOptions .info-button:hover { background-color: #7a4f25; }


/* --- Modal & Menu Styles --- */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(92, 61, 46, 0.7);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #f5f5dc;
    padding: 2rem 3rem;
    border-radius: 1rem;
    border: 2px solid #5c3d2e;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 700px;
    position: relative;
    text-align: left;
}
.modal-content h3 {
    border-bottom: 2px solid #d7c7a9;
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
}

.close-button {
    color: #8b5a2b;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}
.close-button:hover, .close-button:focus { color: #5c3d2e; }

.menu-section {
    margin-top: 2.5rem;
    border-top: 2px solid #d7c7a9;
    padding-top: 2rem;
}

.difficulty-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.difficulty-button {
    width: 160px;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    color: #f5f5dc;
    border: 2px solid #5c3d2e;
}
.difficulty-button.easy { background-color: #556b2f; }
.difficulty-button.easy:hover { background-color: #6B8E23; }
.difficulty-button.medium { background-color: #b8860b; }
.difficulty-button.medium:hover { background-color: #DAA520; }
.difficulty-button.hard { background-color: #8b0000; }
.difficulty-button.hard:hover { background-color: #B22222; }