/* =====================================================
   BASE / BODY
===================================================== */
body {
    min-height: 100vh;
    background: url("398927.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

header {
    width: 100%;
    max-width: 1200px;
}

#main-player-wrapper {
    width: 100%;
    max-width: 1200px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(14px);
    position: relative;
}

/* =====================================================
   VIDEO PLAYER — zoom container
===================================================== */
/* VIDEO CONTAINER - overflow:hidden is the crop boundary for zoom */
#player-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: black;
    overflow: hidden;
}

/* ZOOM WRAPPER - we scale THIS, not the video directly */
#video-zoom-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    transform: scale(1);
    transition: transform 0.18s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

#video-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: black;
}

/* =====================================================
   ZOOM BADGE
===================================================== */
#zoom-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 60;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 4px 10px;
    color: white;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#zoom-badge.visible { opacity: 1; }

/* =====================================================
   CONTROLS
===================================================== */
#controls-container {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}
.controls-hidden { opacity: 0; pointer-events: none; }

button, select {
    transition: transform .15s ease, opacity .15s ease;
}
button:hover, select:hover {
    transform: scale(1.1);
    opacity: .9;
}

#controls-overlay {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    z-index: 50;
}

#progress-bar { margin-bottom: 6px; }
input[type="range"].live { pointer-events: none; opacity: 0.6; }

/* =====================================================
   FULLSCREEN OVERRIDES
===================================================== */
:fullscreen #main-player-wrapper {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none;
    padding: 0;
    border-radius: 0;
}
:fullscreen #player-container { height: 100vh; aspect-ratio: auto; }
:fullscreen #video-player { width: 100vw; height: 100vh; object-fit: cover; }
:fullscreen #controls-overlay { padding: 0 12px 12px; }
:fullscreen #telemetry-panel { position: absolute !important; z-index: 9000 !important; }
:fullscreen #map-panel { position: absolute !important; z-index: 9000 !important; }
:fullscreen #telemetry-corner-btn { position: absolute !important; z-index: 9001 !important; }
:fullscreen #map-corner-btn { position: absolute !important; z-index: 8990 !important; }

