/* css/style.css - Jungle Themed Matchimals Aesthetics */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Outfit:wght@400;600;700;800;900&display=swap');

:root {
    --primary-jungle: #1b4332;
    --jungle-deep: #081c15;
    --jungle-mid: #2d6a4f;
    --jungle-light: #52b788;
    --jungle-accent: #74c69d;
    --jungle-gold: #ffd166;
    --jungle-amber: #f77f00;
    --wood-dark: #3a1e05;
    --wood-mid: #5c3818;
    --wood-light: #8b5a2b;
    --wood-highlight: #ba8352;
    --tile-bg: #fffdf7;
    --tile-side: #e3dac9;
    --tile-border: #b8a68a;
    --font-heading: 'Fredoka One', cursive, sans-serif;
    --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    font-family: var(--font-body);
    color: #ffffff;
    background: radial-gradient(ellipse at 50% 20%, #255c3c 0%, #0d2818 60%, #05140b 100%);
    background-attachment: fixed;
}

/* Ambient Jungle Leaf Silhouette & Vines */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 10% 15%, rgba(116, 198, 157, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 85%, rgba(255, 209, 102, 0.08) 0%, transparent 45%),
        url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M60 10 C30 30 20 60 40 80 C60 100 90 90 100 60 C110 30 90 10 60 10 Z' fill='%23ffffff' fill-opacity='0.015'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.game-icon-inline {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: -2px;
    display: inline-block;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.game-icon-booster {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.game-icon-large {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: inline-block;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

/* Game Layout Shell */

.game-app-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    max-width: 960px;
    margin: 0 auto;
    padding: 10px 16px 20px 16px;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .game-app-shell {
        padding: 0;
        width: 100%;
        max-width: 100vw;
    }
}

/* ==================== HEADER & TOP NAV ==================== */
.game-top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(13, 40, 24, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(116, 198, 157, 0.25);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    margin-bottom: 12px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 24px;
    letter-spacing: 0.5px;
    background: linear-gradient(180deg, #fff275 0%, #ffd166 50%, #f77f00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Nav & Wood Styled Buttons */
.wood-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 12px;
    border: 2px solid #a3703c;
    background: linear-gradient(180deg, #7c4c23 0%, #512f13 100%);
    color: #fffae8;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.wood-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.wood-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.wood-btn:disabled {
    opacity: 0.55;
    filter: grayscale(0.5);
    cursor: not-allowed;
    transform: none;
}

.wood-btn-gold {
    border-color: #ffd166;
    background: linear-gradient(180deg, #e09f12 0%, #a46d04 100%);
    color: #ffffff;
}

.wood-btn-icon {
    padding: 8px 10px;
    font-size: 16px;
}

/* Profile Bar / Guest Bar */
.user-profile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.35);
    padding: 4px 12px 4px 6px;
    border-radius: 24px;
    border: 1px solid rgba(255, 209, 102, 0.3);
}

.profile-avatar-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.profile-avatar-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-weight: 700;
    font-size: 13px;
    color: #ffd166;
}

.profile-stats-summary {
    font-size: 11px;
    color: #c9e4d0;
}

/* ==================== 2-COLUMN THEME RADIO TILES ==================== */
.theme-tiles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-top: 6px;
}

.theme-tile-option {
    position: relative;
    cursor: pointer;
    user-select: none;
    display: block;
    margin: 0;
}

.theme-radio-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.theme-tile-content {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(116, 198, 157, 0.28);
    border-radius: 14px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.theme-tile-preview {
    width: 54px;
    height: 60px;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f3e8 70%, #ded2be 100%);
    box-shadow: 
        0 4px 0 #b39f82,
        0 6px 12px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1.5px solid #d4c4aa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: transform 0.18s ease;
}

.theme-tile-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.theme-tile-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.theme-radio-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(116, 198, 157, 0.55);
    background: rgba(0, 0, 0, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

.theme-radio-circle::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffd166;
    opacity: 0;
    transform: scale(0.3);
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-tile-label {
    font-family: var(--font-heading);
    font-size: 14px;
    color: #e2fbdc;
    letter-spacing: 0.5px;
    transition: color 0.18s ease;
}

/* Hover state */
.theme-tile-option:hover .theme-tile-content {
    border-color: rgba(255, 209, 102, 0.65);
    transform: translateY(-2px);
}

.theme-tile-option:hover .theme-tile-preview {
    transform: scale(1.05);
}

/* Selected / Highlighted State */
.theme-tile-option.selected .theme-tile-content,
.theme-tile-option:has(.theme-radio-input:checked) .theme-tile-content {
    border-color: #ffd166;
    background: linear-gradient(180deg, rgba(255, 209, 102, 0.18) 0%, rgba(20, 60, 40, 0.55) 100%);
    box-shadow: 
        0 0 16px rgba(255, 209, 102, 0.4),
        inset 0 0 10px rgba(255, 209, 102, 0.15);
}

.theme-tile-option.selected .theme-radio-circle,
.theme-tile-option:has(.theme-radio-input:checked) .theme-radio-circle {
    border-color: #ffd166;
    box-shadow: 0 0 8px rgba(255, 209, 102, 0.7);
}

.theme-tile-option.selected .theme-radio-circle::after,
.theme-tile-option:has(.theme-radio-input:checked) .theme-radio-circle::after {
    opacity: 1;
    transform: scale(1);
}

.theme-tile-option.selected .theme-tile-label,
.theme-tile-option:has(.theme-radio-input:checked) .theme-tile-label {
    color: #ffd166;
    font-weight: 700;
}


/* ==================== HUD HEADER ==================== */
.game-hud-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    background: rgba(13, 40, 24, 0.90);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(116, 198, 157, 0.3);
    border-radius: 16px;
    padding: 8px 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

.game-hud-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.game-nav-btn {
    padding: 6px 14px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
    flex-shrink: 0;
}

.game-stage-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 209, 102, 0.4);
    padding: 4px 14px;
    border-radius: 20px;
}

.hud-stage-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #a3e6be;
}

