/**
 * LOBBYNITE - Tactical Map Styles
 * Modern, battle royale inspired design
 */

/* ============================================
   CSS VARIABLES & RESET
   ============================================ */
:root {
    /* Colors */
    --primary: #00d4ff;
    --primary-dark: #00a8cc;
    --secondary: #7b2cbf;
    --success: #00ff88;
    --warning: #ffa502;
    --danger: #ff4757;
    --storm: #9b59b6;
    --zone: #00d4ff;
    --loot: #f1c40f;
    --fight: #e74c3c;
    --dark: #0a0a0f;
    --dark-secondary: #1a1a2e;
    --dark-tertiary: #2a2a3e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --fortnite-yellow: #f5e050;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #00d4ff, #7b2cbf);
    --gradient-success: linear-gradient(135deg, #00ff88, #00cc6a);
    --gradient-danger: linear-gradient(135deg, #ff4757, #ff6b81);
    --gradient-dark: linear-gradient(180deg, rgba(15, 18, 25, 0.98), rgba(10, 10, 15, 0.98));

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);

    /* Spacing */
    --sidebar-width: 280px;
    --right-sidebar-width: 400px;
    --header-height: 70px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

/* Accessibility helpers */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ============================================
   LAYOUT
   ============================================ */
.map-wrapper {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--right-sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--dark);
    overflow: hidden;
    align-items: stretch;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ============================================
   LEFT SIDEBAR - TOOLS
   ============================================ */
.map-sidebar {
    background: var(--gradient-dark);
    border-right: 2px solid rgba(0, 212, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 50;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    padding: 20px 16px;
    box-shadow: var(--shadow-lg);
}

.map-sidebar h3 {
    color: var(--fortnite-yellow);
    font-size: 0.65rem;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
    padding-bottom: 2px;
    border-bottom: 2px solid rgba(245, 224, 80, 0.3);
}

/* Mode Buttons */
.mode-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 20px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 8px 4px;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.mode-btn:hover::before {
    opacity: 0.1;
}

.mode-btn.active {
    border-color: currentColor;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-glow);
}

.mode-btn.active::before {
    opacity: 0.15;
}

.mode-btn.fight {
    color: var(--fight);
}

.mode-btn.zone {
    color: var(--zone);
}

.mode-btn.loot {
    color: var(--loot);
}

.mode-btn.rotation {
    color: var(--warning);
}

.mode-btn i {
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.mode-btn span {
    position: relative;
    z-index: 1;
}

/* ============================================
   COMPACT TOOLBAR GRID - ORIZZONTALE
   ============================================ */
.toolbar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 bottoni in una riga */
    gap: 4px; /* Spazio ridotto */
    margin-bottom: 12px;
}

.toolbar-grid .tool-btn {
    font-size: 0.75rem; /* Icona più piccola */
    padding: 6px 4px; /* Padding ridotto */
    min-height: 36px; /* Altezza fissa */
}

/* ============================================
   DESCRIPTIVE MODE CARDS
   ============================================ */
.modes-descriptive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    text-align: left;
}

.mode-card .icon {
    font-size: 1rem;
    color: var(--m-color);
}

.mode-card .info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mode-card .name {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
}

.mode-card .desc {
    display: block;
    font-size: 0.55rem;
    color: var(--text-secondary);
}

.mode-card .color-preview {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--m-color);
    opacity: 0.3;
}

/* Rotate Horizontal - Full Width (ora diviso in 2 bottoni) */
.mode-card.rotation-horizontal {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    width: 100%;
    margin-top: 8px;
}

.mode-card.rotation-horizontal .icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.mode-card.rotation-horizontal .info {
    flex: 1;
    gap: 2px;
}

/* Rimuoviamo il vecchio stile .new-path-btn non serve più */

/* Quick Actions (Undo/Redo/Cancella) - Compatto */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px; /* Spazio ridotto */
    margin: 4px 0;
    padding: 3px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tool-btn {
    font-size: 0.75rem; /* Icona più piccola */
    padding: 4px; /* Padding ridotto */
    min-height: 32px; /* Altezza fissa */
}

.mode-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.mode-card.active {
    border-color: var(--m-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

.mode-card.active .color-preview {
    opacity: 1;
}

.mode-card.active .icon {
    color: var(--m-color);
    filter: brightness(1.2);
}

.mode-card .new-path-btn {
    margin-top: 8px;
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

/* New Path Button per Rotate Horizontal */
.mode-card.rotation-horizontal .new-path-btn {
    margin-top: 0;
    padding: 6px 10px;
    font-size: 0.7rem;
}

.mode-card .new-path-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--m-color);
    color: white;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--primary);
    color: white;
}

.tool-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.tool-btn.danger:hover {
    background: rgba(255, 71, 87, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.action-buttons-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: auto;
    padding-top: 20px;
}

/* Unified Colors */
.unified-colors {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

/* Color Swatches */
.color-swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.color-swatch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.2));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.color-swatch:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-sm);
}

.color-swatch:hover::before {
    opacity: 1;
}

.color-swatch.active {
    border: 2px solid #fff;
    box-shadow: 0 0 15px currentColor, var(--shadow-sm);
    transform: scale(1.15);
    position: relative;
}

.color-swatch.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 5px #000, 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Sliders */
.slider-group {
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.02);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
    font-weight: 600;
}

