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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000000;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 1;
}

.controls {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 1000;
    padding: 12px;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.controls.visible {
    opacity: 1;
    pointer-events: auto;
}

.control-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: #2a2a2a;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    background: #3a3a3a;
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn .icon {
    width: 24px;
    height: 24px;
}

.layer-menu {
    position: fixed;
    bottom: 104px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.layer-menu.hidden {
    display: none;
}

.layer-menu-item {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #ffffff;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.layer-menu-item:hover {
    background: #3a3a3a;
}

.layer-menu-item.active {
    background: #4285f4;
    font-weight: 600;
}

/* Style Leaflet zoom control to match the share button */
.leaflet-control-zoom {
    margin: 0 0 32px 24px !important;
    border: none !important;
    border-radius: 24px !important;
    overflow: hidden;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    border: none !important;
    border-radius: 50% !important;
    background: #2a2a2a !important;
    color: #ffffff !important;
    font-size: 22px !important;
    font-weight: 400;
    transition: all 0.2s ease;
}

.leaflet-control-zoom a:hover {
    background: #3a3a3a !important;
    transform: scale(1.05);
}

.leaflet-control-zoom a:active {
    transform: scale(0.95);
}

.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 26, 0.95);
    color: #ffffff;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    font-size: 14px;
    max-width: 90%;
    text-align: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.leaflet-control-attribution {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.8);
}

.offline-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.offline-view.hidden {
    display: none;
}

.offline-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
    color: #ffffff;
}

.offline-icon {
    width: 56px;
    height: 56px;
    color: #e67e22;
    margin: 0 auto 16px;
}

.offline-card h2 {
    font-size: 24px;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.offline-card p {
    color: #aaaaaa;
    font-size: 15px;
    margin: 0 0 28px 0;
}

.offline-coords {
    background: #2a2a2a;
    border-radius: 16px;
    padding: 8px 20px;
    margin-bottom: 24px;
}

.coord-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #3a3a3a;
}

.coord-row:last-child {
    border-bottom: none;
}

.coord-row span {
    color: #aaaaaa;
    font-size: 14px;
}

.coord-row strong {
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.offline-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.offline-btn {
    padding: 16px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.offline-btn:active {
    opacity: 0.7;
}

.offline-btn.primary {
    background: #4285f4;
    color: #ffffff;
}

.offline-btn.secondary {
    background: #2a2a2a;
    color: #ffffff;
}

.shared-popup,
.position-popup {
    font-size: 13px;
    line-height: 1.6;
}

.shared-popup strong {
    color: #34a853;
    font-size: 14px;
}

.position-popup strong {
    color: #4285f4;
    font-size: 14px;
}

.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 1s ease;
    overflow: hidden;
    pointer-events: none;
}

.intro-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.circle-mask {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85vw;
    height: 85vw;
    max-width: 50vh;
    max-height: 50vh;
    border-radius: 50%;
    box-shadow: 0 0 0 200vmax #000000;
    z-index: 999;
    transition: all 2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.circle-mask.expanded {
    width: 300vmax;
    height: 300vmax;
    max-width: 300vmax;
    max-height: 300vmax;
}

.permission-dialog {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    background: rgba(42, 42, 42, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px 24px 0 0;
    padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
    width: 100%;
    z-index: 10001;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    text-align: center;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: auto;
}

.permission-dialog.visible {
    opacity: 1;
    transform: translateY(0);
}

.permission-dialog.hidden {
    display: none;
}

.permission-dialog h2 {
    color: #ffffff;
    font-size: 18px;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.permission-dialog p {
    color: #cccccc;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.permission-dialog .icon-large {
    display: none;
}

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

.dialog-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dialog-btn.primary {
    background: #4285f4;
    color: #ffffff;
}

.dialog-btn.primary:hover {
    background: #5294ff;
}

.dialog-btn.secondary {
    background: #2a2a2a;
    color: #ffffff;
}

.dialog-btn.secondary:hover {
    background: #3a3a3a;
}

@media (max-width: 480px) {
    .controls {
        bottom: 24px;
        gap: 12px;
        padding: 10px;
    }
    
    .control-btn {
        width: 48px;
        height: 48px;
    }
    
    .control-btn .icon {
        width: 20px;
        height: 20px;
    }
    
    .permission-dialog {
        padding: 24px;
    }
    
    .permission-dialog h2 {
        font-size: 20px;
    }
    
    .permission-dialog p {
        font-size: 14px;
    }
}
