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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    overflow: hidden;
    background: #0a0a0a;
    color: #e0e0e0;
}

#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hidden { display: none !important; }

/* ── Panel ── */
.panel {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 320px;
    max-height: calc(100vh - 20px);
    z-index: 1000;
    background: rgba(15, 15, 20, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.55);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b35, #ff3333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.panel-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sound-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.08);
    color: #aaa;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.sound-toggle:hover {
    color: #ff6b35;
    border-color: rgba(255,107,53,0.3);
    background: rgba(255,107,53,0.08);
}
.sound-toggle.muted {
    color: #555;
    border-color: rgba(255,255,255,0.04);
}

.panel-toggle {
    display: none;
    background: none;
    border: none;
    color: #aaa;
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
}

.panel-body {
    overflow-y: auto;
    padding: 12px 14px;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.panel-body::-webkit-scrollbar { width: 5px; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* ── Toggles ── */
.unit-toggle, .burst-toggle, .type-toggle, .yield-unit-toggle {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 2px;
}

.unit-btn, .burst-btn, .type-btn, .yield-unit-btn {
    background: none;
    border: none;
    color: #888;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.unit-btn.active, .burst-btn.active, .type-btn.active, .yield-unit-btn.active {
    background: rgba(255, 107, 53, 0.25);
    color: #ff6b35;
}

.burst-mode, .wind-control, .custom-type, .custom-yield, .custom-name {
    margin-bottom: 12px;
}

.burst-mode > label, .wind-control > label, .custom-type > label,
.custom-yield > label, .custom-name > label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #888;
    margin-bottom: 6px;
}

/* ── Wind Control ── */
.wind-inputs {
    display: flex;
    gap: 8px;
}
.wind-field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 6px 10px;
}
.wind-field input {
    width: 50px;
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 14px;
    text-align: center;
    outline: none;
}
.wind-label {
    font-size: 11px;
    color: #888;
}

/* ── Category headers ── */
.category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    user-select: none;
    transition: color 0.2s;
}
.category-header:hover { color: #ff6b35; }

.category-arrow {
    font-size: 10px;
    transition: transform 0.25s;
    display: inline-block;
}
.category-arrow.open { transform: rotate(90deg); }

/* ── Weapon cards ── */
.weapon-list {
    padding: 4px 0;
}

.weapon-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 3px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.weapon-card:hover {
    background: rgba(255,255,255,0.05);
}
.weapon-card.selected {
    background: rgba(255, 107, 53, 0.12);
    border-color: rgba(255, 107, 53, 0.35);
}
.weapon-card .weapon-name {
    font-size: 13px;
    font-weight: 500;
    color: #ddd;
}
.weapon-card .weapon-yield {
    font-size: 11px;
    color: #999;
    font-weight: 600;
}
.weapon-card .weapon-origin {
    font-size: 10px;
    color: #666;
    margin-top: 1px;
}
.weapon-info {
    display: flex;
    flex-direction: column;
}

/* ── Custom section ── */
.custom-body {
    padding: 12px 0 4px;
}

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

.yield-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 8px 12px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.yield-input:focus { border-color: rgba(255, 107, 53, 0.5); }

.yield-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.1);
    outline: none;
    margin: 4px 0;
}
.yield-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff6b35;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255,107,53,0.4);
}
.yield-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff6b35;
    cursor: pointer;
    border: none;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #666;
    margin-top: 2px;
}

.name-input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 8px 12px;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.name-input:focus { border-color: rgba(255, 107, 53, 0.5); }

