:root {
    /* Savanna Theme (Light) */
    --safari-bg: #fdf6e3;
    --safari-glass: #fdf6e3;
    /* Solid parchment */
    --safari-border: #a67c52;
    --safari-text: #3d2314;
    /* Extremely dark brown for contrast */
    --safari-text-muted: #8b5a2b;
    --safari-accent: #d97706;
    --safari-glow: rgba(217, 119, 6, 0.3);
    --safari-map-filter: sepia(0.2) saturate(1.2);
    --safari-panel-shadow: 0 10px 40px rgba(61, 35, 20, 0.15);
    --safari-wood: linear-gradient(135deg, #a67c52, #8b5a2b);
    --safari-parchment: #f4e8c1;
}

[data-theme="dark"] {
    /* Midnight Adventure Theme (Dark) */
    --safari-bg: #0f1610;
    --safari-glass: #1a1f18;
    /* Darker solid back */
    --safari-border: #8b4513;
    --safari-text: #fef0d8;
    --safari-text-muted: #b49b74;
    --safari-accent: #d97706;
    /* Terracotta/Gold */
    --safari-glow: rgba(217, 119, 6, 0.4);
    --safari-map-filter: brightness(0.7) sepia(0.3) hue-rotate(5deg) saturate(1.4);
    --safari-panel-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    --safari-wood: linear-gradient(135deg, #4a2c13, #2a1608);
    --safari-parchment: #1e1913;
}

/* ─── Thematic Backgrounds ─── */
.bg-parchment {
    background-color: var(--safari-parchment, #fdf6e3);
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.05" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.08"/></svg>');
    color: var(--safari-text);
}

.bg-wood {
    background: var(--safari-wood, linear-gradient(135deg, #6b4226, #4a2c13));
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    color: #fcefd6;
    border: 2px solid #3d2314;
}

.bg-leather {
    background: linear-gradient(to bottom right, #8b4513, #5a2a07);
    background-image: url('data:image/svg+xml;utf8,<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.015" numOctaves="2"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.05"/></svg>');
    color: #fcefd6;
    border: 2px solid #3d2314;
}


/* ─── HUD Top Overlay (Shared in Map Pane) ─── */
.safari-hud-top {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

.safari-hud-top>* {
    pointer-events: auto;
}

.hud-module {
    background: var(--safari-wood);
    border: 3px solid #3d2314;
    border-radius: 12px;
    padding: 0.6rem 1.2rem;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), 0 4px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fcefd6;
}

.hud-desktop-only {
    display: none;
}

.hud-mobile-only {
    display: flex;
}

@media (min-width: 1024px) {
    .hud-desktop-only {
        display: flex;
    }

    .hud-mobile-only {
        display: none !important;
    }
}

.hud-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: #fcefd6;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), -1px -1px 0 #2a1608, 1px -1px 0 #2a1608, -1px 1px 0 #2a1608, 1px 1px 0 #2a1608;
    letter-spacing: 0.05em;
}

.hud-btn {
    background: linear-gradient(to bottom, #d97706, #b45309);
    border: 2px solid #78350f;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 4px 0 #78350f;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-btn:hover {
    background: linear-gradient(to bottom, #f59e0b, #d97706);
    transform: translateY(2px);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 2px 0 #78350f;
}

.hud-module.status-center {
    padding: 0.4rem 0.8rem;
    border-radius: 14px;
    gap: 0.8rem;
}

.hud-pill {
    font-size: 0.8rem;
    font-weight: 800;
}

.hud-orb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    /* red outline default */
}

.hud-orb.status-ok {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* ─── Desktop vs Mobile Viewport ─── */
.safari-viewport {
    width: 100%;
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: var(--safari-bg);
}

/* Panes container for horizontal swiping on mobile */
.safari-panes {
    flex: 1;
    display: flex;
    flex-direction: row-reverse;
    /* RTL makes Store left (vis) but right natively. Let's force native RTL flow mapping: Store at End, Map Center, Quests start? */
    /* Using LTR explicitly internally for easier mapping over flex. Wait! */
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    position: relative;
}

.safari-panes::-webkit-scrollbar {
    display: none;
}

.safari-pane {
    min-width: 100vw;
    height: 100%;
    scroll-snap-align: center;
    position: relative;
    background-color: var(--safari-parchment, #fdf6e3);
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.05" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.08"/></svg>');
}

#safari-pane-map {
    background: transparent;
    /* Map pane doesn't get parchment background */
}

/* Dots Indicator */
.safari-nav-dots {
    position: absolute;
    bottom: 85px;
    /* Directly above the 64px mobile nav bar */
    left: 0;
    right: 0;
    margin: 0 auto;
    width: max-content;
    display: flex;
    gap: 0.4rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    z-index: 90;
    pointer-events: none;
}

.safari-nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.safari-nav-dot.active {
    background: #fcefd6;
    transform: scale(1.3);
    box-shadow: 0 0 6px #d97706;
}

@media (min-width: 1024px) {
    .safari-panes {
        overflow: hidden;
    }

    .safari-pane {
        min-width: auto;
        background: transparent;
    }

    #safari-pane-map {
        position: absolute;
        inset: 0;
        z-index: 1;
    }

    #safari-pane-store,
    #safari-pane-quests {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 420px;
        background-color: var(--safari-parchment);
        background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.05" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.08"/></svg>');
        border: none;
        border-radius: 0;
        z-index: 50;
        opacity: 0;
        pointer-events: none;
        transform: translateX(-100%);
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        box-shadow: var(--safari-panel-shadow);
    }

    #safari-pane-quests {
        right: 0;
        transform: translateX(100%);
        border-left: 4px solid var(--safari-border);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
    }

    #safari-pane-store {
        left: 0;
        transform: translateX(-100%);
        border-right: 4px solid var(--safari-border);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3);
    }

    #safari-pane-store.desktop-open,
    #safari-pane-quests.desktop-open {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0);
    }
}

/* Inner content logic */
.safari-pane-inner {
    height: 100%;
    width: 100%;
    overflow-y: auto;
    padding: 2rem;
    padding-bottom: 120px;
    /* for mobile nav */
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .safari-pane-inner {
        padding: 1.5rem;
    }
}

/* Pane Header */
.safari-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--safari-border);
    padding-bottom: 1rem;
}

