/* Ludo Arena - Optimized Design System */

:root {
    --deep: #0f172a;
    --gold-bright: #fcd34d;
    --gold-main: #d4af37;
    --gold-dark: #b8860b;
    --red-marble: #4a1d1d;
    --green-marble: #1d4a3b;
    --wood-bg: #1a0f0a;
    --red: #ff0000;
    --green: #00cc44;
    --blue: #3b82f6;
    --yellow: #ffcc00;
    --piece-w: 28px;
    --piece-h: 32px;
    --base-inner-padding: 20px;
    --base-inner-gap: 20px;
    --dice-size: 80px;
    --dice-half: 40px;
    --dice-color: #10b981;
    --dice-color-dark: #059669;
    --dashboard-border: #fbbf24;
}

body {
    background: transparent;
    color: #ffffff;
    min-height: 100vh;
    font-family: 'DM Sans', sans-serif;
    margin: 0;
    overflow-x: hidden;
}

.gold-text {
    background: linear-gradient(to bottom, #fde68a, #d4af37, #b8860b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
    font-weight: 800;
}

.ornate-frame {
    border: 8px solid transparent;
    border-image: linear-gradient(to bottom right, #fde68a, #d4af37, #b8860b, #d4af37, #fde68a) 1;
    box-shadow: 
        inset 0 0 15px rgba(0,0,0,0.8),
        0 10px 30px rgba(0,0,0,0.6);
    position: relative;
}

.ornate-frame::before {
    content: '';
    position: absolute;
    top: -12px; left: -12px; right: -12px; bottom: -12px;
    border: 2px solid var(--gold-main);
    pointer-events: none;
    z-index: 5;
}

/* Grand Nav */
.ludo-nav {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(20px);
    border-bottom: 2px solid var(--gold-main);
    padding: 16px 40px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.ludo-nav .nav-logo {
    color: var(--gold-main) !important;
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ludo-nav .back-link {
    color: var(--gold-bright) !important;
    opacity: 0.8;
}

.ludo-nav .back-link:hover {
    opacity: 1;
}

#game-container {
    padding: 10px;
    box-sizing: border-box;
    --rotation: 0deg;
}

#board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#game-dashboard {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    width: min(95vw, 600px);
    background: #1e40af;
    border: 4px solid var(--dashboard-border);
    border-radius: 20px;
    padding: 10px 20px 10px;
    margin-top: 50px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    box-sizing: border-box;
    transition: border-color 0.4s ease;
}

.player-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 150px;
    position: relative;
    transition: all 0.3s;
}

.player-panel.active {
    filter: drop-shadow(0 0 10px #fbbf24);
}

.avatar-wrapper {
    width: 60px;
    height: 60px;
    background: #333;
    border: 2px solid #22d3ee;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: -15px;
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-info-card {
    background: #172554;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 15px 5px 5px;
    width: 100%;
    text-align: center;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}

.player-name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 2px;
}

.player-name {
    font-size: 14px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-pin {
    font-size: 14px;
}

.player-stats {
    display: flex;
    flex-direction: column;
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    gap: 2px;
}

.dice-panel {
    flex: 0 0 100px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 100%;
}

/* Ludo Board Redesign */
.ludo-board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    width: min(90vw, 75vh, 580px);
    height: min(90vw, 75vh, 580px);
    background: white;
    border: 4px solid #666;
    position: relative;
    padding: 0;
    gap: 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: rotate(var(--rotation));
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

/* Bases */
.base {
    grid-column: span 6;
    grid-row: span 6;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.4);
}

.base.red { grid-column: 10 / 16; grid-row: 1 / 7; background: #ff0000; }
.base.green { grid-column: 1 / 7; grid-row: 10 / 16; background: #008000; }
.base.yellow { grid-column: 10 / 16; grid-row: 10 / 16; background: #ffff00; }
.base.blue { grid-column: 1 / 7; grid-row: 1 / 7; background: #0000ff; }

.base-inner {
    width: 75%;
    height: 75%;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.4);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: var(--base-inner-gap);
    padding: var(--base-inner-padding);
    box-sizing: border-box;
}

.base-slot {
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: white;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.3);
}

.base.red .base-slot { background: #ff0000; }
.base.green .base-slot { background: #008000; }
.base.yellow .base-slot { background: #ffff00; }
.base.blue .base-slot { background: #0000ff; }


/* Path Cells */
.cell {
    background: white;
    border: 1px solid #666;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    position: relative;
    box-sizing: border-box;
}

.bg-red { background: #ff0000 !important; }
.bg-green { background: #008000 !important; }
.bg-blue { background: #0000ff !important; }
.bg-yellow { background: #ffff00 !important; }

.safe-marker {
    color: black;
    font-size: clamp(12px, 4vw, 24px);
    font-weight: bold;
}

/* Home Center Triangles */
.home-center {
    grid-column: 7 / 10;
    grid-row: 7 / 10;
    position: relative;
    background: white;
    border: 1px solid #666;
}

.home-triangle {
    position: absolute;
    width: 100%;
    height: 100%;
}

.triangle-left {
    background: #0000ff;
    clip-path: polygon(0 0, 50% 50%, 0 100%);
}

.triangle-top {
    background: #ff0000;
    clip-path: polygon(0 0, 100% 0, 50% 50%);
}

.triangle-right {
    background: #ffff00;
    clip-path: polygon(100% 0, 100% 100%, 50% 50%);
}

.triangle-bottom {
    background: #008000;
    clip-path: polygon(0 100%, 100% 100%, 50% 50%);
}

.piece {
    width: 18px;
    height: 18px;
    position: absolute;
    border: none;
    background: transparent;
    cursor: pointer;
    z-index: 100;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    margin-top: 0; /* Center is managed by translateY in the pin transform */
}

/* 3D Map Marker Pins */
.pawn-pin {
    width: 18px;
    height: 18px;
    border-radius: 50% 50% 50% 0;
    /* Soft white/silver metallic gradient with glossy reflections */
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f1f5f9 45%, #cbd5e1 85%, #94a3b8 100%);
    border: 1.5px solid #475569; /* Slate border */
    transform: translateY(-12.7px) rotate(-45deg);
    position: relative;
    box-shadow: 
        -2px 2px 4px rgba(0, 0, 0, 0.35),
        inset -1px 1px 1px rgba(255, 255, 255, 0.9),
        inset 1px -1px 1px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

/* Inner colored dot corresponding to the player */
.pawn-pin::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    /* currentColor is the player's color */
    background: currentColor;
    /* Counter-rotate by 45deg to cancel the parent's rotate(-45deg) */
    transform: rotate(45deg);
    box-shadow: 
        inset 0 1.5px 3px rgba(0,0,0,0.5),
        0 1px 1px rgba(255,255,255,0.4);
    display: block;
    box-sizing: border-box;
}

/* Small dark ring base/shadow below the pin pointy end */
.pawn-pin::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 4px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 80%);
    border-radius: 50%;
    /* Position exactly under the bottom sharp tip */
    bottom: -3px;
    left: -3px;
    transform: translate(-25%, 25%) rotate(45deg);
    z-index: -1;
    pointer-events: none;
}

.piece.playable {
    cursor: pointer;
    z-index: 100;
    animation: piece-pulse 0.6s infinite alternate;
}

@keyframes piece-pulse {
    from { filter: brightness(1.1) drop-shadow(0 0 5px currentColor); }
    to { filter: brightness(1.4) drop-shadow(0 0 20px currentColor); }
}

.pawn-pin.jumping {
    animation: pin-jump 0.3s ease-out;
}

@keyframes pin-jump {
    0%, 100% { transform: rotate(-45deg) translateY(0) scale(1); }
    50% { transform: rotate(-45deg) translateY(-20px) scale(1.15); filter: brightness(1.2); }
}

#game-message {
    font-size: 24px;
    font-weight: 500;
    color: var(--gold);
    background: rgba(255,255,255,0.05);
    padding: 10px 30px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.1);
    margin: 0;
    white-space: nowrap;
}

#dice-container {
    background: transparent;
    border: none;
    border-radius: 15px;
    padding: 10px;
    margin-top: -30px;
    margin-bottom: 5px;
    z-index: 20;
    position: relative;
}

/* Obsolete 2D display styles removed */

#dice-roll-btn, .dice-button {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 80px;
    height: 80px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
    padding: 0;
    position: relative;
    margin: 0 auto;
}

#dice-roll-btn:hover:not(.disabled) .dice-cube {
    transform: scale(1.1) rotateX(-25deg) rotateY(25deg) !important;
}

#dice-roll-btn.disabled,
.dice-button.disabled {
    cursor: not-allowed;
    filter: grayscale(0.6) opacity(0.8);
    pointer-events: none;
}

#dice-roll-btn.active .dice-cube:not(.rolling),
.lobby-cube:not(.rolling) {
    animation: dice-realistic-spin 8s infinite linear;
}

@keyframes dice-realistic-spin {
    0% { transform: translateY(0) rotateX(-15deg) rotateY(15deg) rotateZ(5deg); }
    50% { transform: translateY(-12px) rotateX(165deg) rotateY(375deg) rotateZ(185deg); }
    100% { transform: translateY(0) rotateX(345deg) rotateY(735deg) rotateZ(365deg); }
}

#dice-turn-arrow {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    color: #fbbf24;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5), 0 0 15px #fbbf24;
    display: none;
    z-index: 100;
    animation: arrow-bounce 0.5s infinite alternate ease-in-out;
    pointer-events: none;
}

@keyframes arrow-bounce {
    from { transform: translateX(-50%) translateY(0); filter: brightness(1.2); }
    to { transform: translateX(-50%) translateY(-10px); filter: brightness(0.8); }
}

#dice-turn-arrow.show {
    display: block;
}

#dice-value-display.hidden {
    opacity: 0;
    visibility: hidden;
}

#dice-roll-btn:hover:not(.disabled) {
    background: transparent !important;
}

#dice-roll-btn.rolling-active {
    opacity: 1;
    transform: scale(0.95);
    background: transparent !important;
}

