@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1e3a4c 0%, #2a5266 50%, #1e3a4c 100%);
    background-attachment: fixed;
    color: #ffffff;
    overflow: hidden;
}

/* Animated background particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(74, 158, 187, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(46, 125, 150, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(58, 122, 150, 0.12) 0%, transparent 50%);
    animation: backgroundPulse 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
    filter: blur(40px);
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Modern glassmorphic header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(30, 58, 76, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(74, 158, 187, 0.3);
    padding: 15px 30px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.controls {
    display: flex;
    gap: 12px;
}

.controls button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 15px rgba(33, 150, 243, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.controls button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.controls button:hover::before {
    left: 100%;
}

.controls button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 6px 25px rgba(33, 150, 243, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.controls button:active {
    transform: translateY(0) scale(0.98);
}

.controls button.testing-mode-btn.testing-active {
    background: linear-gradient(135deg, #2196F3 0%, #00BCD4 100%);
    box-shadow: 
        0 4px 20px rgba(33, 150, 243, 0.6),
        0 0 30px rgba(33, 150, 243, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 
            0 4px 20px rgba(33, 150, 243, 0.6),
            0 0 30px rgba(33, 150, 243, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 
            0 4px 25px rgba(33, 150, 243, 0.8),
            0 0 40px rgba(33, 150, 243, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

.map-container {
    position: absolute;
    left: 0;
    right: 320px;
    bottom: 0;
    overflow: hidden;
    cursor: grab;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.map-container:active {
    cursor: grabbing;
}

.map-wrapper {
    position: relative;
    transform-origin: 50% 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: fit-content;
    height: fit-content;
    border: 40px solid transparent;
    border-radius: 16px;
    background: 
        linear-gradient(135deg, #4a9ebb, #2e7d96) padding-box,
        linear-gradient(135deg, #4a9ebb, #2e7d96, #4a9ebb) border-box;
    box-shadow: 
        0 0 0 2px rgba(74, 158, 187, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(74, 158, 187, 0.2);
}

.coordinate-overlays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.coord-overlay {
    position: absolute;
    display: flex;
    pointer-events: none;
}

.coord-overlay.coord-top {
    top: -40px;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 40px;
}

.coord-overlay.coord-bottom {
    bottom: -40px;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 40px;
}

.coord-overlay.coord-left {
    left: -40px;
    top: 0;
    bottom: 0;
    width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 40px 0;
}

.coord-overlay.coord-right {
    right: -40px;
    top: 0;
    bottom: 0;
    width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 40px 0;
}

.coord-label {
    color: #ffffff;
    font-weight: bold;
    font-size: 16px;
    font-family: 'Arial', sans-serif;
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 4px 8px;
    min-width: 30px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    user-select: none;
    cursor: default;
    pointer-events: none;
    transition: all 0.2s ease;
    position: absolute;
}

/* Position horizontal coordinates (A-J) */
.coord-overlay.coord-top .coord-label:nth-child(1),
.coord-overlay.coord-bottom .coord-label:nth-child(1) { left: 5%; transform: translateX(-50%); }
.coord-overlay.coord-top .coord-label:nth-child(2),
.coord-overlay.coord-bottom .coord-label:nth-child(2) { left: 15%; transform: translateX(-50%); }
.coord-overlay.coord-top .coord-label:nth-child(3),
.coord-overlay.coord-bottom .coord-label:nth-child(3) { left: 25%; transform: translateX(-50%); }
.coord-overlay.coord-top .coord-label:nth-child(4),
.coord-overlay.coord-bottom .coord-label:nth-child(4) { left: 35%; transform: translateX(-50%); }
.coord-overlay.coord-top .coord-label:nth-child(5),
.coord-overlay.coord-bottom .coord-label:nth-child(5) { left: 45%; transform: translateX(-50%); }
.coord-overlay.coord-top .coord-label:nth-child(6),
.coord-overlay.coord-bottom .coord-label:nth-child(6) { left: 55%; transform: translateX(-50%); }
.coord-overlay.coord-top .coord-label:nth-child(7),
.coord-overlay.coord-bottom .coord-label:nth-child(7) { left: 65%; transform: translateX(-50%); }
.coord-overlay.coord-top .coord-label:nth-child(8),
.coord-overlay.coord-bottom .coord-label:nth-child(8) { left: 75%; transform: translateX(-50%); }
.coord-overlay.coord-top .coord-label:nth-child(9),
.coord-overlay.coord-bottom .coord-label:nth-child(9) { left: 85%; transform: translateX(-50%); }
.coord-overlay.coord-top .coord-label:nth-child(10),
.coord-overlay.coord-bottom .coord-label:nth-child(10) { left: 95%; transform: translateX(-50%); }