/* =====================================================
   SPINNER
===================================================== */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   ANIMATED COMPANY TITLE
===================================================== */
.company-title-split {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    text-align: center;
    line-height: 1.2;
}
.company-title-split span {
    display: inline-block;
    font-weight: 800;
    font-size: clamp(1.1rem, 4vw, 2.2rem);
    color: #7f1d1d;
    animation: glowWave 2.8s ease-in-out infinite;
    transition: transform 0.25s ease;
    animation-direction: alternate;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.45);
}
@media (hover: hover) {
    .company-title-split span:hover {
        transform: translateY(-6px) scale(1.05);
        color: #ef4444;
    }
}
.company-title-split span:hover { transform: translateY(-6px); color: #0ea5e9; }
@keyframes glowWave {
    0%   { color: #450a0a; }
    50%  { color: #ff3b3b; }
    100% { color: #450a0a; }
}
.company-title-split span:nth-child(1)  { animation-delay: 0s; }
.company-title-split span:nth-child(2)  { animation-delay: .08s; }
.company-title-split span:nth-child(3)  { animation-delay: .16s; }
.company-title-split span:nth-child(4)  { animation-delay: .24s; }
.company-title-split span:nth-child(5)  { animation-delay: .32s; }
.company-title-split span:nth-child(6)  { animation-delay: .4s; }
.company-title-split span:nth-child(7)  { animation-delay: .48s; }
.company-title-split span:nth-child(8)  { animation-delay: .56s; }
.company-title-split span:nth-child(9)  { animation-delay: .64s; }
.company-title-split span:nth-child(10) { animation-delay: .72s; }
.company-title-split span:nth-child(11) { animation-delay: .8s; }
.company-title-split span:nth-child(12) { animation-delay: .88s; }
.company-title-split span:nth-child(13) { animation-delay: .96s; }
.company-title-split span:nth-child(14) { animation-delay: 1.04s; }
.company-title-split span:nth-child(15) { animation-delay: 1.12s; }
.company-title-split span:nth-child(16) { animation-delay: 1.2s; }
.company-title-split span:nth-child(17) { animation-delay: 1.28s; }
.company-title-split span:nth-child(18) { animation-delay: 1.36s; }
.company-title-split span:nth-child(19) { animation-delay: 1.44s; }
.company-title-split span:nth-child(20) { animation-delay: 1.52s; }

/* =====================================================
   GAME UI OVERLAY
===================================================== */
#ui-game-overlay {
    position: absolute;
    inset: 0;
    z-index: 55;
    pointer-events: none;
}

/* ── D-Pad ── */
.camera-nav-zone {
    position: absolute;
    left: clamp(16px, 3vw, 40px);
    bottom: clamp(24px, 10vh, 80px);
    width: clamp(160px, 22vw, 250px);
    height: clamp(160px, 22vw, 250px);
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}
.nav-controller {
    position: relative;
    width: 80%;
    height: 80%;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.35), 0 12px 30px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}
.nav-divider {
    position: absolute;
    top: 50%; left: 0;
    width: 100%; height: 4px;
    background: rgba(255, 255, 255, 0.55);
    z-index: 2;
    pointer-events: none;
}
.nav-divider.d1 { transform: rotate(45deg); }
.nav-divider.d2 { transform: rotate(-45deg); }

.nav-btn-segment {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s;
}
.nav-btn-segment.up    { top: 0;    left: 25%; width: 50%; height: 35%; }
.nav-btn-segment.down  { bottom: 0; left: 25%; width: 50%; height: 35%; }
.nav-btn-segment.left  { left: 0;   top: 25%;  width: 35%; height: 50%; }
.nav-btn-segment.right { right: 0;  top: 25%;  width: 35%; height: 50%; }
.nav-btn-segment.up:hover    { transform: translateY(-6px); }
.nav-btn-segment.down:hover  { transform: translateY(6px); }
.nav-btn-segment.left:hover  { transform: translateX(-6px); }
.nav-btn-segment.right:hover { transform: translateX(6px); }

.nav-chevron {
    width: clamp(20px, 3vw, 30px);
    height: clamp(20px, 3vw, 30px);
    border-bottom: 6px solid #666;
    border-right: 6px solid #666;
    border-radius: 3px;
    transition: all 0.2s ease;
    border-color: rgba(60, 60, 60, 0.85);
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.35));
}
.up    .nav-chevron { transform: rotate(-135deg); }
.down  .nav-chevron { transform: rotate(45deg); }
.left  .nav-chevron { transform: rotate(135deg); }
.right .nav-chevron { transform: rotate(-45deg); }
.nav-btn-segment:hover .nav-chevron { border-color: #333; }
.nav-btn-segment:active .nav-chevron {
    border-color: #fff;
    filter: drop-shadow(0 0 8px #fff);
    background: rgba(255, 255, 255, 0.28);
}
.nav-center-circle {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 35%; height: 35%;
    background: white;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .camera-nav-zone { width: 120px; height: 120px; bottom: 70px; }
    .nav-chevron { border-bottom-width: 4px; border-right-width: 4px; }
}

/* ── PS5 Buttons ── */
.ps5-zone {
    position: absolute;
    right: clamp(16px, 3vw, 40px);
    bottom: clamp(24px, 10vh, 80px);
    width: clamp(160px, 22vw, 260px);
    height: clamp(160px, 22vw, 260px);
    pointer-events: auto;
}
.ps5-pos {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ps5-pos.top    { top: 0;    left: 50%; transform: translateX(-50%); }
.ps5-pos.bottom { bottom: 0; left: 50%; transform: translateX(-50%); }
.ps5-pos.left   { left: 0;   top: 50%;  transform: translateY(-50%); }
.ps5-pos.right  { right: 0;  top: 50%;  transform: translateY(-50%); }

.ps5-btn {
    width: clamp(52px, 7vw, 74px);
    height: clamp(52px, 7vw, 74px);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(12px);
    color: white;
    font-size: clamp(18px, 2.2vw, 22px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.25), 0 10px 26px rgba(0, 0, 0, 0.45);
    transition: transform 0.12s ease, background 0.12s ease;
    cursor: pointer;
}
.ps5-btn:active { transform: scale(0.9); background: rgba(255, 255, 255, 0.28); }
.ps5-btn.zoom-active {
    background: rgba(255, 200, 0, 0.35) !important;
    border-color: rgba(255, 200, 0, 0.7) !important;
    box-shadow: inset 0 0 14px rgba(255, 200, 0, 0.3), 0 0 18px rgba(255, 200, 0, 0.45) !important;
}

@media (max-width: 768px) {
    .ps5-zone { width: 130px; height: 130px; }
    .ps5-btn  { width: 52px; height: 52px; font-size: 18px; }
}

:fullscreen #ui-game-overlay { inset: 0; }

/* ── Gimbal indicator ── */
.gimbal-online {
    background: radial-gradient(circle at top, #22c55e, #16a34a) !important;
    box-shadow: 0 0 12px #22c55e;
}
.gimbal-offline { background: #9ca3af !important; }

/* =====================================================
   TELEMETRY PANEL
===================================================== */
#telemetry-panel {
    position: fixed;
    top: 120px; left: 30px;
    width: clamp(300px, 28vw, 400px);
    z-index: 9000;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    color: white;
    overflow: hidden;
    transition: 0.3s ease;
    display: none;
}
#telemetry-header {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}
#telemetry-header .title { font-weight: 600; font-size: 15px; }
#telemetry-header .title i { margin-right: 6px; color: rgb(233, 30, 30); }

.icon-btn {
    width: 34px; height: 34px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: 0.3s;
}
.icon-btn:hover { background: #ef4444; transform: scale(1.1); }

.premium-grid  { display: flex; gap: 18px; padding: 18px; }
.telemetry-column { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.telemetry-item {
    display: flex; align-items: center; gap: 14px;
    background: rgba(255, 255, 255, 0.07);
    padding: 14px;
    border-radius: 16px;
    transition: 0.3s ease;
}
.telemetry-item:hover { background: rgba(255, 255, 255, 0.15); transform: translateY(-3px); }

.icon-wrap {
    width: 38px; height: 38px; min-width: 38px;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(254, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    color: rgb(226, 86, 86);
    box-shadow: inset 0 0 10px rgba(103, 104, 105, 0.3);
}
.label  { font-size: 15px; opacity: 0.7; }
.value  { font-size: 16px; font-weight: 700; }
.value.small { font-size: 13px; }

#telemetry-open { display: none; }
#telemetry-corner-btn {
    position: absolute;
    z-index: 8980;
    width: 52px; height: 52px;
    border-radius: 16px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    color: white; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
}
#telemetry-corner-btn:hover { transform: scale(1.08); background: #38bdf8; border-color: #38bdf8; }
#telemetry-corner-btn.hidden-btn { display: none !important; }

@media (max-width: 768px) { .premium-grid { flex-direction: column; } }

.battery-status {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(166, 169, 171, 0.15);
    border: 1px solid rgba(212, 226, 232, 0.3);
    font-size: 13px; font-weight: 600;
}
.battery-status i { font-size: 16px; color: #f4f1ef; }
#battery-voltage { color: white; }
.battery-green  { color: #22c55e !important; }
.battery-yellow { color: #facc15 !important; }
.battery-red    { color: #ef4444 !important; }
@keyframes battery-blink {
    0%   { opacity: 1; }
    50%  { opacity: 0.2; }
    100% { opacity: 1; }
}
.battery-warning { animation: battery-blink 1s infinite; }

/* =====================================================
   MAP PANEL
===================================================== */
.floating-map-btn { display: none; }
#map-corner-btn {
    position: absolute;
    z-index: 8990;
    width: 52px; height: 52px;
    border-radius: 16px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    color: white; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
}
#map-corner-btn:hover { transform: scale(1.08); background: #ef4444; border-color: #ef4444; }
#map-corner-btn.hidden-btn { display: none !important; }

#map-panel {
    position: fixed;
    top: 190px; right: 30px;
    width: 420px; height: 320px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9000;
    transition: all 0.3s ease;
}
#map-panel.medium { width: 650px; height: 500px; }

#map-header {
    padding: 14px 18px;
    background: rgb(146, 140, 140);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}
#map-header span { font-weight: 600; font-size: 15px; color: white; }
#map-header span i { margin-right: 6px; color: rgb(233, 30, 30); }

.map-controls button {
    width: 34px; height: 34px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white; font-size: 14px;
    cursor: pointer;
    transition: 0.3s;
    margin-left: 5px;
}
.map-controls button:hover { background: #ef4444; transform: scale(1.1); }
#map-container { flex: 1; }

.copy-btn {
    background: transparent;
    border: none;
    color: white;
    margin-left: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: 0.2s ease;
}
.copy-btn:hover { transform: scale(1.5); }
input, textarea { user-select: text; }

/* =====================================================
   WEBSOCKET STATUS
===================================================== */
#ws-status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    display: inline-block;
    margin-right: 4px;
    transition: background 0.3s;
}
#ws-status-dot.connecting { background: #facc15; animation: battery-blink 1s infinite; }
#ws-status-dot.connected  { background: #22c55e; }
#ws-status-dot.disconnected { background: #ef4444; }

/* =====================================================
   FLIGHT LOG PANEL
===================================================== */
#flightlog-panel {
    position: fixed;
    top: 190px; left: 30px;
    width: clamp(320px, 30vw, 480px);
    z-index: 9000;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    color: white;
    overflow: hidden;
    transition: 0.3s ease;
    display: none;
}
#flightlog-header {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}
#flightlog-header .fl-title {
    font-weight: 600; font-size: 15px;
    display: flex; align-items: center; gap: 8px;
}
#flightlog-header .fl-title i { color: #f97316; }
#flightlog-body { padding: 14px; }
#flightlog-empty {
    text-align: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 13px;
}

/* table */
#flightlog-table { width: 100%; border-collapse: collapse; }
#flightlog-table thead tr { background: rgba(255, 255, 255, 0.06); }
#flightlog-table th {
    padding: 9px 12px;
    font-size: 10px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#flightlog-table td {
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
}
#flightlog-table tr:last-child td { border-bottom: none; }
#flightlog-table tr:hover td { background: rgba(255, 255, 255, 0.04); }

/* status badges */
.fl-status-complete {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
}
.fl-status-active {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.3);
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
    animation: battery-blink 1.2s infinite;
}
.fl-status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* download button */
.fl-dl-btn {
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid rgba(249, 115, 22, 0.4);
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    font-size: 11px; font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}
.fl-dl-btn:hover { background: rgba(249, 115, 22, 0.35); transform: scale(1.05); }
.fl-dl-btn:active { transform: scale(0.96); }
.fl-dl-btn.current {
    border-color: rgba(250, 204, 21, 0.4);
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
}

/* corner button */
#flightlog-corner-btn {
    position: absolute;
    z-index: 8980;
    width: 52px; height: 52px;
    border-radius: 16px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    color: white; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
}
#flightlog-corner-btn:hover { transform: scale(1.08); background: #f97316; border-color: #f97316; }
#flightlog-corner-btn.hidden-btn { display: none !important; }

/* =====================================================
   THERMAL PiP
===================================================== */
#pip-thermal-wrapper {
    position: absolute;
    top: 14px; right: 14px;
    width: clamp(180px, 22%, 280px);
    aspect-ratio: 16/9;
    z-index: 57;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    background: black;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#pip-thermal-wrapper:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 140, 0, 0.7);
}
#pip-thermal-wrapper.swapped { border-color: rgba(34, 197, 94, 0.7); }
#pip-thermal-video { width: 100%; height: 100%; object-fit: cover; background: black; display: block; }
#pip-label {
    position: absolute;
    bottom: 6px; left: 8px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    color: white;
    font-size: 10px; font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 7px;
    border-radius: 6px;
    pointer-events: none;
    text-transform: uppercase;
}
#pip-swap-hint {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0);
    color: rgba(255, 255, 255, 0);
    font-size: 22px;
    transition: all 0.2s ease;
    pointer-events: none;
}
#pip-thermal-wrapper:hover #pip-swap-hint {
    background: rgba(0, 0, 0, 0.35);
    color: white;
}
#pip-thermal-spinner {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.5);
}
#pip-thermal-spinner .mini-spinner {
    width: 24px; height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =====================================================
   ALERT SYSTEM
