/**
 * Dark Realms - World Map Styles
 * Complete redesign with illustrated map, region markers, and transitions
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
    --map-bg-dark: #0a0a12;
    --map-bg-medium: #12121a;
    --gold-primary: #c9a227;
    --gold-light: #e9c638;
    --gold-dark: #8b6c16;
    --marker-size: 80px;
    --marker-size-mobile: 60px;
}

/* ============================================
   WORLD MAP PAGE LAYOUT
   ============================================ */

.world-map-page {
    min-height: 100vh;
    background: var(--map-bg-dark);
    overflow: hidden;
}

.world-map-main {
    position: relative;
    width: 100%;
    height: calc(100vh - 70px);
    overflow: hidden;
}

/* ============================================
   MAP NAVBAR
   ============================================ */

.map-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 18, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(201, 162, 39, 0.2);
}

.map-navbar .nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand .brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.brand-icon {
    font-size: 1.5rem;
}

.brand-text {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: #888;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    transition: color 0.3s;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--gold-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gold-primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.realm-balance {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 20px;
}

.realm-balance.hidden {
    display: none;
}

.realm-icon {
    font-size: 1.1rem;
}

#realm-balance-amount {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: var(--gold-primary);
}

.realm-label {
    font-size: 0.75rem;
    color: #888;
}

.wallet-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #fff;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.wallet-btn:hover {
    border-color: rgba(201, 162, 39, 0.5);
    background: rgba(201, 162, 39, 0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
}

.wallet-btn.connected .status-dot {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

/* ============================================
   MAP HEADER
   ============================================ */

.map-header {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 20;
    pointer-events: none;
}

.map-title {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    background: linear-gradient(145deg, #ffd700, #c9a227, #8b6c16);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 60px rgba(201, 162, 39, 0.4);
    margin-bottom: 0.3rem;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(201, 162, 39, 0.3)); }
    50% { filter: drop-shadow(0 0 40px rgba(201, 162, 39, 0.5)); }
}

.map-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.1em;
}

/* ============================================
   PLAYER PROGRESS BAR
   ============================================ */

.player-progress-bar {
    position: absolute;
    top: 90px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem 1.2rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(201, 162, 39, 0.2);
    border-radius: 12px;
    z-index: 20;
}

.progress-stat {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.progress-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
}

.progress-value {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--gold-primary);
    min-width: 40px;
}

.progress-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   WORLD MAP CANVAS
   ============================================ */

.world-map-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Map Background */
.map-background {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
    filter: brightness(0.7) saturate(0.9);
}

.map-background.fallback {
    background: 
        radial-gradient(ellipse at 20% 40%, rgba(45, 90, 39, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 15%, rgba(168, 213, 229, 0.2) 0%, transparent 40%),
        radial-gradient(ellipse at 78% 55%, rgba(230, 184, 77, 0.2) 0%, transparent 40%),
        radial-gradient(ellipse at 30% 72%, rgba(61, 74, 58, 0.3) 0%, transparent 40%),
        radial-gradient(ellipse at 55% 80%, rgba(139, 37, 0, 0.3) 0%, transparent 40%),
        linear-gradient(180deg, #0a0a12 0%, #1a1a2e 50%, #0a0a12 100%);
}

/* Fog Overlay */
.fog-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background: 
        radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    animation: fogDrift 20s ease-in-out infinite;
}

@keyframes fogDrift {
    0%, 100% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(10px) translateY(-5px); }
    50% { transform: translateX(-5px) translateY(10px); }
    75% { transform: translateX(-10px) translateY(-10px); }
}

/* Map Particles */
.map-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

/* ============================================
   REGION PATHS (SVG CONNECTIONS)
   ============================================ */

.region-paths {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 8;
}

.paths-svg {
    width: 100%;
    height: 100%;
}

.region-path {
    stroke-width: 0.3;
    stroke-linecap: round;
    stroke-dasharray: 2, 1;
    transition: all 0.5s ease;
}