.safari-pane-header h3 {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--safari-text);
    margin: 0;
}

.safari-pane-close {
    background: rgba(2ef, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.safari-pane-close:hover {
    background: #ef4444;
    color: #fff;
}

/* Mobile Bottom Nav */
.safari-hud-bottom {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    margin: 0 auto;
    max-width: 500px;
    height: 64px;
    background: var(--safari-wood, linear-gradient(135deg, #6b4226, #4a2c13));
    border: 2px solid #3d2314;
    border-radius: 24px;
    z-index: 100;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    padding: 0.4rem;
    gap: 0.3rem;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1), 0 10px 40px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
}

.hud-nav-btn {
    width: 100%;
    height: 100%;
    min-height: 44px;
    /* Hit target */
    border: none;
    background: transparent;
    color: #b49b74;
    font-weight: 900;
    font-size: 0.75rem;
    /* Shrunk font so all 3 columns fit */
    font-family: 'Cairo', sans-serif;
    border-radius: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.hud-nav-btn.active {
    background: linear-gradient(to bottom, #8b4513, #5a2a07);
    color: #fcefd6;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    border: 1px solid #3d2314;
}

/* ─── Map Wrapper Adjustments ─── */
.safari-map-wrapper {
    position: relative;
    width: 100%;
    height: calc(100vh - 60px);
    overflow: hidden;
    background: var(--safari-bg);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: background 0.5s ease;
}

.safari-map-wrapper:active {
    cursor: grabbing;
}

/* Vignette overlay for depth feel */
.safari-map-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    background: radial-gradient(ellipse at center, transparent 50%, var(--safari-bg) 100%);
    opacity: 0.5;
}

/* ─── Draggable Canvas ─── */
.safari-map-canvas {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
    transform-origin: 0 0;
    transition: none;
}

.safari-map-canvas img.safari-world-img {
    display: block;
    pointer-events: none;
    min-width: 1400px;
    height: auto;
}

/* ─── Zoom Controls ─── */
.safari-zoom-controls {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.safari-zoom-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--safari-border);
    background: var(--safari-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--safari-text);
    font-size: 1.3rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--safari-panel-shadow);
}

.safari-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
}

/* ─── Mini-Map ─── */
.safari-minimap {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 150px;
    height: 90px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(12, 26, 46, 0.85);
    backdrop-filter: blur(8px);
    z-index: 20;
    overflow: hidden;
}

.safari-minimap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}

.safari-minimap-viewport {
    position: absolute;
    border: 2px solid #f59e0b;
    border-radius: 3px;
    background: rgba(245, 158, 11, 0.15);
    pointer-events: none;
}

/* ─── Biome Zone Buttons ─── */
.safari-biome-zone {
    position: absolute;
    z-index: 20;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0);
}

.safari-biome-zone:hover {
    transform: scale(1.15);
    background: var(--safari-glass);
    box-shadow: 0 0 25px var(--safari-glow);
    backdrop-filter: blur(4px);
    z-index: 25;
}

.safari-biome-zone::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 999px;
    border: 2px solid currentColor;
    opacity: 0;
    animation: safariPulseRing 2.5s ease-in-out infinite;
}

.safari-biome-zone:hover::before {
    opacity: 0.6;
}

@keyframes safariPulseRing {

    0%,
    100% {
        transform: scale(1);
        opacity: 0;
    }

    50% {
        transform: scale(1.08);
        opacity: 0.5;
    }
}

/* Biome label - hidden since the original image has its own labels */
.safari-biome-label {
    display: none;
}

/* Biome badge (player count) */
.safari-biome-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--safari-accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid var(--safari-bg);
    box-shadow: 0 4px 12px var(--safari-glow);
    z-index: 7;
}

/* ─── Biome Color Themes ─── */
.biome-lost-forest {
    color: #2d8a4e;
}

.biome-lost-forest .safari-biome-label {
    background: rgba(45, 138, 78, 0.75);
}

.biome-crystal-caves-top {
    color: #8b5cf6;
}

.biome-crystal-caves-top .safari-biome-label {
    background: rgba(139, 92, 246, 0.75);
}

.biome-frozen-tundra {
    color: #38bdf8;
}

.biome-frozen-tundra .safari-biome-label {
    background: rgba(56, 189, 248, 0.75);
}

.biome-adventurers-square {
    color: #f59e0b;
}

.biome-adventurers-square .safari-biome-label {
    background: rgba(245, 158, 11, 0.75);
}

.biome-neon-desert {
    color: #06b6d4;
}

.biome-neon-desert .safari-biome-label {
    background: rgba(6, 182, 212, 0.75);
}

.biome-crystal-caves-bottom {
    color: #7c3aed;
}

.biome-crystal-caves-bottom .safari-biome-label {
    background: rgba(124, 58, 237, 0.75);
}

.biome-volcanic-plains {
    color: #ef4444;
}

.biome-volcanic-plains .safari-biome-label {
    background: rgba(239, 68, 68, 0.75);
}

/* ─── Player Dots on Map ─── */
.safari-player-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #34d399;
    border: 2px solid #fff;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
    z-index: 8;
    animation: safariDotPulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes safariDotPulse {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
    }

    50% {
        box-shadow: 0 0 14px rgba(52, 211, 153, 0.8);
    }
}