===================================================== */
#aa-border-flash {
    position: fixed; inset: 0;
    z-index: 99990;
    pointer-events: none;
    border: 0px solid transparent;
    opacity: 0;
    transition: opacity 0.1s;
}
#aa-border-flash.active {
    opacity: 1;
    animation: aa-border-pulse 0.55s ease-in-out infinite;
}
@keyframes aa-border-pulse {
    0%, 100% { border-width: 0; border-color: transparent; box-shadow: none; }
    50%       { border-width: 12px; border-color: #ff0000; box-shadow: inset 0 0 80px rgba(255,0,0,0.35), 0 0 60px rgba(255,0,0,0.5); }
}

.aa-corner {
    position: fixed;
    z-index: 99991;
    pointer-events: none;
    width: 140px; height: 140px;
    opacity: 0;
    transition: opacity 0.1s;
}
.aa-corner.active { opacity: 1; animation: aa-corner-blink 0.55s ease-in-out infinite; }
.aa-corner.tl { top: 0;    left: 0;  background: radial-gradient(ellipse at top left,    rgba(255,0,0,0.75) 0%, transparent 70%); }
.aa-corner.tr { top: 0;    right: 0; background: radial-gradient(ellipse at top right,   rgba(255,0,0,0.75) 0%, transparent 70%); }
.aa-corner.bl { bottom: 0; left: 0;  background: radial-gradient(ellipse at bottom left,  rgba(255,0,0,0.75) 0%, transparent 70%); }
.aa-corner.br { bottom: 0; right: 0; background: radial-gradient(ellipse at bottom right, rgba(255,0,0,0.75) 0%, transparent 70%); }
@keyframes aa-corner-blink {
    0%, 100% { opacity: 0; }
    50%       { opacity: 1; }
}

#aa-backdrop {
    position: fixed; inset: 0;
    z-index: 99992;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.3s ease;
}
#aa-backdrop.active { background: rgba(0,0,0,0.62); pointer-events: auto; }

