/* Base Reset and Typography */
:root {
    --primary-color: var(--accent-primary, #00d2ff);
    --secondary-color: var(--accent-secondary, #3a7bd5);
    --bg-dark: var(--bg-deep, #0a0a0f);
    --text-light: #f0f0f5;
    --glass-bg: var(--glass-medium, rgba(15, 15, 25, 0.4));
    --glass-border: rgba(255, 255, 255, 0.08);
    --gold: var(--royal-gold, #ffd700);
    --gold-glow: var(--glow-gold, rgba(255, 215, 0, 0.4));
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    margin: 0;
    padding: 0;
}

.version-tag {
    position: fixed;
    bottom: 15px;
    left: 15px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    font-family: 'Outfit', sans-serif;
    z-index: 9999;
    pointer-events: none;
    letter-spacing: 1px;
}

/* Base Cosmic Background (Shared) */
.shared-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    filter: brightness(0.4) contrast(1.1);
}

.shared-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
    z-index: -1;
    pointer-events: none;
}

/* Authentication Navigation */
.auth-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    padding: 0 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(5, 5, 8, 0.95) 0%, rgba(5, 5, 8, 0.4) 60%, transparent 100%);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.logo {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--secondary-color);
    letter-spacing: 2px;
    pointer-events: auto;
}

.auth-buttons {
    display: flex;
    gap: 20px;
    pointer-events: auto;
    flex: 1;
    justify-content: flex-end;
}

.nav-menu {
    display: flex;
    gap: 40px;
    pointer-events: auto;
    flex: 2;
    justify-content: center;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.9rem;
    transition: all 0.3s;
    opacity: 0.7;
}

.nav-link:hover,
.nav-link.active {
    opacity: 1;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-color);
}

.auth-buttons a {
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 30px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-login {
    color: var(--text-light);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.btn-register {
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-register:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 210, 255, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.3);
    filter: brightness(1.15);
}

/* User Profile (Logged in state) */
.user-profile {
    display: none;
    flex-direction: row !important;
    align-items: center !important;
    gap: 15px !important;
    pointer-events: auto;
}

/* ========================================
   NOTIFICATIONS SYSTEM (DZTFIX EMPIRE)
   ======================================== */
.notif-wrapper {
    position: relative;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px 6px 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    user-select: none;
    height: 48px;
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
}

.username {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
}

.profile-dropdown {
    position: fixed;
    top: 80px;
    left: 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    min-width: 160px;
    padding: 8px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.text-danger {
    color: #ef4444;
}

.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

body {
    overflow: hidden;
    background: #000;
    overscroll-behavior: none;
}

/* Desktop Stage (Stable Cover Mode) */
.empire-stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.empire-world {
    position: absolute;
    /* Use a scaling logic that fills the container (Cover Strategy) */
    width: 100vw;
    height: 56.25vw;
    /* 16:9 */
    min-height: 100vh;
    min-width: 177.78vh;
    /* 16:9 ratio */

    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    overflow: visible;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    /* Removed border-radius as it creates gaps on full-screen cover */
}

/* Custom Scrollbars for when panning */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 10, 15, 0.9);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.8);
}

/* Interactive World Elements */
.world-element {
    position: absolute;
    z-index: 10;
    display: block;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s ease;
    cursor: pointer;
    /* Adding a subtle glow by default */
    filter: drop-shadow(0 0 8px rgba(0, 210, 255, 0.3));
}

.world-element img {
    width: 100%;
    height: auto;
    display: block;
    /* Ensure the transparent PNG scales nicely */
}

.world-element::after {
    content: attr(data-title);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 5px 15px;
    border-radius: 20px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 1px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease, bottom 0.3s ease;
    backdrop-filter: blur(5px);
    pointer-events: none;
}

/* Hover Effects */
.world-element:hover {
    transform: scale(1.1) translateY(-15px);
    filter: drop-shadow(0 0 30px rgba(0, 242, 234, 0.8)) brightness(1.25);
    z-index: 50;
}

.world-element:hover::after {
    opacity: 1;
    bottom: -45px;
    background: var(--glass-heavy);
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px var(--glow-cyan);
}

