:root {
    --bg: #020a05;
    --bg-panel: rgba(5, 18, 11, 0.92);
    --bg-soft: rgba(127, 255, 178, 0.05);
    --line: rgba(127, 255, 178, 0.16);
    --text: #d7ffe7;
    --muted: rgba(215, 255, 231, 0.74);
    --accent: #8dffbe;
    --accent-2: #5fd2ff;
    --warning: #ffd166;
    --danger: #ff6b6b;
    --success: #58d68d;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    --radius: 18px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top, rgba(127, 255, 178, 0.12), transparent 30%),
        linear-gradient(180deg, #020a05 0%, #03130a 100%);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

body {
    padding: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

code {
    color: var(--accent);
}

.container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

.app-shell {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 32px;
}

.card {
    background: var(--bg-panel);
    border: 1px solid rgba(127, 255, 178, 0.16);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.card-subtle {
    background: var(--bg-soft);
    border-radius: calc(var(--radius) - 4px);
}

.app-header {
    margin-top: 16px;
}

.app-title,
.section-title {
    margin: 0;
    letter-spacing: 0.04em;
}

.section-title {
    font-size: 18px;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--muted);
}

.small {
    font-size: 13px;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }
.gap-2 { gap: 10px; }
.d-flex { display: flex; }
.items-center { align-items: center; }
.items-end { align-items: end; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { min-width: 220px; }

@media (max-width: 640px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
}

.input {
    width: 100%;
    border: 1px solid rgba(127, 255, 178, 0.18);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    background: rgba(127, 255, 178, 0.06);
}

.textarea {
    min-height: 320px;
    resize: vertical;
    font-family: Consolas, Monaco, monospace;
    line-height: 1.45;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(127, 255, 178, 0.24);
    border-radius: 12px;
    padding: 12px 16px;
    background: rgba(127, 255, 178, 0.09);
    color: var(--text);
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.99);
}

.btn-primary {
    background: linear-gradient(180deg, rgba(127, 255, 178, 0.28), rgba(127, 255, 178, 0.16));
}

.btn-secondary {
    background: linear-gradient(180deg, rgba(95, 210, 255, 0.24), rgba(95, 210, 255, 0.12));
}

.btn-danger {
    background: linear-gradient(180deg, rgba(255, 107, 107, 0.22), rgba(255, 107, 107, 0.12));
}

.btn-outline {
    background: transparent;
}

.page-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.page-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid rgba(127, 255, 178, 0.18);
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    background: rgba(127, 255, 178, 0.05);
    font-weight: bold;
}

.page-nav-link.is-active {
    color: var(--text);
    background: rgba(127, 255, 178, 0.14);
    border-color: rgba(127, 255, 178, 0.28);
}

.file-btn {
    position: relative;
    overflow: hidden;
}

.file-btn input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
    border: 1px solid transparent;
}

.badge-success {
    background: rgba(88, 214, 141, 0.15);
    border-color: rgba(88, 214, 141, 0.24);
    color: #a8f0c3;
}

.badge-warning {
    background: rgba(255, 209, 102, 0.15);
    border-color: rgba(255, 209, 102, 0.24);
    color: #ffe19a;
}

.radar {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(127, 255, 178, 0.28);
    background:
        radial-gradient(circle, rgba(127, 255, 178, 0.10), transparent 56%),
        linear-gradient(0deg, transparent 49.5%, var(--line) 50%, transparent 50.5%),
        linear-gradient(90deg, transparent 49.5%, var(--line) 50%, transparent 50.5%),
        rgba(8, 36, 21, 0.9);
    contain: layout paint;
}

.radar-rings {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        repeating-radial-gradient(
            circle,
            transparent 0 14%,
            rgba(127, 255, 178, 0.10) 14.5% 15%
        );
    z-index: 1;
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 2px;
    margin-top: -1px;
    transform-origin: 0 50%;
    background: linear-gradient(
        90deg,
        rgba(127, 255, 178, 0.92) 0%,
        rgba(127, 255, 178, 0.42) 55%,
        rgba(127, 255, 178, 0.06) 100%
    );
    box-shadow: 0 0 10px rgba(127, 255, 178, 0.32);
    z-index: 3;
    pointer-events: none;
    transform: rotate(0deg);
}

.radar.is-scanning .radar-sweep {
    animation: radar-sweep-spin 4000ms linear infinite;
}

.radar::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 60%, rgba(0, 0, 0, 0.14) 100%);
    z-index: 2;
    pointer-events: none;
}