#aa-popup {
    width: min(500px, 90vw);
    background: #0a0a0a;
    border: 3px solid #ff0000;
    border-radius: 18px;
    overflow: hidden;
    transform: scale(0.5) translateY(-60px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    animation: popup-breathe 1s ease-in-out infinite paused;
}
#aa-popup.visible {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
    animation-play-state: running;
}
@keyframes popup-breathe {
    0%, 100% { box-shadow: 0 0 40px rgba(255,0,0,0.5), 0 24px 60px rgba(0,0,0,0.9); }
    50%       { box-shadow: 0 0 0 3px rgba(255,0,0,0.6), 0 0 70px rgba(255,0,0,0.8), 0 0 120px rgba(255,0,0,0.4), 0 24px 60px rgba(0,0,0,0.9); }
}

#aa-popup-header {
    background: #ff0000;
    padding: 16px 20px 14px;
    display: flex; align-items: center; gap: 14px;
    animation: header-flash 0.55s ease-in-out infinite;
}
@keyframes header-flash {
    0%, 100% { background: #ff0000; }
    50%       { background: #990000; }
}

#aa-warning-icon {
    width: 52px; height: 52px; flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 2.5px solid rgba(255,255,255,0.5);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    animation: icon-shake 0.5s ease-in-out infinite;
}
@keyframes icon-shake {
    0%, 100% { transform: rotate(-8deg) scale(1); }
    25%       { transform: rotate(8deg) scale(1.1); }
    50%       { transform: rotate(-6deg); }
    75%       { transform: rotate(6deg) scale(1.05); }
}

#aa-header-text .warn-main {
    color: #fff; font-weight: 800; font-size: 20px;
    letter-spacing: 2px; text-transform: uppercase;
    animation: text-flicker 0.4s ease-in-out infinite;
}
@keyframes text-flicker {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}
#aa-header-text .warn-sub {
    color: rgba(255,255,255,0.8);
    font-size: 11px; letter-spacing: 1.5px;
    text-transform: uppercase; margin-top: 3px;
}