.hud-stage-val {
    font-family: var(--font-heading);
    font-size: 15px;
    color: #ffd166;
    text-shadow: 0 0 8px rgba(255, 209, 102, 0.5);
}

.game-hud-row-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.hud-stat-chip {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    padding: 4px 6px;
    border: 1px solid rgba(116, 198, 157, 0.2);
    min-width: 0;
}

.chip-lbl {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #74c69d;
    text-transform: uppercase;
    line-height: 1.1;
    white-space: nowrap;
}

.chip-val {
    font-family: var(--font-heading);
    font-size: 16px;
    color: #ffffff;
    line-height: 1.2;
    white-space: nowrap;
}

.chip-val.gold {
    color: #ffd166;
    text-shadow: 0 0 8px rgba(255, 209, 102, 0.4);
}

/* ==================== FLOATING COMBO HUD & POPUP ==================== */
.combo-badge {
    display: none;
    font-family: var(--font-heading);
    font-size: 14px;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, rgba(247, 127, 0, 0.95), rgba(214, 40, 40, 0.95));
    color: #fff;
    padding: 5px 18px;
    border-radius: 24px;
    border: 2px solid #ffd166;
    box-shadow: 0 8px 24px rgba(247, 127, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.6);
    animation: comboFloatLevitate 2.2s ease-in-out infinite alternate;
    margin: 4px auto;
    z-index: 100;
}

.combo-badge.floating-hud-combo {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.combo-badge.active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.combo-badge .combo-flame {
    font-size: 17px;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
}

.combo-badge .combo-num {
    font-size: 17px;
    color: #ffd166;
    font-weight: 900;
}

.combo-badge .combo-txt {
    font-size: 13px;
    letter-spacing: 1px;
}

/* Screen-Floating Combo Burst Popup */
.floating-combo-burst {
    position: fixed;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9995;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: comboFloatingBurst 1.35s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    text-align: center;
}

.combo-burst-aura {
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 209, 102, 0.5) 0%, rgba(247, 127, 0, 0.25) 45%, transparent 70%);
    animation: comboAuraPulse 1.2s ease-out infinite;
    z-index: -1;
}

.combo-burst-sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.combo-burst-sparkles .sparkle {
    position: absolute;
    font-size: 24px;
    left: 50%;
    top: 50%;
}

.combo-burst-sparkles .s1 { animation: sparkleDrift1 1.2s forwards; }
.combo-burst-sparkles .s2 { animation: sparkleDrift2 1.2s forwards; }
.combo-burst-sparkles .s3 { animation: sparkleDrift3 1.2s forwards; }
.combo-burst-sparkles .s4 { animation: sparkleDrift4 1.2s forwards; }

.combo-burst-main {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    line-height: 1;
}

