/* ==========================================================================
   ULAR TANGGA 2D - ULTRA CASUAL GAME DESIGN SYSTEM
   Modern, Vibrant, 3D Polish, No Blank Space, Mobile-First
   ========================================================================== */

:root {
    --font-heading: 'Fredoka', cursive, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Outfit', sans-serif, -apple-system, BlinkMacSystemFont;

    /* Color Palettes */
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.45);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    
    --accent-gold: #f59e0b;
    --accent-gold-glow: rgba(245, 158, 11, 0.5);
    --gold-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    
    --success-green: #10b981;
    --success-glow: rgba(16, 185, 129, 0.45);
    --green-gradient: linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);

    /* Player Colors */
    --pawn-red: #ef4444;
    --pawn-red-glow: rgba(239, 68, 68, 0.55);
    --pawn-blue: #3b82f6;
    --pawn-blue-glow: rgba(59, 130, 246, 0.55);
    --pawn-green: #10b981;
    --pawn-green-glow: rgba(16, 185, 129, 0.55);
    --pawn-yellow: #f59e0b;
    --pawn-yellow-glow: rgba(245, 158, 11, 0.55);

    /* Backgrounds & Glassmorphism */
    --bg-dark-1: #090d16;
    --bg-dark-2: #13172c;
    --glass-bg: rgba(26, 35, 53, 0.82);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-glow: rgba(99, 102, 241, 0.2);

    /* Board Candy Tile Colors */
    --tile-color-1: #fed7aa; /* Peach */
    --tile-color-2: #bae6fd; /* Sky */
    --tile-color-3: #bbf7d0; /* Mint */
    --tile-color-4: #fef08a; /* Sun */
    --tile-color-5: #ddd6fe; /* Purple */
    --tile-color-6: #fbcfe8; /* Rose */
}

/* --- Resets & Global --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    height: 100%;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

body.game-body {
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    font-family: var(--font-body);
    background: radial-gradient(circle at 50% 15%, #1e1b4b 0%, #111827 60%, #090d16 100%);
    color: #f8fafc;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

#ambientCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.app-wrapper {
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
    box-sizing: border-box;
}

.ui-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
}
.ui-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==========================================================================
   1. HOME SCREEN
   ========================================================================== */

.home-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 1.25rem 1rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 2;
    box-sizing: border-box;
}

.floating-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.35;
    animation: blobWobble 9s ease-in-out infinite alternate;
}
.blob-1 { width: 220px; height: 220px; background: #6366f1; top: 0; left: 0; }
.blob-2 { width: 200px; height: 200px; background: #ec4899; bottom: 80px; right: 0; animation-delay: -3.5s; }
.blob-3 { width: 160px; height: 160px; background: #10b981; top: 45%; left: 0; animation-delay: -6s; }

@keyframes blobWobble {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(25px, 35px) scale(1.15); }
    100% { transform: translate(-20px, 15px) scale(0.95); }
}

.home-header {
    text-align: center;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-logo-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.65));
}

.brand-logo-glow {
    position: absolute;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.45) 0%, rgba(99, 102, 241, 0.3) 50%, transparent 70%);
    border-radius: 50%;
    filter: blur(20px);
    z-index: 0;
    pointer-events: none;
    animation: pulseLogoGlow 3.5s ease-in-out infinite alternate;
}

@keyframes pulseLogoGlow {
    0% { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.2); opacity: 1; }
}

.brand-logo-img {
    position: relative;
    z-index: 1;
    width: 130px;
    height: 130px;
    object-fit: contain;
    border-radius: 28px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    animation: floatLogo 4s ease-in-out infinite alternate;
    transition: transform 0.3s ease;
}

.brand-logo-img:hover {
    transform: scale(1.05) rotate(2deg);
}

@keyframes floatLogo {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-7px) rotate(1.5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

.title-top-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 0.2rem 0.75rem;
    border-radius: 2rem;
    margin-bottom: 0.35rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.title-top-badge .crown-icon {
    font-size: 0.85rem;
}

.logo-mascots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.mascot-badge {
    width: 54px;
    height: 54px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: mascotBounce 3s ease-in-out infinite;
}

.mascot-die {
    background: linear-gradient(135deg, #ffffff, #e2e8f0);
    transform: rotate(-10deg);
}
.mascot-snake {
    background: linear-gradient(135deg, #10b981, #047857);
    animation-delay: -1s;
}
.mascot-ladder {
    background: linear-gradient(135deg, #f59e0b, #b45309);
    transform: rotate(10deg);
    animation-delay: -2s;
}

@keyframes mascotBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.game-title-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-title {
    font-family: var(--font-heading);
    font-size: clamp(2.4rem, 8.5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(180deg, #fffbeb 0%, #fbbf24 35%, #f59e0b 60%, #b45309 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 0 #78350f) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
    line-height: 1.1;
    margin: 0;
}

.title-royale-badge {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #ffffff;
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 50%, #8b5cf6 100%);
    padding: 0.22rem 1.25rem;
    border-radius: 1.5rem;
    border: 1.5px solid rgba(245, 158, 11, 0.7);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.4);
    margin-top: -0.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    animation: royaleShimmer 2.5s ease-in-out infinite alternate;
}

.star-mini {
    color: #fef08a;
    font-size: 0.8rem;
    vertical-align: middle;
}

@keyframes royaleShimmer {
    0% { border-color: rgba(245, 158, 11, 0.6); box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3); }
    100% { border-color: rgba(254, 240, 138, 1); box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5); }
}

.game-subtitle {
    font-size: 0.95rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-top: 0.55rem;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.home-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
    box-sizing: border-box;
}

.btn-primary-play {
    width: 100%;
    max-width: 400px;
    background: var(--green-gradient);
    color: #ffffff;
    border-radius: 1.35rem;
    padding: 1.15rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-decoration: none;
    box-shadow: 0 8px 0 #065f46, 0 15px 30px rgba(16, 185, 129, 0.45);
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 0 #065f46, 0 18px 35px rgba(16, 185, 129, 0.55);
}

.btn-primary-play:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 #065f46, 0 6px 12px rgba(16, 185, 129, 0.4);
}

.btn-primary-play::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-25deg);
    animation: lightSweep 3.5s infinite;
}