#aa-close-x {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 1.5px solid rgba(255,255,255,0.4);
    color: #fff; font-size: 20px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
#aa-close-x:hover { background: rgba(0,0,0,0.4); }

#aa-popup-body { padding: 22px 24px; }
#aa-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; min-height: 32px; }

.aa-badge {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 16px;
    border-radius: 100px;
    font-size: 13px; font-weight: 700;
    letter-spacing: 0.8px; text-transform: uppercase;
    animation: badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badge-pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.aa-badge.fire  { background: #1a0000; color: #ff4444; border: 1.5px solid #ff2222; }
.aa-badge.smoke { background: #140d00; color: #ffaa00; border: 1.5px solid #ff9900; }
.aa-badge-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    animation: pulse-dot 0.6s ease-in-out infinite;
}
.aa-badge.fire  .aa-badge-pulse { background: #ff3333; }
.aa-badge.smoke .aa-badge-pulse { background: #ffaa00; }
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.2; transform: scale(0.7); }
}

#aa-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}
.aa-stat {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 12px 14px;
}
.aa-stat .sl { font-size: 10px; color: #555; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 5px; }
.aa-stat .sv { font-size: 20px; font-weight: 700; }
.sv-conf { color: #ff5555; }
.sv-time { color: #888; font-size: 15px !important; }

#aa-gps-row {
    background: #0d0d0d;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    padding: 11px 14px;
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 18px;
}
#aa-gps-row .gl { font-size: 13px; color: #555; }
.gv { font-size: 13px; color: #888; font-family: monospace; }

#aa-actions { display: flex; gap: 10px; }
.aa-btn {
    flex: 1;
    padding: 13px;
    border-radius: 12px;
    font-size: 14px; font-weight: 700;
    border: none; cursor: pointer;
    letter-spacing: 0.5px; text-transform: uppercase;
    transition: transform 0.12s, background 0.2s;
}
.aa-btn:active { transform: scale(0.96); }
.aa-btn-ack { background: #ff0000; color: #fff; box-shadow: 0 0 20px rgba(255,0,0,0.4); }
.aa-btn-ack:hover { background: #cc0000; }
.aa-btn-dismiss { background: #161616; color: #666; border: 1px solid #2a2a2a; flex: 0.6; }
.aa-btn-dismiss:hover { background: #1e1e1e; color: #aaa; }

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 768px) {
    header { padding: 12px 14px; }
    header img { height: 36px; width: 36px; }
    header span { font-size: 16px; letter-spacing: 1px; }
    #main-player-wrapper { padding: 8px; border-radius: 16px; }
}