.combo-burst-emoji {
    font-size: 42px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

.combo-burst-count {
    font-size: 46px;
    font-weight: 900;
    background: linear-gradient(180deg, #ffffff 0%, #ffd166 40%, #f77f00 80%, #d62828 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 20px rgba(247, 127, 0, 0.9));
}

.combo-burst-word {
    font-size: 38px;
    font-weight: 900;
    background: linear-gradient(180deg, #ffffff 0%, #ffd166 50%, #f77f00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 16px rgba(255, 183, 3, 0.85));
}

.combo-burst-sub {
    font-family: var(--font-heading);
    font-size: 15px;
    letter-spacing: 2px;
    color: #fff;
    background: rgba(10, 30, 20, 0.85);
    border: 2px solid #ffd166;
    padding: 4px 16px;
    border-radius: 14px;
    margin-top: 6px;
    text-transform: uppercase;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* Tier Variations */
.floating-combo-burst.tier-silver .combo-burst-count {
    background: linear-gradient(180deg, #ffffff 0%, #bde0fe 40%, #00b4d8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 20px rgba(0, 180, 216, 0.9));
}

.floating-combo-burst.tier-gold .combo-burst-count,
.floating-combo-burst.tier-platinum .combo-burst-count,
.floating-combo-burst.tier-legendary .combo-burst-count {
    font-size: 52px;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 24px rgba(255, 215, 0, 1));
}

/* ==================== GAMEPLAY FIELD ==================== */
.game-board-viewport {
    position: relative;
    flex: 1;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.board-container {
    position: relative;
    margin: 0 auto;
    width: 100%;
    max-width: 540px;
    height: 100%;
    min-height: 200px;
    border-radius: 20px;
    background: radial-gradient(circle at 50% 50%, rgba(30, 80, 50, 0.45) 0%, rgba(10, 30, 20, 0.65) 100%);
    border: 2px dashed rgba(116, 198, 157, 0.28);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== MAHJONG 3D TILES (ENLARGED) ==================== */
.jungle-tile {
    position: absolute;
    width: 72px;
    height: 84px;
    user-select: none;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.tile-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f3e8 70%, #ded2be 100%);
    box-shadow: 
        0 7px 0 #b39f82,
        0 10px 15px rgba(0, 0, 0, 0.4),
        inset 0 1.5px 0 rgba(255, 255, 255, 0.95);
    border: 1.5px solid #d4c4aa;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile-face {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.tile-face img {
    width: 88%;
    height: 88%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transition: transform 0.15s ease;
}

/* Animal tooltip on hover */
.animal-tooltip {
    display: none;
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffd166;
    font-size: 10px;
    font-weight: 700;
    text-transform: capitalize;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 99999;
}

/* Free / Clickable Tile - ROCK SOLID STABILITY (NO FLICKER) */
.jungle-tile.is-free {
    cursor: pointer;
}

.jungle-tile.is-free:hover .tile-inner {
    border-color: #ffd166;
    box-shadow: 
        0 6px 0 #9e8a6f,
        0 8px 14px rgba(0, 0, 0, 0.4),
        0 0 16px rgba(255, 209, 102, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    filter: brightness(1.08);
}

.jungle-tile.is-free:hover .animal-tooltip {
    display: block;
}

.jungle-tile.is-free:active .tile-inner {
    transform: scale(0.96);
}

/* Blocked Tile (Cast in shadow, strictly non-hoverable) */
.jungle-tile.is-blocked {
    cursor: not-allowed !important;
    filter: brightness(0.50) contrast(0.85) grayscale(0.3);
}

.jungle-tile.is-blocked:hover {
    transform: none !important;
}

.jungle-tile.is-blocked:hover .tile-inner {
    box-shadow: 0 4px 0 #7a6a55, 0 6px 10px rgba(0, 0, 0, 0.45) !important;
    border-color: #8c7860 !important;
    filter: none !important;
}

.jungle-tile.is-blocked:hover .animal-tooltip {
    display: none !important;
}

.jungle-tile.is-blocked .tile-shade-overlay {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(8, 20, 12, 0.58);
    border-radius: 8px;
    pointer-events: none;
}


/* ==================== HOLDING DOCK & SLOTS ==================== */
.dock-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-width: 500px;
    margin: 2px auto 0 auto;
    box-sizing: border-box;
}

/* Holding Area for Magic Booster */
.holding-area-wrapper {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(20, 55, 35, 0.88);
    border: 2px dashed #ffd166;
    padding: 6px 12px;
    border-radius: 14px;
    margin: 0 auto 4px auto;
    width: fit-content;
    max-width: 100%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.holding-slots {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

/* Main 7-Slot Bamboo Dock Frame */
.dock-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    background: linear-gradient(180deg, #44260d 0%, #291505 100%);
    border: 3px solid #7c4c23;
    border-radius: 16px;
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.6),
        inset 0 2px 4px rgba(255, 255, 255, 0.15),
        inset 0 -2px 6px rgba(0, 0, 0, 0.8);
}

.dock-slots {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Individual Slot indentation - Fluid scaling to fit any viewport */
.dock-slot {
    flex: 1;
    max-width: 60px;
    aspect-ratio: 54 / 64;
    height: auto;
    min-width: 0;
    border-radius: 9px;
    background: rgba(15, 8, 3, 0.75);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.85);
    border: 1px dashed rgba(163, 112, 60, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Tiles inside dock */
.dock-tile {
    width: 92%;
    height: 92%;
    position: relative;
    border-radius: 8px;
}

.dock-tile .tile-inner {
    border-radius: 8px;
    box-shadow: 
        0 4px 0 #b39f82,
        0 6px 10px rgba(0, 0, 0, 0.35);
}

.held-tile {
    cursor: pointer;
    transition: transform 0.15s ease;
}

.held-tile:hover {
    transform: scale(1.08);
}

/* ==================== BOOSTERS & ACTION CONTROLS ==================== */
.game-controls-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 500px;
    gap: 8px;
    margin: 2px auto 0 auto;
    box-sizing: border-box;
}

.boosters-group {
    display: flex;
    flex: 1;
    gap: 8px;
    min-width: 0;
}

.booster-btn {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    font-family: var(--font-heading);
    font-size: 13px;
    border-radius: 12px;
    border: 1.5px solid #52b788;
    background: linear-gradient(180deg, #2d6a4f 0%, #1b4332 100%);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
    transition: transform 0.12s ease, filter 0.12s ease;
    white-space: nowrap;
}

.booster-name {
    font-size: 12px;
    white-space: nowrap;
}

.btn-game-restart {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    font-size: 16px !important;
    border-radius: 12px !important;
    flex-shrink: 0;
}

.booster-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.15);
    border-color: #ffd166;
}

.booster-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.6);
}

.booster-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f77f00;
    color: #fff;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 800;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    border: 1.5px solid #fff;
}

/* ==================== MODALS ==================== */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 20, 11, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9990;
    padding: 16px;
}

.game-modal.active {
    display: flex;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: linear-gradient(180deg, #1b4332 0%, #0d2818 100%);
    border: 3px solid #74c69d;
    border-radius: 24px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    padding: 24px;
    color: #ffffff;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 2px solid rgba(116, 198, 157, 0.25);
    padding-bottom: 12px;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 24px;
    color: #ffd166;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-modal {
    background: none;
    border: none;
    color: #74c69d;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
}

.btn-close-modal:hover {
    color: #ffd166;
}

/* Tab Navigation inside Modals */
.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 8px;
}

.modal-tab {
    flex: 1;
    background: none;
    border: none;
    color: #a3e6be;
    font-family: var(--font-heading);
    font-size: 15px;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.modal-tab.active {
    background: rgba(116, 198, 157, 0.25);
    color: #ffd166;
}

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #a3e6be;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.4);
    border: 1.5px solid rgba(116, 198, 157, 0.35);
    border-radius: 10px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    border-color: #ffd166;
}

/* Avatar Picker */
.avatar-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 6px;
}

.avatar-option {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    padding: 3px;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

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

.avatar-option:hover {
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: #ffd166;
    background: rgba(255, 209, 102, 0.25);
}

.auth-alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
}

.auth-alert.error {
    background: rgba(214, 40, 40, 0.3);
    border: 1px solid #d62828;
    color: #ff9999;
}

.auth-alert.success {
    background: rgba(45, 106, 79, 0.4);
    border: 1px solid #52b788;
    color: #a3e6be;
}

/* ==================== LEADERBOARDS ==================== */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}

/* --- Top 3 Champion Podium --- */
.lb-podium-wrapper {
    background: radial-gradient(circle at 50% 25%, rgba(30, 80, 50, 0.5) 0%, rgba(10, 25, 15, 0.75) 100%);
    border: 1.5px solid rgba(116, 198, 157, 0.35);
    border-radius: 18px;
    padding: 16px 8px 10px 8px;
    margin-bottom: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.lb-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.podium-col {
    flex: 1;
    max-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.podium-badge-wrap {
    margin-bottom: -12px;
    z-index: 3;
    position: relative;
    animation: podiumBadgeFloat 3s ease-in-out infinite alternate;
}

.podium-col.rank-1 .podium-badge-wrap { animation-delay: 0s; }
.podium-col.rank-2 .podium-badge-wrap { animation-delay: 0.6s; }
.podium-col.rank-3 .podium-badge-wrap { animation-delay: 1.2s; }

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

.podium-top-badge {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.podium-col.rank-1 .podium-top-badge {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 0 14px rgba(255, 209, 102, 0.75)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8));
}

.podium-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
    border: 2px solid #a3703c;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    z-index: 2;
    position: relative;
}

.podium-avatar.crown-glow {
    width: 50px;
    height: 50px;
    border-color: #ffd166;
    box-shadow: 0 0 16px rgba(255, 209, 102, 0.8), 0 4px 12px rgba(0, 0, 0, 0.5);
}

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

.podium-name {
    font-weight: 700;
    font-size: 11px;
    color: #ffffff;
    margin-top: 5px;
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 2;
}

.podium-col.rank-1 .podium-name {
    color: #ffd166;
    font-size: 12px;
}

.podium-score {
    font-family: var(--font-heading);
    font-size: 11px;
    color: #ffd166;
    margin-bottom: 4px;
    z-index: 2;
    white-space: nowrap;
}

.podium-pedestal {
    width: 100%;
    border-radius: 12px 12px 6px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 0, 0, 0.4);
}