.slider-value {
    color: var(--primary);
    font-weight: 800;
    font-size: 0.8rem;
}

input[type="range"] {
    width: 100%;
    height: 24px;
    background: transparent;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
}

input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: var(--shadow-glow);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.zone-btn {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.zone-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2), transparent);
    transition: left var(--transition-slow);
}

.zone-btn:hover::before {
    left: 100%;
}

.zone-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.zone-btn.active {
    background: rgba(0, 212, 255, 0.25);
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5), inset 0 0 15px rgba(0, 212, 255, 0.2);
    animation: pulse-active 2s ease-in-out infinite;
    position: relative;
}

.zone-btn.active::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 6px;
    font-size: 0.9rem;
    font-weight: 900;
    color: var(--success);
    text-shadow: 0 0 5px var(--success);
    animation: checkmark-pulse 1s ease-in-out infinite;
}

@keyframes pulse-active {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.5), inset 0 0 15px rgba(0, 212, 255, 0.2);
    }

    50% {
        box-shadow: 0 0 30px rgba(0, 212, 255, 0.7), inset 0 0 20px rgba(0, 212, 255, 0.3);
    }
}

@keyframes checkmark-pulse {

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

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

.zone-btn i {
    font-size: 0.9rem;
}

/* Arrow Controls */
.arrow-controls {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.arrow-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.arrow-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.arrow-btn.active {
    background: var(--gradient-primary);
    color: #fff;
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
    position: relative;
}

.arrow-btn.active::after {
    content: '✓';
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.7rem;
    font-weight: 900;
    color: var(--success);
    text-shadow: 0 0 5px var(--success);
    background: var(--dark);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arrow-btn i {
    font-size: 0.9rem;
}

/* Right Sidebar */
.map-sidebar-right {
    background: var(--gradient-dark);
    border-left: 2px solid rgba(0, 212, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    width: var(--right-sidebar-width);
    min-width: var(--right-sidebar-width);
    padding: 20px 16px;
    box-shadow: var(--shadow-lg);
}

.map-sidebar-right h3 {
    color: var(--fortnite-yellow);
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 12px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(245, 224, 80, 0.3);
}

/* Tactic Items */
.tactic-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    margin-bottom: 8px;
}

.tactic-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
    border-radius: var(--radius-md);
    z-index: 0;
}

.tactic-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
}

.tactic-item:hover::before {
    opacity: 0.05;
}

.tactic-item.active {
    background: rgba(0, 212, 255, 0.08);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.tactic-item.active::before {
    opacity: 0.08;
}

.tactic-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.tactic-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 8px currentColor;
}

.tactic-title {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tactic-type {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tactic-meta {
    display: flex;
    gap: 12px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.checkbox-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.tactic-actions {
    display: flex;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.tactic-actions button {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
}

.tactic-actions button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.4);
}

.tactic-actions .btn-danger {
    border-color: rgba(255, 71, 87, 0.3);
    color: var(--danger);
}

.tactic-actions .btn-danger:hover {
    background: rgba(255, 71, 87, 0.1);
    border-color: var(--danger);
}

/* Save Form */
.save-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(0, 212, 255, 0.3);
}

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

.form-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-glow);
}

.form-textarea {
    resize: vertical;
    min-height: 70px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    flex: 1;
    background: var(--gradient-success);
    color: #000;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.3);
}

/* Edit Mode Indicator */
#editModeIndicator {
    display: none;
    background: rgba(255, 165, 2, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 10px;
    margin-bottom: 12px;
    font-size: 0.7rem;
    color: var(--warning);
    font-weight: 700;
    box-shadow: 0 0 15px rgba(255, 165, 2, 0.2);
}

/* Context Menu */
#contextMenu {
    display: none;
    position: fixed;
    background: rgba(10, 10, 15, 0.98);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 15px 6px 6px 6px;
    /* Lascia spazio per la X in alto */
    min-width: 200px;
    z-index: 10000;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    backdrop-filter: blur(10px);
}

/* Context Menu Close Button */
.context-menu-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #ff4757;
    color: white;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    transition: transform 0.2s;
}

.context-menu-close:hover {
    transform: scale(1.1);
    background: #ff6b81;
}

.context-menu-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background var(--transition-fast);
    font-weight: 600;
}

.context-menu-item:hover {
    background: rgba(0, 212, 255, 0.1);
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-item.danger:hover {
    background: rgba(255, 71, 87, 0.1);
}

.context-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 6px 0;
}

/* Stats Bar */
.stats-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 15, 0.98);
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: var(--radius-xl);
    padding: 14px 24px;
    display: flex;
    gap: 24px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 800;
}

/* Message Toast */
#message {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 15, 0.98);
    border-radius: var(--radius-lg);
    padding: 14px 28px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 10000;
    display: none;
    box-shadow: var(--shadow-lg);
    border: 2px solid transparent;
    backdrop-filter: blur(10px);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#message.success {
    border-color: var(--success);
    color: var(--success);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 255, 136, 0.3);
}

#message.error {
    border-color: var(--danger);
    color: var(--danger);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(255, 71, 87, 0.3);
}

#message.info {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* ============================================
   MAIN MAP AREA
   ============================================ */