/* ─── Connection Status Bar ─── */
.safari-status-bar {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    z-index: 20;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.safari-status-pill {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    font-family: 'Cairo', sans-serif;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s;
}

.safari-status-pill.connecting {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
}

.safari-status-pill.connected {
    background: rgba(52, 211, 153, 0.1);
    color: #10b981;
    border: 1.5px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}

.safari-status-pill.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* ─── Back to Map Button (visible in biome) ─── */
.safari-back-to-map {
    position: absolute;
    top: 0.8rem;
    left: 0.8rem;
    z-index: 20;
    padding: 0.5rem 1.2rem;
    border-radius: 999px;
    background: var(--safari-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: var(--safari-text);
    border: 1.5px solid var(--safari-border);
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.safari-back-to-map:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.safari-back-to-map.visible {
    display: inline-flex;
}

/* ═══════════════════════════════════════════════════
   BIOME PANEL — Slide-in drawer
   ═══════════════════════════════════════════════════ */
.safari-biome-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 380px;
    height: 100%;
    z-index: 9999;
    background: #E8D8C8;
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.05" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.08"/></svg>');
    border-right: 3px solid #3d2314;
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.4);
    transform: translateX(-100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Scanning-line animation across the panel */
.safari-biome-panel::before {
    content: '';
    position: absolute;
    top: -5%;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.6), transparent);
    animation: biomeHudScan 4s linear infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes biomeHudScan {
    0% {
        top: -5%;
    }

    100% {
        top: 105%;
    }
}

.safari-biome-panel.active {
    transform: translateX(0);
}

/* Cyber-HUD Panel header */
.safari-biome-panel-header {
    padding: 1rem 1.2rem;
    background: rgba(0, 0, 0, 0.05);
    border-bottom: 2px solid #3d2314;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center the title */
}

/* Corner bracket accents */
.safari-biome-panel-header::before,
.safari-biome-panel-header::after {
    display: none;
}

.safari-biome-panel-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 900;
    color: #3d2314;
    letter-spacing: 0.03em;
    text-shadow: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.safari-biome-close {
    position: absolute;
    /* Take out of flow to center the title */
    left: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ef4444;
    background: #fff;
    color: #ef4444;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.safari-biome-close:hover {
    background: #ef4444;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
}

/* Player list — cyber chips */
.safari-biome-players {
    padding: 0.55rem 1.2rem;
    border-bottom: 1px solid rgba(52, 211, 153, 0.12);
    background: rgba(52, 211, 153, 0.03);
    flex-shrink: 0;
}

.safari-biome-players-title {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    color: #70450c;
    text-transform: uppercase;
    margin-bottom: 0.45rem;
}

.safari-biome-players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.safari-biome-player-chip {
    padding: 0.18rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(52, 211, 153, 0.07);
    border: 1px solid rgba(52, 211, 153, 0.28);
    color: #70450c;
    letter-spacing: 0.02em;
}

.safari-biome-player-chip::before {
    content: '◉ ';
    font-size: 0.55rem;
    color: #70450c;
}

/* Biome chat area */
.safari-biome-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Grid overlay + dark bg for cyber feel */
.safari-biome-chat-log {
    flex: 1;
    padding: 1rem 0.9rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(61, 35, 20, 0.25) transparent;
}

.safari-biome-chat-log::-webkit-scrollbar {
    width: 3px;
}

.safari-biome-chat-log::-webkit-scrollbar-track {
    background: transparent;
}

.safari-biome-chat-log::-webkit-scrollbar-thumb {
    background: rgba(52, 211, 153, 0.35);
    border-radius: 4px;
}

/* Input row */
.safari-biome-chat-input-row {
    padding: 0.8rem 1rem;
    border-top: 3px solid #3d2314;
    display: flex;
    gap: 0.5rem;
    background: var(--safari-wood, linear-gradient(135deg, #a67c52, #8b5a2b));
    flex-shrink: 0;
    align-items: center;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.safari-biome-chat-input-row input {
    flex: 1;
    padding: 0.58rem 1rem;
    border-radius: 8px;
    border: 2px solid #5a2a07;
    outline: none;
    font-family: 'Cairo', sans-serif;
    font-size: 0.88rem;
    background: #fffdf5;
    color: #3d2314;
    transition: all 0.25s;
    caret-color: #3d2314;
    font-weight: 700;
}

.safari-biome-chat-input-row input::placeholder {
    color: #8b5a2b;
    opacity: 0.7;
}

.safari-biome-chat-input-row input:focus {
    border-color: #d97706;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.3);
}

.safari-biome-chat-input-row input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.safari-biome-chat-send {
    padding: 0.58rem 1.1rem;
    border-radius: 8px;
    border: 2px solid #78350f;
    background: linear-gradient(to bottom, #d97706, #b45309);
    color: #fff;
    font-weight: 900;
    font-family: 'Cairo', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.safari-biome-chat-send:hover:not(:disabled) {
    background: linear-gradient(to bottom, #f59e0b, #d97706);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 4px 8px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.safari-biome-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* ─── FUTURISTIC Chat Messages ─── */
.safari-msg-row {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    max-width: 88%;
    animation: safariMsgIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes safariMsgIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.safari-msg-row.self {
    align-self: flex-end;
    align-items: flex-end;
}

.safari-msg-row.other {
    align-self: flex-start;
    align-items: flex-start;
}

.safari-msg-row.system {
    align-self: center;
    align-items: center;
    max-width: 100%;
}

.safari-msg-author {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: 'Cairo', sans-serif;
    opacity: 1;
    /* Increase opacity for contrast */
    padding: 0 0.3rem;
}

.safari-msg-badge {
    font-size: 0.9rem;
    filter: drop-shadow(0 0 4px currentColor);
}

/* Shared bubble base */
.safari-msg-bubble {
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-family: 'Cairo', sans-serif;
    line-height: 1.55;
    word-break: break-word;
    max-width: 100%;
    position: relative;
    overflow: hidden;
}

.safari-msg-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

/* Self / outgoing — green neon */
.safari-msg-row.self .safari-msg-bubble {
    background: linear-gradient(135deg, #065f46 0%, #047857 100%);
    color: #d1fae5;
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-bottom-right-radius: 3px;
    box-shadow: 0 2px 14px rgba(52, 211, 153, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    text-shadow: 0 0 10px rgba(52, 211, 153, 0.25);
}

/* Other / incoming */
.safari-msg-row.other .safari-msg-bubble {
    background: rgba(255, 255, 255, 0.3);
    color: #3d2314;
    border: 1px solid rgba(166, 124, 82, 0.4);
    border-bottom-left-radius: 3px;
    box-shadow: 0 2px 6px rgba(61, 35, 20, 0.05);
    font-weight: 600;
}

/* System — centered monoline pill */
.safari-msg-row.system .safari-msg-bubble {
    background: rgba(61, 35, 20, 0.08);
    /* Darker brown bg */
    color: #4A3525;
    /* Dark brown text */
    font-size: 0.73rem;
    border-radius: 4px;
    padding: 0.22rem 0.85rem;
    font-style: italic;
    border: 1px solid rgba(61, 35, 20, 0.15);
    letter-spacing: 0.02em;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════
   BIOME-SPECIFIC THEMES (COUSTOM CSS)
   ═══════════════════════════════════════════════════ */

/* 🌿 LOST FOREST: Deep Jungle & Organic Borders */
.theme-lost-forest {
    --biome-primary: #2d8a4e;
    --biome-glow: rgba(45, 138, 78, 0.4);
    background: radial-gradient(circle at top right, rgba(45, 138, 78, 0.15), transparent 70%), rgba(10, 25, 20, 0.5) !important;
    border-right: 2px solid var(--biome-primary) !important;
}

.theme-lost-forest::after {
    content: '🌿';
    font-size: 15rem;
    position: absolute;
    bottom: -20px;
    right: -20px;
    opacity: 0.1;
    pointer-events: none;
    filter: blur(2px) grayscale(0.5);
}

.theme-lost-forest .safari-biome-panel-header {
    background: rgba(45, 138, 78, 0.08);
    border-bottom: 2px solid var(--biome-primary) !important;
}

.theme-lost-forest .safari-msg-row.self .safari-msg-bubble {
    background: linear-gradient(135deg, #1b4332, #2d8a4e);
    box-shadow: 0 4px 15px var(--biome-glow);
}






/* 💎 GLASS CRYSTAL CAVES */
.theme-crystal-caves-top,
.theme-crystal-caves-bottom {
    --biome-primary: #8b5cf6;
    --biome-glow: rgba(139, 92, 246, 0.4);
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.18), transparent 70%), rgba(15, 12, 40, 0.5) !important;
    border-right: 2px solid var(--biome-primary) !important;
}

.theme-crystal-caves-top::after,
.theme-crystal-caves-bottom::after {
    content: '💎';
    font-size: 14rem;
    position: absolute;
    top: 20%;
    right: -30px;
    opacity: 0.1;
    pointer-events: none;
    filter: blur(3px) hue-rotate(280deg);
}

.theme-crystal-caves-top .safari-biome-chat-log,
.theme-crystal-caves-bottom .safari-biome-chat-log {
    background-color: #0c0a21;
    background-image: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
}

.theme-crystal-caves-top .safari-msg-row.self .safari-msg-bubble,
.theme-crystal-caves-bottom .safari-msg-row.self .safari-msg-bubble {
    background: #6d28d9;
    border-color: #8b5cf6;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

/* ❄️ GLASS FROZEN TUNDRA */
.theme-frozen-tundra {
    --biome-primary: #38bdf8;
    --biome-glow: rgba(56, 189, 248, 0.4);
    background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.2), transparent 70%), rgba(10, 25, 30, 0.5) !important;
    border-right: 2px solid var(--biome-primary) !important;
}

.theme-frozen-tundra::after {
    content: '❄️';
    font-size: 16rem;
    position: absolute;
    top: 10%;
    left: -40px;
    opacity: 0.1;
    pointer-events: none;
    filter: blur(2px);
}

.theme-frozen-tundra .safari-biome-chat-log {
    background-color: #082f49;
}

.theme-frozen-tundra .safari-msg-row.self .safari-msg-bubble {
    background: #0284c7;
    border-color: #38bdf8;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.theme-adventurers-square {
    --biome-primary: #f59e0b;
    --biome-glow: rgba(245, 158, 11, 0.35);
    background: radial-gradient(circle at top right, rgba(245, 158, 11, 0.15), transparent 70%), url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.05" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.08"/></svg>'), #E8D8C8 !important;
    border-right: 2px solid var(--biome-primary) !important;
}

.theme-adventurers-square .safari-biome-panel-header::before {
    border-color: #f59e0b;
}

.theme-adventurers-square .safari-biome-panel-header::after {
    border-color: #f59e0b;
}

.theme-adventurers-square::after {
    content: '🧭';
    font-size: 14rem;
    position: absolute;
    bottom: -20px;
    right: -20px;
    opacity: 0.15;
    pointer-events: none;
}

.theme-adventurers-square .safari-msg-row.self .safari-msg-bubble {
    background: #b45309;
    border-color: #d97706;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

/* 🏜️ GLASS NEON DESERT */
.theme-neon-desert {
    --biome-primary: #06b6d4;
    --biome-glow: rgba(6, 182, 212, 0.4);
    background: radial-gradient(circle at top right, rgba(6, 182, 212, 0.3), transparent 70%), rgba(10, 30, 40, 0.5) !important;
    border-right: 2px solid var(--biome-primary) !important;
}

.theme-neon-desert::after {
    content: '🌵';
    font-size: 15rem;
    position: absolute;
    bottom: -30px;
    right: -30px;
    opacity: 0.1;
    pointer-events: none;
    filter: drop-shadow(0 0 10px #06b6d4) blur(1px);
}

.theme-neon-desert .safari-msg-row.self .safari-msg-bubble {
    background: linear-gradient(135deg, #0e7490, #06b6d4);
    box-shadow: 0 0 15px var(--biome-glow);
}

/* 🌋 GLASS VOLCANIC PLAINS */
.theme-volcanic-plains {
    --biome-primary: #ef4444;
    --biome-glow: rgba(239, 68, 68, 0.35);
    background: radial-gradient(circle at top right, rgba(239, 68, 68, 0.2), transparent 70%), rgba(30, 10, 10, 0.5) !important;
    border-right: 2px solid var(--biome-primary) !important;
}

.theme-volcanic-plains .safari-biome-chat-log {
    background-color: #1a0404;
    background-image: radial-gradient(circle at bottom right, rgba(239, 68, 68, 0.15) 0%, transparent 60%);
}

.theme-volcanic-plains::after {
    content: '🌋';
    font-size: 14rem;
    position: absolute;
    top: 15%;
    right: -20px;
    opacity: 0.12;
    pointer-events: none;
    filter: drop-shadow(0 0 20px #ef4444);
}

.theme-volcanic-plains .safari-msg-row.self .safari-msg-bubble {
    background: linear-gradient(135deg, #991b1b, #ef4444);
    box-shadow: 0 4px 15px var(--biome-glow);
    border-color: #f87171;
}

/* ═══════════════════════════════════════════════════
   EVENT POPUP THEMES — SweetAlert2 Overrides
   ═══════════════════════════════════════════════════ */
.safari-event-popup {
    background: #ffffff !important;
    border-radius: 24px !important;
    border: 3px solid rgba(0, 0, 0, 0.15) !important;
    padding: 0 !important;
    overflow: hidden;
    font-family: 'Cairo', sans-serif !important;
    max-width: 420px !important;
}

.safari-event-popup .swal2-html-container {
    margin: 0 !important;
    padding: 0 !important;
}

/* Event body  */
.safari-event-body {
    padding: 1.5rem;
    text-align: center;
}

.safari-event-emoji {
    font-size: 3.5rem;
    margin-bottom: 0.8rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.safari-event-title {
    font-size: 1.3rem;
    font-weight: 900;
    margin-bottom: 0.6rem;
    line-height: 1.4;
    color: #111827 !important;
}

.safari-event-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #4b5563 !important;
    margin-bottom: 1.2rem;
}

.safari-event-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.safari-event-type-badge.good {
    background: rgba(52, 211, 153, 0.15);
    color: #059669;
}

.safari-event-type-badge.bad {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.safari-event-type-badge.neutral {
    background: rgba(251, 191, 36, 0.15);
    color: #d97706;
}

/* Event action buttons */
.safari-event-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1.5rem 1.5rem;
}

.safari-event-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 14px;
    border: 2px solid transparent;
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.safari-event-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.safari-event-btn.primary {
    background: var(--biome-color, #2d6a4f);
    color: #fff;
}

.safari-event-btn.secondary {
    background: transparent;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: #4b5563 !important;
}

/* Per-biome popup header gradients */
.safari-event-popup.biome-lost-forest {
    --biome-color: #2d8a4e;
    border-color: #2d8a4e !important;
}

.safari-event-popup.biome-lost-forest .safari-event-body {
    background: linear-gradient(180deg, #e8f5e9, transparent);
}

.safari-event-popup.biome-crystal-caves-top,
.safari-event-popup.biome-crystal-caves-bottom {
    --biome-color: #8b5cf6;
    border-color: #8b5cf6 !important;
}

.safari-event-popup.biome-crystal-caves-top .safari-event-body,
.safari-event-popup.biome-crystal-caves-bottom .safari-event-body {
    background: linear-gradient(180deg, #ede9fe, transparent);
}

.safari-event-popup.biome-frozen-tundra {
    --biome-color: #0ea5e9;
    border-color: #38bdf8 !important;
}

.safari-event-popup.biome-frozen-tundra .safari-event-body {
    background: linear-gradient(180deg, #e0f2fe, transparent);
}

.safari-event-popup.biome-adventurers-square {
    --biome-color: #d97706;
    border-color: #f59e0b !important;
}

.safari-event-popup.biome-adventurers-square .safari-event-body {
    background: linear-gradient(180deg, #fffbeb, transparent);
}

.safari-event-popup.biome-neon-desert {
    --biome-color: #0891b2;
    border-color: #06b6d4 !important;
}

.safari-event-popup.biome-neon-desert .safari-event-body {
    background: linear-gradient(180deg, #ecfeff, transparent);
}

.safari-event-popup.biome-volcanic-plains {
    --biome-color: #dc2626;
    border-color: #ef4444 !important;
}

.safari-event-popup.biome-volcanic-plains .safari-event-body {
    background: linear-gradient(180deg, #fef2f2, transparent);
}

/* ═══════════════════════════════════════════════════
   RESPONSIVENESS
   ═══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .safari-biome-panel {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .dash-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.8rem;
        padding-bottom: 1rem;
    }

    .dash-header>div:last-child {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .safari-status-pill {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
    }

    .safari-shop-toggle-btn {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }

    .safari-map-wrapper {
        height: calc(100vh - 120px);
    }

    .safari-biome-panel {
        width: 100%;
        height: 50vh;
        top: auto;
        bottom: 0;
        border-right: none;
        border-top: 4px solid var(--biome-color, #2d184a);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
        transform: translateY(100%);
    }

    .safari-biome-panel.active {
        transform: translateY(0);
    }

    .safari-minimap {
        display: none;
    }

    .safari-biome-label {
        font-size: 0.7rem;
        padding: 0.3rem 0.7rem;
    }

    .safari-event-popup {
        max-width: 95vw !important;
        padding: 1rem !important;
    }

    .safari-event-emoji {
        font-size: 3rem;
    }

    .safari-shop-modal-content {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.6rem;
    }

    .safari-shop-card {
        padding: 0.6rem;
    }

    .safari-shop-item-preview {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .safari-status-pill.sari-pill {
        order: -1;
        width: 100%;
        text-align: center;
    }
}


/* ═══════════════════════════════════════════════════
   ECONOMY & COSMETICS
   ═══════════════════════════════════════════════════ */
.sari-pill {
    background: linear-gradient(135deg, #ffd700, #f59e0b) !important;
    color: #fff !important;
    font-weight: 800 !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    border: none !important;
    padding: 0.5rem 1rem !important;
    animation: sariPillPulse 2s infinite ease-in-out;
}

@keyframes sariPillPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    }
}


.safari-shop-toggle-btn {
    background: var(--lana-green);
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(45, 138, 78, 0.2);
}

.safari-shop-toggle-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* ═══════════════════════════════════════════════════
   PREMIUM SHOP UI (1000x UPGRADE)
   ═══════════════════════════════════════════════════ */
.safari-shop-popup {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 24px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
}

.safari-shop-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 0.8rem;
}

.safari-shop-tab {
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(0, 0, 0, 0.03);
    color: #666;
}

.safari-shop-tab.active {
    background: var(--lana-green);
    color: white;
    box-shadow: 0 4px 15px rgba(45, 138, 78, 0.3);
}

.safari-shop-modal-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.2rem;
    padding: 0.5rem;
    max-height: 55vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.safari-shop-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 18px;
    padding: 1.2rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.safari-shop-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: var(--lana-green);
}

.safari-shop-card.owned {
    background: #f8fafc;
    border-color: #e2e8f0;
    cursor: default;
}

.safari-shop-card.owned::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(45, 138, 78, 0.05));
}

.safari-shop-card.owned::after {
    content: '✨ تم الشراء';
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--lana-green);
}

.safari-shop-item-preview {
    font-size: 3rem;
    margin-bottom: 0.8rem;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s;
}

.safari-shop-card:hover .safari-shop-item-preview {
    transform: scale(1.1);
}

.safari-shop-item-name {
    font-weight: 900;
    display: block;
    font-size: 0.95rem;
    color: #1e293b;
    margin-bottom: 0.3rem;
}

.safari-shop-item-price {
    font-size: 0.85rem;
    color: #f59e0b;
    font-weight: 900;
    background: rgba(245, 158, 11, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    display: inline-block;
}

.safari-shop-price-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* ═══════════════════════════════════════════════════
   FLOATING HUD — Modern HUD System
   ═══════════════════════════════════════════════════ */

.safari-hud-top {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    width: auto;
    max-width: 95vw;
    pointer-events: none;
}

.hud-module {
    background: var(--safari-glass);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1.5px solid var(--safari-border);
    border-radius: 28px;
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hud-module:hover {
    border-color: var(--safari-accent);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px var(--safari-glow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.hud-module.status-center {
    gap: 1.2rem;
}

.hud-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--safari-text);
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.hud-emoji {
    font-size: 1.4rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

/* Status Orbs & Pills */
.hud-pill {
    padding: 0.5rem 1rem;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 850;
    color: var(--safari-text);
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--safari-border);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.balance-pill {
    background: linear-gradient(135deg, #ffd700, #f59e0b);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.hud-sep {
    width: 1px;
    height: 16px;
    background: var(--safari-border);
    margin: 0 0.2rem;
}

.hud-orb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--safari-text-muted);
    border: 2px solid var(--safari-bg);
    box-shadow: 0 0 0 1px var(--safari-border);
    position: relative;
    transition: all 0.3s;
}

.hud-orb.status-ok {
    background: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.hud-orb.status-error {
    background: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

.hud-orb::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1px solid currentColor;
    opacity: 0;
    animation: orbPulse 2s infinite;
}

.hud-orb.status-ok::after {
    color: #10b981;
}

.hud-orb.status-error::after {
    color: #ef4444;
}

@keyframes orbPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* HUD Buttons */
.hud-btn {
    background: var(--safari-accent);
    color: #fff;
    border: none;
    padding: 0.5rem 1.1rem;
    border-radius: 14px;
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    font-family: 'Cairo', sans-serif;
}

.hud-btn.shop-btn {
    background: #1b4332;
}

.hud-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--safari-glow);
}

.hud-icon-btn {
    background: rgba(0, 0, 0, 0.08);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--safari-text);
}

.hud-icon-btn:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: rotate(45deg);
}

/* ─── Mobile Bottom HUD ─── */
.safari-hud-bottom {
    display: none;
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 92vw;
    background: var(--safari-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--safari-border);
    border-radius: 24px;
    padding: 0.5rem;
    box-shadow: var(--safari-panel-shadow);
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .hud-desktop-only {
        display: none;
    }

    .safari-hud-bottom {
        display: flex;
    }

    .hud-module.branding {
        display: none;
    }

    .safari-hud-top {
        top: 0.8rem;
        width: 100%;
        padding: 0 1rem;
    }
}

/* ═══════════════════════════════════════════════════
   PREMIUM GLASSY MODALS (Shop & Quests)
   ═══════════════════════════════════════════════════ */

.safari-modal-glass {
    background: var(--safari-glass) !important;
    backdrop-filter: blur(30px) !important;
    -webkit-backdrop-filter: blur(30px) !important;
    border: 1px solid var(--safari-border) !important;
    border-radius: 32px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4) !important;
    color: var(--safari-text) !important;
}

[data-theme="dark"] .safari-modal-glass {
    background: rgba(15, 23, 42, 0.75) !important;
}

.safari-modal-title {
    font-weight: 950 !important;
    color: var(--safari-text) !important;
    font-size: 1.8rem !important;
    letter-spacing: -0.5px;
    margin-bottom: 1.5rem !important;
}

/* Tabs Unification */
.safari-tab-container {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1.8rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    border-radius: 100px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

[data-theme="dark"] .safari-tab-container {
    background: rgba(255, 255, 255, 0.05);
}

.safari-tab-item {
    padding: 0.7rem 1.6rem;
    border-radius: 100px;
    font-weight: 850;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--safari-text-muted);
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.safari-tab-item.active {
    background: var(--safari-accent);
    color: #fff;
    box-shadow: 0 8px 20px var(--safari-glow);
    transform: scale(1.05);
}

.safari-tab-item:hover:not(.active) {
    background: rgba(0, 0, 0, 0.05);
    color: var(--safari-text);
}

/* Shop Preview Box */
.safari-shop-preview {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.4rem;
    border-radius: 24px;
    margin-bottom: 1.5rem;
    text-align: center;
    border: 1px dashed var(--safari-border);
    position: relative;
    overflow: hidden;
}

.safari-shop-balance {
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 950;
    color: #f59e0b;
    font-size: 1.4rem;
    text-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

/* Card Grid Layout */
.safari-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.2rem;
    max-height: 55vh;
    overflow-y: auto;
    padding: 0.6rem;
    scrollbar-width: thin;
    direction: rtl;
}

/* Premium Item Card */
.safari-item-card {
    background: rgba(0, 0, 0, 0.05);
    border: 2px solid transparent;
    padding: 1.5rem 1rem;
    border-radius: 12px;
    /* Boxier, like a plank or parchment */
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(255, 255, 255, 0.5);
}

.safari-item-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, var(--safari-accent), transparent 70%);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.safari-item-card:hover {
    transform: translateY(-4px);
    border-color: var(--safari-accent);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15), inset 0 0 10px rgba(217, 119, 6, 0.1);
}

.safari-item-card:hover::before {
    opacity: 0.1;
}

.safari-item-card.owned {
    opacity: 0.8;
}

.safari-item-preview-icon {
    font-size: 3.5rem;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.15));
    margin-bottom: 0.5rem;
    transition: transform 0.4s;
}

.safari-item-card:hover .safari-item-preview-icon {
    transform: scale(1.15) rotate(5deg);
}

.safari-item-label {
    font-weight: 900;
    color: var(--safari-text);
    font-size: 1.2rem;
    display: block;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.safari-item-price-tag {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    padding: 0.4rem 1rem;
    border-radius: 12px;
    font-weight: 900;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    margin-top: 0.4rem;
}

.safari-item-card.owned .safari-item-price-tag {
    background: #10b98122;
    color: #10b981;
}

/* ═══════════════════════════════════════════════════
   SCROLLBAR POLISH
   ═══════════════════════════════════════════════════ */
.safari-card-grid::-webkit-scrollbar {
    width: 6px;
}

.safari-card-grid::-webkit-scrollbar-track {
    background: transparent;
}

.safari-card-grid::-webkit-scrollbar-thumb {
    background: var(--safari-border);
    border-radius: 10px;
}

.safari-card-grid::-webkit-scrollbar-thumb:hover {
    background: var(--safari-accent);
}

/* ═══════════════════════════════════════════════════
   QUESTS & ACHIEVEMENTS UI — Theme Aware
   ═══════════════════════════════════════════════════ */

.safari-quests-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--safari-border);
    padding-bottom: 1rem;
    direction: rtl;
}

.safari-quests-tab {
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(0, 0, 0, 0.05);
    color: var(--safari-text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.safari-quests-tab.active {
    background: var(--safari-accent);
    color: #fff;
    box-shadow: 0 4px 15px var(--safari-glow);
}

.safari-quests-overview {
    background: var(--safari-glass);
    padding: 1.4rem;
    border-radius: 22px;
    margin-bottom: 1.8rem;
    text-align: right;
    border: 1px dashed var(--safari-accent);
    position: relative;
    overflow: hidden;
    direction: rtl;
}

.safari-quests-overview-title {
    font-weight: 900;
    color: var(--safari-accent);
    margin-bottom: 0.5rem;
    font-size: 1.15rem;
}

.safari-quests-overview-desc {
    font-size: 0.88rem;
    color: var(--safari-text);
    opacity: 0.8;
    line-height: 1.5;
}

.safari-quest-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    direction: rtl;
}

.safari-quest-card {
    background: var(--safari-glass);
    border: 2px solid var(--safari-border);
    padding: 1.5rem;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--safari-panel-shadow);
    transition: all 0.3s;
    text-align: right;
    display: block;
}

.safari-quest-card.completed {
    border-color: #10b981;
    opacity: 0.95;
}

.safari-quest-card:hover {
    transform: translateY(-3px);
    border-color: var(--safari-accent);
    box-shadow: 0 15px 35px var(--safari-glow);
}

.safari-quest-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.safari-quest-info {
    flex: 1;
    text-align: right;
}

.safari-quest-title {
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--safari-text);
}

.safari-quest-desc {
    font-size: 0.95rem;
    color: var(--safari-text-muted);
    margin-top: 0.3rem;
}

.safari-quest-reward-box {
    text-align: left;
    min-width: 100px;
    background: rgba(245, 158, 11, 0.1);
    padding: 0.8rem;
    border-radius: 15px;
    border: 1.5px solid rgba(245, 158, 11, 0.2);
}

.safari-quest-reward-value {
    font-weight: 950;
    color: #f59e0b;
    font-size: 1.3rem;
    display: block;
}

.safari-quest-reward-label {
    font-size: 0.65rem;
    color: #f59e0b;
    font-weight: 900;
    opacity: 0.8;
    letter-spacing: 0.5px;
}

.safari-progress-container {
    background: rgba(0, 0, 0, 0.1);
    height: 14px;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 0.5rem;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .safari-progress-container {
    background: rgba(255, 255, 255, 0.1);
}

.safari-progress-bar {
    height: 100%;
    background: linear-gradient(270deg, #3b82f6, #60a5fa);
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    border-radius: 99px;
}

.safari-quest-card.completed .safari-progress-bar {
    background: linear-gradient(270deg, #10b981, #34d399);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.safari-quest-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-top: 1rem;
    color: var(--safari-text-muted);
    font-weight: 800;
}

.safari-quest-status.done {
    color: #10b981;
}

.safari-quest-status.pending {
    color: #3b82f6;
}

.safari-quest-completed-badge {
    position: absolute;
    top: 15px;
    left: -35px;
    background: #10b981;
    color: #fff;
    padding: 6px 45px;
    font-size: 0.7rem;
    transform: rotate(-45deg);
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
    letter-spacing: 1px;
    z-index: 2;
}

/* Achievements Grid */
.safari-achievements-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--safari-glass);
    border-radius: 22px;
    border: 1.5px solid var(--safari-border);
    direction: rtl;
}

.safari-achievements-title {
    font-weight: 900;
    color: var(--safari-accent);
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
}

.safari-achievements-desc {
    font-size: 0.9rem;
    color: var(--safari-text);
    opacity: 0.8;
    font-weight: 600;
}

.safari-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    max-height: 55vh;
    overflow-y: auto;
    padding: 0.5rem;
    scrollbar-width: thin;
    direction: rtl;
}

.safari-achievement-card {
    padding: 1.8rem;
    border-radius: 26px;
    border: 1px solid var(--safari-border);
    background: var(--safari-glass);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--safari-panel-shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.safari-achievement-card:hover {
    transform: scale(1.02);
    border-color: var(--safari-accent);
    box-shadow: 0 10px 30px var(--safari-glow);
}

.safari-achievement-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: #10b981;
}

.safari-achievement-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.12));
}

.safari-achievement-title {
    font-weight: 950;
    color: var(--safari-text);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.safari-achievement-desc {
    font-size: 0.95rem;
    color: var(--safari-text-muted);
    line-height: 1.6;
    font-weight: 600;
    opacity: 0.9;
}

.safari-achievement-date {
    font-size: 0.8rem;
    color: var(--safari-text-muted);
    margin-top: 1.4rem;
    border-top: 2.5px solid var(--safari-border);
    padding-top: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.safari-quest-empty,
.safari-achievements-empty {
    text-align: center;
    color: var(--safari-text-muted);
    padding: 4rem;
    background: var(--safari-glass);
    border-radius: 20px;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════
   QUESTS & ACHIEVEMENTS UI — Theme Aware
   ═══════════════════════════════════════════════════ */

.safari-quests-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--safari-border);
    padding-bottom: 1rem;
    direction: rtl;
}

.safari-quests-tab {
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(0, 0, 0, 0.05);
    color: var(--safari-text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.safari-quests-tab.active {
    background: var(--safari-accent);
    color: #fff;
    box-shadow: 0 4px 15px var(--safari-glow);
}

.safari-quests-overview {
    background: var(--safari-glass);
    padding: 1.4rem;
    border-radius: 22px;
    margin-bottom: 1.8rem;
    text-align: right;
    border: 1px dashed var(--safari-accent);
    position: relative;
    overflow: hidden;
    direction: rtl;
}

.safari-quests-overview-title {
    font-weight: 900;
    color: var(--safari-accent);
    margin-bottom: 0.5rem;
    font-size: 1.15rem;
}

.safari-quests-overview-desc {
    font-size: 0.88rem;
    color: var(--safari-text);
    opacity: 0.8;
    line-height: 1.5;
}

.safari-quest-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    direction: rtl;
}

.safari-quest-card {
    background: var(--safari-glass);
    border: 2px solid var(--safari-border);
    padding: 1.5rem;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--safari-panel-shadow);
    transition: all 0.3s;
    text-align: right;
    display: block;
}

.safari-quest-card.completed {
    border-color: #10b981;
    opacity: 0.95;
}

.safari-quest-card:hover {
    transform: translateY(-3px);
    border-color: var(--safari-accent);
    box-shadow: 0 15px 35px var(--safari-glow);
}

.safari-quest-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.safari-quest-info {
    flex: 1;
    text-align: right;
}

.safari-quest-title {
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--safari-text);
}

.safari-quest-desc {
    font-size: 0.95rem;
    color: var(--safari-text-muted);
    margin-top: 0.3rem;
}

.safari-quest-reward-box {
    text-align: left;
    min-width: 100px;
    background: rgba(245, 158, 11, 0.1);
    padding: 0.8rem;
    border-radius: 15px;
    border: 1.5px solid rgba(245, 158, 11, 0.2);
}

.safari-quest-reward-value {
    font-weight: 950;
    color: #f59e0b;
    font-size: 1.3rem;
    display: block;
}

.safari-quest-reward-label {
    font-size: 0.65rem;
    color: #f59e0b;
    font-weight: 900;
    opacity: 0.8;
    letter-spacing: 0.5px;
}

.safari-progress-container {
    background: rgba(0, 0, 0, 0.1);
    height: 14px;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 0.5rem;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .safari-progress-container {
    background: rgba(255, 255, 255, 0.1);
}

.safari-progress-bar {
    height: 100%;
    background: linear-gradient(270deg, #3b82f6, #60a5fa);
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    border-radius: 99px;
}

.safari-quest-card.completed .safari-progress-bar {
    background: linear-gradient(270deg, #10b981, #34d399);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.safari-quest-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-top: 1rem;
    color: var(--safari-text-muted);
    font-weight: 800;
}

.safari-quest-status.done {
    color: #10b981;
}

.safari-quest-status.pending {
    color: #3b82f6;
}

.safari-quest-completed-badge {
    position: absolute;
    top: 15px;
    left: -35px;
    background: #10b981;
    color: #fff;
    padding: 6px 45px;
    font-size: 0.7rem;
    transform: rotate(-45deg);
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
    letter-spacing: 1px;
    z-index: 2;
}

/* Achievements Grid */
.safari-achievements-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--safari-glass);
    border-radius: 22px;
    border: 1.5px solid var(--safari-border);
    direction: rtl;
}

.safari-achievements-title {
    font-weight: 900;
    color: var(--safari-accent);
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
}

.safari-achievements-desc {
    font-size: 0.9rem;
    color: var(--safari-text);
    opacity: 0.8;
    font-weight: 600;
}

.safari-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    max-height: 55vh;
    overflow-y: auto;
    padding: 0.5rem;
    scrollbar-width: thin;
    direction: rtl;
}

.safari-achievement-card {
    padding: 1.8rem;
    border-radius: 26px;
    border: 1px solid var(--safari-border);
    background: var(--safari-glass);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--safari-panel-shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.safari-achievement-card:hover {
    transform: scale(1.02);
    border-color: var(--safari-accent);
    box-shadow: 0 10px 30px var(--safari-glow);
}

.safari-achievement-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: #10b981;
}

.safari-achievement-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.12));
}

.safari-achievement-title {
    font-weight: 950;
    color: var(--safari-text);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.safari-achievement-desc {
    font-size: 0.95rem;
    color: var(--safari-text-muted);
    line-height: 1.6;
    font-weight: 600;
    opacity: 0.9;
}

.safari-achievement-date {
    font-size: 0.8rem;
    color: var(--safari-text-muted);
    margin-top: 1.4rem;
    border-top: 2.5px solid var(--safari-border);
    padding-top: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.safari-quest-empty,
.safari-achievements-empty {
    text-align: center;
    color: var(--safari-text-muted);
    padding: 4rem;
    background: var(--safari-glass);
    border-radius: 20px;
    font-weight: 700;
}