.pedestal-1 {
    height: 64px;
    background: linear-gradient(180deg, #d49a24 0%, #855507 100%);
    border-color: #ffd166;
}

.pedestal-2 {
    height: 46px;
    background: linear-gradient(180deg, #8a9ba8 0%, #465561 100%);
    border-color: #b0c4de;
}

.pedestal-3 {
    height: 34px;
    background: linear-gradient(180deg, #a66a38 0%, #542f10 100%);
    border-color: #cd7f32;
}

.pedestal-num {
    font-family: var(--font-heading);
    font-size: 18px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* --- Leaderboard List Items --- */
.lb-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1.5px solid rgba(116, 198, 157, 0.2);
    border-radius: 14px;
    padding: 8px 10px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.leaderboard-item:hover {
    transform: translateX(3px);
    background: rgba(0, 0, 0, 0.5);
}

.leaderboard-item.rank-top1 {
    background: linear-gradient(90deg, rgba(255, 209, 102, 0.22) 0%, rgba(20, 50, 30, 0.7) 100%);
    border-color: rgba(255, 209, 102, 0.8);
    box-shadow: 0 4px 14px rgba(255, 209, 102, 0.25);
}

.leaderboard-item.rank-top2 {
    background: linear-gradient(90deg, rgba(200, 220, 240, 0.18) 0%, rgba(20, 50, 30, 0.7) 100%);
    border-color: rgba(180, 205, 230, 0.7);
    box-shadow: 0 4px 12px rgba(180, 205, 230, 0.18);
}

.leaderboard-item.rank-top3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.18) 0%, rgba(20, 50, 30, 0.7) 100%);
    border-color: rgba(205, 127, 50, 0.7);
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.18);
}