.map-main {
    position: relative;
    background: var(--dark);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

/* Feedback visivo quando Pan Mode è attivo */
#viewport.pan-mode {
    border: 3px solid var(--primary) !important;
    box-shadow: inset 0 0 50px rgba(0, 212, 255, 0.2);
    pointer-events: auto;
}

#viewport.pan-mode::after {
    content: "🖐️ MODALITÀ SPOSTAMENTO ATTIVA - Clicca un'icona per tornare a disegnare";
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.8rem;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    animation: pulse-pan 2s infinite;
    white-space: nowrap;
}

@keyframes pulse-pan {
    0% { opacity: 0.8; }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
    100% { opacity: 0.8; }
}

#viewport.crosshair {
    cursor: crosshair;
}

#viewport.grabbing {
    cursor: grabbing;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.zoom-controls button {
    width: 40px;
    height: 40px;
    border: 2px solid var(--primary);
    background: rgba(10, 10, 15, 0.9);
    color: var(--primary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.zoom-controls button:hover {
    background: var(--primary);
    color: var(--dark);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
}

.zoom-controls button:active {
    transform: translateY(0);
}

/* Pan Mode Toggle */
.pan-mode-toggle {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.pan-mode-toggle button {
    border: 2px solid var(--primary);
    background: rgba(10, 10, 15, 0.9);
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
    white-space: nowrap;
}

.pan-mode-toggle button:hover {
    background: rgba(0, 212, 255, 0.15);
    color: var(--primary);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.4);
}

.pan-mode-toggle button.active {
    background: var(--primary);
    color: var(--dark);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.6), 0 4px 16px rgba(0, 212, 255, 0.4);
    animation: pan-glow 2s ease-in-out infinite;
}

@keyframes pan-glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.6), 0 4px 16px rgba(0, 212, 255, 0.4);
    }

    50% {
        box-shadow: 0 0 30px rgba(0, 212, 255, 0.8), 0 4px 20px rgba(0, 212, 255, 0.5);
    }
}

/* Pan mode cursor on viewport */
#viewport.pan-mode {
    cursor: grab;
}

#viewport.pan-mode.grabbing {
    cursor: grabbing;
}

#mapContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    will-change: transform;
}

#mapImage {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #0a0a0f;
}

/* Map Layers - MUST scale with map container */
.map-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    /* Critical: layers inherit transform from parent */
    transform: none;
}

#gridLayer {
    z-index: 5;
}

#lineLayer {
    z-index: 10;
}

#tacticLineLayer {
    z-index: 11;
}

#drawingLayer {
    z-index: 12;
}

#zoneLayer {
    z-index: 20;
}

#tacticLayer {
    z-index: 21;
}

#poiLayer {
    z-index: 22;
}

#arrowLayerDiv {
    z-index: 100 !important;
}

/* Grid */
.grid-line {
    stroke: rgba(0, 212, 255, 0.12);
    stroke-width: 0.2;
}

/* Tactic Points */
.tactic-point {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #000;
    /* Default border - overridden by JS for rotation point 1 */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    color: #000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    z-index: 50;
    /* Sotto le zone */
    pointer-events: auto;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

/* Testo Libero - Nasconde il cerchio del punto */
.tactic-point.text-only-point {
    width: auto !important;   /* Permetti al testo di espandersi */
    height: auto !important;  /* Permetti al testo di espandersi */
    min-width: 30px;          /* Dimensione minima per ancoraggio */
    min-height: 30px;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    pointer-events: auto; /* Ancora cliccabile per modifiche */
    z-index: 100 !important; /* Sopra gli altri elementi */
}

/* Fix per l'hover nel CSS */
.tactic-point.text-only-point:hover {
    transform: translate(-50%, -50%) !important; /* Mantieni il centro durante hover */
    box-shadow: none !important;
}

.tactic-point::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent);
    pointer-events: none;
}

.tactic-point:hover {
    transform: translate(-50%, -50%) scale(1.15);
    z-index: 101;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(255, 255, 255, 0.5), var(--shadow-glow);
}

/* Testo libero non si ingrandisce all'hover - RIMOSSO per fix salto */
/* La regola corretta è quella sopra con translate(-50%, -50%) */

.tactic-point .point-label {
    position: absolute;
    bottom: -26px;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--text-size, 12px);
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.85));
    padding: 2px 6px;
    border-radius: 4px;
    text-shadow: 0 0 4px rgba(0,0,0,0.8), 0 2px 4px rgba(0,0,0,0.9);
    pointer-events: none;
    z-index: 50;
}

/* Testo Libero che "galleggia" sulla mappa */
.tactic-point .point-label.floating-text {
    position: relative !important;                /* Fondamentale: non più absolute */
    bottom: auto !important;                      /* Rimuoviamo il vecchio offset */
    left: auto !important;                        /* Rimuoviamo il vecchio offset */
    transform: none !important;                   /* La centratura ora la fa il contenitore padre */
    display: inline-block;                        /* Permette al testo di avere dimensioni solide */
    background: rgba(0, 0, 0, 0.4) !important;    /* Sfondo molto leggero quasi invisibile */
    border: none !important;
    padding: 4px 8px !important;                  /* Area di click più larga e comoda */
    font-size: var(--text-size, 14px);
    color: white;
    text-shadow: 2px 2px 4px #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    /* RIGA RIMOSSA: pointer-events: none; - Ora il testo riceve i click direttamente */
}