/* Position vertical coordinates (1-10) */
.coord-overlay.coord-left .coord-label:nth-child(1),
.coord-overlay.coord-right .coord-label:nth-child(1) { top: 5%; transform: translateY(-50%); }
.coord-overlay.coord-left .coord-label:nth-child(2),
.coord-overlay.coord-right .coord-label:nth-child(2) { top: 15%; transform: translateY(-50%); }
.coord-overlay.coord-left .coord-label:nth-child(3),
.coord-overlay.coord-right .coord-label:nth-child(3) { top: 25%; transform: translateY(-50%); }
.coord-overlay.coord-left .coord-label:nth-child(4),
.coord-overlay.coord-right .coord-label:nth-child(4) { top: 35%; transform: translateY(-50%); }
.coord-overlay.coord-left .coord-label:nth-child(5),
.coord-overlay.coord-right .coord-label:nth-child(5) { top: 45%; transform: translateY(-50%); }
.coord-overlay.coord-left .coord-label:nth-child(6),
.coord-overlay.coord-right .coord-label:nth-child(6) { top: 55%; transform: translateY(-50%); }
.coord-overlay.coord-left .coord-label:nth-child(7),
.coord-overlay.coord-right .coord-label:nth-child(7) { top: 65%; transform: translateY(-50%); }
.coord-overlay.coord-left .coord-label:nth-child(8),
.coord-overlay.coord-right .coord-label:nth-child(8) { top: 75%; transform: translateY(-50%); }
.coord-overlay.coord-left .coord-label:nth-child(9),
.coord-overlay.coord-right .coord-label:nth-child(9) { top: 85%; transform: translateY(-50%); }
.coord-overlay.coord-left .coord-label:nth-child(10),
.coord-overlay.coord-right .coord-label:nth-child(10) { top: 95%; transform: translateY(-50%); }

.main-map {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    border-radius: 4px;
}

.emblem-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8;
}

.emblem-piece {
    pointer-events: none !important;
}

.tribe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 8;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 10;
}

.grid-cell {
    position: absolute;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.grid-cell:hover {
    background-color: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.6);
    box-shadow: 
        0 0 20px rgba(33, 150, 243, 0.4),
        inset 0 0 20px rgba(33, 150, 243, 0.2);
    transform: scale(1.02);
}

.grid-cell.owned {
    background-color: rgba(60, 60, 60, 0.2);
    border-color: rgba(60, 60, 60, 0.5);
}

/* Loading animation */
.main-map {
    opacity: 0;
    animation: fadeInUp 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.2s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Modern Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 12, 41, 0.8);
    backdrop-filter: blur(15px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 24px;
    box-shadow: 
        0 30px 90px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 550px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    animation: modalSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2196F3, #00BCD4, #2196F3);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.modal-header {
    padding: 28px 28px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), transparent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.3px;
}

.close-modal {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.close-modal:hover {
    background: rgba(244, 67, 54, 0.8);
    border-color: rgba(244, 67, 54, 1);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 5px 20px rgba(244, 67, 54, 0.4);
}

.modal-body {
    padding: 28px;
    max-height: calc(85vh - 180px);
    overflow-y: auto;
    background: rgba(52, 73, 94, 0.5);
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #2196F3, #1976D2);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #42A5F5, #2196F3);
}

#quadrantInfo {
    margin-bottom: 20px;
    font-size: 16px;
    padding: 12px;
    background: rgba(33, 150, 243, 0.1);
    border-left: 3px solid #2196F3;
    border-radius: 8px;
}

#selectedQuadrant {
    font-weight: 700;
    color: #2196F3;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.08);
    box-shadow: 
        0 0 0 4px rgba(33, 150, 243, 0.15),
        0 5px 20px rgba(33, 150, 243, 0.2);
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.07);
}

.form-group select option {
    background-color: #2c3e50;
    color: #fff;
}

.new-tribe-fields {
    border: 2px dashed rgba(33, 150, 243, 0.4);
    border-radius: 16px;
    padding: 20px;
    margin: 15px 0;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.08), rgba(33, 150, 243, 0.03));
    backdrop-filter: blur(10px);
}