.leaderboard-item.is-me {
    border-color: #ffd166;
    background: rgba(255, 209, 102, 0.18);
}

.lb-rank {
    width: 38px;
    min-width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-top-badge {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
    transition: transform 0.15s ease;
}

.leaderboard-item:hover .lb-top-badge {
    transform: scale(1.18);
}

.lb-rank-num {
    font-family: var(--font-heading);
    font-size: 16px;
    color: #a3e6be;
}

.lb-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

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

.lb-details {
    flex: 1;
    min-width: 0;
}

.lb-name {
    font-weight: 700;
    font-size: 13px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.you-badge {
    font-size: 9px;
    font-weight: 800;
    background: #ffd166;
    color: #1b4332;
    padding: 1px 5px;
    border-radius: 6px;
}

.lb-meta {
    font-size: 11px;
    color: #a3e6be;
}

.lb-score {
    text-align: right;
    flex-shrink: 0;
}

.score-val {
    display: block;
    font-family: var(--font-heading);
    font-size: 16px;
    color: #ffd166;
}

.score-lbl {
    font-size: 9px;
    font-weight: 700;
    color: #74c69d;
}

.user-rank-banner {
    display: none;
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(255, 209, 102, 0.15);
    border: 1px solid #ffd166;
    border-radius: 12px;
    justify-content: center;
    align-items: center;
}

.user-best-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #ffd166;
    flex-wrap: wrap;
    justify-content: center;
}

.user-best-badge-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.leaderboard-empty, .leaderboard-loading {
    text-align: center;
    padding: 30px 15px;
    color: #a3e6be;
    font-size: 14px;
}

/* ==================== WIN & GAME OVER MODALS ==================== */
.victory-card, .gameover-card {
    text-align: center;
}

.stars-award-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    font-size: 38px;
}