/* Zone Circles */
.zone-circle {
    position: absolute;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-shadow: 0 0 40px, inset 0 0 20px;
    cursor: pointer;
    z-index: 200 !important;
    /* Zone sopra i punti ma sotto i dropdown */
    transition: all var(--transition-normal);
    pointer-events: none;
    /* Il layer in sé è trasparente ai click... */
    opacity: 1 !important;
    /* Assicura massima visibilità */
}

.zone-circle:hover {
    box-shadow: 0 0 20px, inset 0 0 10px;
    z-index: 200 !important;
    transform: translate(-50%, -50%) scale(1.02);
}

/* Zone handles - always clickable */
.zone-resize-handle,
.zone-drag-handle,
.zone-delete-handle {
    pointer-events: auto !important;
    /* Forza i pulsanti a ricevere il click */
    z-index: 300 !important;
    /* Sempre sopra i punti (tactic-point) */
}

/* Layer delle zone deve dominare */
#zoneLayer {
    z-index: 200 !important;
    pointer-events: none;
    /* Il layer in sé è trasparente ai click... */
}

/* Storm zone animation - Fortnite style */
.zone-circle[data-type="storm"] {
    animation: stormPulse 3s ease-in-out infinite, stormMove 20s linear infinite;
}

@keyframes stormPulse {

    0%,
    100% {
        opacity: 0.9;
        box-shadow: 0 0 10px #9b59b6, inset 0 0 4px #9b59b6;
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 15px #9b59b6, inset 0 0 6px #9b59b6;
    }
}

@keyframes stormMove {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    25% {
        transform: translate(-48%, -52%) scale(1.02);
    }

    50% {
        transform: translate(-52%, -48%) scale(0.98);
    }

    75% {
        transform: translate(-49%, -51%) scale(1.01);
    }
}

/* Zone Resize Handle */
.zone-resize-handle {
    transition: all 0.2s ease;
}

.zone-resize-handle:hover {
    width: 16px !important;
    height: 16px !important;
    box-shadow: 0 0 12px, 0 0 20px !important;
}

.zone-resize-handle:active {
    background: #fff !important;
}

/* Zone Drag Handle */
.zone-drag-handle {
    transition: all 0.2s ease;
}

.zone-drag-handle:hover {
    width: 20px !important;
    height: 20px !important;
    box-shadow: 0 0 12px, 0 0 20px !important;
}

.zone-drag-handle:active {
    background: #fff !important;
}

/* POI Markers */
.poi-marker {
    position: absolute;
    transform: translate(-50%, -100%);
    background: linear-gradient(135deg, rgba(10, 10, 15, 0.95), rgba(10, 10, 15, 0.85));
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 6px 10px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    z-index: 100;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: all var(--transition-fast);
}

.poi-marker:hover {
    z-index: 101;
    transform: translate(-50%, -105%);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.3), 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Map Arrows */
.map-arrow {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
    transition: transform var(--transition-fast);
}

.map-arrow:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 101;
}

.map-arrow i {
    filter: none;
}

/* Preview Arrow */
#previewArrow {
    position: absolute;
    pointer-events: none;
    z-index: 100;
    opacity: 0.7;
}

/* ============================================
   RIGHT SIDEBAR - TACTICS LIST
   ============================================ */
.map-sidebar-right {
    background: linear-gradient(180deg, rgba(15, 18, 25, 0.95), rgba(10, 10, 15, 0.95));
    border-left: 2px solid rgba(0, 212, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    width: var(--right-sidebar-width);
    min-width: var(--right-sidebar-width);
    padding: 16px;
}

.map-sidebar-right h3 {
    color: var(--fortnite-yellow);
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 12px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Export/Share Message */
#exportShareMessage {
    display: none;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
    border: 1px solid transparent;
}

/* Tactics List con Scorrimento */
#tacticsList {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    flex: 1 0 180px;
    min-height: 180px;
    max-height: 45vh;
    overflow-y: auto;
    padding-right: 6px;
}

/* Stile elegante per la barra di scorrimento della lista */
#tacticsList::-webkit-scrollbar {
    width: 6px;
}

#tacticsList::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

#tacticsList::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

#tacticsList::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.6);
}

.tactic-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--primary);
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.tactic-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}

.tactic-item.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--primary);
}

.tactic-item.selected {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 212, 255, 0.05));
    border: 1px solid var(--success);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.tactic-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.tactic-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tactic-title {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tactic-type {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    text-transform: uppercase;
}

.tactic-meta {
    display: flex;
    gap: 8px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.checkbox-wrapper {
    position: absolute;
    top: 8px;
    right: 8px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.tactic-actions {
    display: flex;
    gap: 4px;
}

.tactic-actions button {
    flex: 1;
    padding: 4px 8px;
    font-size: 0.65rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tactic-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.tactic-actions .btn-danger {
    border-color: rgba(255, 71, 87, 0.3);
    color: var(--danger);
}

.tactic-actions .btn-danger:hover {
    background: rgba(255, 71, 87, 0.1);
}

/* Save Form */
.save-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid rgba(0, 212, 255, 0.3);
}

.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--primary);
}

.form-textarea {
    resize: vertical;
    min-height: 60px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-success {
    flex: 1;
    background: linear-gradient(135deg, var(--success), #00cc6a);
    color: #000;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

/* Edit Mode Indicator */
#editModeIndicator {
    display: none;
    background: rgba(255, 165, 2, 0.15);
    border: 1px solid var(--warning);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
    font-size: 0.7rem;
    color: var(--warning);
    font-weight: 700;
}

/* ============================================
   CONTEXT MENU
   ============================================ */
#contextMenu {
    display: none;
    position: fixed;
    background: rgba(10, 10, 15, 0.98);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 6px;
    min-width: 180px;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.context-menu-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background var(--transition-fast);
}

.context-menu-item:hover {
    background: rgba(0, 212, 255, 0.1);
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-item.danger:hover {
    background: rgba(255, 71, 87, 0.1);
}

.context-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 6px 0;
}

/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 15, 0.95);
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    gap: 20px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
}