.region-path.unlocked {
    stroke: rgba(201, 162, 39, 0.4);
    animation: pathFlow 3s linear infinite;
}

.region-path.locked {
    stroke: rgba(100, 100, 100, 0.2);
}

@keyframes pathFlow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -6; }
}

/* ============================================
   REGION MARKERS
   ============================================ */

.region-markers {
    position: absolute;
    inset: 0;
    z-index: 10;
}

.region-marker {
    position: absolute;
    width: var(--marker-size);
    height: var(--marker-size);
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: z-index 0s;
}

.region-marker:hover {
    z-index: 15;
}

.region-marker.locked {
    filter: grayscale(0.8) brightness(0.5);
    cursor: not-allowed;
}

.region-marker.locked:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Marker Pulse Animation */
.marker-pulse {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--region-color, #c9a227) 0%, transparent 70%);
    opacity: 0;
    animation: markerPulse 2s ease-out infinite;
}

.region-marker:not(.locked) .marker-pulse {
    opacity: 0.3;
}

@keyframes markerPulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Marker Icon */
.marker-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, rgba(20, 20, 30, 0.9), rgba(10, 10, 18, 0.95));
    border: 3px solid var(--region-color, #c9a227);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 
        0 0 20px rgba(0, 0, 0, 0.5),
        0 0 30px var(--region-color, rgba(201, 162, 39, 0.3)),
        inset 0 0 15px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.marker-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.marker-icon .marker-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.95), rgba(15, 15, 25, 0.98));
}

.region-marker:hover .marker-icon {
    box-shadow: 
        0 0 25px rgba(0, 0, 0, 0.6),
        0 0 50px var(--region-color, rgba(201, 162, 39, 0.5)),
        inset 0 0 20px rgba(0, 0, 0, 0.4);
    border-color: var(--gold-light);
}

.region-marker:hover .marker-icon img {
    transform: scale(1.15);
}

.region-marker.locked .marker-icon {
    border-color: #444;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    filter: grayscale(1) brightness(0.5);
}

.region-marker.locked .marker-icon::after {
    content: '🔒';
    position: absolute;
    font-size: 1.2rem;
    filter: none;
}