@keyframes lightSweep {
    0% { left: -100%; }
    40%, 100% { left: 160%; }
}

.play-icon-box {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-content {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.play-text {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.1;
}

.play-sub {
    font-size: 0.8rem;
    opacity: 0.92;
    font-weight: 500;
}

.menu-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1.25rem 1.05rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
    overflow: hidden;
}

.card-title-badge {
    text-align: center;
    margin-bottom: 1.1rem;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    padding: 0.35rem 1rem;
    border-radius: 1rem;
    display: inline-block;
}

.mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.65);
    padding: 0.35rem;
    border-radius: 1rem;
    margin-bottom: 1.1rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.7rem 0.35rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    transition: all 0.2s ease;
    min-width: 0;
}

.tab-btn.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.45);
}

.mode-content {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.mode-content.hidden {
    display: none;
}

.preview-players, .local-players-preview, .player-name-inputs, .local-players-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.vs-divider {
    display: flex;
    justify-content: center;
    margin: -0.1rem 0;
}

.vs-badge {
    align-self: center;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 800;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 0.15rem 0.75rem;
    border-radius: 1rem;
}

/* Customizable Player Name Inputs */
.player-name-field {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(15, 23, 42, 0.65);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    padding: 0.42rem 0.75rem;
    border-radius: 0.85rem;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.player-name-field:focus-within {
    background: rgba(30, 41, 59, 0.9);
}

.player-name-field.focus-red:focus-within {
    border-color: #ef4444;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
}
.player-name-field.focus-blue:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
}
.player-name-field.focus-green:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}
.player-name-field.focus-yellow:focus-within {
    border-color: #f59e0b;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}

.player-field-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.player-field-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.1;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-field-input {
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.12rem 0;
    width: 100%;
    min-width: 0;
}

.player-field-input::placeholder {
    color: #64748b;
    font-weight: 500;
}

.btn-shuffle-name {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.btn-shuffle-name:hover {
    background: rgba(99, 102, 241, 0.3);
    color: #ffffff;
    border-color: #6366f1;
    transform: rotate(18deg) scale(1.05);
}

.btn-shuffle-name:active {
    transform: scale(0.92);
}

.player-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.6rem 0.9rem;
    border-radius: 0.8rem;
    font-size: 0.88rem;
    font-weight: 600;
}

.pawn-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 10px currentColor;
    border: 2px solid #ffffff;
}
.dot-red { background: var(--pawn-red); color: var(--pawn-red); }
.dot-blue { background: var(--pawn-blue); color: var(--pawn-blue); }
.dot-green { background: var(--pawn-green); color: var(--pawn-green); }
.dot-yellow { background: var(--pawn-yellow); color: var(--pawn-yellow); }

.player-count-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.65rem 0.95rem;
    border-radius: 0.8rem;
}

.count-buttons {
    display: flex;
    gap: 0.45rem;
}