.stat-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 800;
}

/* ============================================
   MESSAGE TOAST
   ============================================ */
#message {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 15, 0.98);
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 10000;
    display: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid transparent;
}

#message.success {
    border-color: var(--success);
    color: var(--success);
}

#message.error {
    border-color: var(--danger);
    color: var(--danger);
}

#message.info {
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   TRIAL & LOCK OVERLAY
   ============================================ */
.lock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.98);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30000;
}

.lock-overlay.active {
    display: flex;
}

.lock-content {
    background: var(--dark-secondary);
    border: 2px solid rgba(255, 71, 87, 0.3);
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    text-align: center;
}

.lock-icon-wrapper {
    margin-bottom: 16px;
}

.lock-icon {
    font-size: 4rem;
    color: var(--danger);
}

.lock-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.lock-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.lock-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.lock-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.lock-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
}

.lock-btn-epic {
    background: linear-gradient(135deg, #f5e050, #ffa502);
    color: #000;
}

.lock-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ============================================
   RESPONSIVE
   ============================================ */
.mobile-map-tabs,
.mobile-panel-backdrop,
.mobile-map-status,
.mobile-panel-header,
.tool-btn-label {
    display: none;
}

@media (max-width: 1024px) {
    .map-wrapper {
        grid-template-columns: 220px 1fr 260px;
    }
}

@media (max-width: 768px), (max-width: 950px) and (max-height: 500px) {
    :root {
        --header-height: 60px;
    }

    html,
    body {
        height: 100%;
        min-height: 100dvh;
        overflow: hidden;
        overscroll-behavior: none;
    }

    body > footer {
        display: none;
    }

    body > .main-content {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        padding: 0;
        overflow: hidden;
    }

    .map-wrapper {
        display: block;
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        width: 100%;
        overflow: hidden;
        position: relative;
    }

    .map-main {
        position: absolute;
        inset: 0;
        height: 100%;
        width: 100%;
    }

    #viewport {
        inset: 0;
        touch-action: none;
        container-type: size;
    }

    #mapContainer {
        width: 100%;
        height: 100%;
    }

    .map-sidebar,
    .map-sidebar-right {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        min-width: 0;
        max-height: 72dvh;
        transform: translateY(105%);
        transition: transform 0.25s ease;
        z-index: 1200;
        border-right: 0;
        border-top: 2px solid rgba(0, 212, 255, 0.25);
        border-radius: 14px 14px 0 0;
        padding: 14px;
        overflow-y: auto;
    }

    .map-sidebar.mobile-open,
    .map-sidebar-right.mobile-open {
        transform: translateY(0);
    }

    .mobile-panel-backdrop {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(0, 0, 0, 0.55);
        z-index: 1100;
    }

    .mobile-panel-backdrop[hidden] {
        display: none;
    }

    .mobile-map-tabs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: max(10px, env(safe-area-inset-bottom));
        top: auto;
        z-index: 100020;
        padding: 6px;
        background: rgba(10, 10, 15, 0.96);
        border: 1px solid rgba(0, 212, 255, 0.35);
        border-radius: 12px;
        backdrop-filter: blur(10px);
    }

    .mobile-map-tabs button {
        min-width: 0;
        width: 100%;
        min-height: 44px;
        border-radius: 8px;
        border: 1px solid rgba(255,255,255,0.12);
        background: rgba(255,255,255,0.06);
        color: var(--text-primary);
        font-weight: 700;
        font-size: 0.72rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .zoom-controls {
        display: none;
    }

    .pan-mode-toggle {
        display: none;
    }

    .stats-bar {
        display: none;
    }

    .bottom-controls {
        display: none;
    }

    #viewport {
        top: 0;
        height: 100%;
    }

    #viewport.pan-mode::after {
        display: none;
    }

    #viewport.pan-mode {
        border: 0 !important;
        box-shadow: inset 0 0 0 3px var(--primary), inset 0 0 50px rgba(0, 212, 255, 0.2);
    }
}

/* ============================================
   BOTTOM CONTROLS BAR
   ============================================ */
.bottom-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--gradient-dark);
    border-top: 2px solid rgba(0, 212, 255, 0.3);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

/* Map update report */
.map-report-section {
    width: 100%;
    max-width: none;
    margin: 0 0 6px;
    padding: 0;
    text-align: right;
}

.map-report-summary {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 4px 9px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.42);
    width: 100%;
    box-sizing: border-box;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
    list-style: none;
}

