/* ----------- GENERAL PAGE STYLING ----------- */

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #111;
    color: #eee;
    overflow-x: hidden;
}

.container {
    height: 100vh;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 20px 8px;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    align-items: center;
}

/* utility for overlays */
.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ----------- TITLE + SCORES ----------- */

h1 {
    margin: 2px 0 6px;
    font-size: 32px;
    letter-spacing: 1px;
}

.scores {
    width: 100%;
    max-width: 1300px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 18px;
}

.score {
    font-weight: bold;
}

/* ----------- BOARD LAYOUT (BIG WOOD BOARD) ----------- */

.board {
    position: relative;
    width: 100%;
    max-width: 1300px;
    margin: 4px auto 0;
    padding: 18px 32px;
    border-radius: 50px;
    background: linear-gradient(145deg, #c68b4d, #9c6a34);
    box-shadow:
        inset 0 4px 10px rgba(255,255,255,0.4),
        inset 0 -6px 14px rgba(0,0,0,0.6),
        0 14px 22px rgba(0,0,0,0.8);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;

    /* take nice portion of screen height on desktop */
    flex: 0 0 58vh;
}

.pits-area {
    display: flex;
    flex-direction: column;
    gap: 44px; /* MORE SPACE between upper and lower pits */
}

/* ----------- PIT ROWS ----------- */

.row {
    display: grid;
    grid-template-columns: repeat(9, 105px);
    gap: 10px;
}

/* ----------- PITS (OVAL WOODEN CELLS) ----------- */

.pit {
    position: relative; /* for pit numbers */
    width: 105px;
    height: 72px;
    border-radius: 32px;
    border: 2px solid rgba(60,40,20,0.9);

    background: radial-gradient(circle at 30% 20%, #f2c48a, #b4773f);
    box-shadow:
        inset 0 3px 5px rgba(255,255,255,0.4),
        inset 0 -4px 6px rgba(0,0,0,0.45);

    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: 0.15s ease-in-out;
    padding: 8px 10px 4px;
    box-sizing: border-box;
}

.pit:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 3px 5px rgba(255,255,255,0.4),
        inset 0 -4px 6px rgba(0,0,0,0.45),
        0 0 10px rgba(255,255,255,0.4);
}

.active-player {
    outline: 2px solid #ffeb99;
    box-shadow:
        inset 0 3px 5px rgba(255,255,255,0.4),
        inset 0 -4px 6px rgba(0,0,0,0.45),
        0 0 14px rgba(255,235,153,0.9);
}

/* PIT NUMBERS – nicer, separated for top/bottom rows */

.pit-number {
    position: absolute;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.3px;
    color: rgba(245, 220, 180, 0.85); /* soft light wood */
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    pointer-events: none;
}

/* Player A (bottom row) – numbers UNDER the pits */
.pit-bottom .pit-number {
    bottom: -20px;             /* pushed further down so no overlap */
    left: 50%;
    transform: translateX(-50%);
}

/* Player B (top row) – numbers ABOVE the pits */
.pit-top .pit-number {
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
}

/* stones inside pits */

.stones-container {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
    flex: 1;
    align-content: center;
    justify-items: center;
}

.stone {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #f7f1d0, #3b2a19);
    box-shadow: 0 0 2px rgba(0,0,0,0.8);
}

.stone-count {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 2px;
}

/* TUZ highlight */

.pit.tuz {
    border: 3px solid #ffeb3b;
    box-shadow:
        inset 0 3px 5px rgba(255,255,255,0.6),
        inset 0 -4px 6px rgba(0,0,0,0.45),
        0 0 15px rgba(255, 235, 59, 0.9);
}

/* ----------- STORES / KAZANS ----------- */

.store {
    width: 130px;
    height: 290px;
    border-radius: 44px;
    border: 2px solid rgba(60,40,20,0.9);

    background: radial-gradient(circle at 30% 20%, #f2c48a, #b4773f);
    box-shadow:
        inset 0 3px 6px rgba(255,255,255,0.45),
        inset 0 -6px 10px rgba(0,0,0,0.55);

    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 8px 6px;
    box-sizing: border-box;
}

.store-label {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 4px;
}

/* stones inside kazans */

.store-stones {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
    align-content: flex-start;
    justify-items: center;
}

.store-stones .stone {
    width: 7px;
    height: 7px;
}

.store-count {
    margin-top: 3px;
    font-size: 12px;
    font-weight: bold;
}

/* ----------- MOVE HISTORY (OVERLAY) ----------- */

.history-container {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    width: 520px;
    max-width: 90%;
    background: rgba(0, 0, 0, 0.6);
    color: #f5f5f5;
    border-radius: 12px;
    padding: 6px 10px;
    box-sizing: border-box;
    font-size: 12px;
    box-shadow: 0 0 8px rgba(0,0,0,0.7);
}

.history-title {
    font-weight: bold;
    margin-bottom: 3px;
    text-align: left;
}

.history-list {
    max-height: 70px;
    overflow-y: auto;
    text-align: left;
    font-family: Consolas, "Courier New", monospace;
}

.history-entry {
    margin-bottom: 2px;
}

/* ----------- STATUS + BUTTONS ----------- */

.status {
    margin-top: 6px;
    font-size: 17px;
    min-height: 22px;
    text-align: center;
}

.buttons {
    margin-top: 6px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* BUTTONS */

.btn {
    padding: 8px 20px;
    font-size: 15px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.btn:hover {
    background: #1e88e5;
}

.btn:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: #555;
}

.btn-secondary:hover {
    background: #666;
}

/* Pit currently receiving a stone */

.pit.sowing {
    box-shadow:
        inset 0 3px 5px rgba(255,255,255,0.5),
        inset 0 -4px 6px rgba(0,0,0,0.45),
        0 0 18px rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

/* ----------- SPLASH SCREEN ----------- */

.splash {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, #3b2a16 0%, #000 60%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

.splash-panel {
    background: rgba(0, 0, 0, 0.75);
    border-radius: 24px;
    padding: 26px 40px;
    text-align: center;
    box-shadow: 0 0 24px rgba(0,0,0,0.8);
}

.splash-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #f5e0a6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    background: radial-gradient(circle, #f5e0a6, #b9863e);
    box-shadow: 0 0 18px rgba(0,0,0,0.8);
}

.splash-logo span {
    font-weight: bold;
    font-size: 28px;
    color: #4b2c0a;
}

.splash-title {
    margin: 4px 0;
    font-size: 28px;
}

.splash-subtitle {
    font-size: 14px;
    color: #ddd;
    margin-bottom: 16px;
}

.splash-btn {
    margin-top: 4px;
}

/* ----------- SETTINGS OVERLAY ----------- */

.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: opacity 0.3s ease;
}

.settings-panel {
    background: #222;
    border-radius: 16px;
    width: min(480px, 90%);
    max-height: 80vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #444;
}

.settings-header h2 {
    margin: 0;
    font-size: 18px;
}

.settings-close {
    background: none;
    border: none;
    color: #eee;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 6px;
}

.settings-body {
    padding: 10px 16px 14px;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 12px;
}

.settings-section h3 {
    margin: 2px 0 4px;
    font-size: 15px;
}

.rules-text {
    font-size: 13px;
    line-height: 1.4;
}

/* toggle style */

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
}

.toggle input {
    width: 18px;
    height: 18px;
}

/* ----------- SMALL / MEDIUM SCREEN TWEAKS ----------- */

@media (max-width: 1100px) {
    h1 {
        font-size: 26px;
    }

    .scores {
        font-size: 16px;
    }

    .board {
        padding: 14px 20px;
        gap: 16px;
        flex: 0 0 55vh;
    }

    .pits-area {
        gap: 36px;
    }

    .row {
        grid-template-columns: repeat(9, 85px);
        gap: 8px;
    }

    .pit {
        width: 85px;
        height: 58px;
        border-radius: 26px;
        padding: 6px 8px 3px;
    }

    .store {
        width: 100px;
        height: 240px;
        border-radius: 36px;
    }

    .stone {
        width: 7px;
        height: 7px;
    }

    .store-stones .stone {
        width: 5px;
        height: 5px;
    }

    .pit-number {
        font-size: 9px;
    }

    .pit-bottom .pit-number {
        bottom: -15px;   /* still clearly below */
    }

    .pit-top .pit-number {
        top: -11px;
    }
}

@media (max-width: 800px) {
    h1 {
        font-size: 22px;
    }

    .scores {
        font-size: 14px;
    }

    .board {
        padding: 10px 10px;
        gap: 10px;
        flex: 0 0 auto;
    }

    .pits-area {
        gap: 26px;
    }

    .row {
        grid-template-columns: repeat(9, 65px);
        gap: 6px;
    }

    .pit {
        width: 65px;
        height: 48px;
        border-radius: 22px;
        padding: 4px 6px 2px;
    }

    .store {
        width: 80px;
        height: 210px;
        border-radius: 32px;
    }

    .stone {
        width: 5px;
        height: 5px;
    }

    .store-stones .stone {
        width: 4px;
        height: 4px;
    }

    .history-container {
        font-size: 10px;
        width: 95%;
    }

    .btn {
        font-size: 13px;
        padding: 6px 14px;
    }

    .splash-panel {
        width: 90%;
        padding: 20px 20px;
    }

    .pit-number {
        font-size: 8.5px;
    }

    .pit-bottom .pit-number {
        bottom: -12px;  /* a bit closer on mobile, still outside */
    }

    .pit-top .pit-number {
        top: -9px;
    }
}
