@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    min-height: 100vh;
    padding: 24px;
    color: #241542;
    font-family: 'Baloo 2', 'Trebuchet MS', sans-serif;
    background: #10152e url('assets/playbg.jpg') center / cover fixed;
}

.container { width: 100%; max-width: 1280px; margin: auto; }
.hidden { display: none !important; }
.screen { min-height: 100vh; }
.intro-screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: #10152e; }
.intro-screen img { width: 100%; height: 100%; object-fit: cover; }
.intro-screen .btn { position: absolute; right: 24px; bottom: 24px; }
.opening-credit { position: absolute; bottom: 9%; left: 50%; display: flex; flex-direction: column; gap: 2px; padding: 14px 28px; transform: translateX(-50%); color: white; text-align: center; background: rgba(37, 18, 72, .78); border: 2px solid #f6c445; border-radius: 16px; box-shadow: 0 7px 20px rgba(0,0,0,.35); }
.opening-credit strong { color: #ffe66d; font-size: clamp(1.35em, 3vw, 2em); }
.opening-credit span, .music-credit span { font-size: .98em; }
.menu-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80vh; padding: 32px; background: linear-gradient(rgba(20,10,60,.35),rgba(20,10,60,.6)), url('assets/menu.jpg') center / cover; border: 5px solid #f6c445; border-radius: 28px; box-shadow: 0 18px 45px rgba(0,0,0,.42); }
.menu-screen h1 { font-size: clamp(3em, 8vw, 6em); }
.menu-screen h2 { color: #ffe66d; font-size: clamp(2em, 5vw, 4em); text-shadow: 0 4px #b9345d; }
.menu-subtitle { margin: 8px 0 22px; color: white; font-size: 1.25em; }
.menu-buttons { display: flex; width: min(320px, 90%); flex-direction: column; gap: 14px; }
.btn-purple { background: linear-gradient(135deg,#673ab7,#4d236b); }
.credits-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; background: #10152e; }
.credits-screen img { max-width: 100%; max-height: 82vh; object-fit: contain; border: 5px solid #f6c445; border-radius: 16px; }
.music-credit { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; max-width: 800px; padding: 10px 18px; color: white; text-align: center; background: rgba(77,35,107,.9); border-radius: 12px; }
.music-credit strong { color: #ffe66d; }
.game-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.game-header h1 { margin: 0; font-size: clamp(2em, 5vw, 3.8em); }
.dashboard-label { color: #8a5a00; font-size: 12px; font-weight: 800; letter-spacing: 1px; }
.game-header .btn { flex: 0 0 auto; }
.player-list { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; background: rgba(255,255,255,.72); border-radius: 14px; }
.player-row { display: flex; align-items: center; gap: 8px; color: #5b5368; }
.player-row span { width: 13px; height: 13px; border-radius: 50%; }
.player-row strong { margin-left: auto; color: #4d236b; }
.player-row.active { color: #4d236b; font-weight: 800; }

h1 {
    margin-bottom: 18px;
    color: #ffe66d;
    font-size: clamp(2.4em, 6vw, 4.5em);
    letter-spacing: 2px;
    text-align: center;
    text-shadow: 0 5px 0 #b9345d, 0 9px 18px rgba(0,0,0,.45);
}

.game-wrapper {
    display: flex;
    gap: 26px;
    padding: 22px;
    background: rgba(255,249,225,.95);
    border: 5px solid #f6c445;
    border-radius: 28px;
    box-shadow: 0 18px 45px rgba(0,0,0,.42);
}

.board-container { display: flex; flex: 1 1 680px; align-items: center; justify-content: center; }

.board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    width: min(72vw, 680px);
    aspect-ratio: 1;
    gap: 3px;
    padding: 10px;
    background: url('assets/Snakes-and-Ladders-Bigger.jpg') center / cover;
    border: 6px solid #4d236b;
    border-radius: 20px;
    box-shadow: inset 0 0 0 3px #f6c445, 0 8px 0 #c18b2d;
}

.square {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    min-height: 0;
    border: 1px solid rgba(77,35,107,.3);
    border-radius: 5px;
    font-size: clamp(9px, 1.4vw, 15px);
    font-weight: 800;
    text-shadow: 0 1px white;
    transition: transform .2s ease;
}

.square:hover { z-index: 2; transform: scale(1.12); }
.square.ladder { background: rgba(79,205,143,.62); }
.square.snake { background: rgba(255,113,99,.62); }
.square-number { position: absolute; top: 2px; right: 3px; color: #4d236b; font-size: .75em; }
.square-content { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }

.player-marker {
    display: flex;
    width: clamp(18px, 3vw, 32px);
    height: clamp(18px, 3vw, 32px);
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    font-size: clamp(9px, 1.4vw, 14px);
    font-weight: 800;
    box-shadow: 0 3px 4px rgba(0,0,0,.35);
}

.controls { display: flex; flex: 0 0 270px; flex-direction: column; gap: 14px; }
.game-info { padding: 16px; background: linear-gradient(135deg,#fff4bd,#ffe2a8); border: 3px solid #f6c445; border-radius: 16px; }
.current-player { margin-bottom: 10px; color: #4d236b; font-size: 20px; font-weight: 800; }
.dice-result { min-height: 86px; color: #4d236b; font-size: 32px; font-weight: 800; text-align: center; }
.dice-result img { display: block; width: 78px; height: 78px; margin: auto; object-fit: contain; filter: drop-shadow(0 5px 2px rgba(0,0,0,.25)); }
.btn { padding: 13px 20px; border: 0; border-radius: 14px; color: white; cursor: pointer; font-family: inherit; font-size: 17px; font-weight: 800; text-transform: uppercase; transition: transform .2s ease, box-shadow .2s ease; }
.btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 7px 15px rgba(0,0,0,.22); }
.btn-roll { background: linear-gradient(135deg,#ef476f,#b9345d); }
.btn-reset { background: linear-gradient(135deg,#4ecdc4,#168aad); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.game-status { display: flex; min-height: 66px; align-items: center; justify-content: center; padding: 12px; background: #fff4bd; border: 3px solid #f6c445; border-radius: 14px; color: #856404; font-weight: 800; text-align: center; }
.game-status.winner { background: #c8f7cf; border-color: #28a745; color: #176b3a; font-size: 18px; }
.legend { padding: 15px; background: rgba(255,255,255,.7); border: 3px solid #f6c445; border-radius: 14px; }
.legend h3 { margin-bottom: 8px; color: #4d236b; }
.legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; color: #5b5368; }
.ladder-icon, .snake-icon { font-size: 22px; }

@media (max-width: 820px) {
    body { padding: 12px; }
    .game-wrapper { flex-direction: column; padding: 14px; }
    .board { width: min(92vw, 620px); }
    .controls { flex-basis: auto; }
}