.map-report-summary::-webkit-details-marker { display: none; }
.map-report-summary::after { content: '›'; font-size: 1rem; color: #00d4ff; }
.map-report-section[open] .map-report-summary::after { content: '⌄'; }
.map-report-summary:hover,
.map-report-section[open] .map-report-summary { color: var(--text-primary); border-color: rgba(0, 212, 255, 0.45); background: rgba(0, 212, 255, 0.08); }

.map-report-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid rgba(0, 212, 255, 0.35);
    border-radius: 10px;
    background: rgba(15, 24, 42, 0.92);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    text-align: left;
    clear: both;
}

.map-report-intro {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: var(--text-primary);
}

.map-report-intro > i {
    color: #00d4ff;
    font-size: 1rem;
    margin-top: 3px;
}

.map-report-intro h2 { margin: 0 0 2px; font-size: 0.9rem; }
.map-report-intro p { margin: 0; color: var(--text-secondary); }
.map-report-note { color: #ffd166 !important; font-size: 0.75rem; white-space: normal; overflow-wrap: anywhere; }
.map-report-toggle { margin-left: auto; padding: 5px 10px; font-size: 0.75rem; }
.map-report-form-wrapper { margin-top: 10px; flex-basis: 100%; }
.map-report-form { max-width: 760px; }
.map-report-form label { display: block; margin-bottom: 8px; color: var(--text-primary); font-weight: 600; }
.map-report-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.map-report-form textarea { width: 100%; resize: vertical; margin: 4px 0 16px; }
.map-report-form .cf-turnstile { margin: 12px 0 16px; }
.map-report-alert { padding: 12px 14px; margin-bottom: 16px; border-radius: 8px; }
.map-report-alert-error { color: #ffb4b4; background: rgba(255, 71, 87, 0.12); border: 1px solid rgba(255, 71, 87, 0.5); }

@media (max-width: 640px) {
    .map-report-card { padding: 8px 10px; }
    .map-report-form-row { grid-template-columns: 1fr; gap: 0; }
}

.controls-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.controls-section h4 {
    color: var(--fortnite-yellow);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.controls-divider {
    width: 2px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(0, 212, 255, 0.3), transparent);
}

.mode-badges {
    display: flex;
    gap: 6px;
}

.mode-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    position: relative;
}

.mode-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.mode-badge.active {
    background: var(--gradient-primary);
    color: #fff;
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5), inset 0 0 15px rgba(0, 212, 255, 0.2);
    animation: pulse-active 2s ease-in-out infinite;
    position: relative;
}

.mode-badge.active::after {
    content: '✓';
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.7rem;
    font-weight: 900;
    color: var(--success);
    text-shadow: 0 0 5px var(--success);
    background: var(--dark);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: checkmark-pulse 1s ease-in-out infinite;
}

.mode-badge.fight {
    color: var(--fight);
    border-color: rgba(231, 76, 60, 0.5);
}

.mode-badge.zone {
    color: var(--zone);
    border-color: rgba(0, 212, 255, 0.5);
}

.mode-badge.loot {
    color: var(--loot);
    border-color: rgba(241, 196, 15, 0.5);
}

.mode-badge.rotation {
    color: var(--warning);
    border-color: rgba(255, 165, 2, 0.5);
}

.mode-badge.fight.active,
.mode-badge.zone.active,
.mode-badge.loot.active,
.mode-badge.rotation.active {
    color: #fff;
}

.shortcuts-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.shortcut-item kbd {
    background: rgba(0, 212, 255, 0.15);
    color: var(--primary);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.7rem;
    border: 1px solid rgba(0, 212, 255, 0.3);
    font-weight: 700;
}

.controls-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.controls-list[style*="flex-direction: row"] {
    flex-direction: row !important;
    align-items: center;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.control-item i {
    color: var(--primary);
    font-size: 0.75rem;
}

.control-item span {
    font-weight: 600;
}

/* ============================================
   CONTEXT MENU IMPROVED
   ============================================ */
#contextMenu {
    display: none;
    position: fixed;
    background: rgba(10, 10, 15, 0.98);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    padding: 8px;
    min-width: 220px;
    z-index: 10000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 212, 255, 0.2);
    backdrop-filter: blur(10px);
    animation: menuSlideIn 0.2s ease;
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

.context-menu-item {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-fast);
    font-weight: 600;
}

.context-menu-item.highlight {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(123, 44, 191, 0.15));
    border: 1px solid rgba(0, 212, 255, 0.4);
    margin-bottom: 8px;
}

.context-menu-item.highlight i {
    color: var(--primary);
    font-size: 1.1rem;
}

.context-menu-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.context-menu-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.context-menu-item:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateX(4px);
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-item.danger:hover {
    background: rgba(255, 71, 87, 0.1);
}

.context-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

/* ============================================
   HELP TOOLTIP
   ============================================ */
.help-tooltip {
    position: fixed;
    bottom: 100px;
    right: clamp(10px, 18vw, 320px);
    z-index: 100;
    animation: tooltipBounce 0.5s ease;
}

@keyframes tooltipBounce {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    50% {
        transform: translateY(-5px) scale(1.02);
    }

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

.help-tooltip-content {
    background: linear-gradient(135deg, rgba(10, 10, 15, 0.98), rgba(20, 20, 30, 0.98));
    border: 2px solid rgba(245, 224, 80, 0.5);
    border-radius: 12px;
    padding: 16px;
    max-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 30px rgba(245, 224, 80, 0.3);
    position: relative;
}

.help-tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--fortnite-yellow);
    font-weight: 700;
    font-size: 0.9rem;
}