/* Marker Label */
.marker-label {
    position: absolute;
    top: calc(100% - 5px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(0, 0, 0, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.9);
    transition: all 0.3s ease;
}

.region-marker:hover .marker-label {
    color: var(--region-color, #c9a227);
}

/* Marker Level Badge */
.marker-level {
    position: absolute;
    top: -5px;
    right: -5px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--region-color, #c9a227);
    border-radius: 8px;
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    color: var(--region-color, #c9a227);
    white-space: nowrap;
}

/* Progress Ring */
.marker-progress-ring {
    position: absolute;
    inset: -5px;
    pointer-events: none;
}

.marker-progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.marker-progress-ring .progress-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 2;
}

.marker-progress-ring .progress-fill {
    fill: none;
    stroke: var(--region-color, #c9a227);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

/* ============================================
   COMPASS ROSE
   ============================================ */

.compass-rose {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 70px;
    height: 70px;
    z-index: 20;
}

.compass-n {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold-primary);
}

.compass-inner {
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(201, 162, 39, 0.4);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
}

.compass-needle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 30px;
    transform: translate(-50%, -50%);
    background: linear-gradient(to bottom, #ff4444 0%, #ff4444 50%, #fff 50%, #fff 100%);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* ============================================
   MAP LEGEND
   ============================================ */

.map-legend {
    position: absolute;
    bottom: 30px;
    right: 30px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(201, 162, 39, 0.2);
    border-radius: 10px;
    z-index: 20;
}

.legend-title {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold-primary);
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.4rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid;
}

.legend-marker.unlocked {
    border-color: var(--gold-primary);
    background: rgba(201, 162, 39, 0.2);
}

.legend-marker.locked {
    border-color: #444;
    background: rgba(68, 68, 68, 0.2);
}

.legend-marker.current {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.2);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

/* ============================================
   REGION TOOLTIP
   ============================================ */

.region-tooltip {
    position: fixed;
    width: 300px;
    background: linear-gradient(145deg, rgba(26, 26, 36, 0.98), rgba(18, 18, 26, 0.98));
    border: 1px solid rgba(201, 162, 39, 0.4);
    border-radius: 12px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(201, 162, 39, 0.1);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s ease;
    overflow: hidden;
}

.region-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.region-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(201, 162, 39, 0.4);
}

.region-tooltip.below::after {
    bottom: auto;
    top: -8px;
    border-top-color: transparent;
    border-bottom-color: rgba(201, 162, 39, 0.4);
}

/* Tooltip Image Preview */
.tooltip-image {
    width: 100%;
    height: 100px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.tooltip-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(18, 18, 26, 1) 0%, transparent 100%);
}

.tooltip-image.no-image {
    height: 60px;
}

.tooltip-body {
    padding: 1rem 1.2rem 1.2rem;
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.tooltip-name {
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
}

.tooltip-level {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--gold-primary);
    padding: 3px 10px;
    background: rgba(201, 162, 39, 0.15);
    border-radius: 10px;
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.tooltip-description {
    font-size: 0.85rem;
    color: #999;
    line-height: 1.5;
    margin-bottom: 0.8rem;
}

.tooltip-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.tooltip-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: #aaa;
}

.tooltip-stat .stat-icon {
    font-size: 0.9rem;
}

.tooltip-progress {
    margin-bottom: 0.8rem;
}

.tooltip-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.tooltip-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.tooltip-progress-text {
    font-size: 0.7rem;
    color: #666;
}

.tooltip-action {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--gold-primary);
    text-align: center;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.region-tooltip.locked .tooltip-action {
    color: #666;
}

/* ============================================
   TRANSITION OVERLAY
   ============================================ */

.transition-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 18, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.transition-overlay.active {
    opacity: 1;
    visibility: visible;
}

.transition-content {
    text-align: center;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.4s ease 0.2s;
}

.transition-overlay.active .transition-content {
    transform: scale(1);
    opacity: 1;
}

.transition-region-image {
    width: 200px;
    height: 250px;
    margin: 0 auto 1.5rem;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(201, 162, 39, 0.5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.transition-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1.5rem;
}

.transition-loader {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.loader-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary), var(--gold-light));
    border-radius: 2px;
    animation: loaderProgress 0.8s ease forwards;
}

@keyframes loaderProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ============================================
   MAP ERROR STATE
   ============================================ */

.map-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(255, 100, 100, 0.3);
}

.map-error p {
    color: #ff6b6b;
    margin-bottom: 1rem;
}

.retry-btn {
    padding: 0.8rem 2rem;
    background: linear-gradient(145deg, var(--gold-primary), var(--gold-dark));
    border: none;
    border-radius: 8px;
    color: #000;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(201, 162, 39, 0.3);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .map-header {
        top: 80px;
    }
    
    .map-title {
        font-size: 2rem;
    }
    
    .player-progress-bar {
        top: auto;
        bottom: 100px;
        right: 20px;
        flex-direction: row;
        gap: 1.5rem;
    }
    
    .compass-rose {
        display: none;
    }
}