#dice-roll-btn.active {
    /* Glowing visual feedback is now rendered dynamically on dice faces */
}

@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(201, 169, 110, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(201, 169, 110, 0); }
    100% { box-shadow: 0 0 0 0 rgba(201, 169, 110, 0); }
}

.turn-glow {
    animation: turn-pulse 1.5s infinite alternate;
}

@keyframes turn-pulse {
    from { transform: scale(1); filter: brightness(1); }
    to { transform: scale(1.05); filter: brightness(1.2); }
}

/* Ultra-Realistic 3D Dice */
/* Shared 3D Dice Container Styles */
#dice-value-display,
.lobby-display {
    width: 60px;
    height: 60px;
    perspective: 800px;
    display: flex;
    justify-content: center;
    align-items: center;
    --dice-size: 60px;
    --dice-half: 30px;
    margin: 0 auto;
}

.dice-cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.1, 0.9, 0.2, 1);
    transform: rotateX(-15deg) rotateY(15deg) rotateZ(5deg);
}

/* Old shadow styles removed in favor of unified system below */

/* Using shadow-realistic-pulse instead */

.dice-cube.stopping {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dice-cube.rolling {
    animation: cube-roll 0.6s infinite linear;
}

@keyframes cube-roll {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateY(0); }
    15% { transform: rotateX(150deg) rotateY(45deg) rotateZ(20deg) translateY(-25px); }
    30% { transform: rotateX(300deg) rotateY(180deg) rotateZ(150deg) translateY(5px); }
    45% { transform: rotateX(450deg) rotateY(90deg) rotateZ(240deg) translateY(-30px); }
    60% { transform: rotateX(600deg) rotateY(270deg) rotateZ(45deg) translateY(0); }
    75% { transform: rotateX(750deg) rotateY(405deg) rotateZ(320deg) translateY(-15px); }
    90% { transform: rotateX(900deg) rotateY(540deg) rotateZ(180deg) translateY(5px); }
    100% { transform: rotateX(1080deg) rotateY(720deg) rotateZ(360deg) translateY(0); }
}

/* Unified Dice Shadow System */
#dice-container,
.dice-container-outer {
    position: relative;
}