.select-custom-btn {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background: linear-gradient(135deg, #ff6b35, #e8442a);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}
.select-custom-btn:hover { opacity: 0.9; }
.select-custom-btn:active { transform: scale(0.98); }

.panel-instructions {
    margin-top: 12px;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    text-align: center;
}
.panel-instructions p {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

/* ── Detonations Panel ── */
.detonations-panel {
    position: fixed;
    bottom: 60px;
    right: 10px;
    width: 260px;
    max-height: 280px;
    z-index: 1000;
    background: rgba(15, 15, 20, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.55);
}

.det-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.det-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
}

.clear-all-btn {
    background: rgba(255, 60, 60, 0.15);
    border: none;
    color: #ff4444;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.clear-all-btn:hover { background: rgba(255, 60, 60, 0.3); }

.det-list {
    overflow-y: auto;
    max-height: 220px;
    padding: 6px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.det-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    margin: 2px 0;
    border-radius: 6px;
    font-size: 12px;
    color: #bbb;
    transition: background 0.2s;
}
.det-item:hover { background: rgba(255,255,255,0.05); }

.det-item-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.det-item-name { font-weight: 600; color: #ddd; }
.det-item-yield { font-size: 10px; color: #888; }

.det-remove {
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}
.det-remove:hover { color: #ff4444; background: rgba(255,60,60,0.1); }

/* ── Legend ── */
.legend {
    position: fixed;
    bottom: 60px;
    left: 10px;
    z-index: 1000;
    background: rgba(15, 15, 20, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.55);
}
.legend h4 {
    font-size: 12px;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
    color: #bbb;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}
.legend-radius {
    margin-left: auto;
    font-weight: 600;
    color: #999;
    font-size: 11px;
}

/* ── Disclaimer ── */
.disclaimer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: rgba(30, 20, 10, 0.92);
    backdrop-filter: blur(10px);
    padding: 10px 50px 10px 20px;
    font-size: 12px;
    color: #cca;
    line-height: 1.4;
    border-top: 1px solid rgba(255, 160, 60, 0.2);
}
.disclaimer-close {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #997;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}
.disclaimer-close:hover { color: #ff6b35; }

/* ── Countdown Overlay ── */
.countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.countdown-number {
    font-size: 160px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 60px rgba(255,107,53,0.6), 0 0 120px rgba(255,50,50,0.3);
    font-family: 'Segoe UI', Arial, sans-serif;
    user-select: none;
}
.countdown-skip {
    position: absolute;
    bottom: 40px;
    right: 40px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #aaa;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.countdown-skip:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ── Flash Overlay ── */
.flash-overlay {
    position: fixed;
    inset: 0;
    z-index: 1999;
    pointer-events: none;
    background: radial-gradient(circle at var(--flash-x, 50%) var(--flash-y, 50%),
        rgba(255,255,230,1) 0%,
        rgba(255,200,100,0.8) 20%,
        rgba(255,100,30,0.4) 50%,
        transparent 80%);
}

/* ── Popup ── */
.blast-popup .leaflet-popup-content-wrapper {
    background: rgba(15, 15, 20, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #ddd;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.blast-popup .leaflet-popup-tip {
    background: rgba(15, 15, 20, 0.92);
}
.blast-popup .leaflet-popup-content {
    margin: 12px 16px;
    font-size: 13px;
    line-height: 1.5;
}
.popup-title {
    font-size: 15px;
    font-weight: 700;
    color: #ff6b35;
    margin-bottom: 6px;
}
.popup-yield {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}
.popup-zones {
    list-style: none;
    padding: 0;
}
.popup-zones li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 12px;
}
.popup-zone-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.popup-share {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.copy-link-btn {
    background: rgba(255,107,53,0.15);
    border: 1px solid rgba(255,107,53,0.3);
    color: #ff6b35;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}
.copy-link-btn:hover { background: rgba(255,107,53,0.25); }

/* ── Geocoder override ── */
.leaflet-control-geocoder {
    background: rgba(15, 15, 20, 0.88) !important;
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
}
.leaflet-control-geocoder input {
    color: #e0e0e0 !important;
    background: transparent !important;
}
.leaflet-control-geocoder .leaflet-control-geocoder-alternatives {
    background: rgba(15, 15, 20, 0.95) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 0 0 10px 10px !important;
}
.leaflet-control-geocoder .leaflet-control-geocoder-alternatives li:hover {
    background: rgba(255,107,53,0.15) !important;
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .panel {
        width: calc(100% - 20px);
        max-height: 50vh;
    }
    .panel-toggle { display: block; }
    .panel-body.collapsed { display: none; }

    .detonations-panel {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        bottom: 60px;
    }
    .legend {
        left: 10px;
        right: 10px;
        bottom: 60px;
    }
    .countdown-number { font-size: 100px; }
}

/* ── Leaflet zoom override ── */
.leaflet-control-zoom a {
    background: rgba(15,15,20,0.88) !important;
    color: #ccc !important;
    border-color: rgba(255,255,255,0.08) !important;
    backdrop-filter: blur(18px);
}
.leaflet-control-zoom a:hover {
    background: rgba(30,30,40,0.9) !important;
    color: #ff6b35 !important;
}

/* ── Custom Type Dropdown ── */
.custom-type-select {
    margin-bottom: 12px;
}
.custom-type-select > label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #888;
    margin-bottom: 6px;
}
.custom-dropdown {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.custom-dropdown:focus {
    outline: none;
    border-color: #ff6b35;
}
.custom-dropdown option {
    background: #1e1e28;
    color: #e0e0e0;
}

/* ── Antimatter Input ── */
.antimatter-input {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: rgba(128, 0, 255, 0.06);
    border: 1px solid rgba(128, 0, 255, 0.15);
    border-radius: 10px;
}
.antimatter-input > label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #a855f7;
    margin-bottom: 6px;
}
.am-unit {
    font-size: 13px;
    color: #a855f7;
    font-weight: 600;
    padding: 0 8px;
}
.am-equiv {
    font-size: 11px;
    color: #888;
    margin-top: 6px;
    font-style: italic;
}

/* ── Target Marker ── */
.target-marker-icon {
    background: none !important;
    border: none !important;
}
.target-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 300;
    color: #ff3333;
    text-shadow: 0 0 8px rgba(255,50,50,0.8), 0 0 20px rgba(255,50,50,0.4);
    pointer-events: none;
    line-height: 1;
}
.target-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 50, 50, 0.7);
    border-radius: 50%;
    animation: targetPulse 1.5s ease-out infinite;
}
@keyframes targetPulse {
    0% { width: 10px; height: 10px; opacity: 1; }
    100% { width: 50px; height: 50px; opacity: 0; }
}

/* ── Target Info & Detonate Button ── */
.target-info {
    padding: 8px 12px;
    margin-top: 8px;
    background: rgba(255, 50, 50, 0.08);
    border: 1px solid rgba(255, 50, 50, 0.2);
    border-radius: 8px;
    font-size: 12px;
    color: #ff6b35;
    text-align: center;
    line-height: 1.4;
}
.detonate-btn {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: linear-gradient(135deg, #ff3333, #cc0000);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(255, 50, 50, 0.3);
}
.detonate-btn:hover {
    background: linear-gradient(135deg, #ff4444, #dd1111);
    box-shadow: 0 6px 28px rgba(255, 50, 50, 0.5);
    transform: translateY(-1px);
}
.detonate-btn:active {
    transform: translateY(0) scale(0.98);
}