@media (max-width: 768px) {
    .map-navbar .nav-inner {
        flex-wrap: wrap;
        gap: 0.8rem;
        padding: 0.8rem 1rem;
    }
    
    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 1.5rem;
    }
    
    .map-header {
        top: 130px;
    }
    
    .map-title {
        font-size: 1.6rem;
    }
    
    .map-subtitle {
        font-size: 0.9rem;
    }
    
    .region-marker {
        --marker-size: var(--marker-size-mobile);
    }
    
    .marker-icon {
        width: 45px;
        height: 45px;
    }
    
    .marker-icon .marker-fallback {
        font-size: 1.3rem;
    }
    
    .marker-label {
        font-size: 0.7rem;
    }
    
    .marker-level {
        font-size: 0.55rem;
        padding: 1px 4px;
    }
    
    .player-progress-bar {
        bottom: 80px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        padding: 0.8rem 1rem;
    }
    
    .progress-stat {
        flex-direction: column;
        gap: 0.2rem;
        text-align: center;
    }
    
    .progress-label {
        font-size: 0.65rem;
    }
    
    .map-legend {
        bottom: 20px;
        right: 20px;
        padding: 0.8rem;
    }
    
    .region-tooltip {
        width: 240px;
        padding: 1rem;
    }
    
    .tooltip-name {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .map-title {
        font-size: 1.3rem;
    }
    
    .region-marker {
        --marker-size: 50px;
    }
    
    .marker-icon {
        width: 38px;
        height: 38px;
    }
    
    .marker-icon .marker-fallback {
        font-size: 1.1rem;
    }
    
    .marker-label {
        font-size: 0.6rem;
    }
    
    .map-legend {
        display: none;
    }
    
    .player-progress-bar {
        padding: 0.6rem;
        gap: 1rem;
    }
    
    .progress-value {
        font-size: 0.9rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .region-marker {
        --marker-size: 70px;
    }
    
    .marker-icon {
        width: 45px;
        height: 45px;
    }
    
    .zone-marker-icon {
        width: 40px;
        height: 40px;
    }
    
    .region-tooltip,
    .zone-tooltip {
        display: none !important;
    }
    
    .parcel-cell {
        min-width: 44px;
        min-height: 44px;
    }
    
    .filter-btn {
        padding: 10px 18px;
    }
}

/* ============================================
   REGION DETAIL PAGE (from original)
   ============================================ */

.region-detail-container {
    min-height: 100vh;
    padding: 2rem;
    padding-top: 90px;
    background: linear-gradient(180deg, #0a0a12 0%, #1a1a2e 50%, #0a0a12 100%);
}

/* Region Header */
.region-header {
    position: relative;
    height: 350px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.region-header-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.5);
    transition: transform 0.5s ease;
}

.region-header:hover .region-header-bg {
    transform: scale(1.05);
}

.region-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 10, 18, 1) 0%, transparent 50%);
}

.region-header-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
}

.region-header-title {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
}

.region-header-meta {
    display: flex;
    gap: 2rem;
    color: #ccc;
}

.region-header-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Back Button */
.back-btn {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
    backdrop-filter: blur(5px);
}

.back-btn:hover {
    background: rgba(201, 162, 39, 0.3);
    border-color: rgba(201, 162, 39, 0.5);
}

/* ============================================
   ZONES GRID (Region Detail)
   ============================================ */

.zones-section {
    max-width: 1400px;
    margin: 0 auto 3rem;
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--gold-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(201, 162, 39, 0.3);
}

