
:root {
    --color0: red;
    --color1: green;
    --color2: goldenrod;
    --color3: skyblue;
    --outline: black;
    --house: white;
    --dot: maroon;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, #263b78, transparent 35%),
        radial-gradient(circle at bottom right, #54245f, transparent 35%),
        #080d20;
    color: white;
    font-family: Arial, sans-serif;
    overflow-x: hidden;
}

/* =========================
   MAIN CONTAINER
   ========================= */

.game-container {
    width: min(1500px, 96%);
    margin: 0 auto;
    padding: 25px 0 35px;
}

/* =========================
   HEADER
   ========================= */

.game-header {
    text-align: center;
    margin-bottom: 22px;
}

.game-header h1 {
    font-size: 42px;
    margin: 0;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(255,255,255,.3);
}

/* =========================
   4 COLUMN MAIN LAYOUT
   LEFT | BOARD | RIGHT | INFO
   ========================= */

.game-layout {
    display: grid;
    grid-template-columns:
        minmax(160px, 210px)
        minmax(420px, 1fr)
        minmax(160px, 210px)
        minmax(180px, 220px);

    justify-content: center;
    align-items: center;
    gap: 18px;
    width: 100%;
}

/* =========================
   PLAYER PANELS
   ========================= */

.left-panel,
.right-panel {
    width: 100%;
}

.player-card {
    width: 100%;
    padding: 15px;
    margin: 12px 0;
    border-radius: 18px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.15);
    box-shadow: 0 10px 25px rgba(0,0,0,.3);
    transition: .3s;
}

.player-card:hover {
    transform: translateY(-3px);
}

.player-card h3 {
    margin: 5px 0;
    font-size: 19px;
}

.player-card span {
    font-size: 14px;
}

.player-icon {
    font-size: 35px;
    margin-bottom: 5px;
}

.mini-chips {
    margin-top: 10px;
    font-size: 17px;
    letter-spacing: 4px;
}

.red-player {
    border-color: #ff3150;
}

.green-player {
    border-color: #27d95f;
}

.yellow-player {
    border-color: #ffc400;
}

.blue-player {
    border-color: #2196ff;
}

/* =========================
   CENTER GAME
   ========================= */

.center-game {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/*
   Current HTML uses .board, not .board-wrapper.
   Keep the board wrapper around 430px so it does not
   push the other columns outside the viewport.
*/

.board {
    position: relative;
    width: 436px;
    height: 436px;
    padding: 18px;
    margin: 0 auto;
    border-radius: 25px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.15);
    box-shadow:
        0 20px 60px rgba(0,0,0,.5),
        inset 0 0 30px rgba(255,255,255,.04);

    display: flex;
    justify-content: center;
    align-items: center;
}

.ludoBoard {
    width: 400px !important;
    height: 400px !important;
    flex-shrink: 0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(255,255,255,.15);
}

/* =========================
   BOARD ACTIONS
   ========================= */

.board-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.good-luck {
    margin: 0;
    min-width: 160px;
    padding: 12px 18px;
    border-radius: 30px;
    background: rgba(255,255,255,.06);
    border: 1px solid #3879ff;
    font-size: 17px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
}

.bottom-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 0;
}

.bottom-buttons button,
.game-btn {
    min-width: 145px;
    padding: 12px 18px;
    border-radius: 30px;
    background: rgba(255,255,255,.08);
    color: white;
    border: 1px solid rgba(255,255,255,.2);
    cursor: pointer;
    font-size: 15px;
    transition: .3s;
}

.bottom-buttons button:hover,
.game-btn:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,.15);
}

/* =========================
   TURN CARD
   ========================= */

.turn-card {
    width: 100%;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255,255,255,.07);
    border: 1px solid #ffbd4a;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
}

.turn-title {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: bold;
    color: #ffc857;
}