.radar-north {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin-left: -12px;
    margin-top: -12px;
    z-index: 5;
    color: var(--text);
    font-size: 13px;
    font-weight: bold;
    line-height: 24px;
    text-align: center;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}


.radar-target {
    position: absolute;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    margin-top: -7px;
    border-radius: 50%;
    background: #d9fff0;
    box-shadow: 0 0 10px rgba(127, 255, 178, 0.45);
    z-index: 6;
}

.radar-target::before,
.radar-target::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    opacity: 0;
}

.radar-target.is-pulsing::before,
.radar-target.is-pulsing::after {
    animation: radar-blip 3s ease-out forwards;
}

.radar-target.is-pulsing::after {
    animation-delay: 0.18s;
}

@keyframes radar-blip {
    0% {
        transform: scale(1);
        opacity: 0.82;
        box-shadow: 0 0 0 0 rgba(127, 255, 178, 0.4);
        border: 1px solid rgba(217, 255, 240, 0.92);
    }
    100% {
        transform: scale(5.2);
        opacity: 0;
        box-shadow: 0 0 0 10px rgba(127, 255, 178, 0);
        border: 1px solid rgba(127, 255, 178, 0);
    }
}

@keyframes radar-sweep-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.radar-center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(127, 255, 178, 0.58);
    z-index: 7;
}

.distance-display {
    text-align: center;
    font-size: clamp(36px, 8vw, 52px);
    font-weight: bold;
    letter-spacing: 0.04em;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(127, 255, 178, 0.18);
}

.target-summary {
    border: 1px solid rgba(127, 255, 178, 0.12);
    background: rgba(127, 255, 178, 0.04);
    border-radius: 14px;
    padding: 12px 14px;
}

.stat-box {
    border: 1px solid rgba(127, 255, 178, 0.12);
    background: rgba(127, 255, 178, 0.04);
    border-radius: 14px;
    padding: 12px;
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.stat-value {
    font-weight: bold;
}

.alert,
.status-box {
    border-radius: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(127, 255, 178, 0.12);
    line-height: 1.45;
}

.alert-info,
.status-box {
    background: rgba(95, 210, 255, 0.08);
    border-color: rgba(95, 210, 255, 0.18);
}

.alert-warning {
    background: rgba(255, 209, 102, 0.12);
    border-color: rgba(255, 209, 102, 0.24);
    color: #ffe19a;
}

.alert-danger {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.24);
    color: #ffb0b0;
}

.hint-media-box {
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(127, 255, 178, 0.16);
    background: rgba(127, 255, 178, 0.04);
}

.media-block {
    display: block;
    width: 100%;
    height: auto;
    background: #000;
}

.hint-caption {
    padding: 12px 14px;
    color: var(--muted);
}

.d-none {
    display: none !important;
}

@media (max-width: 640px), (hover: none) and (pointer: coarse) {
    .card {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    }

    .radar-sweep {
        box-shadow: 0 0 8px rgba(127, 255, 178, 0.24);
    }

    .radar-target {
        box-shadow: 0 0 8px rgba(127, 255, 178, 0.34);
    }

    .radar-center-dot {
        box-shadow: 0 0 8px rgba(127, 255, 178, 0.42);
    }
}

@media (prefers-reduced-motion: reduce) {
    .radar.is-scanning .radar-sweep {
        animation-duration: 12000ms;
    }

    .radar-target.is-pulsing::before,
    .radar-target.is-pulsing::after {
        animation: none;
        opacity: 0;
    }
}