.help-tooltip-header i {
    font-size: 1.2rem;
    animation: pulse 2s ease-in-out infinite;
}

.help-tooltip-content p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.help-tooltip-btn {
    background: var(--gradient-success);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
}

.help-tooltip-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
}

.help-tooltip-arrow {
    position: absolute;
    bottom: -10px;
    right: 20px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, rgba(10, 10, 15, 0.98), rgba(20, 20, 30, 0.98));
    border-right: 2px solid rgba(245, 224, 80, 0.5);
    border-bottom: 2px solid rgba(245, 224, 80, 0.5);
    transform: rotate(45deg);
}

/* ============================================
   TEXT LABEL MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: var(--dark-secondary);
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 212, 255, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

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

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header i {
    font-size: 1.5rem;
    color: var(--primary);
}

.modal-header h3 {
    flex: 1;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 71, 87, 0.2);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.modal-label i {
    color: var(--primary);
}

.modal-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
}

.modal-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.modal-input::placeholder {
    color: var(--text-secondary);
}

.modal-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.modal-hint i {
    color: var(--primary);
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.modal-btn-primary {
    background: var(--gradient-success);
    color: #000;
}

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
}

/* ============================================
   TUTORIAL MODAL
   ============================================ */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Keep the tutorial above the global header (z-index: 100000). */
    z-index: 100200;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease;
}

.tutorial-content {
    background: linear-gradient(135deg, var(--dark-secondary), var(--dark));
    border: 2px solid rgba(245, 224, 80, 0.3);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 50px rgba(245, 224, 80, 0.2);
    animation: tutorialSlideIn 0.5s ease;
}

@keyframes tutorialSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

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

