/* ==========================================================================
   LUDO ZNAINA MOURADE : LE CHOC DES PETITS CHEVAUX
   Édition Spéciale Zarzis • Sang et Or (عكارة Akkara)
   Cyber-Luxury Glassmorphic Gaming UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Fredoka:wght@600;700&display=swap');

:root {
    /* Backgrounds & Surface (Obsidian Dark with Sang & Or Ambiance) */
    --bg-dark: #060408;
    --bg-surface: #0F0A14;
    --bg-card: rgba(22, 14, 28, 0.78);
    --border-glass: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(255, 199, 0, 0.35);
    --glass-blur: blur(16px);

    /* Zarzis Sang & Or Primary Identity */
    --zarzis-sang: #E50914;
    --zarzis-sang-dark: #8B0000;
    --zarzis-or: #FFC700;
    --zarzis-or-dark: #B45309;
    --zarzis-gradient: linear-gradient(135deg, #E50914 0%, #FF6F00 50%, #FFC700 100%);
    --zarzis-glow: 0 0 25px rgba(229, 9, 20, 0.55), 0 0 40px rgba(255, 199, 0, 0.45);

    /* Traditional Ludo Palettes (Rouge, Vert, Jaune, Bleu Classiques) */
    --color-red: #E53935;
    --color-red-dark: #B71C1C;
    --color-red-light: #FF8A80;
    --color-red-glow: rgba(229, 57, 53, 0.65);

    --color-yellow: #FDD835;
    --color-yellow-dark: #F57F17;
    --color-yellow-light: #FFF59D;
    --color-yellow-glow: rgba(253, 216, 53, 0.65);

    --color-green: #43A047;
    --color-green-dark: #1B5E20;
    --color-green-light: #A5D6A7;
    --color-green-glow: rgba(67, 160, 71, 0.55);

    --color-blue: #1E88E5;
    --color-blue-dark: #0D47A1;
    --color-blue-light: #90CAF9;
    --color-blue-glow: rgba(30, 136, 229, 0.55);

    /* Luxury Gold & Typography */
    --gold: #FFC700;
    --gold-glow: rgba(255, 199, 0, 0.6);
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;

    /* Board Sizing (Agrandi légèrement pour plus de confort visuel) */
    --board-size: min(91vmin, 700px);
    --cell-size: calc(var(--board-size) / 15);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(circle at 10% 12%, rgba(229, 9, 20, 0.28), transparent 45%),
                radial-gradient(circle at 90% 88%, rgba(255, 199, 0, 0.24), transparent 45%),
                radial-gradient(circle at 50% 15%, rgba(229, 9, 20, 0.16), transparent 45%),
                radial-gradient(circle at 50% 50%, #110915 0%, #060408 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    user-select: none;
}

/* -------------------------------------------------------------------------
   Header & Navigation (Zarzis Prestige Edition)
------------------------------------------------------------------------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: rgba(15, 9, 20, 0.90);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid rgba(255, 199, 0, 0.28);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6), 0 2px 20px rgba(229, 9, 20, 0.25);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-img-badge {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #FFC700;
    box-shadow: 0 0 18px rgba(255, 199, 0, 0.55), 0 0 10px rgba(229, 9, 20, 0.45);
    background: #FFFFFF;
}

.center-logo-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

@keyframes horseFloat {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-4px) rotate(4deg); }
}

.logo-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.logo-text h1 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #FFFFFF 15%, #FFC700 65%, #E50914 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 22px rgba(255, 199, 0, 0.45);
}

.zarzis-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    background: linear-gradient(135deg, rgba(229, 9, 20, 0.35), rgba(255, 199, 0, 0.28));
    border: 1px solid rgba(255, 199, 0, 0.65);
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    color: #FFF275;
    letter-spacing: 0.8px;
    box-shadow: 0 0 16px rgba(229, 9, 20, 0.4);
    text-transform: uppercase;
    animation: zarzisPulse 2.4s infinite alternate;
}

@keyframes zarzisPulse {
    0% { box-shadow: 0 0 10px rgba(229, 9, 20, 0.35); border-color: rgba(255, 199, 0, 0.5); }
    100% { box-shadow: 0 0 22px rgba(255, 199, 0, 0.65), 0 0 12px rgba(229, 9, 20, 0.6); border-color: rgba(255, 199, 0, 0.95); }
}

.logo-text p {
    font-size: 0.76rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* -------------------------------------------------------------------------
   Modern Buttons & Badges (Zarzis Sang et Or)
------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

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

.btn-primary {
    background: linear-gradient(135deg, #E50914 0%, #E65100 48%, #FFC700 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 18px rgba(229, 9, 20, 0.5), 0 0 12px rgba(255, 199, 0, 0.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 26px rgba(229, 9, 20, 0.7), 0 0 20px rgba(255, 199, 0, 0.55);
    background: linear-gradient(135deg, #FF1A3C 0%, #FF6F00 48%, #FFD600 100%);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--border-glass);
    backdrop-filter: blur(8px);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-accent);
    transform: translateY(-1px);
}

.btn-voice {
    background: linear-gradient(135deg, #EC4899, #8B5CF6);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
}
.btn-voice:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(236, 72, 153, 0.6);
}

.btn-record {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    font-weight: 700;
    border-radius: 30px;
    padding: 10px 24px;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
}
.btn-record:disabled {
    background: #334155;
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-stop {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 30px;
    padding: 10px 24px;
    border: 1px solid var(--border-glass);
}
.btn-stop:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* -------------------------------------------------------------------------
   Layout Container
------------------------------------------------------------------------- */
.game-container {
    display: flex;
    flex: 1;
    max-width: 1560px;
    margin: 0 auto;
    padding: 20px 28px;
    gap: 28px;
    align-items: flex-start;
    justify-content: center;
}

/* Left Sidebar: Player Status HUD */
.sidebar-left {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.players-hud {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.player-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-top: 3px solid var(--color-red);
    border-radius: 16px;
    padding: 14px 16px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.player-card.active-turn {
    transform: scale(1.03) translateX(6px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}

.player-card.active-turn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: shineCard 2.5s infinite;
}

@keyframes shineCard {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

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

.player-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

.player-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.badge {
    margin-left: auto;
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.badge-human { background: rgba(59, 130, 246, 0.22); color: #93C5FD; border: 1px solid rgba(59, 130, 246, 0.35); }
.badge-bot { background: rgba(148, 163, 184, 0.18); color: #CBD5E1; border: 1px solid rgba(148, 163, 184, 0.25); }

.player-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    padding: 8px 6px;
    border-radius: 10px;
    font-size: 0.8rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.kill-stat {
    color: #F87171;
    font-weight: 800;
}

.turn-indicator-pill {
    margin-top: 10px;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
    padding: 4px;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    animation: pulseTurn 1.6s infinite alternate;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes pulseTurn {
    0% { opacity: 0.75; transform: scale(0.99); }
    100% { opacity: 1; transform: scale(1.02); }
}

/* -------------------------------------------------------------------------
   Center: The Modern Ludo Board & Controls
------------------------------------------------------------------------- */
.board-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.ludo-board-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: radial-gradient(circle at 50% 50%, #172338 0%, #0A101D 100%);
    padding: 20px;
    border-radius: 32px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.95), 
                0 0 50px rgba(59, 130, 246, 0.15), 
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
}

.corners-bar {
    display: flex;
    justify-content: space-between;
    width: var(--board-size);
    gap: 14px;
}

.corner-pad {
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: var(--glass-blur);
    border: 1.5px solid var(--border-glass);
    border-radius: 18px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0.62;
}

.corner-pad.active-corner {
    opacity: 1;
    border-color: #FBBF24;
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.45), inset 0 0 15px rgba(251, 191, 36, 0.15);
    transform: scale(1.03);
}

.corner-pad.corner-red.active-corner { border-color: var(--color-red); box-shadow: 0 0 28px var(--color-red-glow); }
.corner-pad.corner-green.active-corner { border-color: var(--color-green); box-shadow: 0 0 28px var(--color-green-glow); }
.corner-pad.corner-yellow.active-corner { border-color: var(--color-yellow); box-shadow: 0 0 28px var(--color-yellow-glow); }
.corner-pad.corner-blue.active-corner { border-color: var(--color-blue); box-shadow: 0 0 28px var(--color-blue-glow); }

.corner-info-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.corner-header {
    display: flex;
    align-items: center;
    gap: 7px;
}

.corner-name {
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.corner-stats {
    display: flex;
    gap: 8px;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.45);
    padding: 4px 8px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.corner-last-roll b {
    color: #FBBF24;
    font-size: 0.9rem;
}

.btn-corner-roll {
    padding: 5px 10px;
    border-radius: 9px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.28);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}

.btn-roll-red { background: linear-gradient(135deg, #E50914, #990008); box-shadow: 0 3px 12px rgba(229, 9, 20, 0.45); }
.btn-roll-green { background: linear-gradient(135deg, #00E676, #047857); color: #042F2E; box-shadow: 0 3px 12px rgba(0, 230, 118, 0.35); }
.btn-roll-yellow { background: linear-gradient(135deg, #FFC700, #B45309); color: #1E0F00; box-shadow: 0 3px 12px rgba(255, 199, 0, 0.4); }
.btn-roll-blue { background: linear-gradient(135deg, #00D2FF, #005082); box-shadow: 0 3px 12px rgba(0, 210, 255, 0.4); }

.btn-corner-roll:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.03);
    filter: brightness(1.12);
}

.btn-corner-roll:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

/* Individual 3D Dice Stage inside each Corner Pad */
.corner-dice-stage {
    width: 52px;
    height: 52px;
    perspective: 400px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    padding: 2px;
    transition: transform 0.2s, filter 0.2s;
}

.corner-pad.active-corner .corner-dice-stage {
    animation: diceBoxPulse 0.95s infinite alternate;
}

.corner-pad:not(.active-corner) .corner-dice-stage {
    cursor: not-allowed;
    filter: saturate(0.75);
}

@keyframes diceBoxPulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.45)); }
    100% { transform: scale(1.11); filter: drop-shadow(0 0 16px #FBBF24); }
}

.corner-arrow {
    font-size: 1.5rem;
}
.arrow-red, .arrow-blue {
    animation: arrowBounceRight 0.7s infinite alternate;
}
@keyframes arrowBounceRight {
    0% { transform: translateX(0); }
    100% { transform: translateX(8px); }
}
.arrow-green, .arrow-yellow {
    animation: arrowBounceLeft 0.7s infinite alternate;
}
@keyframes arrowBounceLeft {
    0% { transform: translateX(0); }
    100% { transform: translateX(-8px); }
}

/* -------------------------------------------------------------------------
   The 15x15 Traditional White & Classic Colors Board Wrapper
------------------------------------------------------------------------- */
.board-wrapper {
    width: var(--board-size);
    height: var(--board-size);
    background: #FFFFFF;
    border-radius: 18px;
    padding: 6px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.8), 
                0 0 0 4px #1E293B;
    border: 3px solid #CBD5E1;
    position: relative;
    user-select: none;
    transition: transform 0.15s ease-out;
}

.shake-fx {
    animation: screenShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes screenShake {
    10%, 90% { transform: translate3d(-4px, 0, 0); }
    20%, 80% { transform: translate3d(6px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}

#board-container {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 2.5px solid #1E293B;
    background: #0F172A;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    grid-template-rows: repeat(15, minmax(0, 1fr));
    width: 100%;
    height: 100%;
    gap: 2px;
    padding: 0;
    background: #0F172A;
    border: none;
    position: relative;
    box-sizing: border-box;
}

.board-cell {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: calc(var(--cell-size) * 0.42);
    line-height: 1;
    font-weight: 800;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    transition: background 0.2s, transform 0.15s;
}

/* Stables Grid Placeholders (transparent so colored paddocks show) */
.cell-stable {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Center Grid Placeholder (transparent so nexus overlay shows) */
.cell-center {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* -------------------------------------------------------------------------
   Traditional Stables Overlay (Colored Outer Frame + Smaller Crisp White Inner Yard)
------------------------------------------------------------------------- */
.stables-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 2;
}

.stable-quadrant {
    position: absolute;
    width: 40%;
    height: 40%;
    padding: 2px;
    box-sizing: border-box;
}

.quad-red { top: 0; left: 0; }
.quad-green { top: 0; right: 0; }
.quad-yellow { bottom: 0; right: 0; }
.quad-blue { bottom: 0; left: 0; }

.stable-card {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2.5px solid #1E293B;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    position: relative;
}

.card-red {
    background: #E53935;
}
.card-green {
    background: #43A047;
}
.card-yellow {
    background: #FDD835;
}
.card-blue {
    background: #1E88E5;
}

.stable-badge {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    color: #0F172A;
    padding: 2px 8px;
    border-radius: 14px;
    border: 1.5px solid #1E293B;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

.stable-badge-icon {
    font-size: 0.78rem;
}
.stable-badge-text {
    font-size: 0.68rem;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: -0.2px;
}

/* Smaller White Inner Box inside each Stable */
.stable-plate {
    position: absolute;
    top: 18%;
    left: 18%;
    width: 64%;
    height: 64%;
    background: #FFFFFF;
    border-radius: 16px;
    border: 2.5px solid #1E293B;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Smaller Pawn Slots inside the White Inner Box */
.pedestal-slot {
    position: absolute;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: #FFFFFF;
    border: 3px solid #1E293B;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.slot-red { background: rgba(229, 57, 53, 0.22); border-color: #E53935; }
.slot-green { background: rgba(67, 160, 71, 0.22); border-color: #43A047; }
.slot-yellow { background: rgba(253, 216, 53, 0.32); border-color: #FBC02D; }
.slot-blue { background: rgba(30, 136, 229, 0.22); border-color: #1E88E5; }

.slot-0 { top: 28%; left: 28%; }
.slot-1 { top: 28%; left: 72%; }
.slot-2 { top: 72%; left: 28%; }
.slot-3 { top: 72%; left: 72%; }

/* -------------------------------------------------------------------------
   Center Victory Nexus (Traditional 4 Colored Triangles + Mister Znina Logo)
------------------------------------------------------------------------- */
.center-nexus-overlay {
    position: absolute;
    top: 40%;
    left: 40%;
    width: 20%;
    height: 20%;
    pointer-events: none;
    z-index: 3;
    border-radius: 12px;
    overflow: hidden;
    border: 2.5px solid #1E293B;
    background: #FFFFFF;
}

.center-tri {
    position: absolute;
    width: 100%;
    height: 100%;
}

.tri-left {
    background: #E53935;
    clip-path: polygon(0 0, 50% 50%, 0 100%);
    opacity: 1;
}
.tri-top {
    background: #43A047;
    clip-path: polygon(0 0, 100% 0, 50% 50%);
    opacity: 1;
}
.tri-right {
    background: #FDD835;
    clip-path: polygon(100% 0, 100% 100%, 50% 50%);
    opacity: 1;
}
.tri-bottom {
    background: #1E88E5;
    clip-path: polygon(0 100%, 100% 100%, 50% 50%);
    opacity: 1;
}

.center-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    background: #FFFFFF;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    border: 2.5px solid #1E293B;
}

/* -------------------------------------------------------------------------
   Track Cells & Starting Launchpads (High-Contrast Traditional Ludo Circuit)
------------------------------------------------------------------------- */
.cell-track {
    background: #FFFFFF !important;
    border: 1.5px solid #1E293B !important;
    border-radius: 5px !important;
    box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.12) !important;
    color: #0F172A;
}

.cell-track:hover {
    background: #F8FAFC !important;
    border-color: #000000 !important;
}

/* Start Cells */
.start-red { background: #E53935 !important; border: 1.5px solid #1E293B !important; border-radius: 5px !important; color: #FFFFFF !important; }
.start-green { background: #43A047 !important; border: 1.5px solid #1E293B !important; border-radius: 5px !important; color: #FFFFFF !important; }
.start-yellow { background: #FDD835 !important; border: 1.5px solid #1E293B !important; border-radius: 5px !important; color: #1E293B !important; }
.start-blue { background: #1E88E5 !important; border: 1.5px solid #1E293B !important; border-radius: 5px !important; color: #FFFFFF !important; }

.start-icon {
    font-size: calc(var(--cell-size) * 0.52);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* Safe Star Squares */
.cell-safe-star {
    background: #FFF9C4 !important;
    border: 1.5px solid #F59E0B !important;
    border-radius: 5px !important;
    box-shadow: inset 0 -1px 2px rgba(245, 158, 11, 0.2) !important;
}

.safe-star-icon {
    font-size: calc(var(--cell-size) * 0.50);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D97706;
}

/* Home Ladders ("Le Ciel" - Solid Traditional Colors) */
.ladder-red { background: #E53935 !important; border: 1.5px solid #B71C1C !important; color: #FFFFFF !important; font-weight: 900; border-radius: 5px !important; }
.ladder-green { background: #43A047 !important; border: 1.5px solid #1B5E20 !important; color: #FFFFFF !important; font-weight: 900; border-radius: 5px !important; }
.ladder-yellow { background: #FDD835 !important; border: 1.5px solid #F57F17 !important; color: #1E293B !important; font-weight: 900; border-radius: 5px !important; }
.ladder-blue { background: #1E88E5 !important; border: 1.5px solid #0D47A1 !important; color: #FFFFFF !important; font-weight: 900; border-radius: 5px !important; }

.ladder-num {
    font-size: calc(var(--cell-size) * 0.42);
    line-height: 1;
    font-weight: 900;
}

/* -------------------------------------------------------------------------
   Horse Layer & Modern Pieces
------------------------------------------------------------------------- */
.horse-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
}

.horse-piece {
    position: absolute;
    width: calc(var(--cell-size) * 0.94);
    height: calc(var(--cell-size) * 0.94);
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: left 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), 
                top 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 12;
}

/* Invisible tap target expansion for phone touchscreens (>=44px touch hitbox) */
.horse-piece::before {
    content: '';
    position: absolute;
    top: -14px;
    left: -14px;
    right: -14px;
    bottom: -14px;
    z-index: 20;
}

.horse-svg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    filter: drop-shadow(0 4px 6px rgba(15, 23, 42, 0.45));
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pion-pedestal {
    display: none;
}

.pion-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
    pointer-events: none;
    user-select: none;
}

.horse-piece:hover .horse-svg {
    transform: scale(1.25) translateY(-8px);
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.9));
}

/* Valid Move Glow Animation */
.horse-valid-move {
    z-index: 25;
}

.horse-valid-move .horse-svg {
    animation: validMoveBounce 0.65s infinite alternate;
    filter: drop-shadow(0 0 14px #FFFFFF) drop-shadow(0 0 25px var(--gold));
}

@keyframes validMoveBounce {
    0% { transform: translateY(0) scale(1.08); }
    100% { transform: translateY(-12px) scale(1.28); }
}

/* Hopping Animation during movement */
.horse-hopping .horse-svg {
    animation: singleHop 0.18s ease-in-out;
}

@keyframes singleHop {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.35) rotate(-6deg); }
    100% { transform: translateY(0) scale(1); }
}

/* Elimination Spin Animation */
.horse-eliminated-spin {
    animation: eliminateSpin 0.4s ease-in-out forwards;
}

@keyframes eliminateSpin {
    0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.7) rotate(360deg); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(720deg); opacity: 1; }
}

/* -------------------------------------------------------------------------
   Modern 3D Dice Stage & Controls
------------------------------------------------------------------------- */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-card);
    padding: 12px 24px;
    border-radius: 18px;
    border: 1px solid var(--border-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.turn-status-banner {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
    text-align: center;
}

.dice-cube {
    width: 48px;
    height: 48px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-15deg) rotateY(25deg);
    transition: transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dice-face {
    position: absolute;
    width: 48px;
    height: 48px;
    background: linear-gradient(145deg, #FFFFFF, #E2E8F0);
    border: 2px solid #CBD5E1;
    border-radius: 11px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.18), 0 4px 10px rgba(0, 0, 0, 0.4);
    display: grid;
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    padding: 6px;
    box-sizing: border-box;
}

/* Color-specific 3D Dice Themes (Each player plays with their OWN colored dice!) */
.dice-red .dice-face {
    background: linear-gradient(145deg, #FF2A3C 0%, #B8000A 100%);
    border-color: #FFC700;
    box-shadow: inset 0 0 8px rgba(255, 199, 0, 0.25), 0 4px 10px rgba(229, 9, 20, 0.45);
}
.dice-red .pip { background: #FFFFFF; }
.dice-red .pip-center { background: #FFC700; box-shadow: 0 0 6px #FFC700; }

.dice-green .dice-face {
    background: linear-gradient(145deg, #00E676 0%, #047857 100%);
    border-color: #A7F3D0;
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.25), 0 4px 10px rgba(0, 230, 118, 0.4);
}
.dice-green .pip { background: #042F2E; }
.dice-green .pip-center { background: #FFFFFF; box-shadow: 0 0 6px #FFFFFF; }

.dice-yellow .dice-face {
    background: linear-gradient(145deg, #FFE033 0%, #D97706 100%);
    border-color: #FEF08A;
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.3), 0 4px 10px rgba(255, 199, 0, 0.45);
}
.dice-yellow .pip { background: #14080E; }
.dice-yellow .pip-center { background: #E50914; box-shadow: 0 0 6px #E50914; }

.dice-blue .dice-face {
    background: linear-gradient(145deg, #00D2FF 0%, #005082 100%);
    border-color: #BAE6FD;
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.25), 0 4px 10px rgba(0, 210, 255, 0.4);
}
.dice-blue .pip { background: #FFFFFF; }
.dice-blue .pip-center { background: #FFC700; box-shadow: 0 0 6px #FFC700; }

.pip {
    background: #0F172A;
    border-radius: 50%;
    width: 8px;
    height: 8px;
    align-self: center;
    justify-self: center;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Cube 3D Face Transforms (48px cube -> 24px half-size) */
.face-1 { transform: translateZ(24px); }
.face-2 { transform: rotateX(-90deg) translateZ(24px); }
.face-3 { transform: rotateY(90deg) translateZ(24px); }
.face-4 { transform: rotateY(-90deg) translateZ(24px); }
.face-5 { transform: rotateX(90deg) translateZ(24px); }
.face-6 { transform: rotateX(180deg) translateZ(24px); }

/* Pip placements */
.face-1 .pip:nth-child(1) { grid-area: 2 / 2; width: 13px; height: 13px; }
.face-2 .pip:nth-child(1) { grid-area: 1 / 1; }
.face-2 .pip:nth-child(2) { grid-area: 3 / 3; }
.face-3 .pip:nth-child(1) { grid-area: 1 / 1; }
.face-3 .pip:nth-child(2) { grid-area: 2 / 2; }
.face-3 .pip:nth-child(3) { grid-area: 3 / 3; }
.face-4 .pip:nth-child(1) { grid-area: 1 / 1; }
.face-4 .pip:nth-child(2) { grid-area: 1 / 3; }
.face-4 .pip:nth-child(3) { grid-area: 3 / 1; }
.face-4 .pip:nth-child(4) { grid-area: 3 / 3; }
.face-5 .pip:nth-child(1) { grid-area: 1 / 1; }
.face-5 .pip:nth-child(2) { grid-area: 1 / 3; }
.face-5 .pip:nth-child(3) { grid-area: 2 / 2; }
.face-5 .pip:nth-child(4) { grid-area: 3 / 1; }
.face-5 .pip:nth-child(5) { grid-area: 3 / 3; }
.face-6 .pip:nth-child(1) { grid-area: 1 / 1; }
.face-6 .pip:nth-child(2) { grid-area: 1 / 3; }
.face-6 .pip:nth-child(3) { grid-area: 2 / 1; }
.face-6 .pip:nth-child(4) { grid-area: 2 / 3; }
.face-6 .pip:nth-child(5) { grid-area: 3 / 1; }
.face-6 .pip:nth-child(6) { grid-area: 3 / 3; }

.btn-roll {
    font-size: 1.1rem;
    padding: 13px 28px;
    border-radius: 14px;
    background: linear-gradient(135deg, #EF4444, #F59E0B);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
}
.btn-roll:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.65);
    background: linear-gradient(135deg, #F43F5E, #FBBF24);
}
.btn-roll:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

/* -------------------------------------------------------------------------
   Right Sidebar: Elimination Feed & Quick Studio
------------------------------------------------------------------------- */
.sidebar-right {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 18px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 10px;
    letter-spacing: -0.2px;
}

.elimination-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 290px;
    overflow-y: auto;
}

.feed-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 8px;
    font-style: italic;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.35);
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 0.84rem;
    border-left: 3px solid #EF4444;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.feed-time {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
}

.feed-text {
    flex: 1;
}

.feed-replay-btn {
    background: transparent;
    border: none;
    font-size: 1.05rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: transform 0.2s;
}
.feed-replay-btn:hover {
    transform: scale(1.3);
}

/* -------------------------------------------------------------------------
   Elimination Banner (Comic Burst)
------------------------------------------------------------------------- */
.elimination-banner {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-180px) scale(0.8);
    background: linear-gradient(135deg, #E11D48, #9F1239);
    color: white;
    padding: 18px 32px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 20px 50px rgba(225, 29, 72, 0.6), 0 0 30px rgba(255, 255, 255, 0.35);
    border: 2px solid #FCD34D;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.elimination-banner.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

.elim-comic-burst {
    font-size: 2.8rem;
    animation: burstSpin 1s infinite alternate;
}

@keyframes burstSpin {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.25) rotate(18deg); }
}

.elim-title {
    font-family: 'Fredoka', cursive;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #FCD34D;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.elim-subtitle {
    font-size: 1rem;
    font-weight: 600;
    margin: 3px 0 6px 0;
}

.elim-voice-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FEF08A;
}

/* -------------------------------------------------------------------------
   Toast Notifications
------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: white;
    padding: 12px 20px;
    border-radius: 14px;
    border: 1px solid var(--border-glass);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
    0% { transform: translateY(20px) scale(0.9); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.toast-success { border-color: rgba(16, 185, 129, 0.5); }
.toast-warning { border-color: rgba(245, 158, 11, 0.5); }
.toast-info { border-color: rgba(59, 130, 246, 0.5); }

/* -------------------------------------------------------------------------
   Modals (Studio Vocal & Multijoueur)
------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(4, 7, 14, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    width: 90%;
    max-width: 580px;
    padding: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(59, 130, 246, 0.15);
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}
.modal-close-btn:hover {
    color: white;
    transform: scale(1.2);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.voice-list-container {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.voice-item-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.voice-item-card .voice-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
}

.voice-item-card .voice-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 6px 10px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.voice-item-card .voice-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* -------------------------------------------------------------------------
   Ultra-Responsive Mobile & Smartphone Engine (< 900px, < 768px, < 480px, < 380px)
------------------------------------------------------------------------- */

/* Tablet & Smaller Screens */
@media (max-width: 1024px) {
    .game-container {
        flex-direction: column;
        align-items: center;
        padding: 12px 8px;
        gap: 16px;
    }
    .board-section {
        order: 1;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .sidebar-left {
        order: 2;
        width: 100%;
        max-width: var(--board-size);
    }
    .sidebar-right {
        order: 3;
        width: 100%;
        max-width: var(--board-size);
    }
    .players-hud {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Standard Mobile Smartphones (iPhone, Samsung, Xiaomi, etc. <= 768px) */
@media (max-width: 768px) {
    :root {
        --board-size: min(92vw, calc(100dvh - 215px), calc(100vh - 215px), 340px);
    }

    html, body {
        height: 100%;
        max-height: 100dvh;
        overflow: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    body {
        padding-bottom: env(safe-area-inset-bottom, 2px);
        justify-content: flex-start;
    }

    /* Masquer TOUS les boutons inutiles sur smartphone (Studio, Téléphone, Son, Relance, Démo...) */
    .header-actions {
        display: none !important;
    }

    /* Masquer les barres latérales (panneaux de joueurs, règles, journal d'élimination) pour ne laisser QUE le jeu */
    .sidebar-left, 
    .sidebar-right {
        display: none !important;
    }

    /* Header ultra-compact centré sur le titre du jeu */
    .app-header {
        padding: 2px 6px;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 0;
        position: relative;
        min-height: 28px;
    }

    .logo-container {
        width: auto;
        justify-content: center;
        gap: 6px;
    }

    .logo-img-badge {
        width: 22px;
        height: 22px;
        border-radius: 5px;
    }

    .logo-text h1 {
        font-size: 0.88rem;
    }

    .logo-text p {
        display: none;
    }

    .zarzis-badge {
        font-size: 0.52rem;
        padding: 1px 4px;
    }

    .game-container {
        padding: 2px;
        gap: 0;
        width: 100%;
        max-width: 100vw;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
    }

    /* Mobile Board Frame - Centré plein écran */
    .board-section {
        order: 1;
        width: 100%;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
    }

    .ludo-board-frame {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .board-wrapper {
        width: var(--board-size);
        height: var(--board-size);
        padding: 2px;
        border-radius: 12px;
    }

    .corners-bar {
        width: var(--board-size);
        gap: 4px;
        margin-bottom: 2px;
    }

    .corners-bottom {
        margin-top: 2px;
        margin-bottom: 0;
    }

    .corner-pad {
        padding: 2px 5px;
        gap: 3px;
        border-radius: 7px;
    }

    .corner-name {
        font-size: 0.66rem;
        max-width: 65px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .corner-stats {
        font-size: 0.58rem;
        gap: 2px;
    }

    .corner-dice-stage {
        width: 32px;
        height: 32px;
        transform: scale(0.62);
    }

    .btn-corner-roll {
        padding: 1px 4px;
        font-size: 0.58rem;
    }

    .corner-arrow {
        font-size: 0.8rem;
    }

    /* Mobile Controls (Ergonomic thumb zone) */
    .controls-bar {
        width: var(--board-size);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 4px;
        margin-top: 2px;
        padding: 4px 6px;
        background: rgba(15, 9, 20, 0.85);
        border: 1px solid var(--border-glass);
        border-radius: 10px;
        backdrop-filter: blur(10px);
    }

    .turn-status-banner {
        font-size: 0.70rem;
    }

    #btn-roll-main {
        font-size: 0.78rem !important;
        padding: 6px 10px !important;
    }

    /* Modals on Mobile Phones */
    .modal-box, .modal-card {
        width: 95vw;
        max-width: 95vw;
        max-height: 85vh;
        overflow-y: auto;
        padding: 16px;
        border-radius: 18px;
        margin: 8px;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }
}

/* Extra Compact Phones (iPhone SE, Galaxy A-series, small screens <= 420px) */
@media (max-width: 420px) {
    :root {
        --board-size: min(94vw, calc(100dvh - 150px), calc(100vh - 150px), 360px);
    }

    .board-wrapper {
        padding: 3px;
        border-radius: 14px;
    }

    .board-grid {
        gap: 1.5px;
    }

    .corner-pad {
        padding: 4px 6px;
        gap: 4px;
    }

    .corner-name {
        font-size: 0.68rem;
        max-width: 65px;
    }

    .corner-stats {
        font-size: 0.64rem;
    }

    .corner-dice-box {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .ladder-num {
        font-size: 0.65rem;
    }

    .center-core {
        width: 40px;
        height: 40px;
    }

    .core-crown {
        font-size: 0.95rem;
    }

    .core-zarzis-label {
        font-size: 0.42rem;
    }

    .core-akkara-sub {
        font-size: 0.36rem;
    }

    .players-hud {
        grid-template-columns: 1fr;
    }
}