.current-player {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.current-player-dot {
    font-size: 19px;
}

/* =========================
   DICE CARD
   ========================= */

.dice-card {
    width: 100%;
    margin: 15px 0;
    padding: 18px;
    text-align: center;
    border-radius: 20px;
    background: rgba(255,255,255,.06);
    border: 1px solid #5c9dff;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.dice-card h2 {
    margin: 0 0 7px;
    font-size: 21px;
}

.dice-card p {
    margin-bottom: 10px;
    color: #c9d4ff;
    font-size: 13px;
}

.dice-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.dice-player {
    width: 100%;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
}

.dice-player.active-dice {
    border-color: #ffc857;
    box-shadow: 0 0 15px rgba(255,200,87,.35);
}

/* =========================
   ORIGINAL LUDO BOARD ENGINE
   ========================= */

.rotate {
    animation: rotate infinite 5s linear;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Board grid */

.ludoBoard {
    display: grid;
    grid-template-rows: repeat(15, 1fr);
    grid-template-columns: repeat(15, 1fr);
}

/* Board cells */

.box {
    position: relative;
    outline: 1px solid var(--outline);
    display: flex;
    justify-content: center;
    align-items: center;
}

.carpet {
    outline: 1px solid var(--outline);
    display: grid;
}

/* Home areas */

.city {
    outline: 1px solid var(--outline);
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    grid-template-columns: repeat(6, 1fr);
}

.house {
    outline: 1px solid var(--outline);
    grid-row: 2/6;
    grid-column: 2/6;
    background-color: var(--house);

    display: grid;
    grid-template-rows: 1fr 2fr 1fr 2fr 1fr;
    grid-template-columns: 1fr 2fr 1fr 2fr 1fr;
}

.room {
    outline: 1px solid var(--outline);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Board positioning */

.p0s0 {
    grid-row: 7/8;
    grid-column: 2/3;
}

.p0s1 {
    grid-row: 3/4;
    grid-column: 7/8;
}

.p1s0 {
    grid-row: 2/3;
    grid-column: 9/10;
}

.p1s1 {
    grid-row: 7/8;
    grid-column: 13/14;
}

.p2s0 {
    grid-row: 9/10;
    grid-column: 14/15;
}

.p2s1 {
    grid-row: 13/14;
    grid-column: 9/10;
}

.p3s0 {
    grid-row: 14/15;
    grid-column: 7/8;
}

.p3s1 {
    grid-row: 9/10;
    grid-column: 3/4;
}

.carpet0 {
    grid-row: 8/9;
    grid-column: 2/7;
    grid-template-rows: 1fr;
    grid-template-columns: repeat(5, 1fr);
}

.carpet1 {
    grid-row: 2/7;
    grid-column: 8/9;
    grid-template-rows: repeat(5, 1fr);
    grid-template-columns: 1fr;
}

.carpet2 {
    grid-row: 8/9;
    grid-column: 10/15;
    grid-template-rows: 1fr;
    grid-template-columns: repeat(5, 1fr);
}

.carpet3 {
    grid-row: 10/15;
    grid-column: 8/9;
    grid-template-rows: repeat(5, 1fr);
    grid-template-columns: 1fr;
}

.winningBox {
    grid-row: 7/10;
    grid-column: 7/10;
    outline: 1px solid var(--outline);
    border-top: 30px solid var(--color1);
    border-right: 30px solid var(--color2);
    border-left: 30px solid var(--color0);
    border-bottom: 30px solid var(--color3);
}

.city0 {
    grid-row: 1/7;
    grid-column: 1/7;
}

.city1 {
    grid-row: 1/7;
    grid-column: 10/16;
}

.city2 {
    grid-row: 10/16;
    grid-column: 10/16;
}

.city3 {
    grid-row: 10/16;
    grid-column: 1/7;
}

.room0 {
    grid-row: 2/3;
    grid-column: 2/3;
}

.room1 {
    grid-row: 2/3;
    grid-column: 4/5;
}

.room2 {
    grid-row: 4/5;
    grid-column: 4/5;
}

.room3 {
    grid-row: 4/5;
    grid-column: 2/3;
}

/* =========================
   CHIPS
   ========================= */

.chip {
    position: absolute;
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px dashed white;
    box-shadow: 0 0 5px 1px black;
}

.top-chip {
    z-index: 100;
}

.color0 {
    background-color: var(--color0);
}

.color1 {
    background-color: var(--color1);
}

.color2 {
    background-color: var(--color2);
}

.color3 {
    background-color: var(--color3);
}

/* =========================
   DICE
   ========================= */

.dice {
    height: 30px;
    width: 30px;
    outline: 1px solid var(--outline);
    display: grid;
    background-color: var(--house);
    cursor: pointer;
}

.dot {
    background-color: var(--dot);
    border-radius: 50%;
}

.dice0 {
    grid-template-rows: 12px 6px 12px;
    grid-template-columns: 12px 6px 12px;
}

.dice0 .dot0 {
    grid-row: 2/3;
    grid-column: 2/3;
}

.dice1 {
    grid-template-rows: 6px 6px 6px 6px 6px;
    grid-template-columns: 6px 6px 6px 6px 6px;
}

.dice1 .dot0 {
    grid-row: 2/3;
    grid-column: 2/3;
}

.dice1 .dot1 {
    grid-row: 4/5;
    grid-column: 4/5;
}

.dice2 {
    grid-template-rows: 3px 6px 3px 6px 3px 6px 3px;
    grid-template-columns: 3px 6px 3px 6px 3px 6px 3px;
}

.dice2 .dot0 {
    grid-row: 2/3;
    grid-column: 2/3;
}

.dice2 .dot1 {
    grid-row: 4/5;
    grid-column: 4/5;
}

.dice2 .dot2 {
    grid-row: 6/7;
    grid-column: 6/7;
}

.dice3 {
    grid-template-rows: 6px 6px 6px 6px 6px;
    grid-template-columns: 6px 6px 6px 6px 6px;
}

.dice3 .dot0 {
    grid-row: 2/3;
    grid-column: 2/3;
}

.dice3 .dot1 {
    grid-row: 4/5;
    grid-column: 4/5;
}

.dice3 .dot2 {
    grid-row: 2/3;
    grid-column: 4/5;
}

.dice3 .dot3 {
    grid-row: 4/5;
    grid-column: 2/3;
}

.dice4 {
    grid-template-rows: 3px 6px 3px 6px 3px 6px 3px;
    grid-template-columns: 3px 6px 3px 6px 3px 6px 3px;
}

.dice4 .dot0 {
    grid-row: 2/3;
    grid-column: 2/3;
}

.dice4 .dot1 {
    grid-row: 4/5;
    grid-column: 4/5;
}

.dice4 .dot2 {
    grid-row: 6/7;
    grid-column: 6/7;
}

.dice4 .dot3 {
    grid-row: 2/3;
    grid-column: 6/7;
}

.dice4 .dot4 {
    grid-row: 6/7;
    grid-column: 2/3;
}

.dice5 {
    grid-template-rows: 3px 6px 3px 6px 3px 6px 3px;
    grid-template-columns: 6px 6px 6px 6px 6px;
}

.dice5 .dot0 {
    grid-row: 2/3;
    grid-column: 2/3;
}

.dice5 .dot1 {
    grid-row: 4/5;
    grid-column: 2/3;
}

.dice5 .dot2 {
    grid-row: 6/7;
    grid-column: 2/3;
}

.dice5 .dot3 {
    grid-row: 2/3;
    grid-column: 4/5;
}

.dice5 .dot4 {
    grid-row: 4/5;
    grid-column: 4/5;
}

.dice5 .dot5 {
    grid-row: 6/7;
    grid-column: 4/5;
}

.roll-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}


/* =========================================
   PLAYER VALUE / SCORE DETAILS
========================================= */

.player-card {
    box-sizing: border-box;
    overflow: hidden;
}

.mini-chips {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
    letter-spacing: normal;
}

.chip-value {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 9px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 13px;
    transition: 0.2s ease;
}

.chip-value:hover {
    background: rgba(255,255,255,0.12);
    transform: translateX(2px);
}

.chip-value > span {
    font-size: 18px;
    line-height: 1;
}

.chip-value b {
    font-size: 11px;
    font-weight: 700;
    color: white;
    min-width: 48px;
    text-align: right;
}

.player-score {
    margin-top: 13px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.12);
    font-size: 14px;
    color: #bfc8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-score b {
    color: white;
    font-size: 16px;
    font-weight: 800;
}

.red-player .chip-value > span { color: #ff3150; }
.green-player .chip-value > span { color: #27d95f; }
.yellow-player .chip-value > span { color: #ffc400; }
.blue-player .chip-value > span { color: #2196ff; }

.chip-value.active {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.10);
}

.chip-value.finished b {
    color: #6dff9b;
}

.chip-value.home b {
    color: #aeb8df;
}


/* Optional roll button / result styles */
.roll-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffb300, #ff7a00);
    color: white;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    transition: .25s;
    box-shadow: 0 8px 20px rgba(255, 140, 0, .25);
}

.roll-btn:hover { transform: translateY(-3px); }
.roll-btn:active { transform: scale(.96); }

.dice-result {
    width: 70px;
    height: 70px;
    margin: 0 auto 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    background: rgba(255,255,255,.1);
    font-size: 38px;
}

.red { color: red; }
.green { color: green; }


/* =========================================
   MODERN SVG LUDO CHIPS
========================================= */

.box,
.room,
.winningBox {
    position: relative !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

.chip {
    width: 28px !important;
    height: 28px !important;
    position: absolute !important;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    background: transparent !important;
    cursor: pointer;
    z-index: 5;
    flex-shrink: 0 !important;
}

.chip-svg {
    width: 100% !important;
    height: 100% !important;
    display: block;
    overflow: visible;
    flex-shrink: 0;
    filter:
        drop-shadow(0 2px 3px rgba(0,0,0,.5))
        drop-shadow(0 0 5px currentColor);
    transition: transform .2s ease, filter .2s ease;
}

.chip.color0 { color: #ff2020 !important; }
.chip.color1 { color: #16c932 !important; }
.chip.color2 { color: #ffd21c !important; }
.chip.color3 { color: #1599ff !important; }

.chip.rotate { cursor: pointer; }

.chip.rotate .chip-svg {
    animation: chipPulse 1s infinite;
}

.chip.rotate:hover .chip-svg {
    transform: scale(1.15);
    filter:
        drop-shadow(0 3px 4px rgba(0,0,0,.5))
        drop-shadow(0 0 8px currentColor);
}

.chip.top-chip {
    z-index: 100 !important;
}

@keyframes chipPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.start-screen {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(circle at top left, rgba(255, 80, 80, .20), transparent 35%),
        radial-gradient(circle at bottom right, rgba(80, 120, 255, .20), transparent 35%),
        rgba(10, 10, 20, .96);
    backdrop-filter: blur(10px);
}

.start-box {
    width: 430px;
    max-width: 90%;
    padding: 35px;
    border-radius: 28px;
    text-align: center;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 25px 80px rgba(0, 0, 0, .45);
    animation: startBoxShow .5s ease;
}

.start-logo {
    font-size: 55px;
    margin-bottom: 5px;
}

.start-box h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 900;
}

.start-subtitle {
    margin: 8px 0 25px;
    color: #777;
    font-size: 14px;
}

.start-box h3 {
    margin-bottom: 12px;
}


/* PLAYER COUNT */

.player-count {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
}

.player-count-btn {
    flex: 1;
    padding: 13px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #fff;
    color: #333;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: .25s;
}

.player-count-btn:hover {
    transform: translateY(-2px);
}

.player-count-btn.active {
    background: #222;
    color: #fff;
    border-color: #222;
}


/* NAME INPUT */

.name-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.name-input {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    background: #fafafa;
    transition: .2s;
}

.name-input:focus-within {
    border-color: #555;
    background: #fff;
}

.name-input span {
    font-size: 22px;
}

.name-input input {
    width: 100%;
    padding: 10px 5px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
}

.hidden-player {
    display: none;
}


/* START BUTTON */

.start-game-btn {
    width: 100%;
    margin-top: 25px;
    padding: 15px;
    border: none;
    border-radius: 14px;
    background: #222;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    transition: .25s;
}

.start-game-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 10px 25px rgba(0, 0, 0, .25);
}


/* ANIMATION */

@keyframes startBoxShow {

    from {
        opacity: 0;
        transform: scale(.8) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

}


/* =========================================
   LEGACY SELECTOR COMPATIBILITY
   (kept from the original design CSS)
========================================= */

.game-header p {
    margin-top: 5px;
    color: #aeb8df;
    font-size: 18px;
}

.turn-card small {
    color: #ffc857;
}

.turn-card h2 {
    margin: 10px 0 0;
}

.bottom-buttons button {
    min-width: 145px;
    padding: 12px 18px;
    border-radius: 30px;
    background: rgba(255,255,255,.08);
    color: white;
    border: 1px solid rgba(255,255,255,.2);
    cursor: pointer;
    font-size: 15px;
    transition: .3s;
}

.bottom-buttons button:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,.15);
}

.center-game .board {
    width: 436px;
    height: 436px;
}

.center-game .ludoBoard {
    width: 400px !important;
    height: 400px !important;
}

.dice-player .dice {
    cursor: pointer;
}

/* =========================================
   GAME OVER POPUP
========================================= */

.game-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    backdrop-filter: blur(8px);
    padding: 15px;
}

.game-over-popup {
    width: 420px;
    max-width: 100%;
    padding: 30px;
    border-radius: 24px;
    background: #ffffff;
    color: #111;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: popupShow 0.4s ease;
}

.game-over-popup h1 {
    margin-bottom: 25px;
    font-size: 32px;
}

.winner,
.rank {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin: 10px 0;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
}

.winner {
    background: #fff3cd;
    font-size: 21px;
}

.winner span { color: #d89b00; }
.second { background: #eeeeee; color: #000; }
.third { background: #f5e0cf; color: #000; }
.loser { background: #f5f5f5; color: #000; }

.play-again-btn {
    margin-top: 20px;
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    background: #222;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
}

.play-again-btn:hover {
    transform: scale(1.05);
}

@keyframes popupShow {
    from {
        opacity: 0;
        transform: scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* =========================================
   RESPONSIVE
========================================= */

/* Medium desktop / laptop */
@media (max-width: 1250px) {
    .game-layout {
        grid-template-columns: 170px minmax(390px, 1fr) 170px 180px;
        gap: 12px;
    }

    .board {
        width: 416px;
        height: 416px;
        padding: 8px;
    }

    .ludoBoard {
        width: 400px !important;
        height: 400px !important;
    }

    .player-card {
        padding: 12px;
    }

    .player-card h3 {
        font-size: 17px;
    }
}

/* Tablet */
@media (max-width: 1050px) {
    .game-layout {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    .center-game {
        grid-column: 1 / 3;
        grid-row: 1;
        order: 1;
    }

    .left-panel {
        grid-column: 1;
        grid-row: 2;
        order: 2;
    }

    .right-panel {
        grid-column: 2;
        grid-row: 2;
        order: 3;
    }

    .game-layout > div:last-child {
        grid-column: 1 / 3;
        grid-row: 3;
        order: 4;
        width: min(440px, 100%);
        margin: 0 auto;
    }

    .left-panel,
    .right-panel {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .player-card {
        width: 200px;
        margin: 5px;
    }
}

/* Mobile */
@media (max-width: 650px) {
    .game-container {
        width: 100%;
        padding: 15px 8px 30px;
    }

    .game-header {
        margin-bottom: 15px;
    }

    .game-header h1 {
        font-size: clamp(24px, 7vw, 28px);
        letter-spacing: 1px;
    }

    .game-layout {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .center-game,
    .left-panel,
    .right-panel,
    .game-layout > div:last-child {
        width: 100%;
    }

    .center-game { order: 1; }
    .left-panel { order: 2; }
    .right-panel { order: 3; }
    .game-layout > div:last-child { order: 4; }

    .board {
        width: min(96vw, 600px) !important;
        height: min(96vw, 600px) !important;
        padding: 6px;
        border-radius: 16px;
    }

    .ludoBoard {
        width: min(92vw, 570px) !important;
        height: min(92vw, 570px) !important;
    }

    .board-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .good-luck,
    .bottom-buttons,
    .game-btn {
        width: 100%;
        min-width: 0;
    }

    .good-luck {
        padding: 12px 15px;
        font-size: 16px;
    }

    .left-panel,
    .right-panel {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .player-card {
        width: 100%;
        margin: 0;
        padding: 10px;
        border-radius: 14px;
    }

    .player-icon { font-size: 26px; }
    .player-card h3 { font-size: 15px; }
    .player-card span { font-size: 11px; }

    .mini-chips {
        margin-top: 9px;
        gap: 5px;
    }

    .chip-value {
        padding: 5px 6px;
        font-size: 11px;
    }

    .chip-value > span { font-size: 14px; }
    .chip-value b { font-size: 9px; min-width: 38px; }

    .player-score {
        margin-top: 9px;
        padding-top: 7px;
        font-size: 11px;
    }

    .player-score b { font-size: 13px; }

    .dice-card,
    .turn-card {
        padding: 15px;
    }

    .dice-card h2 { font-size: 20px; }

    .dice-container {
        gap: 8px;
    }

    .dice-player {
        width: 55px;
        height: 55px;
        margin: auto;
    }

    .start-screen {
        padding: 15px;
    }

    .start-box {
        width: 100%;
        max-width: 420px;
        padding: 25px 18px;
    }

    .start-box h1 { font-size: 26px; }
    .player-count { gap: 8px; }
    .player-count-btn { padding: 11px 8px; font-size: 14px; }

    .game-over-popup {
        padding: 22px 16px;
        border-radius: 20px;
    }

    .game-over-popup h1 {
        font-size: 26px;
        margin-bottom: 18px;
    }

    .winner,
    .rank {
        padding: 11px 12px;
        font-size: 15px;
    }

    .winner { font-size: 17px; }
}

/* Small mobile */
@media (max-width: 480px) {
    .game-container {
        padding: 10px 6px 25px;
    }

    .game-header h1 {
        font-size: 23px;
    }

    .board {
        width: 96vw !important;
        height: 96vw !important;
        padding: 5px;
        border-radius: 12px;
    }

    .ludoBoard {
        width: 92vw !important;
        height: 92vw !important;
        border-radius: 8px;
    }

    .left-panel,
    .right-panel {
        grid-template-columns: 1fr 1fr;
        gap: 7px;
    }

    .player-card { padding: 9px; }
    .player-icon { font-size: 23px; }
    .player-card h3 { font-size: 14px; }
    .player-card span { font-size: 10px; }

    .mini-chips {
        gap: 4px;
        margin-top: 8px;
    }

    .chip-value { padding: 4px 5px; }
    .chip-value > span { font-size: 13px; }
    .chip-value b { font-size: 9px; }

    .player-score {
        margin-top: 8px;
        padding-top: 7px;
        font-size: 10px;
    }

    .game-btn,
    .good-luck {
        font-size: 14px;
        padding: 11px 15px;
    }

    .dice-card h2 { font-size: 20px; }

    .chip {
        width: 22px !important;
        height: 22px !important;
    }

    .chip-svg {
        width: 100% !important;
        height: 100% !important;
    }
        .game-layout.two-player-mode .left-panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    .game-layout.two-player-mode .right-panel {
        display: none;
    }

    .game-layout.two-player-mode .red-player,
    .game-layout.two-player-mode .green-player {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
    }
}

/* Very small mobile */
@media (max-width: 360px) {
    .game-header h1 { font-size: 20px; }

    .ludoBoard {
        width: 93vw !important;
        height: 93vw !important;
    }

    .player-card { padding: 7px; }
    .player-card h3 { font-size: 12px; }
    .player-card span { font-size: 10px; }
    .chip-value b { font-size: 8px; }
}

/* =========================================
   TWO PLAYER DESKTOP LAYOUT
========================================= */

@media (min-width: 651px) {

    .game-layout.two-player-mode {
        grid-template-columns:
            minmax(160px, 210px)
            minmax(420px, 1fr)
            minmax(160px, 210px);

        justify-content: center;
        align-items: center;
    }

    /* Left panel ke players ko direct grid items banao */
    .game-layout.two-player-mode .left-panel {
        display: contents;
    }

    /* Right panel 2-player mode me hide */
    .game-layout.two-player-mode .right-panel {
        display: none;
    }

    /* Player 1 = Board ke left */
    .game-layout.two-player-mode .red-player {
        grid-column: 1;
        grid-row: 1;
    }

    /* Board = center */
    .game-layout.two-player-mode .center-game {
        grid-column: 2;
        grid-row: 1;
    }

    /* Player 2 = Board ke right */
    .game-layout.two-player-mode .green-player {
        grid-column: 3;
        grid-row: 1;
    }

    /* Current turn + dice */
    .game-layout.two-player-mode > div:last-child {
        grid-column: 2;
        grid-row: 2;
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }
}
/* =========================================
   MOBILE LAYOUT
========================================= */

@media (max-width: 650px) {

    .game-layout {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* 1. Board */
    .center-game {
        order: 1;
        width: 100%;
    }

    /* 2. Turn + Dice immediately after board */
    .game-layout > div:last-child {
        order: 2;
        width: 100%;
    }

    /* 3. Player 1 & 2 */
    .left-panel {
        order: 3;
        width: 100%;
    }

    /* 4. Player 3 & 4 */
    .right-panel {
        order: 4;
        width: 100%;
    }
}

/* =========================================
   2 PLAYER DESKTOP
========================================= */

@media (min-width: 651px) {

    /* 2 player mode detect */
    .game-layout:has(#player3Input.hidden-player) {
        grid-template-columns:
            minmax(160px, 210px)
            minmax(420px, 1fr)
            minmax(160px, 210px);
    }

    /* Left panel ko contents banakar
       Player 1 aur Player 2 ko direct grid item */
    .game-layout:has(#player3Input.hidden-player) .left-panel {
        display: contents;
    }

    /* 2 player me right panel hide */
    .game-layout:has(#player3Input.hidden-player) .right-panel {
        display: none;
    }

    /* Player 1 - LEFT */
    .game-layout:has(#player3Input.hidden-player) .red-player {
        grid-column: 1;
        grid-row: 1;
    }

    /* Board - CENTER */
    .game-layout:has(#player3Input.hidden-player) .center-game {
        grid-column: 2;
        grid-row: 1;
    }

    /* Player 2 - RIGHT */
    .game-layout:has(#player3Input.hidden-player) .green-player {
        grid-column: 3;
        grid-row: 1;
    }

    /* Turn + Dice */
    .game-layout:has(#player3Input.hidden-player) > div:last-child {
        grid-column: 2;
        grid-row: 2;
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 650px) {

    .game-layout {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* Board */
    .center-game {
        order: 1;
        width: 100%;
    }

    /* CURRENT TURN + DICE
       board ke just baad */
    .game-layout > div:last-child {
        order: 2;
        width: 100%;
    }

    /* Player 1 + Player 2 */
    .left-panel {
        order: 3;
        width: 100%;
    }

    /* Player 3 + Player 4 */
    .right-panel {
        order: 4;
        width: 100%;
    }


    /* 2 PLAYER MOBILE */
    .game-layout:has(#player3Input.hidden-player) .left-panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .game-layout:has(#player3Input.hidden-player) .right-panel {
        display: none;
    }

    .game-layout:has(#player3Input.hidden-player) .red-player,
    .game-layout:has(#player3Input.hidden-player) .green-player {
        width: 100%;
        margin: 0;
    }
}