/* Coming Soon Effect */
.world-element.coming-soon {
    filter: grayscale(100%) opacity(0.6) drop-shadow(0 0 5px rgba(255, 255, 255, 0.1));
    cursor: not-allowed;
}

.world-element.coming-soon:hover {
    filter: grayscale(100%) opacity(0.8) drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
    transform: scale(1.02) translateY(-2px);
}

.world-element.coming-soon:hover::after {
    content: "Coming Soon";
    background: rgba(40, 40, 50, 0.8);
    border-color: rgba(100, 100, 120, 0.5);
    color: #a0a0b0;
}

/* Specific Positions based on the reference image */
/* Coordinates are approximate percentages relative to the 16:9 container */

.node-top-left {
    /* Floating Islands */
    top: 16%;
    left: 8%;
    width: 26%;
}

.node-bottom-left {
    /* Pirate Port */
    top: 61%;
    left: 17%;
    width: 28%;
}

.node-right {
    /* Futuristic City */
    top: 40%;
    right: 10%;
    width: 28%;
}

.node-center {
    /* Majestic Castle */
    top: 15%;
    left: 35%;
    width: 30%;
}

/* Citizens of the Empire */
.citizen-token {
    position: absolute;
    width: 60px;
    height: 60px;
    /* Center the origin so coordinates (e.g. 5%) represent the center, stopping out-of-bounds */
    margin-left: -30px;
    margin-top: -30px;
    border-radius: 50%;
    border: 3px solid transparent;
    z-index: 5;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}

.citizen-token:hover {
    transform: scale(1.25) !important;
    z-index: 10002;
}

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

.citizen-name {
    position: absolute;
    top: -30px;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px #000;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
    font-family: 'Cinzel', serif;
    background: rgba(0, 0, 0, 0.6);
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid var(--gold-glow);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Online Status Indicator (Only if active) */
.citizen-token.is-online::after {
    content: '';
    position: absolute;
    top: -3px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #00ff88;
    border: 2px solid #000;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ff88;
    z-index: 10;
    animation: status-pulse 2s infinite;
}

@keyframes status-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }

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

@keyframes wander {

    /* Adjusted transform to protect boundaries */
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    25% {
        transform: translate(10px, -5px) rotate(2deg) scale(1.02);
    }

    50% {
        transform: translate(-5px, 10px) rotate(-3deg) scale(0.98);
    }

    75% {
        transform: translate(-10px, -2px) rotate(1deg) scale(1.01);
    }

    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
}

/* Base Mobile Rules moved to mobile.css as requested */

/* Sidebar Toggle Button (Advanced Royale) */
.sidebar-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(15px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.sidebar-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transform: translateX(-100%);
    transition: 0.6s;
}

.sidebar-toggle:hover {
    transform: scale(1.1) rotate(90deg);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.sidebar-toggle:hover::before {
    transform: translateX(100%);
}

.sidebar-toggle svg {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

/* Sidebar Menu (Glassmorphism Royale) */
.sidebar-menu {
    position: fixed;
    top: 0;
    right: -350px;
    width: 320px;
    height: 100vh;
    background: rgba(10, 10, 15, 0.9);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px);
    z-index: 10000;
    transition: right 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.sidebar-menu.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#closeSidebar {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}

#closeSidebar:hover {
    opacity: 1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.coming-soon-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
    text-align: center;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    font-weight: 600;
    letter-spacing: 2px;
}

/* Citizen Info Card (Hover - Premium) */
.citizen-info-card {
    position: fixed;
    padding: 18px 25px;
    background: linear-gradient(135deg, rgba(10, 10, 18, 0.98) 0%, rgba(20, 20, 35, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    backdrop-filter: blur(30px);
    z-index: 10001;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(10px);
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    gap: 20px;
    align-items: center;
    min-width: 280px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), inset 0 0 20px rgba(255, 255, 255, 0.03);
}

/* Add a subtle top border highlight */
.citizen-info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.4), transparent);
}

.citizen-info-card.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.card-avatar {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.card-details h3 {
    margin: 0;
    font-size: 1.1rem;
    font-family: 'Cinzel', serif;
    color: #fff;
}

.card-rank {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    color: #ffd700;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.card-rank img {
    width: 28px;
    height: 28px;
    border: none;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.cinzel {
    font-family: 'Cinzel', serif;
}