.star-icon {
    transition: transform 0.25s ease;
}

.star-icon.earned {
    filter: drop-shadow(0 0 12px #ffd166);
    transform: scale(1.15);
}

.star-icon.empty {
    opacity: 0.25;
    filter: grayscale(1);
}

.stat-box-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 18px 0;
}

.stat-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(116, 198, 157, 0.25);
    border-radius: 14px;
    padding: 10px;
}

.stat-box .lbl {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: #74c69d;
}

.stat-box .val {
    font-family: var(--font-heading);
    font-size: 20px;
    color: #ffd166;
}

.guest-login-prompt {
    display: none;
    font-size: 12px;
    color: #ffda79;
    margin-top: 10px;
    background: rgba(255, 218, 121, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
}

/* ==================== JUNGLE THEMED ALERT MODAL ==================== */
.jungle-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 18, 10, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 18px;
    box-sizing: border-box;
}

.jungle-modal-overlay.active {
    display: flex;
}

.jungle-modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: radial-gradient(ellipse at 50% 0%, #1e4d35 0%, #0d2a1c 65%, #06160e 100%);
    border: 3.5px solid #74c69d;
    border-radius: 28px;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.85),
        inset 0 1px 1px rgba(255, 255, 255, 0.35),
        0 0 30px rgba(45, 106, 79, 0.45);
    padding: 24px 22px 22px 22px;
    color: #ffffff;
    text-align: center;
    overflow: visible;
}

.jungle-modal-card.animate-pop {
    animation: jungleModalPop 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Corner Vine Leaves */
.jungle-modal-vine {
    position: absolute;
    font-size: 26px;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.jungle-modal-vine.vine-tl {
    top: -12px;
    left: 12px;
    transform: rotate(-25deg);
}

.jungle-modal-vine.vine-tr {
    top: -12px;
    right: 12px;
    transform: rotate(25deg);
}

/* Floating Emblem Badge */
.jungle-modal-badge {
    width: 68px;
    height: 68px;
    margin: -50px auto 14px auto;
    border-radius: 50%;
    background: radial-gradient(circle, #2d6a4f 0%, #081c15 100%);
    border: 3.5px solid #ffd166;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.65),
        0 0 18px rgba(255, 209, 102, 0.45),
        inset 0 2px 4px rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalBadgeFloat 3s ease-in-out infinite alternate;
}

.jungle-modal-badge .badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.modal-badge-img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
}

.jungle-modal-title {
    font-family: var(--font-heading);
    font-size: 24px;
    letter-spacing: 0.5px;
    color: #ffd166;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.jungle-modal-body {
    background: rgba(0, 0, 0, 0.32);
    border: 1.5px solid rgba(116, 198, 157, 0.28);
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.jungle-modal-body p {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: #d8f3dc;
    font-weight: 600;
}

.jungle-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.jungle-modal-actions .wood-btn {
    padding: 12px 24px;
    font-size: 15px;
    min-width: 120px;
}

.jungle-modal-actions .jungle-btn-cancel {
    background: linear-gradient(180deg, #495057 0%, #212529 100%);
    border: 2px solid #6c757d;
    box-shadow: 0 4px 0 #1b1e21, 0 6px 12px rgba(0, 0, 0, 0.4);
    color: #ced4da;
}

.jungle-modal-actions .jungle-btn-cancel:hover {
    background: linear-gradient(180deg, #6c757d 0%, #343a40 100%);
    color: #fff;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .brand-title {
        font-size: 18px;
    }
    .brand-logo {
        width: 34px;
        height: 34px;
    }
    .game-top-nav {
        padding: 6px 10px;
    }
    .dock-slot {
        aspect-ratio: 54 / 64;
    }
    .dock-tile {
        width: 94%;
        height: 94%;
    }
    .booster-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    .avatar-picker-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}