.form-group input[type="color"] {
    height: 52px;
    border-radius: 12px;
    cursor: pointer;
    padding: 6px;
}

.form-group input[type="file"] {
    padding: 12px;
    cursor: pointer;
}

.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.form-group small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.coord-inputs {
    display: flex;
    gap: 12px;
}

.coord-inputs input {
    flex: 1;
}

.modal-footer {
    padding: 20px 28px 28px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.2);
}

.modal-footer button {
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.modal-footer button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.modal-footer button:hover::before {
    width: 300px;
    height: 300px;
}

.modal-footer button:first-child {
    background: rgba(108, 117, 125, 0.8);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.modal-footer button:first-child:hover {
    background: rgba(90, 98, 104, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.modal-footer button:last-child {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: #ffffff;
    box-shadow: 
        0 4px 15px rgba(33, 150, 243, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.modal-footer button:last-child:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 25px rgba(33, 150, 243, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.modal-footer button[style*="background-color: #dc3545"],
.modal-footer button[style*="background-color: #e74c3c"] {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    box-shadow: 
        0 4px 15px rgba(231, 76, 60, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.modal-footer button[style*="background-color: #dc3545"]:hover,
.modal-footer button[style*="background-color: #e74c3c"]:hover {
    transform: translateY(-2px) !important;
    box-shadow: 
        0 6px 25px rgba(231, 76, 60, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

#deleteBtn {
    pointer-events: auto !important;
    cursor: pointer;
    z-index: 1;
}

/* Warning Styles */
#deleteTribeWarning {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.15), rgba(243, 156, 18, 0.05));
    border: 2px solid rgba(243, 156, 18, 0.5);
    border-radius: 12px;
    padding: 18px;
    margin-top: 16px;
    backdrop-filter: blur(10px);
}

#deleteTribeWarning p {
    margin: 0 0 10px 0;
    color: #f39c12;
}

#deleteTribeWarning p:last-child {
    margin-bottom: 0;
    font-weight: 700;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 340px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    padding: 18px 22px;
    min-width: 320px;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translateX(500px);
    animation: toastSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    border-left: 4px solid;
}

.toast.success {
    border-left-color: #27ae60;
}

.toast.error {
    border-left-color: #e74c3c;
}

.toast.warning {
    border-left-color: #f39c12;
}

.toast.info {
    border-left-color: #3498db;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #27ae60;
}

.toast.error .toast-icon {
    color: #e74c3c;
}

.toast.warning .toast-icon {
    color: #f39c12;
}

.toast.info .toast-icon {
    color: #3498db;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    margin-bottom: 4px;
    color: #2c3e50;
    font-size: 15px;
}

.toast-message {
    color: #5a6c7d;
    font-size: 13px;
    line-height: 1.5;
}

.toast-close {
    background: none;
    border: none;
    color: #95a5a6;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toast-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #2c3e50;
    transform: scale(1.1);
    }

/* Modern Continents Legend */
.continents-legend {
    position: fixed;
    top: 0px;
    right: 0;
    width: 320px;
    bottom: 0;
    background: rgba(30, 58, 76, 0.9);
    backdrop-filter: blur(25px) saturate(180%);
    border-left: 1px solid rgba(74, 158, 187, 0.3);
    z-index: 1000;
    overflow-y: auto;
    padding: 24px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
}

.continents-legend.collapsed {
    transform: translateX(100%);
}

.legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 18px;
    border-bottom: 2px solid rgba(33, 150, 243, 0.3);
    margin-bottom: 24px;
}

.continents-legend h3 {
    color: #2196F3;
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 0 20px rgba(33, 150, 243, 0.3);
}

.legend-toggle {
    background: rgba(33, 150, 243, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(33, 150, 243, 0.3);
    color: #2196F3;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.legend-toggle:hover {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: #ffffff;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 5px 20px rgba(33, 150, 243, 0.4);
}

.legend-toggle svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.continents-legend.collapsed .legend-toggle svg {
    transform: rotate(-90deg);
}

.legend-collapsed-toggle {
    position: fixed;
    top: 90px;
    right: 10px;
    background: rgba(30, 58, 76, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(33, 150, 243, 0.4);
    color: #2196F3;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 700;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.legend-collapsed-toggle:hover {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: #ffffff;
    transform: translateX(-5px) scale(1.05);
    box-shadow: 0 8px 30px rgba(33, 150, 243, 0.4);
}

.legend-collapsed-toggle svg {
    flex-shrink: 0;
}

.legend-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.legend-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(33, 150, 243, 0.1), transparent);
    transition: left 0.5s;
}

.legend-item:hover::before {
    left: 100%;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #2196F3;
    transform: translateX(-8px) scale(1.02);
    box-shadow: 
        0 5px 20px rgba(33, 150, 243, 0.2),
        inset 0 0 20px rgba(33, 150, 243, 0.1);
}

.legend-color {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.legend-info {
    flex: 1;
    min-width: 0;
}

.legend-name {
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-stats {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.continents-legend::-webkit-scrollbar {
    width: 10px;
}

.continents-legend::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 5px;
    margin: 10px 0;
}

.continents-legend::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #2196F3, #1976D2);
    border-radius: 5px;
    border: 2px solid rgba(30, 58, 76, 0.9);
}

.continents-legend::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #42A5F5, #2196F3);
}

/* Region Tooltip */
.region-tooltip {
    position: fixed;
    display: none;
    background: rgba(15, 12, 41, 0.95);
    backdrop-filter: blur(20px);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(33, 150, 243, 0.3);
    border: 1px solid rgba(33, 150, 243, 0.4);
}

/* Continent Detail Modal */
.continent-detail-modal {
    max-width: 650px;
    width: 90%;
}

.continent-color-indicator {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    margin-right: 12px;
    vertical-align: middle;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.continent-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 18px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 14px;
    border: 1px solid rgba(33, 150, 243, 0.2);
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: #2196F3;
    text-shadow: 0 0 20px rgba(33, 150, 243, 0.4);
}

.continent-regions-list {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.continent-region-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.continent-region-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #2196F3;
    transform: translateX(-4px);
}

.region-item-info {
    flex: 1;
    min-width: 0;
}

.region-item-name {
    font-weight: 700;
    font-size: 14px;
    color: #ffffff;
    margin-bottom: 5px;
}

.claimed-by {
    font-size: 12px;
    color: #27ae60;
}

.claimed-by strong {
    color: #2ecc71;
    font-weight: 700;
}

.unclaimed {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.highlight-region-btn {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.highlight-region-btn:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 6px 25px rgba(33, 150, 243, 0.5);
}

.btn-highlight-all {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.btn-highlight-all:hover {
    box-shadow: 0 6px 25px rgba(33, 150, 243, 0.5);
}

.continent-regions-list::-webkit-scrollbar {
    width: 8px;
}

.continent-regions-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.continent-regions-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #2196F3, #1976D2);
    border-radius: 4px;
}

.continent-regions-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #42A5F5, #2196F3);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(500px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(500px) scale(0.8);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
    }
    
    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .controls button {
        flex: 1;
        min-width: 140px;
    }
    
    .continents-legend {
        width: 100%;
        height: auto;
        max-height: 220px;
        position: fixed;
        top: auto;
        bottom: 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .continents-legend.collapsed {
        transform: translateY(100%);
    }
    
    .map-container {
        top: 140px;
        left: 0;
        right: 0;
        bottom: 240px;
    }
    
    .map-wrapper {
        border-width: 30px;
    }
    
    .coord-label {
        font-size: 14px;
        padding: 4px 8px;
        min-width: 26px;
    }
    
    .coord-overlay.coord-top,
    .coord-overlay.coord-bottom {
        height: 30px;
        padding: 0 30px;
    }
    
    .coord-overlay.coord-top {
        top: -30px;
    }
    
    .coord-overlay.coord-bottom {
        bottom: -30px;
    }
    
    .coord-overlay.coord-left,
    .coord-overlay.coord-right {
        width: 30px;
        padding: 30px 0;
    }
    
    .coord-overlay.coord-left {
        left: -30px;
    }
    
    .coord-overlay.coord-right {
        right: -30px;
    }
    
    .legend-content {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .legend-item {
        flex: 0 0 calc(50% - 7px);
    }
    
    .continent-stats {
        flex-direction: column;
        gap: 12px;
    }
    
    .legend-collapsed-toggle {
        top: auto;
        bottom: 10px;
        right: 50%;
        transform: translateX(50%);
    }
    
    .legend-collapsed-toggle:hover {
        transform: translateX(50%) translateY(-5px);
    }
    
    .toast-container {
        right: 20px;
        top: 20px;
    }
    
    .toast {
        min-width: 280px;
        max-width: calc(100vw - 40px);
    }
}