.btn-count {
    width: 38px;
    height: 38px;
    border-radius: 0.6rem;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-count.active {
    background: var(--gold-gradient);
    color: #0f172a;
    border-color: #f59e0b;
    box-shadow: 0 0 14px var(--accent-gold-glow);
}

.btn-start-game {
    width: 100%;
    padding: 0.95rem;
    border-radius: 1rem;
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.btn-mode-single {
    background: var(--primary-gradient);
    box-shadow: 0 6px 0 #3730a3, 0 10px 20px rgba(99, 102, 241, 0.35);
}
.btn-mode-single:active { transform: translateY(4px); box-shadow: 0 2px 0 #3730a3; }

.btn-mode-local {
    background: var(--gold-gradient);
    box-shadow: 0 6px 0 #b45309, 0 10px 20px rgba(245, 158, 11, 0.35);
    color: #0f172a;
}
.btn-mode-local:active { transform: translateY(4px); box-shadow: 0 2px 0 #b45309; }

.home-actions {
    display: flex;
    gap: 0.65rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.btn-secondary {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    color: #e2e8f0;
    padding: 0.75rem 0.6rem;
    border-radius: 0.9rem;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.feature-item {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    padding: 0.7rem 0.35rem;
    border-radius: 0.9rem;
    text-align: center;
    min-width: 0;
}

.feature-icon-wrap {
    width: 38px;
    height: 38px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 0.75rem;
    margin: 0 auto 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-item strong {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #f1f5f9;
}

.feature-item p {
    font-size: 0.68rem;
    color: #94a3b8;
}

.home-footer {
    font-size: 0.78rem;
    color: #64748b;
    text-align: center;
    margin-top: 1.25rem;
}

/* ==========================================================================
   2. GAME ARENA SCREEN (UNIFIED LAYOUT - NO BLANK SPACE)
   ========================================================================== */

.game-screen {
    width: 100%;
    max-width: 960px; /* Snug, centered arcade console */
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: auto;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

/* HUD Top Header */
.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0.85rem;
    padding: 0 0.25rem;
}

.hud-btn {
    width: 42px;
    height: 42px;
    border-radius: 0.8rem;
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    backdrop-filter: blur(12px);
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.15s ease;
}

.hud-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}
.hud-btn:active { transform: scale(0.92); }

.hud-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.hud-brand-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.hud-mini-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    flex-shrink: 0;
}

.hud-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #fffbeb 0%, #fbbf24 40%, #f59e0b 70%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.hud-royale-tag {
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #ffffff;
    background: linear-gradient(135deg, #4f46e5, #8b5cf6);
    -webkit-background-clip: initial;
    -webkit-text-fill-color: #ffffff;
    padding: 0.12rem 0.45rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(245, 158, 11, 0.6);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.round-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 0.12rem 0.65rem;
    border-radius: 1rem;
    display: inline-block;
}

.hud-actions {
    display: flex;
    gap: 0.45rem;
}

/* ==========================================================================
   3. UNIFIED GAME ARENA (BOARD + CONSOLE SIDEBAR)
   ========================================================================== */

.game-arena {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 1.25rem;
    width: 100%;
    margin: 0 auto;
}

/* Board Wrapper */
.board-wrapper {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-frame {
    --frame-padding: 0.45rem;
    width: 520px;
    aspect-ratio: 1 / 1;
    position: relative;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 1.25rem;
    padding: var(--frame-padding);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 
                0 0 0 2.5px #334155, 
                0 0 0 4.5px rgba(245, 158, 11, 0.4),
                inset 0 2px 4px rgba(255, 255, 255, 0.15);
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 2.5px;
    width: 100%;
    height: 100%;
    border-radius: 0.85rem;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.35);
    padding: 1px;
}

/* Candy Tiles (3D Beveled) */
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 3px;
    border-radius: 5px;
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.6), inset 0 -2px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0,0,0,0.2);
}

.tile-c-1 { background: linear-gradient(135deg, #fed7aa, #fdba74); color: #7c2d12; border: 1px solid #fed7aa; }
.tile-c-2 { background: linear-gradient(135deg, #bae6fd, #7dd3fc); color: #0369a1; border: 1px solid #bae6fd; }
.tile-c-3 { background: linear-gradient(135deg, #bbf7d0, #86efac); color: #15803d; border: 1px solid #bbf7d0; }
.tile-c-4 { background: linear-gradient(135deg, #fef08a, #fde047); color: #854d0e; border: 1px solid #fef08a; }
.tile-c-5 { background: linear-gradient(135deg, #ddd6fe, #c4b5fd); color: #6b21a8; border: 1px solid #ddd6fe; }
.tile-c-6 { background: linear-gradient(135deg, #fbcfe8, #f472b6); color: #9d174d; border: 1px solid #fbcfe8; }

.tile-number {
    font-family: var(--font-heading);
    font-size: clamp(0.62rem, 1.8vw, 0.85rem);
    font-weight: 800;
    line-height: 1;
    opacity: 0.9;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
}

/* Tile Badges for 1 and 100 (NO EMOJI TOFU) */
.tile-start {
    background: linear-gradient(135deg, #86efac 0%, #22c55e 100%) !important;
    color: #064e3b !important;
}
.tile-badge-start {
    font-size: 0.55rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: #064e3b;
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.7);
    padding: 0 2px;
    border-radius: 2px;
    line-height: 1;
}

.tile-finish {
    background: linear-gradient(135deg, #fde047 0%, #f59e0b 50%, #ea580c 100%) !important;
    color: #78350f !important;
    animation: crownShimmer 1.8s infinite alternate;
}
.tile-badge-finish {
    align-self: flex-end;
    line-height: 1;
    display: flex;
}

/* Mystery Lucky Tiles */
.tile-mystery {
    background: radial-gradient(circle at 50% 40%, #fef08a 0%, #fbbf24 60%, #d97706 100%) !important;
    color: #78350f !important;
    border: 1.5px solid #fde047 !important;
    box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.8), 0 0 10px rgba(251, 191, 36, 0.6) !important;
    animation: starPulse 2.2s infinite ease-in-out;
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.04); filter: brightness(1.15) drop-shadow(0 0 6px rgba(245, 158, 11, 0.8)); }
}

.tile-badge-star {
    align-self: flex-end;
    line-height: 1;
    display: flex;
    animation: starSpin 7s infinite linear;
}

@keyframes starSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes crownShimmer {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.2) drop-shadow(0 0 8px #f59e0b); }
}

/* SVG Overlay */
.board-svg-overlay {
    position: absolute;
    top: var(--frame-padding);
    left: var(--frame-padding);
    right: var(--frame-padding);
    bottom: var(--frame-padding);
    width: calc(100% - (var(--frame-padding) * 2));
    height: calc(100% - (var(--frame-padding) * 2));
    pointer-events: none;
    z-index: 3;
}

/* Pawns Layer */
.pawns-container {
    position: absolute;
    top: var(--frame-padding);
    left: var(--frame-padding);
    right: var(--frame-padding);
    bottom: var(--frame-padding);
    width: calc(100% - (var(--frame-padding) * 2));
    height: calc(100% - (var(--frame-padding) * 2));
    pointer-events: none;
    z-index: 4;
}

.pawn-token {
    position: absolute;
    width: clamp(24px, 5.5vw, 36px);
    height: clamp(24px, 5.5vw, 36px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: clamp(0.75rem, 2vw, 0.95rem);
    font-weight: 800;
    color: #ffffff;
    border: 2.5px solid #ffffff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5), inset 0 3px 5px rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
    transition: left 0.24s cubic-bezier(0.34, 1.4, 0.64, 1), top 0.24s cubic-bezier(0.34, 1.4, 0.64, 1);
    will-change: left, top, transform;
}

.pawn-token.pawn-red {
    background: radial-gradient(circle at 35% 30%, #f87171 0%, #dc2626 60%, #991b1b 100%);
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.55), 0 0 12px var(--pawn-red-glow);
}
.pawn-token.pawn-blue {
    background: radial-gradient(circle at 35% 30%, #60a5fa 0%, #2563eb 60%, #1e40af 100%);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.55), 0 0 12px var(--pawn-blue-glow);
}
.pawn-token.pawn-green {
    background: radial-gradient(circle at 35% 30%, #34d399 0%, #059669 60%, #065f46 100%);
    box-shadow: 0 6px 14px rgba(5, 150, 105, 0.55), 0 0 12px var(--pawn-green-glow);
}
.pawn-token.pawn-yellow {
    background: radial-gradient(circle at 35% 30%, #fbbf24 0%, #d97706 60%, #92400e 100%);
    box-shadow: 0 6px 14px rgba(217, 119, 6, 0.55), 0 0 12px var(--pawn-yellow-glow);
}

.pawn-token.hopping {
    animation: pawnHop 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pawnHop {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -85%) scale(1.3); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.pawn-token.climbing {
    animation: pawnClimb 0.6s ease-in-out;
    filter: drop-shadow(0 0 14px #fde047);
}
@keyframes pawnClimb {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.35) rotate(15deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

.pawn-token.sliding {
    animation: pawnSlide 0.6s ease-in-out;
    filter: drop-shadow(0 0 14px #ef4444);
}
@keyframes pawnSlide {
    0% { transform: translate(-50%, -50%) scale(1); }
    25% { transform: translate(-50%, -50%) scale(0.9) rotate(-18deg); }
    75% { transform: translate(-50%, -50%) scale(1.25) rotate(18deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

/* ==========================================================================
   4. INTEGRATED SIDEBAR CONSOLE (Right Next to Board - No Gaps!)
   ========================================================================== */

.game-console {
    flex: 1;
    min-width: 290px;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.75rem;
}

.console-card {
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 1.15rem;
    padding: 0.85rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

/* Card Header inside console */
.card-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.card-header-title {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 1px;
}

.card-header-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-rename-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.68rem;
    font-family: var(--font-body);
    font-weight: 700;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-rename-pill:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #ffffff;
    border-color: #6366f1;
}

.mode-badge-pill {
    font-size: 0.72rem;
    font-weight: 700;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 0.12rem 0.55rem;
    border-radius: 0.5rem;
}

/* Scoreboard Player Cards inside console */
.players-bar {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
}

.player-card {
    background: rgba(15, 23, 42, 0.65);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.8rem;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.player-card.active-turn {
    background: rgba(30, 41, 59, 0.95);
    border-color: var(--turn-color, #f59e0b);
    box-shadow: 0 0 18px var(--turn-glow, rgba(245, 158, 11, 0.45));
    transform: scale(1.02);
}

.player-card.active-turn::after {
    content: 'GILIRAN!';
    position: absolute;
    top: 3px;
    right: 8px;
    font-size: 0.55rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--turn-color, #f59e0b);
    letter-spacing: 0.5px;
    animation: turnBlink 1.2s infinite;
}

@keyframes turnBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
    border: 2px solid #ffffff;
}

.card-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.card-name {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f8fafc;
}

.card-pos {
    font-size: 0.72rem;
    color: #94a3b8;
    font-weight: 600;
}

.card-info-top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.shield-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 0.08rem 0.35rem;
    border-radius: 0.4rem;
    line-height: 1;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.shield-badge.hidden {
    display: none !important;
}

/* Status Banner */
.status-banner {
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 1rem;
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.status-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.status-text-box {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.status-label {
    font-size: 0.72rem;
    color: var(--accent-gold);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.status-detail {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dice & Action Card */
.dice-action-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dice-box {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
}

.dice-display {
    width: 68px;
    height: 68px;
    perspective: 600px;
    flex-shrink: 0;
}

.dice-face {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 6px 0 #94a3b8, 0 10px 20px rgba(0,0,0,0.3);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 7px;
    box-sizing: border-box;
    transition: transform 0.15s ease;
}

.pip {
    display: block;
    background: #0f172a;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    margin: auto;
    box-shadow: inset 0 2px 3px rgba(0,0,0,0.5);
}

.face-1 .pip:nth-child(1) { grid-area: 2 / 2 / 3 / 3; background: #dc2626; width: 14px; height: 14px; }
.face-2 .pip:nth-child(1) { grid-area: 1 / 1 / 2 / 2; }
.face-2 .pip:nth-child(2) { grid-area: 3 / 3 / 4 / 4; }
.face-3 .pip:nth-child(1) { grid-area: 1 / 1 / 2 / 2; }
.face-3 .pip:nth-child(2) { grid-area: 2 / 2 / 3 / 3; }
.face-3 .pip:nth-child(3) { grid-area: 3 / 3 / 4 / 4; }
.face-4 .pip:nth-child(1) { grid-area: 1 / 1 / 2 / 2; }
.face-4 .pip:nth-child(2) { grid-area: 1 / 3 / 2 / 4; }
.face-4 .pip:nth-child(3) { grid-area: 3 / 1 / 4 / 2; }
.face-4 .pip:nth-child(4) { grid-area: 3 / 3 / 4 / 4; }
.face-5 .pip:nth-child(1) { grid-area: 1 / 1 / 2 / 2; }
.face-5 .pip:nth-child(2) { grid-area: 1 / 3 / 2 / 4; }
.face-5 .pip:nth-child(3) { grid-area: 2 / 2 / 3 / 3; }
.face-5 .pip:nth-child(4) { grid-area: 3 / 1 / 4 / 2; }
.face-5 .pip:nth-child(5) { grid-area: 3 / 3 / 4 / 4; }
.face-6 .pip:nth-child(1) { grid-area: 1 / 1 / 2 / 2; }
.face-6 .pip:nth-child(2) { grid-area: 2 / 1 / 3 / 2; }
.face-6 .pip:nth-child(3) { grid-area: 3 / 1 / 4 / 2; }
.face-6 .pip:nth-child(4) { grid-area: 1 / 3 / 2 / 4; }
.face-6 .pip:nth-child(5) { grid-area: 2 / 3 / 3 / 4; }
.face-6 .pip:nth-child(6) { grid-area: 3 / 3 / 4 / 4; }

.dice-face.rolling {
    animation: diceRollAnim 0.75s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes diceRollAnim {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(180deg) scale(1.25) translateY(-12px); }
    50% { transform: rotate(360deg) scale(0.9); }
    75% { transform: rotate(540deg) scale(1.2) translateY(-6px); }
    100% { transform: rotate(720deg) scale(1); }
}

.btn-roll-dice {
    flex: 1;
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    border-radius: 1rem;
    padding: 0.95rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    cursor: pointer;
    box-shadow: 0 6px 0 #3730a3, 0 10px 20px rgba(99, 102, 241, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    touch-action: manipulation;
}

.btn-roll-dice:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #3730a3, 0 12px 24px rgba(99, 102, 241, 0.5);
}

.btn-roll-dice:active:not(:disabled) {
    transform: translateY(5px);
    box-shadow: 0 1px 0 #3730a3;
}

.btn-roll-dice:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(40%);
    transform: none;
    box-shadow: 0 6px 0 #3730a3;
}

.btn-roll-dice .roll-text {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.rule-hint-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.74rem;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.4rem 0.65rem;
    border-radius: 0.6rem;
}

/* ==========================================================================
   5. TOAST NOTIFICATIONS & MODALS
   ========================================================================== */

.toast-container {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    width: 90%;
    max-width: 380px;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    color: #ffffff;
    padding: 0.75rem 1.1rem;
    border-radius: 0.9rem;
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    animation: toastIn 0.3s ease forwards;
}

@keyframes toastIn {
    0% { opacity: 0; transform: translateY(-15px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.toast-fadeout {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-15px); }
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: modalFadeIn 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes modalFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.confetti-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1001;
}

.win-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 2px solid rgba(245, 158, 11, 0.4);
    border-radius: 1.75rem;
    padding: 2.2rem 1.75rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
    z-index: 1002;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.75), 0 0 45px rgba(245, 158, 11, 0.3);
    animation: winCardPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes winCardPop {
    0% { transform: scale(0.65); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.trophy-sparkle {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
    animation: trophyWobble 2.5s infinite ease-in-out;
}

@keyframes trophyWobble {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-8deg) scale(1.08); }
    75% { transform: rotate(8deg) scale(1.08); }
}

.win-badge {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--accent-gold);
    letter-spacing: 2px;
}

.winner-name {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    margin: 0.35rem 0;
    color: #ffffff;
}

.win-subtitle {
    font-size: 0.88rem;
    color: #94a3b8;
    margin-bottom: 1.35rem;
}

.win-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.85rem 0.65rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
}

.win-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.win-stat-card strong {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    color: #ffffff;
}

.win-stat-card span:last-child {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 600;
}

.win-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.btn-modal-primary {
    width: 100%;
    background: var(--green-gradient);
    color: #ffffff;
    border: none;
    border-radius: 1rem;
    padding: 0.95rem;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 5px 0 #065f46;
}

.btn-modal-primary:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #065f46;
}

.btn-modal-secondary {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 1rem;
    padding: 0.85rem;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    display: block;
    box-sizing: border-box;
}

/* Rename Modal */
.rename-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 1.5rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.65);
    animation: modalFadeIn 0.25s ease;
}

.rename-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.1rem;
}

.rename-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: #ffffff;
    font-weight: 800;
}

.btn-modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 0.4rem;
    transition: all 0.15s ease;
}

.btn-modal-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.rename-inputs-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.rename-actions {
    display: flex;
    gap: 0.6rem;
}

.rename-actions .btn-confirm-cancel,
.rename-actions .btn-modal-primary {
    flex: 1;
    margin: 0;
    padding: 0.75rem;
    font-size: 0.9rem;
}

/* Exit Confirmation Card */
.confirm-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 1.5rem;
    padding: 1.75rem;
    width: 100%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
}

.confirm-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 0.6rem;
}

.confirm-card h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.confirm-card p {
    font-size: 0.88rem;
    color: #94a3b8;
    margin-bottom: 1.35rem;
}

.confirm-actions {
    display: flex;
    gap: 0.6rem;
}

.btn-confirm-cancel, .btn-confirm-leave {
    flex: 1;
    padding: 0.75rem 0.5rem;
    border-radius: 0.8rem;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-confirm-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    border: none;
}

.btn-confirm-leave {
    background: #ef4444;
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
}

/* ==========================================================================
   6. RULES / HOW TO PLAY SCREEN
   ========================================================================== */

.rules-container {
    max-width: 540px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

.rules-header {
    margin-bottom: 1.5rem;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #f59e0b;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.85rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    padding: 0.35rem 0.85rem;
    border-radius: 0.75rem;
    transition: all 0.15s ease;
}

.btn-back:hover {
    background: rgba(245, 158, 11, 0.22);
    transform: translateX(-3px);
}

.rules-logo-badge {
    display: block;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}
.rules-logo-badge img {
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.page-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    letter-spacing: 1px;
    color: #ffffff;
}

.page-desc {
    color: #94a3b8;
    font-size: 0.92rem;
}

.rules-content {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.rule-card {
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 1.25rem;
    padding: 1.1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.rule-card.highlight-card {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.08);
}

.rule-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.rule-body h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: #ffffff;
}

.rule-body p {
    font-size: 0.88rem;
    color: #cbd5e1;
    line-height: 1.45;
}

.rules-cta {
    margin-top: 1.25rem;
    width: 100%;
}

/* ==========================================================================
   7. RESPONSIVE BREAKPOINTS (DESKTOP & MOBILE TIGHTENING)
   ========================================================================== */

/* Mobile Portrait Screen (<= 767px) */
@media (max-width: 767px) {
    .game-screen {
        padding: 0.5rem 0.6rem 1.25rem;
    }

    .game-arena {
        flex-direction: column;
        align-items: center;
        gap: 0.65rem;
    }

    .board-frame {
        width: min(94vw, 460px);
        padding: 0.35rem;
    }

    .game-console {
        width: 100%;
        max-width: 460px;
        min-width: unset;
        gap: 0.6rem;
    }

    /* On mobile, player cards are arranged in horizontal grid */
    .players-bar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 0.4rem;
    }

    .dice-action-card {
        padding: 0.65rem 0.75rem;
    }

    .btn-roll-dice {
        padding: 0.85rem 1rem;
    }

    .btn-roll-dice .roll-text {
        font-size: 1.05rem;
    }

    .dice-display {
        width: 58px;
        height: 58px;
    }
}

/* Tablet & Medium Screen (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .game-screen {
        max-width: 960px;
        padding: 0.85rem 1rem 1.5rem;
    }

    .game-arena {
        align-items: stretch;
        gap: 1.25rem;
    }

    .board-frame {
        --frame-padding: 0.45rem;
        width: min(540px, calc(100vh - 130px));
    }

    .game-console {
        min-width: 290px;
        max-width: 360px;
    }
}

/* Laptops & Standard PC Screens (992px - 1399px) */
@media (min-width: 992px) {
    .game-screen {
        max-width: 1340px;
        width: 96%;
        padding: 0.75rem 1.5rem 1.5rem;
    }

    .game-hud {
        width: 100%;
        margin-bottom: 0.85rem;
    }

    .hud-title {
        font-size: 1.35rem;
    }

    .game-arena {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        justify-content: center;
        gap: 2rem;
        width: 100%;
    }

    /* Much larger, spacious board for laptops & PCs */
    .board-frame {
        --frame-padding: 0.6rem;
        width: min(720px, calc(100vh - 120px), 54vw);
        border-radius: 1.5rem;
        box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 
                    0 0 0 3px #334155, 
                    0 0 0 6px rgba(245, 158, 11, 0.45),
                    inset 0 3px 6px rgba(255, 255, 255, 0.2);
    }

    .board-grid {
        gap: 3.5px;
        border-radius: 1rem;
    }

    .tile {
        padding: 4px 5px;
        border-radius: 7px;
    }

    .tile-number {
        font-size: 0.95rem;
    }

    .pawn-token {
        width: 44px;
        height: 44px;
        font-size: 1.15rem;
        border-width: 3px;
    }

    .game-console {
        min-width: 350px;
        max-width: 440px;
        gap: 1rem;
    }

    .console-card {
        padding: 1.1rem;
        border-radius: 1.35rem;
    }

    .card-header-title {
        font-size: 0.85rem;
    }

    .player-card {
        padding: 0.65rem 0.9rem;
        border-radius: 0.95rem;
        gap: 0.8rem;
    }

    .card-avatar {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    .card-name {
        font-size: 0.92rem;
    }

    .card-pos {
        font-size: 0.8rem;
    }

    .status-banner {
        padding: 0.85rem 1.1rem;
        border-radius: 1.15rem;
    }

    .status-icon {
        font-size: 1.75rem;
    }

    .status-label {
        font-size: 0.78rem;
    }

    .status-detail {
        font-size: 0.95rem;
    }

    .dice-action-card {
        padding: 1.1rem;
    }

    .dice-display {
        width: 78px;
        height: 78px;
    }

    .dice-face {
        border-radius: 16px;
        padding: 8px;
    }

    .pip {
        width: 12px;
        height: 12px;
    }

    .face-1 .pip:nth-child(1) {
        width: 16px;
        height: 16px;
    }

    .btn-roll-dice {
        padding: 1.1rem 1.4rem;
        border-radius: 1.15rem;
    }

    .btn-roll-dice .roll-text {
        font-size: 1.18rem;
    }
}

/* Large Displays & Desktop Monitors (>= 1400px) */
@media (min-width: 1400px) {
    .game-screen {
        max-width: 1540px;
        padding: 1rem 2rem 2rem;
    }

    .game-arena {
        gap: 2.5rem;
    }

    /* Ultra roomy board for 1080p, 1440p, 4K desktop screens */
    .board-frame {
        --frame-padding: 0.75rem;
        width: min(840px, calc(100vh - 125px), 54vw);
        border-radius: 1.75rem;
    }

    .board-grid {
        gap: 4.5px;
        border-radius: 1.15rem;
    }

    .tile {
        padding: 5px 6px;
        border-radius: 8px;
    }

    .tile-number {
        font-size: 1.05rem;
    }

    .pawn-token {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
        border-width: 3.5px;
    }

    .game-console {
        min-width: 400px;
        max-width: 490px;
        gap: 1.25rem;
    }

    .console-card {
        padding: 1.35rem;
        border-radius: 1.5rem;
    }

    .player-card {
        padding: 0.75rem 1.1rem;
    }

    .card-avatar {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .card-name {
        font-size: 1.05rem;
    }

    .card-pos {
        font-size: 0.88rem;
    }

    .status-banner {
        padding: 1rem 1.25rem;
    }

    .status-detail {
        font-size: 1.05rem;
    }

    .dice-display {
        width: 86px;
        height: 86px;
    }

    .dice-face {
        border-radius: 18px;
        padding: 10px;
    }

    .pip {
        width: 14px;
        height: 14px;
    }

    .face-1 .pip:nth-child(1) {
        width: 18px;
        height: 18px;
    }

    .btn-roll-dice {
        padding: 1.25rem 1.6rem;
    }

    .btn-roll-dice .roll-text {
        font-size: 1.3rem;
    }
}

/* Landscape Mobile */
@media (orientation: landscape) and (max-height: 520px) {
    .game-screen {
        padding: 0.25rem 0.5rem;
        min-height: 100vh;
    }
    .game-hud {
        margin-bottom: 0.25rem;
    }
    .game-arena {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
    }
    .board-frame {
        width: min(76vh, 380px);
    }
    .game-console {
        max-width: 280px;
        gap: 0.35rem;
    }
    .console-card {
        padding: 0.5rem;
    }
    .dice-display {
        width: 50px;
        height: 50px;
    }
    .btn-roll-dice {
        padding: 0.65rem 0.85rem;
    }
    .btn-roll-dice .roll-text {
        font-size: 0.95rem;
    }
}

/* ==========================================================================
   7. BOT DIFFICULTY & MAP ARENA THEMES (NEW FEATURES)
   ========================================================================== */

/* Bot Difficulty Picker */
.difficulty-picker-box {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.65rem 0.75rem;
    border-radius: 0.9rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.diff-picker-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}

.diff-picker-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.diff-options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
}

.diff-btn {
    background: rgba(15, 23, 42, 0.7);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 0.45rem 0.1rem;
    border-radius: 0.75rem;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.diff-btn .diff-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.diff-btn.btn-diff-easy .diff-dot { background: #10b981; }
.diff-btn.btn-diff-medium .diff-dot { background: #f59e0b; }
.diff-btn.btn-diff-hard .diff-dot { background: #ef4444; }
.diff-btn.btn-diff-extreme .diff-dot { background: #a855f7; }

.diff-btn.active.btn-diff-easy {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #34d399;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}
.diff-btn.active.btn-diff-medium {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fbbf24;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}
.diff-btn.active.btn-diff-hard {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #f87171;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}
.diff-btn.active.btn-diff-extreme {
    background: rgba(168, 85, 247, 0.2);
    border-color: #a855f7;
    color: #c084fc;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.35);
}

.diff-desc-pill {
    font-size: 0.72rem;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.25rem 0.55rem;
    border-radius: 0.65rem;
    text-align: right;
    font-style: italic;
    max-width: 100%;
    word-break: break-word;
}

/* Map Arena Carousel / Selector */
.map-selector-section {
    margin-top: 1.1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.map-selector-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.55rem;
    gap: 0.35rem;
    width: 100%;
}

.map-selector-title {
    font-family: var(--font-heading);
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--accent-gold);
    letter-spacing: 1px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.map-cards-scroll {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.4rem;
    scrollbar-width: thin;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 640px) {
    .map-cards-scroll {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 0.5rem;
    }
    .map-card-btn {
        flex: 0 0 105px;
        min-width: 105px;
        scroll-snap-align: start;
    }
}

.map-card-btn {
    background: rgba(15, 23, 42, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.95rem;
    padding: 0.6rem 0.45rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    flex: 0 0 105px;
    min-width: 105px;
}

.map-card-btn:hover {
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.map-card-btn.active {
    border-color: var(--map-border-color, #fbbf24);
    box-shadow: 0 0 14px var(--map-glow-color, rgba(251, 191, 36, 0.45));
    background: rgba(30, 41, 59, 0.95);
}

.map-card-btn.card-map-candy { --map-border-color: #f472b6; --map-glow-color: rgba(244, 114, 182, 0.45); }
.map-card-btn.card-map-lava { --map-border-color: #ef4444; --map-glow-color: rgba(239, 68, 68, 0.45); }
.map-card-btn.card-map-cosmic { --map-border-color: #06b6d4; --map-glow-color: rgba(6, 182, 212, 0.45); }
.map-card-btn.card-map-jungle { --map-border-color: #10b981; --map-glow-color: rgba(16, 185, 129, 0.45); }
.map-card-btn.card-map-arctic { --map-border-color: #38bdf8; --map-glow-color: rgba(56, 189, 248, 0.45); }

.map-card-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.map-card-name {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.map-card-sub {
    font-size: 0.6rem;
    color: #94a3b8;
    font-weight: 600;
    white-space: nowrap;
}

/* ==========================================================================
   8. SPECIFIC MAP ARENA VISUAL THEMES
   ========================================================================== */

/* --- HUD SUB BADGES --- */
.hud-sub-badges {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.map-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 0.12rem 0.6rem;
    border-radius: 1rem;
    display: inline-block;
}

/* Scoreboard Difficulty Badges */
.difficulty-pill {
    font-size: 0.58rem;
    font-family: var(--font-heading);
    font-weight: 800;
    padding: 0.08rem 0.35rem;
    border-radius: 0.35rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.difficulty-pill.diff-easy { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.difficulty-pill.diff-medium { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.difficulty-pill.diff-hard { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.difficulty-pill.diff-extreme { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }

/* --- THEME 2: LAVA INFERNO --- */
.theme-lava {
    background: radial-gradient(circle at 50% 15%, #450a0a 0%, #1c1917 60%, #0c0a09 100%) !important;
}
.theme-lava .board-frame {
    background: linear-gradient(145deg, #1c1917, #0c0a09);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 0 2.5px #7f1d1d, 0 0 0 4.5px rgba(239, 68, 68, 0.5), inset 0 2px 4px rgba(249, 115, 22, 0.3);
}
.theme-lava .tile-theme-lava.tile-c-1 { background: linear-gradient(135deg, #ea580c, #c2410c) !important; color: #fff !important; border-color: #f97316 !important; }
.theme-lava .tile-theme-lava.tile-c-2 { background: linear-gradient(135deg, #7f1d1d, #991b1b) !important; color: #fecaca !important; border-color: #b91c1c !important; }
.theme-lava .tile-theme-lava.tile-c-3 { background: linear-gradient(135deg, #f59e0b, #d97706) !important; color: #451a03 !important; border-color: #fbbf24 !important; }
.theme-lava .tile-theme-lava.tile-c-4 { background: linear-gradient(135deg, #44403c, #292524) !important; color: #fed7aa !important; border-color: #57534e !important; }
.theme-lava .tile-theme-lava.tile-c-5 { background: linear-gradient(135deg, #dc2626, #b91c1c) !important; color: #fff !important; border-color: #ef4444 !important; }
.theme-lava .tile-theme-lava.tile-c-6 { background: linear-gradient(135deg, #9a3412, #7c2d12) !important; color: #ffedd5 !important; border-color: #c2410c !important; }

/* --- THEME 3: COSMIC GALAXY --- */
.theme-cosmic {
    background: radial-gradient(circle at 50% 15%, #1e1b4b 0%, #0f172a 60%, #030712 100%) !important;
}
.theme-cosmic .board-frame {
    background: linear-gradient(145deg, #090d16, #130e2a);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 0 2.5px #0284c7, 0 0 0 4.5px rgba(6, 182, 212, 0.5), inset 0 2px 4px rgba(217, 70, 239, 0.3);
}
.theme-cosmic .tile-theme-cosmic.tile-c-1 { background: linear-gradient(135deg, #06b6d4, #0891b2) !important; color: #082f49 !important; border-color: #22d3ee !important; }
.theme-cosmic .tile-theme-cosmic.tile-c-2 { background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important; color: #ede9fe !important; border-color: #a78bfa !important; }
.theme-cosmic .tile-theme-cosmic.tile-c-3 { background: linear-gradient(135deg, #1e1b4b, #312e81) !important; color: #c7d2fe !important; border-color: #4338ca !important; }
.theme-cosmic .tile-theme-cosmic.tile-c-4 { background: linear-gradient(135deg, #d946ef, #c026d3) !important; color: #fdf4ff !important; border-color: #e879f9 !important; }
.theme-cosmic .tile-theme-cosmic.tile-c-5 { background: linear-gradient(135deg, #0f172a, #1e293b) !important; color: #38bdf8 !important; border-color: #334155 !important; }
.theme-cosmic .tile-theme-cosmic.tile-c-6 { background: linear-gradient(135deg, #14b8a6, #0d9488) !important; color: #f0fdfa !important; border-color: #2dd4bf !important; }

/* --- THEME 4: JUNGLE ADVENTURE --- */
.theme-jungle {
    background: radial-gradient(circle at 50% 15%, #064e3b 0%, #022c22 60%, #051610 100%) !important;
}
.theme-jungle .board-frame {
    background: linear-gradient(145deg, #06261c, #021a12);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 0 2.5px #065f46, 0 0 0 4.5px rgba(16, 185, 129, 0.5), inset 0 2px 4px rgba(132, 204, 22, 0.3);
}
.theme-jungle .tile-theme-jungle.tile-c-1 { background: linear-gradient(135deg, #10b981, #059669) !important; color: #022c22 !important; border-color: #34d399 !important; }
.theme-jungle .tile-theme-jungle.tile-c-2 { background: linear-gradient(135deg, #064e3b, #022c22) !important; color: #a7f3d0 !important; border-color: #047857 !important; }
.theme-jungle .tile-theme-jungle.tile-c-3 { background: linear-gradient(135deg, #84cc16, #65a30d) !important; color: #1a2e05 !important; border-color: #a3e635 !important; }
.theme-jungle .tile-theme-jungle.tile-c-4 { background: linear-gradient(135deg, #78350f, #451a03) !important; color: #fef3c7 !important; border-color: #92400e !important; }
.theme-jungle .tile-theme-jungle.tile-c-5 { background: linear-gradient(135deg, #34d399, #10b981) !important; color: #064e3b !important; border-color: #6ee7b7 !important; }
.theme-jungle .tile-theme-jungle.tile-c-6 { background: linear-gradient(135deg, #eab308, #ca8a04) !important; color: #422006 !important; border-color: #facc15 !important; }

/* --- THEME 5: FROZEN ARCTIC --- */
.theme-arctic {
    background: radial-gradient(circle at 50% 15%, #075985 0%, #0c4a6e 60%, #031c2c 100%) !important;
}
.theme-arctic .board-frame {
    background: linear-gradient(145deg, #082f49, #031e30);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 0 2.5px #0284c7, 0 0 0 4.5px rgba(56, 189, 248, 0.5), inset 0 2px 4px rgba(224, 242, 254, 0.4);
}
.theme-arctic .tile-theme-arctic.tile-c-1 { background: linear-gradient(135deg, #38bdf8, #0284c7) !important; color: #082f49 !important; border-color: #7dd3fc !important; }
.theme-arctic .tile-theme-arctic.tile-c-2 { background: linear-gradient(135deg, #0c4a6e, #082f49) !important; color: #e0f2fe !important; border-color: #0369a1 !important; }
.theme-arctic .tile-theme-arctic.tile-c-3 { background: linear-gradient(135deg, #e0f2fe, #bae6fd) !important; color: #0369a1 !important; border-color: #ffffff !important; }
.theme-arctic .tile-theme-arctic.tile-c-4 { background: linear-gradient(135deg, #7dd3fc, #38bdf8) !important; color: #0c4a6e !important; border-color: #bae6fd !important; }
.theme-arctic .tile-theme-arctic.tile-c-5 { background: linear-gradient(135deg, #1e293b, #0f172a) !important; color: #38bdf8 !important; border-color: #334155 !important; }
.theme-arctic .tile-theme-arctic.tile-c-6 { background: linear-gradient(135deg, #2dd4bf, #0f766e) !important; color: #f0fdfa !important; border-color: #5eead4 !important; }

/* ==========================================================================
   9. MOBILE REFINEMENT & OVERFLOW PREVENTION (<= 480px)
   ========================================================================== */

@media (max-width: 480px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .app-wrapper {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .home-container {
        padding: 0.95rem 0.75rem 1.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .home-header {
        margin-bottom: 0.9rem;
    }

    .mascot-badge {
        width: 46px;
        height: 46px;
        border-radius: 0.85rem;
    }

    .mascot-badge svg {
        width: 26px;
        height: 26px;
    }

    .game-title {
        font-size: clamp(1.85rem, 8.5vw, 2.5rem);
        letter-spacing: 1px;
    }

    .game-subtitle {
        font-size: 0.82rem;
    }

    .btn-primary-play {
        padding: 0.9rem 1.15rem;
        border-radius: 1.15rem;
    }

    .play-icon-box {
        width: 40px;
        height: 40px;
    }

    .play-text {
        font-size: 1.15rem;
    }

    .play-sub {
        font-size: 0.74rem;
    }

    .menu-card {
        padding: 1rem 0.8rem;
        border-radius: 1.25rem;
    }

    .card-title {
        font-size: 0.82rem;
        padding: 0.28rem 0.75rem;
        letter-spacing: 1px;
    }

    .mode-tabs {
        gap: 0.4rem;
        padding: 0.25rem;
    }

    .tab-btn {
        padding: 0.55rem 0.25rem;
    }

    .tab-btn strong {
        font-size: 0.82rem;
    }

    .tab-btn small {
        font-size: 0.68rem;
    }

    .player-name-field {
        padding: 0.38rem 0.65rem;
        gap: 0.5rem;
    }

    .player-field-label {
        font-size: 0.62rem;
    }

    .player-field-input {
        font-size: 0.88rem;
    }

    .btn-shuffle-name {
        width: 28px;
        height: 28px;
    }

    .diff-picker-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.25rem !important;
    }

    .diff-desc-pill {
        width: 100% !important;
        text-align: left !important;
        font-size: 0.68rem !important;
        padding: 0.25rem 0.45rem !important;
        box-sizing: border-box !important;
    }

    .diff-options-grid {
        gap: 0.25rem !important;
    }

    .diff-btn {
        padding: 0.4rem 0.1rem !important;
        font-size: 0.7rem !important;
    }

    .btn-start-game {
        padding: 0.85rem;
        font-size: 1.05rem;
    }

    .map-selector-section {
        margin-top: 0.9rem;
    }

    .map-selector-header {
        gap: 0.25rem;
    }

    .map-card-btn {
        flex: 0 0 96px !important;
        min-width: 96px !important;
        padding: 0.5rem 0.35rem !important;
    }

    .map-card-icon {
        font-size: 1.25rem;
    }

    .map-card-name {
        font-size: 0.7rem;
    }

    .map-card-sub {
        font-size: 0.55rem;
    }

    .home-actions {
        gap: 0.45rem;
    }

    .btn-secondary {
        padding: 0.65rem 0.4rem;
        font-size: 0.78rem;
    }

    .features-grid {
        gap: 0.35rem;
    }

    .feature-item {
        padding: 0.55rem 0.25rem;
    }

    .feature-icon-wrap {
        width: 32px;
        height: 32px;
        margin-bottom: 0.25rem;
    }

    .feature-icon-wrap svg {
        width: 17px;
        height: 17px;
    }

    .feature-item strong {
        font-size: 0.68rem;
    }

    .feature-item p {
        font-size: 0.58rem;
    }
}

/* Extra small mobile (< 360px) */
@media (max-width: 360px) {
    .home-container {
        padding: 0.75rem 0.5rem 1.25rem !important;
    }
    .menu-card {
        padding: 0.85rem 0.65rem !important;
    }
    .diff-btn {
        font-size: 0.65rem !important;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
}