#dice-container::before,
.dice-container-outer::before {
    content: "";
    position: absolute;
    bottom: 5px;
    left: 50%;
    width: 60px;
    height: 10px;
    background: rgba(0,0,0,0.35);
    border-radius: 50%;
    transform: translateX(-50%) scale(1);
    filter: blur(5px);
    transition: all 0.3s;
    opacity: 1;
    z-index: 1;
}

/* Shadow pulsing when the dice is idling or spinning */
#dice-roll-btn.active ~ #dice-container::before,
.dice-container-outer::before,
.lobby-cube ~ .dice-container-outer::before {
     animation: shadow-realistic-pulse 4s infinite alternate ease-in-out;
}

@keyframes shadow-realistic-pulse {
    from { transform: translateX(-50%) scale(1); opacity: 0.35; }
    to { transform: translateX(-50%) scale(0.7); opacity: 0.15; }
}

#dice-container.is-rolling::before {
    animation: shadow-realistic-pulse 0.2s infinite alternate ease-in-out;
}

.dice-cube.rolling + #dice-container::before,
.dice-cube.rolling ~ #dice-container::before {
    /* CSS sibling selector won't work as before is a pseudo-element of parent */
}

/* Result Number Pop-up */
#dice-pop-up {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    color: white;
    font-weight: 900;
    font-size: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    background: var(--gold);
    min-width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#dice-pop-up.show {
    transform: translateX(-50%) scale(1.2);
    opacity: 1;
}

.dice-cube.stop-bounce {
    animation: dice-bounce 0.4s ease-out;
}

@keyframes dice-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.dice-face {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--dice-face-bg, radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(240, 240, 240, 0.6) 40%, rgba(212, 212, 212, 0.4) 100%));
    border: 1px solid var(--dice-border-color, rgba(255, 255, 255, 0.4));
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 8px;
    box-sizing: border-box;
    backface-visibility: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 
        inset 0 0 15px rgba(255, 255, 255, 0.3),
        inset 3px 3px 6px rgba(255, 255, 255, 0.6),
        inset -3px -3px 6px rgba(0, 0, 0, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.15);
    transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.3s ease;
}