.tutorial-header {
    text-align: center;
    padding: 30px 24px;
    background: linear-gradient(135deg, rgba(245, 224, 80, 0.1), rgba(0, 212, 255, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.tutorial-icon {
    font-size: 3rem;
    color: var(--fortnite-yellow);
    margin-bottom: 12px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.tutorial-header h2 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.tutorial-header p {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tutorial-skip {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tutorial-skip:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    transform: scale(1.05);
}

.tutorial-steps {
    padding: 24px;
    min-height: 280px;
}

.tutorial-step {
    display: none;
    animation: stepFadeIn 0.4s ease;
}

.tutorial-step.active {
    display: block;
}

@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: 50%;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

.step-content h3 {
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.step-content p {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.9rem;
}

.step-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    background: rgba(0, 212, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.step-visual i {
    font-size: 2rem;
    color: var(--primary);
}

.step-visual span {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mode-badges-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mode-badge-preview {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.mode-badge-preview.fight {
    background: rgba(231, 76, 60, 0.2);
    color: var(--fight);
    border: 1px solid var(--fight);
}

.mode-badge-preview.zone {
    background: rgba(0, 212, 255, 0.2);
    color: var(--zone);
    border: 1px solid var(--zone);
}

.mode-badge-preview.loot {
    background: rgba(241, 196, 15, 0.2);
    color: var(--loot);
    border: 1px solid var(--loot);
}

.mode-badge-preview.rotation {
    background: rgba(255, 165, 2, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.tutorial-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tutorial-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dot.active {
    background: var(--fortnite-yellow);
    width: 30px;
    border-radius: 5px;
}

.tutorial-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.tutorial-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-btn-prev,
.tutorial-btn-next {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.tutorial-btn-prev:hover,
.tutorial-btn-next:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.tutorial-btn-finish {
    background: var(--gradient-success);
    color: #000;
}

.tutorial-btn-finish:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
}

/* ============================================
   CONFIRMATION MODAL
   ============================================ */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 40000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

.confirm-modal {
    background: linear-gradient(135deg, var(--dark-secondary), var(--dark));
    border: 2px solid rgba(255, 71, 87, 0.5);
    border-radius: 20px;
    width: 90%;
    max-width: 420px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 71, 87, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }

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

.confirm-modal-icon {
    font-size: 3.5rem;
    color: var(--danger);
    margin-bottom: 20px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

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

    25% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(10deg);
    }
}

.confirm-modal-title {
    margin: 0 0 12px 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

.confirm-modal-message {
    margin: 0 0 28px 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.confirm-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-btn {
    flex: 1;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.confirm-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.confirm-btn-confirm {
    background: linear-gradient(135deg, var(--danger), #ff6b81);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.confirm-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 71, 87, 0.6);
}

/* ============================================
   TRIAL BANNER
   ============================================ */
.trial-banner {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.95), rgba(255, 107, 129, 0.95));
    border-bottom: 2px solid var(--danger);
    border-radius: 0 0 12px 12px;
    padding: 12px 24px;
    z-index: 10001;
    box-shadow: 0 4px 20px rgba(255, 71, 87, 0.4);
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.trial-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.trial-content i {
    font-size: 1.2rem;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

#trialTimeLeft {
    color: #fff !important;
    font-size: 1rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

#trialTimeLeft.danger {
    background: rgba(255, 255, 255, 0.3);
    animation: pulse-danger 0.5s ease-in-out infinite;
}

@keyframes pulse-danger {

    0%,
    100% {
        background: rgba(255, 255, 255, 0.3);
    }

    50% {
        background: rgba(255, 0, 0, 0.5);
    }
}

.trial-link {
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    margin-left: 12px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: all 0.2s;
}

.trial-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* ============================================
   LOCK OVERLAY
   ============================================ */
.lock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.98);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30000;
    animation: fadeIn 0.3s ease;
}

.lock-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.lock-content {
    background: var(--dark-secondary);
    border: 2px solid rgba(255, 71, 87, 0.3);
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lock-icon-wrapper {
    margin-bottom: 20px;
}

.lock-icon {
    font-size: 5rem;
    color: var(--danger);
    text-shadow: 0 0 30px rgba(255, 71, 87, 0.5);
}

.lock-title {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.lock-message {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.lock-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.lock-btn {
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
}

.lock-btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.lock-btn-epic {
    background: linear-gradient(135deg, #f5e050, #ffa502);
    color: #000;
    box-shadow: 0 4px 15px rgba(245, 224, 80, 0.3);
}

.lock-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.lock-timer {
    border: 1px solid;
    border-radius: 8px;
    padding: 12px;
}

@media (min-width: 769px) and (max-width: 1024px) {
    .map-wrapper {
        grid-template-columns: 200px 1fr 280px;
    }

    .map-sidebar {
        width: 200px !important;
        min-width: 200px !important;
        padding: 12px 8px;
    }

    .map-sidebar-right {
        width: 280px !important;
        min-width: 280px !important;
        padding: 12px 8px;
    }

    .map-sidebar h3 {
        font-size: 0.55rem;
    }

    .mode-buttons {
        grid-template-columns: 1fr !important;
    }

    .modes-descriptive-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px), (max-width: 950px) and (max-height: 500px) {
    .mobile-map-status {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 74px;
        z-index: 100020;
        padding: 8px 10px;
        border-radius: 10px;
        background: rgba(10, 10, 15, 0.92);
        border: 1px solid rgba(0, 212, 255, 0.35);
        color: #fff;
        font-size: 0.72rem;
        line-height: 1.25;
        font-weight: 700;
        text-align: center;
        pointer-events: none;
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .mobile-map-status.visible {
        display: block;
        opacity: 1;
        transform: translateY(0);
    }

    .zone-resize-handle {
        width: 30px !important;
        height: 30px !important;
        right: -15px !important;
    }

    .zone-drag-handle {
        width: 30px !important;
        height: 30px !important;
        left: -15px !important;
    }

    .zone-delete-handle {
        width: 34px !important;
        height: 34px !important;
        font-size: 14px !important;
    }

    .bottom-controls {
        display: none !important;
    }

    .mobile-map-tabs button {
        font-size: 0.78rem;
        padding: 6px 4px;
    }

    #contextMenu [style*="grid-template-columns"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .map-sidebar.mobile-panel,
    .map-sidebar-right.mobile-panel {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 82dvh !important;
        max-height: 82dvh !important;
        padding: 0 14px 28px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        z-index: 100030 !important;
        border-radius: 18px 18px 0 0;
        transform: translateY(105%);
    }

    .map-sidebar.mobile-open,
    .map-sidebar-right.mobile-open {
        transform: translateY(0) !important;
    }

    .mobile-panel-backdrop {
        z-index: 100025 !important;
    }

    .mobile-panel::before {
        display: none;
    }

    .mobile-panel-header {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 62px;
        margin: 0 -14px 14px;
        padding: 10px 14px;
        background: rgba(10, 10, 15, 0.98);
        border-bottom: 1px solid rgba(0, 212, 255, 0.25);
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    }

    .mobile-panel-header::before {
        content: "";
        position: absolute;
        top: 7px;
        left: 50%;
        width: 42px;
        height: 4px;
        transform: translateX(-50%);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.3);
    }

    .mobile-panel-header strong {
        padding-top: 5px;
        color: #fff;
        font-size: 0.92rem;
    }

    .mobile-panel-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 42px;
        padding: 7px 12px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
        font-size: 0.78rem;
        font-weight: 800;
    }

    .mobile-panel-close span:last-child {
        font-size: 1.45rem;
        line-height: 1;
    }

    .modes-descriptive-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .toolbar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .toolbar-grid .tool-btn:last-child {
        grid-column: 1 / -1;
    }

    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .toolbar-grid .tool-btn,
    .quick-actions .tool-btn {
        flex-direction: column;
        gap: 5px;
        min-height: 54px;
        padding: 8px 6px;
        color: #fff;
        border-color: rgba(255, 255, 255, 0.18);
        background: rgba(255, 255, 255, 0.07);
    }

    .toolbar-grid .tool-btn i,
    .quick-actions .tool-btn i {
        min-height: 1em;
        font-size: 1rem;
    }

    .tool-btn-label {
        display: block;
        max-width: 100%;
        color: inherit;
        font-size: 0.68rem;
        font-weight: 800;
        line-height: 1.15;
        text-align: center;
        overflow-wrap: anywhere;
    }

    .slider-group {
        margin-bottom: 14px;
    }

    #mobilePanToggleBtn.active {
        background: rgba(255, 71, 87, 0.22);
        border-color: rgba(255, 71, 87, 0.75);
        color: #fff;
    }
}