.zones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Zone Card */
.zone-card {
    background: linear-gradient(145deg, #1a1a24, #12121a);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.zone-card:hover {
    border-color: rgba(201, 162, 39, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.zone-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.zone-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.zone-icon.combat { background: linear-gradient(145deg, #8B0000, #5C1A00); }
.zone-icon.resources { background: linear-gradient(145deg, #228B22, #1A5A1A); }
.zone-icon.buildable { background: linear-gradient(145deg, #4169E1, #2A4A9A); }
.zone-icon.safe { background: linear-gradient(145deg, #DAA520, #8B6C16); }
.zone-icon.dungeon { background: linear-gradient(145deg, #4B0082, #2E0854); }
.zone-icon.boss { background: linear-gradient(145deg, #8B0000, #4B0000); }
.zone-icon.pvp { background: linear-gradient(145deg, #DC143C, #8B0A1A); }

.zone-info h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 0.3rem;
}

.zone-type-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.zone-type-badge.combat { background: rgba(139, 0, 0, 0.3); color: #ff6b6b; }
.zone-type-badge.resources { background: rgba(34, 139, 34, 0.3); color: #90EE90; }
.zone-type-badge.buildable { background: rgba(65, 105, 225, 0.3); color: #87CEEB; }
.zone-type-badge.safe { background: rgba(218, 165, 32, 0.3); color: #FFD700; }
.zone-type-badge.dungeon { background: rgba(75, 0, 130, 0.3); color: #DDA0DD; }
.zone-type-badge.boss { background: rgba(139, 0, 0, 0.5); color: #FF4444; }
.zone-type-badge.pvp { background: rgba(220, 20, 60, 0.3); color: #FF6B6B; }

.zone-description {
    font-size: 0.9rem;
    color: #888;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.zone-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #aaa;
    flex-wrap: wrap;
}

.zone-action-btn {
    width: 100%;
    padding: 12px;
    margin-top: 1rem;
    background: transparent;
    border: 1px solid rgba(201, 162, 39, 0.5);
    border-radius: 8px;
    color: var(--gold-primary);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.zone-action-btn:hover {
    background: rgba(201, 162, 39, 0.2);
    border-color: var(--gold-primary);
}

/* ============================================
   PARCEL GRID
   ============================================ */

.parcel-grid-container {
    max-width: 1400px;
    margin: 0 auto;
    background: linear-gradient(145deg, #1a1a24, #12121a);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.parcel-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.parcel-grid-title {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: #fff;
}

.parcel-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.parcel-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #888;
}

.parcel-legend .legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.parcel-legend .legend-color.available { background: rgba(34, 139, 34, 0.6); }
.parcel-legend .legend-color.owned { background: rgba(65, 105, 225, 0.6); }
.parcel-legend .legend-color.yours { background: rgba(201, 162, 39, 0.8); }
.parcel-legend .legend-color.for-sale { background: rgba(220, 20, 60, 0.6); }

/* Parcel Grid */
.parcel-grid {
    display: grid;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
}

.parcel-cell {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

.parcel-cell:hover {
    transform: scale(1.15);
    z-index: 1;
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.5);
}

.parcel-cell.available {
    background: rgba(34, 139, 34, 0.4);
    border: 1px solid rgba(34, 139, 34, 0.6);
}

.parcel-cell.owned {
    background: rgba(65, 105, 225, 0.4);
    border: 1px solid rgba(65, 105, 225, 0.6);
}

.parcel-cell.yours {
    background: rgba(201, 162, 39, 0.5);
    border: 2px solid var(--gold-primary);
}

.parcel-cell.for-sale {
    background: rgba(220, 20, 60, 0.4);
    border: 1px solid rgba(220, 20, 60, 0.6);
    animation: pulse-sale 2s infinite;
}

@keyframes pulse-sale {
    0%, 100% { box-shadow: 0 0 5px rgba(220, 20, 60, 0.3); }
    50% { box-shadow: 0 0 15px rgba(220, 20, 60, 0.6); }
}

.parcel-cell.size-medium {
    width: 60px;
    height: 60px;
}

.parcel-cell.size-large {
    width: 80px;
    height: 80px;
}

.parcel-cell.empty {
    opacity: 0.3;
    cursor: default;
}

/* ============================================
   PARCEL POPUP
   ============================================ */

.parcel-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.parcel-popup {
    background: linear-gradient(145deg, #1a1a24, #12121a);
    border: 1px solid rgba(201, 162, 39, 0.4);
    border-radius: 16px;
    padding: 2rem;
    width: 400px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.parcel-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.parcel-popup-title {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: var(--gold-primary);
}

.parcel-popup-close {
    background: none;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.parcel-popup-close:hover {
    color: #fff;
}

.parcel-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.parcel-info-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.8rem;
    border-radius: 8px;
}

.parcel-info-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.parcel-info-value {
    font-size: 1.1rem;
    color: #fff;
}

.parcel-bonuses {
    margin-bottom: 1.5rem;
}

.parcel-bonuses h4 {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.bonus-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bonus-tag {
    padding: 4px 10px;
    background: rgba(34, 139, 34, 0.2);
    border: 1px solid rgba(34, 139, 34, 0.4);
    border-radius: 12px;
    font-size: 0.85rem;
    color: #90EE90;
}

.parcel-owner {
    margin-bottom: 1rem;
}

.parcel-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.parcel-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.parcel-btn-primary {
    background: linear-gradient(145deg, var(--gold-primary), var(--gold-dark));
    border: none;
    color: #000;
}

.parcel-btn-primary:hover {
    background: linear-gradient(145deg, var(--gold-light), var(--gold-primary));
    transform: translateY(-2px);
}

.parcel-btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.parcel-btn-secondary:hover {
    border-color: rgba(201, 162, 39, 0.5);
    background: rgba(201, 162, 39, 0.1);
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.loading-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(201, 162, 39, 0.2);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.zone-card {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

.zone-card:nth-child(1) { animation-delay: 0.1s; }
.zone-card:nth-child(2) { animation-delay: 0.15s; }
.zone-card:nth-child(3) { animation-delay: 0.2s; }
.zone-card:nth-child(4) { animation-delay: 0.25s; }
.zone-card:nth-child(5) { animation-delay: 0.3s; }
.zone-card:nth-child(6) { animation-delay: 0.35s; }

.region-marker {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.region-marker:nth-child(1) { animation-delay: 0.2s; }
.region-marker:nth-child(2) { animation-delay: 0.35s; }
.region-marker:nth-child(3) { animation-delay: 0.5s; }
.region-marker:nth-child(4) { animation-delay: 0.65s; }
.region-marker:nth-child(5) { animation-delay: 0.8s; }

/* ============================================
   ADDITIONAL VISUAL EFFECTS
   ============================================ */

/* Vignette effect on map */
.world-map-canvas::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(10, 10, 18, 0.6) 100%);
    pointer-events: none;
    z-index: 6;
}

/* Subtle scan line effect */
.world-map-canvas::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 7;
}

/* Glowing border for active/hovered regions */
.region-marker.current .marker-icon {
    border-color: #4ade80;
    box-shadow: 
        0 0 20px rgba(74, 222, 128, 0.4),
        0 0 40px rgba(74, 222, 128, 0.2),
        inset 0 0 15px rgba(74, 222, 128, 0.1);
    animation: currentPulse 2s ease-in-out infinite;
}

@keyframes currentPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(74, 222, 128, 0.4), 0 0 40px rgba(74, 222, 128, 0.2); }
    50% { box-shadow: 0 0 30px rgba(74, 222, 128, 0.6), 0 0 60px rgba(74, 222, 128, 0.3); }
}

/* Completed region glow */
.region-marker.completed .marker-icon {
    border-color: var(--gold-primary);
    box-shadow: 
        0 0 15px rgba(201, 162, 39, 0.5),
        inset 0 0 10px rgba(201, 162, 39, 0.2);
}

.region-marker.completed::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #4ade80;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #000;
    font-weight: bold;
}

/* Shimmer effect on gold elements */
@keyframes goldShimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.map-title {
    background-size: 200% auto;
    animation: goldShimmer 4s linear infinite;
}

/* Floating animation for marker icons only */
@keyframes markerIconFloat {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-4px); }
}

.region-marker:not(.locked) .marker-icon {
    animation: markerIconFloat 3s ease-in-out infinite;
}

.region-marker:hover .marker-icon {
    animation: none;
}

/* Path glow on hover */
.region-path.unlocked:hover {
    stroke: rgba(201, 162, 39, 0.8);
    stroke-width: 0.5;
    filter: drop-shadow(0 0 3px rgba(201, 162, 39, 0.5));
}

/* Loading skeleton animation */
@keyframes skeletonPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

.loading-placeholder {
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

/* Smooth page transitions */
.world-map-page {
    animation: pageEnter 0.4s ease-out;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Region card hover lift effect */
.region-card {
    will-change: transform;
}

/* Optimized animations for performance */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .marker-pulse,
    .zone-marker-pulse {
        display: none;
    }
}