#dice-roll-btn.glow-active .dice-face {
    box-shadow: 
        inset 0 0 20px rgba(0,0,0,0.15),
        inset 2px 2px 5px rgba(255,255,255,0.8),
        inset -2px -2px 5px rgba(0,0,0,0.2),
        0 0 20px var(--dice-color, rgba(239, 68, 68, 0.6));
    border-color: var(--dice-border-color, var(--dice-color, #bfbfbf));
}

.dot {
    width: 14px;
    height: 14px;
    background: var(--dice-dot-color, #111);
    border-radius: 50%;
    justify-self: center;
    align-self: center;
    box-shadow: 
        inset 0 3px 5px rgba(0,0,0,0.8), 
        inset 0 -2px 2px rgba(255,255,255,0.4),
        0 1px 1px rgba(255,255,255,0.8);
    transition: background 0.5s ease;
}

.dot.center { grid-column: 2; grid-row: 2; }
.dot.top-left { grid-column: 1; grid-row: 1; }
.dot.top-right { grid-column: 3; grid-row: 1; }
.dot.bottom-left { grid-column: 1; grid-row: 3; }
.dot.bottom-right { grid-column: 3; grid-row: 3; }
.dot.middle-left { grid-column: 1; grid-row: 2; }
.dot.middle-right { grid-column: 3; grid-row: 2; }

/* 3D Positions */
.face-1 { transform: translateZ(var(--dice-half)); }
.face-2 { transform: rotateY(180deg) translateZ(var(--dice-half)); }
.face-3 { transform: rotateY(90deg) translateZ(var(--dice-half)); }
.face-4 { transform: rotateY(-90deg) translateZ(var(--dice-half)); }
.face-5 { transform: rotateX(90deg) translateZ(var(--dice-half)); }
.face-6 { transform: rotateX(-90deg) translateZ(var(--dice-half)); }

/* Glow when active is now handled via volumetric glows on individual faces to prevent 3D flattening */

/* Lobby 3D Dice specifics */
/* Lobby 3D Dice specifics (consolidated) */

/* Lobby display properties inherited from shared styles above */

.lobby-cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

/* Using unified dice-realistic-spin keyframes */

.lobby-3d-dice:hover .lobby-cube {
    animation-duration: 2s;
}
/* Simplified Matchmaking Layout */
.simple-match-container {
    max-width: 1000px;
    margin: 60px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.match-header {
    text-align: center;
    margin-bottom: 40px;
}

.match-title {
    font-family: 'Luckiest Guy', cursive;
    font-size: 72px;
    margin: 0;
    color: #ffffff;
    letter-spacing: 2px;
    text-shadow: 0 4px 0 #000000;
}

.match-title span {
    color: #00ff88; /* Green "ARENA" */
}

.match-subtitle {
    color: #9ca3af;
    font-size: 18px;
    margin-top: 5px;
}

.match-panels {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    justify-content: center;
}

.match-card {
    background: #252438;
    border-radius: 40px;
    padding: 60px 40px;
    width: 420px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
}

.host-card {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    z-index: 1;
}

.join-card {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background: #1e1d2e;
}

.match-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.card-header-simple {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
}

.card-icon {
    font-size: 32px;
}

.card-label {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.host-card .card-label { color: #ff5e5e; }
.join-card .card-label { color: #5e9fff; }

.otp-boxes, .otp-inputs {
    background: #141321;
    padding: 30px;
    border-radius: 20px;
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    width: 100%;
    justify-content: center;
}

.otp-box-simple, .otp-input-simple {
    width: 60px;
    height: 80px;
    background: #222133;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: #ff5e5e;
    border: 1px solid rgba(255,94,94,0.1);
}

.join-card .otp-input-simple {
    background: #ffffff;
    color: #1a1a2e;
    border: none;
    text-align: center;
    width: 60px;
    height: 80px;
    padding: 0;
    outline: none;
}

.btn-simple {
    width: 100%;
    padding: 20px;
    border-radius: 15px;
    border: none;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-host {
    background: #ffffff;
    color: #ff5e5e;
}

.btn-join {
    background: #2a2942;
    color: #5e9fff;
    border: 1px solid rgba(255,255,255,0.05);
}

.vs-badge {
    width: 60px;
    height: 60px;
    background: #222133;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Luckiest Guy', cursive;
    color: #4b4a6b;
    font-size: 20px;
    border: 4px solid #1a1a2e;
    margin: 0 -30px;
    z-index: 10;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.match-dots {
    display: flex;
    gap: 10px;
    margin-top: 40px;
}

.color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.color-dot.red { background: #ff5e5e; }
.color-dot.yellow { background: #ffcc00; }
.color-dot.green { background: #00ff88; }
.color-dot.blue { background: #5e9fff; }

.status-text-simple {
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
}

.btn-glass-simple {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #ffffff;
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 12px;
}

@media (max-width: 900px) {
    .match-panels {
        flex-direction: column;
    }
    .match-card {
        width: 100%;
        max-width: 420px;
        border-radius: 40px !important;
    }
    .vs-badge {
        margin: -20px 0;
    }
    .match-title {
        font-size: 48px;
    }
}



@media (max-width: 600px) {
    :root {
        --base-inner-padding: 8px;
        --base-inner-gap: 8px;
    }
    .ludo-board {
        border-width: 2px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    }
    .base-slot {
        box-shadow: inset 0 0 3px rgba(0,0,0,0.2);
    }
    .match-title {
        font-size: 40px;
    }
    .match-subtitle {
        font-size: 14px;
    }
    .match-card {
        padding: 40px 20px;
    }
    .otp-boxes, .otp-inputs {
        padding: 15px;
        gap: 10px;
    }
    .otp-box-simple, .otp-input-simple {
        width: 50px;
        height: 70px;
        font-size: 24px;
    }
    .join-card .otp-input-simple {
        width: 50px;
        height: 70px;
    }
}

/* ==========================================================================
   Live Beach Background Styles
   ========================================================================== */
.beach-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -10;
    overflow: hidden;
    background: radial-gradient(circle at 50% 20%, #fff7e6 0%, #f4dfbe 60%, #e2c08d 100%);
    pointer-events: none; /* Let clicks pass through to game elements */
    perspective: 1200px;
    transform-style: preserve-3d;
}

/* Shells scattered on the sand */
.beach-shell {
    position: absolute;
    font-size: 16px;
    opacity: 0.6;
    z-index: -9;
}
.shell-1 { top: 15%; left: 10%; transform: rotate(15deg); }
.shell-2 { top: 40%; right: 12%; transform: rotate(-30deg); }

/* Live Crabs */
.live-crab {
    position: absolute;
    width: 24px;
    height: 16px;
    background: #ff5722;
    border-radius: 50% 50% 40% 40%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    z-index: -8;
}
.live-crab::before, .live-crab::after {
    content: '';
    position: absolute;
    background: #fff;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    top: -4px;
}
.live-crab::before { left: 5px; }
.live-crab::after { right: 5px; }

.live-crab .crab-eye {
    position: absolute;
    background: #000;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    top: -3px;
    z-index: 10;
}
.live-crab .crab-eye.left { left: 6px; }
.live-crab .crab-eye.right { right: 6px; }

.live-crab .crab-claw {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff5722;
    border-radius: 50% 50% 0 50%;
    top: -2px;
}
.live-crab .crab-claw.left {
    left: -4px;
    transform: rotate(-30deg);
    animation: pinch-left-animation 0.8s ease-in-out infinite alternate;
}
.live-crab .crab-claw.right {
    right: -4px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(30deg);
    animation: pinch-right-animation 0.8s ease-in-out infinite alternate;
}

@keyframes pinch-left-animation {
    0% { transform: rotate(-30deg); }
    100% { transform: rotate(-55deg); }
}
@keyframes pinch-right-animation {
    0% { transform: rotate(30deg); }
    100% { transform: rotate(55deg); }
}

.live-crab .crab-leg {
    position: absolute;
    width: 2px;
    height: 6px;
    background: #d84315;
    bottom: -5px;
    border-radius: 2px;
    transform-origin: top center;
}
.live-crab .crab-leg.l1 { left: 4px; transform: rotate(20deg); animation: wiggle-left-animation 0.15s infinite alternate; }
.live-crab .crab-leg.l2 { left: 8px; transform: rotate(0deg); animation: wiggle-left-animation 0.15s infinite alternate 0.05s; }
.live-crab .crab-leg.l3 { left: 12px; transform: rotate(-20deg); animation: wiggle-left-animation 0.15s infinite alternate 0.1s; }
.live-crab .crab-leg.r1 { right: 4px; transform: rotate(-20deg); animation: wiggle-right-animation 0.15s infinite alternate; }
.live-crab .crab-leg.r2 { right: 8px; transform: rotate(0deg); animation: wiggle-right-animation 0.15s infinite alternate 0.05s; }
.live-crab .crab-leg.r3 { right: 12px; transform: rotate(20deg); animation: wiggle-right-animation 0.15s infinite alternate 0.1s; }

@keyframes wiggle-left-animation {
    from { transform: rotate(10deg); }
    to { transform: rotate(35deg); }
}
@keyframes wiggle-right-animation {
    from { transform: rotate(-10deg); }
    to { transform: rotate(-35deg); }
}

/* Scuttling animations */
.crab-1 {
    top: 25%;
    animation: scuttle-path-1 24s linear infinite;
}
.crab-2 {
    top: 52%;
    animation: scuttle-path-2 30s linear infinite;
}

@keyframes scuttle-path-1 {
    0% { left: -40px; transform: scaleX(1); }
    48% { left: 105%; transform: scaleX(1); }
    50% { left: 105%; transform: scaleX(-1); }
    98% { left: -40px; transform: scaleX(-1); }
    100% { left: -40px; transform: scaleX(1); }
}
@keyframes scuttle-path-2 {
    0% { right: -40px; transform: scaleX(-1); }
    48% { right: 105%; transform: scaleX(-1); }
    50% { right: 105%; transform: scaleX(1); }
    98% { right: -40px; transform: scaleX(1); }
    100% { right: -40px; transform: scaleX(-1); }
}

/* Wet sand area left behind by receding tides */
.wet-sand {
    position: absolute;
    bottom: -20vh;
    left: -50%;
    width: 200%;
    height: 72vh;
    background: radial-gradient(circle at 50% 20%, #d5be9b 0%, #cca972 55%, #b38b52 100%);
    filter: blur(8px);
    z-index: -8;
    opacity: 0;
    pointer-events: none;
    transform-style: preserve-3d;
    transform: rotateX(55deg) translateY(12vh) translateZ(-5px);
    transform-origin: bottom center;
    animation: wet-sand-3d-wash 16s ease-in-out infinite;
}

.wet-sand::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(110deg, rgba(255,255,255,0) 30%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0) 70%);
    background-size: 200% 100%;
    animation: wet-sand-shine 8s linear infinite;
    pointer-events: none;
}

@keyframes wet-sand-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes wet-sand-3d-wash {
    0% {
        transform: rotateX(55deg) translateY(20vh) translateZ(-15px);
        opacity: 0;
    }
    30% {
        opacity: 0;
    }
    38% {
        transform: rotateX(55deg) translateY(-15.2vh) translateZ(8px);
        opacity: 0.95;
    }
    50% {
        transform: rotateX(55deg) translateY(-15.2vh) translateZ(8px);
        opacity: 0.95;
    }
    85% {
        transform: rotateX(55deg) translateY(-15.2vh) translateZ(8px);
        opacity: 0;
    }
    100% {
        transform: rotateX(55deg) translateY(20vh) translateZ(-15px);
        opacity: 0;
    }
}

/* Live Ocean Tides at the Bottom with 3D Rotate */
.ocean-water {
    position: absolute;
    bottom: -20vh;
    left: -50%;
    width: 200%;
    height: 70vh;
    background: linear-gradient(to bottom, 
        rgba(0, 168, 204, 0.82) 0%, 
        rgba(0, 131, 176, 0.92) 20%, 
        #004488 100%
    );
    box-shadow: inset 0 20px 40px rgba(0,0,0,0.15);
    z-index: -7;
    transform-style: preserve-3d;
    transform: rotateX(55deg) translateY(12vh) translateZ(0);
    transform-origin: bottom center;
    animation: live-tide-3d-wash 16s ease-in-out infinite;
}

/* Sunlight Glare Shimmer Overlay */
.ocean-water::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 65%);
    mix-blend-mode: overlay;
    z-index: 2;
    animation: water-shimmer 10s ease-in-out infinite alternate;
}

@keyframes water-shimmer {
    0% {
        opacity: 0.5;
        transform: scale(0.9) rotate(-1deg);
    }
    100% {
        opacity: 0.95;
        transform: scale(1.1) rotate(1deg);
    }
}

/* Live Tide Edge Foam Ripple Overlay & Realistic Lacy Seafoam */
.seafoam-front-wrap {
    position: absolute;
    top: -35px;
    left: 0;
    width: 100%;
    height: 50px;
    z-index: 8;
    transform-style: preserve-3d;
    pointer-events: none;
}

.seafoam-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.seafoam-base {
    background: linear-gradient(to bottom, 
        rgba(255,255,255,1) 0%, 
        rgba(255,255,255,0.85) 35%, 
        rgba(255,255,255,0) 90%
    );
    filter: url(#realistic-seafoam);
    opacity: 0;
    animation: seafoam-base-cycle 16s ease-in-out infinite;
}

.seafoam-bubbles {
    background: linear-gradient(to bottom, 
        rgba(255,255,255,0.95) 0%, 
        rgba(255,255,255,0.65) 45%, 
        rgba(255,255,255,0) 100%
    );
    filter: url(#realistic-seafoam);
    opacity: 0;
    animation: seafoam-bubbles-cycle 16s ease-in-out infinite;
}

@keyframes seafoam-base-cycle {
    0% {
        opacity: 0.1;
        transform: translateZ(12px) scaleY(0.85);
    }
    30% {
        opacity: 0.2;
        transform: translateZ(12px) scaleY(0.9);
    }
    35% {
        opacity: 0.95;
        transform: translateZ(12px) scaleY(1.1);
    }
    45% {
        opacity: 0.98;
        transform: translateZ(12px) scaleY(1.15) translateY(-1px);
    }
    65% {
        opacity: 0.7;
        transform: translateZ(12px) scaleY(1.0) translateY(-4px);
    }
    80% {
        opacity: 0;
        transform: translateZ(12px) scaleY(0.85) translateY(-6px);
    }
    100% {
        opacity: 0.1;
        transform: translateZ(12px) scaleY(0.85);
    }
}

@keyframes seafoam-bubbles-cycle {
    0% {
        /* No bubbles during initial wave surge */
        opacity: 0;
        transform: translateZ(8px) translateY(12px) scaleY(0.7);
    }
    30% {
        opacity: 0;
        transform: translateZ(8px) translateY(12px) scaleY(0.7);
    }
    36% {
        /* Bubbles start to form just as wave reaches peak */
        opacity: 0.35;
        transform: translateZ(8px) translateY(6px) scaleY(1.0);
    }
    45% {
        /* Peak: dense bubble cover created by breaking water */
        opacity: 0.95;
        transform: translateZ(8px) translateY(0px) scaleY(1.2);
    }
    60% {
        /* Receding phase: bubbles are left behind on wet sand, stretching out */
        opacity: 0.85;
        transform: translateZ(8px) translateY(-10px) scaleY(1.4);
    }
    75% {
        /* Dissolving/drying phase */
        opacity: 0.4;
        transform: translateZ(8px) translateY(-14px) scaleY(1.5);
    }
    85% {
        opacity: 0;
        transform: translateZ(8px) translateY(-16px) scaleY(1.5);
    }
    100% {
        opacity: 0;
        transform: translateZ(8px) translateY(12px) scaleY(0.7);
    }
}

@keyframes live-tide-3d-wash {
    0% {
        transform: rotateX(55deg) translateY(20vh) translateZ(-10px);
    }
    35% {
        transform: rotateX(55deg) translateY(-15vh) translateZ(10px); /* Massive surge up the shore */
    }
    45% {
        transform: rotateX(55deg) translateY(-15vh) translateZ(10px);
    }
    80% {
        transform: rotateX(55deg) translateY(20vh) translateZ(-10px);
    }
    100% {
        transform: rotateX(55deg) translateY(20vh) translateZ(-10px);
    }
}

/* 3D Wave Layers */
.wave-layer {
    position: absolute;
    top: -26px;
    left: 0;
    width: 100%;
    height: 30px;
    transform-style: preserve-3d;
}

.wave-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.wave-depth-1 {
    transform: translateZ(1px);
    animation: wave-horizontal-1 14s linear infinite;
}
.wave-depth-2 {
    transform: translateZ(5px);
    animation: wave-horizontal-2 18s linear infinite;
}
.wave-depth-3 {
    transform: translateZ(10px);
    animation: wave-horizontal-3 22s linear infinite;
}

@keyframes wave-horizontal-1 {
    0% { transform: translateZ(1px) translateX(-100px) translateY(-2px) scaleY(0.85) skewX(-3deg); }
    50% { transform: translateZ(1px) translateX(100px) translateY(2px) scaleY(1.15) skewX(3deg); }
    100% { transform: translateZ(1px) translateX(-100px) translateY(-2px) scaleY(0.85) skewX(-3deg); }
}
@keyframes wave-horizontal-2 {
    0% { transform: translateZ(5px) translateX(80px) translateY(2px) scaleY(1.2) skewX(4deg); }
    50% { transform: translateZ(5px) translateX(-80px) translateY(-2px) scaleY(0.8) skewX(-4deg); }
    100% { transform: translateZ(5px) translateX(80px) translateY(2px) scaleY(1.2) skewX(4deg); }
}
@keyframes wave-horizontal-3 {
    0% { transform: translateZ(10px) translateX(-60px) translateY(-3px) scaleY(0.7) skewX(-2deg); }
    50% { transform: translateZ(10px) translateX(60px) translateY(3px) scaleY(1.3) skewX(2deg); }
    100% { transform: translateZ(10px) translateX(-60px) translateY(-3px) scaleY(0.7) skewX(-2deg); }
}

/* Swimming Fishes inside water container */
.live-fish {
    position: absolute;
    width: 22px;
    height: 12px;
    background: linear-gradient(135deg, #ffb300 0%, #ff5722 100%);
    border-radius: 50% 50% 50% 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    z-index: 5;
}
.live-fish.fish-2 {
    background: linear-gradient(135deg, #00e5ff 0%, #1565c0 100%);
    transform: scale(0.85);
}
.live-fish.fish-3 {
    background: linear-gradient(135deg, #e040fb 0%, #8e24aa 100%);
    transform: scale(0.7);
}

.live-fish::before {
    content: '';
    position: absolute;
    background: #000;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    top: 3px;
    left: 4px;
    border: 1px solid #fff;
}

.live-fish .fish-tail {
    position: absolute;
    right: -6px;
    top: 2px;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 6px solid #ff5722;
    transform-origin: left center;
    animation: swim-tail-wiggle 0.12s infinite alternate ease-in-out;
}
.live-fish.fish-2 .fish-tail { border-left-color: #1565c0; }
.live-fish.fish-3 .fish-tail { border-left-color: #8e24aa; }

@keyframes swim-tail-wiggle {
    0% { transform: rotate(-18deg); }
    100% { transform: rotate(18deg); }
}

/* Swim paths */
.fish-1 {
    top: 25%;
    animation: swim-path-1 16s linear infinite;
}
.fish-2 {
    top: 45%;
    animation: swim-path-2 22s linear infinite;
}
.fish-3 {
    top: 65%;
    animation: swim-path-3 19s linear infinite;
}

@keyframes swim-path-1 {
    0% { left: 20%; transform: scaleX(1); }
    100% { left: 80%; transform: scaleX(1); }
}
@keyframes swim-path-2 {
    0% { right: 20%; transform: scaleX(-1); }
    100% { right: 80%; transform: scaleX(-1); }
}
@keyframes swim-path-3 {
    0% { left: 20%; transform: scaleX(1) scale(0.7); }
    100% { left: 80%; transform: scaleX(1) scale(0.7); }
}

/* Ensure message readability on light background */
#game-message {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* ==========================================================================
   Swimming Dolphins and Sharks
   ========================================================================== */

/* Dolphin Styling */
.live-dolphin {
    position: absolute;
    width: 90px;
    height: 35px;
    z-index: 4; /* Behind front waves, in the water */
    pointer-events: none;
}

.dolphin-body {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #5b8ba8 0%, #305870 100%);
    border-radius: 50% 50% 30% 30%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.dolphin-eye {
    position: absolute;
    background: #000;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    top: 10px;
    left: 15px;
    border: 1px solid #fff;
}

.dolphin-snout {
    position: absolute;
    width: 14px;
    height: 8px;
    background: #5b8ba8;
    border-radius: 4px;
    left: -8px;
    top: 15px;
}

.dolphin-flipper {
    position: absolute;
    width: 14px;
    height: 22px;
    background: #46728c;
    border-radius: 0 0 100% 50%;
    left: 28px;
    bottom: -10px;
    transform: rotate(-25deg);
    transform-origin: top center;
    animation: dolphin-flipper-wiggle 1.5s infinite alternate ease-in-out;
}

.dolphin-dorsal {
    position: absolute;
    width: 16px;
    height: 18px;
    background: #5b8ba8;
    border-radius: 100% 0 0 0;
    left: 45px;
    top: -12px;
    transform: skewX(-20deg);
}

.dolphin-tail-joint {
    position: absolute;
    width: 25px;
    height: 14px;
    background: #46728c;
    right: -18px;
    top: 10px;
    border-radius: 30% 50% 50% 30%;
    transform-origin: left center;
    animation: dolphin-tail-wiggle 0.2s infinite alternate ease-in-out;
}

.dolphin-fluke {
    position: absolute;
    width: 10px;
    height: 28px;
    background: #305870;
    right: -6px;
    top: -7px;
    border-radius: 50%;
    clip-path: polygon(0% 50%, 100% 0%, 75% 50%, 100% 100%);
}

@keyframes dolphin-flipper-wiggle {
    0% { transform: rotate(-20deg); }
    100% { transform: rotate(-35deg); }
}

@keyframes dolphin-tail-wiggle {
    0% { transform: rotate(-10deg); }
    100% { transform: rotate(10deg); }
}

/* Shark Styling */
.live-shark {
    position: absolute;
    width: 120px;
    height: 42px;
    z-index: 3; /* Deeper in the water */
    pointer-events: none;
}

.shark-body {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #6c7c8c 0%, #3a4754 100%);
    border-radius: 60% 40% 35% 35%;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.shark-eye {
    position: absolute;
    background: #ff3b30;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    top: 14px;
    left: 18px;
    box-shadow: 0 0 4px #ff3b30;
}

.shark-gills {
    position: absolute;
    width: 1px;
    height: 12px;
    background: rgba(0, 0, 0, 0.35);
    left: 32px;
    top: 16px;
    box-shadow: 4px 0 rgba(0, 0, 0, 0.35), 8px 0 rgba(0, 0, 0, 0.35);
}

.shark-pectoral {
    position: absolute;
    width: 20px;
    height: 30px;
    background: #536270;
    border-radius: 0 0 100% 50%;
    left: 40px;
    bottom: -15px;
    transform: rotate(-30deg);
    transform-origin: top center;
    animation: shark-flipper-wiggle 2s infinite alternate ease-in-out;
}

.shark-dorsal {
    position: absolute;
    width: 24px;
    height: 30px;
    background: #6c7c8c;
    border-radius: 0 100% 0 0;
    left: 55px;
    top: -24px;
    transform: skewX(-15deg);
}

.shark-tail-joint {
    position: absolute;
    width: 30px;
    height: 16px;
    background: #536270;
    right: -22px;
    top: 12px;
    border-radius: 30% 50% 50% 30%;
    transform-origin: left center;
    animation: shark-tail-wiggle 0.25s infinite alternate ease-in-out;
}

.shark-caudal {
    position: absolute;
    width: 12px;
    height: 44px;
    background: #3a4754;
    right: -8px;
    top: -14px;
    clip-path: polygon(0% 50%, 100% 0%, 70% 50%, 100% 100%);
}

@keyframes shark-flipper-wiggle {
    0% { transform: rotate(-25deg); }
    100% { transform: rotate(-35deg); }
}

@keyframes shark-tail-wiggle {
    0% { transform: rotate(-12deg); }
    100% { transform: rotate(12deg); }
}

/* Swim Paths & Speeds */
.dolphin-1 {
    top: 15%;
    animation: dolphin-swim-path-1 18s linear infinite;
}

.dolphin-2 {
    top: 32%;
    animation: dolphin-swim-path-2 15s linear infinite;
    animation-delay: 4s;
}

.shark-1 {
    top: 55%;
    animation: shark-swim-path-1 25s linear infinite;
}

.shark-2 {
    top: 70%;
    animation: shark-swim-path-2 28s linear infinite;
    animation-delay: 6s;
}

@keyframes dolphin-swim-path-1 {
    0% {
        left: 85%;
        transform: scaleX(1) translateY(10px) rotate(5deg);
    }
    12.5% {
        transform: scaleX(1) translateY(-25px) rotate(-15deg);
    }
    25% {
        transform: scaleX(1) translateY(15px) rotate(12deg);
    }
    37.5% {
        transform: scaleX(1) translateY(-25px) rotate(-15deg);
    }
    50% {
        transform: scaleX(1) translateY(15px) rotate(12deg);
    }
    62.5% {
        transform: scaleX(1) translateY(-25px) rotate(-15deg);
    }
    75% {
        transform: scaleX(1) translateY(15px) rotate(12deg);
    }
    87.5% {
        transform: scaleX(1) translateY(-25px) rotate(-15deg);
    }
    100% {
        left: 15%;
        transform: scaleX(1) translateY(10px) rotate(5deg);
    }
}

@keyframes dolphin-swim-path-2 {
    0% {
        left: 15%;
        transform: scaleX(-1) translateY(-10px) rotate(-5deg) scale(0.85);
    }
    15% {
        transform: scaleX(-1) translateY(15px) rotate(10deg) scale(0.85);
    }
    30% {
        transform: scaleX(-1) translateY(-20px) rotate(-12deg) scale(0.85);
    }
    45% {
        transform: scaleX(-1) translateY(15px) rotate(10deg) scale(0.85);
    }
    60% {
        transform: scaleX(-1) translateY(-20px) rotate(-12deg) scale(0.85);
    }
    75% {
        transform: scaleX(-1) translateY(15px) rotate(10deg) scale(0.85);
    }
    90% {
        transform: scaleX(-1) translateY(-20px) rotate(-12deg) scale(0.85);
    }
    100% {
        left: 85%;
        transform: scaleX(-1) translateY(-10px) rotate(-5deg) scale(0.85);
    }
}

@keyframes shark-swim-path-1 {
    0% {
        left: 15%;
        transform: scaleX(-1) translateY(5px) rotate(-2deg);
    }
    25% {
        transform: scaleX(-1) translateY(-10px) rotate(3deg);
    }
    50% {
        transform: scaleX(-1) translateY(8px) rotate(-2deg);
    }
    75% {
        transform: scaleX(-1) translateY(-10px) rotate(3deg);
    }
    100% {
        left: 85%;
        transform: scaleX(-1) translateY(5px) rotate(-2deg);
    }
}

@keyframes shark-swim-path-2 {
    0% {
        left: 85%;
        transform: scaleX(1) translateY(-5px) rotate(2deg) scale(0.8);
    }
    25% {
        transform: scaleX(1) translateY(8px) rotate(-3deg) scale(0.8);
    }
    50% {
        transform: scaleX(1) translateY(-5px) rotate(2deg) scale(0.8);
    }
    75% {
        transform: scaleX(1) translateY(8px) rotate(-3deg) scale(0.8);
    }
    100% {
        left: 15%;
        transform: scaleX(1) translateY(-5px) rotate(2deg) scale(0.8);
    }
}

/* Hide beach background and set background to white during active gameplay */
body.game-active {
    background: radial-gradient(circle, #ffffff 0%, #f3f4f6 100%) !important;
    color: #1f2937 !important;
}

body.game-active .beach-background {
    display: none !important;
}

body.game-active .fire-flares-container {
    display: none !important;
}

body.game-active #dice-result-text {
    color: #1f2937 !important;
    text-shadow: none !important;
    font-weight: 600;
}

/* Fire Flares Background Overlay Styles */
.fire-flares-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -5;
    background: radial-gradient(circle at center, #230b05 0%, #070201 100%);
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

body.game-active .fire-flares-container {
    opacity: 1;
}

/* Pulse glow at the bottom to resemble fire hearth */
.fire-flares-container::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: radial-gradient(circle at 50% 100%, rgba(220, 38, 38, 0.28) 0%, rgba(249, 115, 22, 0.08) 50%, rgba(0,0,0,0) 80%);
    pointer-events: none;
    animation: flame-glow-pulse 6s ease-in-out infinite alternate;
}

@keyframes flame-glow-pulse {
    0% { opacity: 0.6; transform: scaleY(0.95); }
    100% { opacity: 1; transform: scaleY(1.1); }
}

/* Individual Fire Flare Elements */
.fire-flare {
    position: absolute;
    bottom: -120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.9) 0%, rgba(249, 115, 22, 0.45) 50%, rgba(239, 68, 68, 0) 75%);
    filter: blur(8px);
    mix-blend-mode: screen;
    animation: fire-flare-float 15s linear infinite;
    pointer-events: none;
}

@keyframes fire-flare-float {
    0% {
        transform: translateY(0) translateX(0) scale(1) rotate(0deg);
        opacity: 0;
    }
    15% {
        opacity: 0.85;
    }
    85% {
        opacity: 0.85;
    }
    100% {
        transform: translateY(-115vh) translateX(120px) scale(0.55) rotate(320deg);
        opacity: 0;
    }
}

/* Customized Sizes, Durations, Delays, and Starting Positions to create random natural flow */
.flare-1 { left: 8%; width: 45px; height: 45px; animation-duration: 12s; animation-delay: 0s; }
.flare-2 { left: 22%; width: 75px; height: 75px; background: radial-gradient(circle, rgba(252, 211, 77, 0.85) 0%, rgba(239, 68, 68, 0.4) 55%, rgba(0,0,0,0) 75%); animation-duration: 16s; animation-delay: 2s; }
.flare-3 { left: 36%; width: 35px; height: 35px; animation-duration: 10s; animation-delay: 5s; }
.flare-4 { left: 50%; width: 85px; height: 85px; background: radial-gradient(circle, rgba(239, 68, 68, 0.9) 0%, rgba(127, 29, 29, 0.5) 60%, rgba(0,0,0,0) 75%); animation-duration: 20s; animation-delay: 1s; }
.flare-5 { left: 64%; width: 55px; height: 55px; animation-duration: 14s; animation-delay: 7s; }
.flare-6 { left: 78%; width: 30px; height: 30px; animation-duration: 9s; animation-delay: 3s; }
.flare-7 { left: 16%; width: 65px; height: 65px; animation-duration: 15s; animation-delay: 11s; }
.flare-8 { left: 88%; width: 50px; height: 50px; animation-duration: 13s; animation-delay: 6s; }

/* Dice & Player Info Bar styling */
.dice-bar-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(90vw, 75vh, 580px);
    background: linear-gradient(to bottom, #0d54c0 0%, #063990 100%);
    border: 3px solid #fcd34d; /* Golden/yellow border */
    border-radius: 12px;
    padding: 8px 16px;
    box-shadow: 
        0 8px 24px rgba(0,0,0,0.6), 
        inset 0 2px 4px rgba(255,255,255,0.3);
    margin: 25px auto 15px;
    position: relative;
    box-sizing: border-box;
}

.dice-bar-player {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dice-bar-player.active {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(253, 211, 77, 0.8);
    box-shadow: 0 0 10px rgba(253, 211, 77, 0.35);
}

.player-pin-container {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Ensure the pin inside the bar is upright and displays nicely */
.player-pin-container .pawn-pin {
    width: 24px;
    height: 24px;
}

.player-name-text {
    font-family: 'Fredoka One', 'Luckiest Guy', sans-serif;
    font-size: 24px;
    font-weight: 900;
    font-style: italic;
    color: #ffd700; /* bright yellow gold */
    text-shadow: 
        -1px -1px 0 #000,  
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000,
         2px 2px 4px rgba(0,0,0,0.6);
    letter-spacing: 0.5px;
    text-transform: capitalize;
}

.dice-bar-center {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffe3e0; /* light pinkish-peach background */
    border: 4px solid #fbcfe8; /* pastel pink border */
    border-radius: 16px;
    width: 76px;
    height: 76px;
    box-shadow: 
        inset 0 3px 6px rgba(0,0,0,0.15), 
        0 4px 12px rgba(0,0,0,0.3);
    margin: 0 15px;
    box-sizing: border-box;
}

/* Position the turn arrow relative to the center dice frame */
.dice-bar-arrow {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    background: linear-gradient(to bottom, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)) drop-shadow(0 0 6px #f59e0b);
    display: none;
    z-index: 101;
    animation: arrow-bounce 0.5s infinite alternate ease-in-out;
    pointer-events: none;
}

.dice-bar-arrow.show {
    display: block;
}

/* Ensure dice fits perfectly inside the center frame */
.dice-bar-center #dice-container {
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.dice-bar-center #dice-roll-btn {
    width: 60px;
    height: 60px;
}

.dice-bar-center #dice-value-display {
    width: 50px;
    height: 50px;
    --dice-size: 50px;
    --dice-half: 25px;
}

.dice-bar-center .dice-cube {
    width: 50px;
    height: 50px;
}

/* Override 3D faces dimensions to fit the 50px dice container */
.dice-bar-center .face-1 { transform: translateZ(25px); }
.dice-bar-center .face-2 { transform: rotateY(180deg) translateZ(25px); }
.dice-bar-center .face-3 { transform: rotateY(90deg) translateZ(25px); }
.dice-bar-center .face-4 { transform: rotateY(-90deg) translateZ(25px); }
.dice-bar-center .face-5 { transform: rotateX(90deg) translateZ(25px); }
.dice-bar-center .face-6 { transform: rotateX(-90deg) translateZ(25px); }

.dice-bar-center .dice-face {
    padding: 4px;
    border-radius: 10px;
}

.dice-bar-center .dot {
    width: 10px;
    height: 10px;
}

