/**
 * ============================================================================
 * BATTLEGROUND TACTICAL ASTROLABE RADAR (CSS)
 * Gaya Da Vinci Renaissance Parchment Blueprint & Polished Mahogany Workbench
 * Posisi: Pojok Kiri Atas (Top-Left) Layar Pertempuran
 * ============================================================================
 */

.bg-tactical-radar {
    position: absolute;
    top: 12px;
    left: 12px;
    right: auto;
    z-index: 1000 !important;
    width: 230px;
    background: #0e0b09;
    border: 1.5px solid #85633e;
    border-radius: 10px;
    padding: 6px 8px 7px 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.9), inset 0 0 20px rgba(0, 0, 0, 0.6), 0 0 14px rgba(133, 99, 62, 0.28);
    font-family: 'Cinzel', 'Georgia', serif;
    color: #e8ded1;
    user-select: none;
    pointer-events: auto !important;
    transform: scale(1.32);
    transform-origin: top left;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.3s ease;
    box-sizing: border-box;
    display: block;
}

.bg-tactical-radar.hidden {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Sudut Logam Kuningan Renaissance (Brass Ornate Rivets) */
.bg-tactical-radar::before,
.bg-tactical-radar::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, #f59e0b 20%, #785a3c 80%);
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.5);
    z-index: 3;
}
.bg-tactical-radar::before {
    top: 5px;
    left: 5px;
}
.bg-tactical-radar::after {
    top: 5px;
    right: 5px;
}

/* Header Radar Taktis (+12% ukuran & jarak lebih lega ke lingkaran radar) */
.bg-radar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(133, 99, 62, 0.45);
    padding-bottom: 7px;
    margin-bottom: 12px;
}

.bg-radar-header-left {
    display: flex;
    align-items: center;
    gap: 7px;
}

.bg-radar-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
    animation: bgRadarPulse 2s infinite ease-in-out;
}

@keyframes bgRadarPulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
        box-shadow: 0 0 12px #38bdf8;
    }
}

.bg-radar-title {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 1.3px;
    color: #f3e8d6;
    text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.bg-radar-header-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bg-radar-tool-btn {
    background: rgba(30, 22, 17, 0.8);
    border: 1px solid #785a3c;
    color: #e2d9cc;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.2;
    transition: all 0.15s ease;
}

.bg-radar-tool-btn:hover {
    background: #785a3c;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* Viewport Canvas Radar & Kompas */
.bg-radar-body {
    position: relative;
    width: 214px;
    height: 214px;
    margin: 0 auto;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(16, 24, 39, 0.95) 0%, rgba(10, 13, 20, 0.98) 75%, rgba(6, 8, 12, 1) 100%);
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#bg-radar-canvas {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 214px !important;
    height: 214px !important;
    display: block !important;
    border-radius: 50% !important;
    z-index: 2 !important;
}

/* Label Arah Mata Angin statis disembunyikan karena kompas N/E/S/W kini berputar otoritatif di canvas */
.bg-radar-cardinal {
    display: none !important;
}

.bg-cardinal-n {
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    color: #38bdf8;
}

.bg-cardinal-e {
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.bg-cardinal-s {
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}

.bg-cardinal-w {
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
}

/* Footer & Legenda Ringkas (1 Baris: Sekutu, Musuh, Inti) */
.bg-radar-footer {
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px solid rgba(133, 99, 62, 0.45);
}

.bg-radar-legend {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    letter-spacing: 0.3px;
}

.bg-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #e2d7c5;
    font-size: 11.5px;
    font-weight: 700;
}

.bg-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.bg-legend-dot.player {
    background-color: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.bg-legend-dot.ally {
    background-color: #3b82f6;
    box-shadow: 0 0 6px #3b82f6;
}

.bg-legend-dot.enemy {
    background-color: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

.bg-legend-dot.core {
    background-color: #f8fafc;
    box-shadow: 0 0 6px #ffffff;
}

.bg-radar-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    color: #cbd5e1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    margin-top: 4px;
    padding-top: 5px;
    border-top: 1px dashed rgba(133, 99, 62, 0.4);
}

.bg-radar-stat-text {
    color: #cbd5e1;
    letter-spacing: 0.3px;
    font-size: 11.5px;
    font-weight: 700;
}

.bg-radar-stat-badge {
    color: #fef3c7;
    font-weight: 800;
    letter-spacing: 0.8px;
    font-size: 11.5px;
    background: #5c1d18;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1.5px solid #a16207;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Status Saat Diminimalkan (Compact Mini Astrolabe Badge) */
.bg-tactical-radar.minimized {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: radial-gradient(circle, rgba(26, 18, 14, 0.95), rgba(12, 9, 7, 0.98));
    border: 2px solid #85633e;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.9), 0 0 12px rgba(245, 158, 11, 0.3);
}

.bg-tactical-radar.minimized .bg-radar-header,
.bg-tactical-radar.minimized .bg-radar-body,
.bg-tactical-radar.minimized .bg-radar-footer {
    display: none !important;
}

.bg-radar-min-icon {
    display: none;
    font-size: 16px;
    color: #38bdf8;
    text-shadow: 0 0 8px #38bdf8;
    pointer-events: none;
}

.bg-tactical-radar.minimized .bg-radar-min-icon {
    display: block;
}

@media (max-width: 900px), (pointer: coarse) {
    .bg-tactical-radar {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(14, 11, 9, 0.96) !important;
    }
    .bg-player-kd-hud {
        background: rgba(14, 11, 9, 0.96) !important;
    }
}

/* ============================================================================
   PLAYER KILL / DEATH COMPACT HUD (TEPAT DI BAWAH RADAR BATTLEGROUND)
   ============================================================================ */
.bg-player-kd-hud {
    position: absolute;
    top: 414px;
    left: 12px;
    z-index: 1000 !important;
    width: 230px;
    background: #0e0b09;
    border: 1.5px solid #85633e;
    border-radius: 10px;
    padding: 6px 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.85), inset 0 0 14px rgba(0, 0, 0, 0.6);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #e8ded1;
    user-select: none;
    pointer-events: none;
    transform: scale(1.32);
    transform-origin: top left;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bg-player-kd-hud.hidden {
    display: none !important;
}

.bg-kd-cell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
}

.bg-kd-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.bg-kd-cell.kill .bg-kd-icon {
    color: #4ade80;
}

.bg-kd-cell.death .bg-kd-icon {
    color: #f87171;
}

.bg-kd-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #cbbba3;
}

.bg-kd-val {
    font-size: 15px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.bg-kd-cell.kill .bg-kd-val {
    color: #4ade80;
}

.bg-kd-cell.death .bg-kd-val {
    color: #f87171;
}

.bg-kd-sep {
    width: 1px;
    height: 18px;
    background: rgba(133, 99, 62, 0.55);
    flex-shrink: 0;
    margin: 0 6px;
}
