:root {
    --bg: #060908;
    --bg-2: #0a0f0d;
    --panel: rgba(15, 22, 20, 0.72);
    --line: #1b2b26;
    --line-bright: #294037;
    --ink: #d7e6df;
    --muted: #6c7d76;
    --hud: #4fe3a6;
    --hud-deep: #1f8c63;
    --good: #4fe3a6;
    --average: #f4ba45;
    --poor: #ff5f56;
    --grid: rgba(79, 227, 166, 0.045);
    --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
    --display: "Saira Condensed", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--mono);
    color: var(--ink);
    background:
        radial-gradient(120% 80% at 50% -10%, rgba(31, 140, 99, 0.18), transparent 60%),
        radial-gradient(80% 60% at 100% 0%, rgba(79, 227, 166, 0.06), transparent 55%),
        linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 100% 34px,
        linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 34px 100%,
        var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ---- Atmosphere overlays ---- */
.scanlines, .grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}
.scanlines {
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0,
        rgba(0, 0, 0, 0) 2px,
        rgba(0, 0, 0, 0.16) 3px
    );
    mix-blend-mode: multiply;
    opacity: 0.5;
}
.grain {
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Header ---- */
.hud-header {
    max-width: 880px;
    margin: 0 auto;
    padding: 2.4rem 1.25rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.9rem; }
.brand__mark {
    width: 46px;
    height: 46px;
    fill: var(--hud);
    filter: drop-shadow(0 0 10px rgba(79, 227, 166, 0.45));
    animation: sweep 6s ease-in-out infinite;
}
@keyframes sweep {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}
.brand__text h1 {
    margin: 0;
    font-family: var(--display);
    font-weight: 800;
    font-size: 2.1rem;
    letter-spacing: 4px;
    line-height: 0.9;
    color: var(--ink);
    text-shadow: 0 0 18px rgba(79, 227, 166, 0.25);
}
.tagline {
    margin: 0.3rem 0 0;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
}
.hud-header__status {
    font-size: 0.68rem;
    letter-spacing: 2px;
    color: var(--hud);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--line-bright);
    padding: 0.4rem 0.7rem;
    border-radius: 2px;
    background: rgba(79, 227, 166, 0.04);
}
.hud-header__status.offline { color: var(--average); }
.hud-header__status.offline .dot { background: var(--average); box-shadow: 0 0 8px var(--average); }
.dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--hud);
    box-shadow: 0 0 8px var(--hud);
    animation: blink 2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

/* ---- Layout ---- */
main {
    max-width: 880px;
    margin: 0 auto;
    padding: 0.5rem 1.25rem 1rem;
}

/* ---- Panels with corner brackets ---- */
.panel {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 1.5rem 1.25rem 1.25rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(2px);
    animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: var(--delay, 0s);
}
.panel::before, .panel::after {
    content: "";
    position: absolute;
    width: 14px; height: 14px;
    border: 2px solid var(--hud);
    opacity: 0.7;
}
.panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.panel__tag {
    position: absolute;
    top: -0.62rem;
    left: 1rem;
    background: var(--bg-2);
    padding: 0 0.5rem;
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--hud);
}
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Inputs ---- */
.autocomplete { position: relative; }
input[type="text"] {
    width: 100%;
    padding: 0.8rem 0.95rem;
    font-family: var(--mono);
    font-size: 1rem;
    color: var(--ink);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--line-bright);
    border-radius: 2px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]::placeholder { color: var(--muted); }
input[type="text"]:focus {
    outline: none;
    border-color: var(--hud);
    box-shadow: 0 0 0 1px var(--hud), 0 0 22px rgba(79, 227, 166, 0.15);
}

/* ---- Suggestions dropdown ---- */
.suggestions {
    list-style: none;
    margin: 0.35rem 0 0;
    padding: 0.25rem;
    position: absolute;
    left: 0; right: 0;
    z-index: 20;
    background: #0c1411;
    border: 1px solid var(--line-bright);
    border-radius: 2px;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}
.suggestions li {
    padding: 0.45rem 0.55rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border-radius: 2px;
}
.suggestions li:hover,
.suggestions li.active {
    background: rgba(79, 227, 166, 0.14);
    box-shadow: inset 2px 0 0 var(--hud);
}
.suggestions .thumb {
    width: 44px; height: 28px;
    object-fit: cover;
    flex: none;
    background: #060908;
    border: 1px solid var(--line);
    border-radius: 1px;
}
.suggestions .thumb--empty { display: inline-block; }
.suggestions .s-name { flex: 1; font-size: 0.92rem; }
.suggestions .s-meta {
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}
.suggestions li:hover .s-meta,
.suggestions li.active .s-meta { color: var(--hud); }

/* ---- Saved ownship card ---- */
.ownship-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.ownship-card__img {
    width: 124px;
    height: 70px;
    flex: none;
    border: 1px solid var(--line-bright);
    background:
        linear-gradient(135deg, rgba(79, 227, 166, 0.08), transparent),
        #060908;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 2px;
}
.ownship-card__img img { width: 100%; height: 100%; object-fit: cover; }
.ownship-card__meta { flex: 1; min-width: 0; }
.ownship-card__name {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 1px;
    line-height: 1;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ownship-card__sub {
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.74rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.btn-clear {
    flex: none;
    font-family: var(--display);
    font-weight: 600;
    letter-spacing: 2px;
    font-size: 0.8rem;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line-bright);
    padding: 0.5rem 0.85rem;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-clear:hover {
    color: var(--poor);
    border-color: var(--poor);
    box-shadow: 0 0 16px rgba(255, 95, 86, 0.2);
}

/* ---- Result reveal ---- */
#result { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* ---- Verdict ---- */
.verdict {
    position: relative;
    border: 1px solid var(--line-bright);
    border-radius: 2px;
    padding: 1.3rem 1.25rem 1.1rem;
    margin-bottom: 1rem;
    text-align: center;
    overflow: hidden;
}
.verdict::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.12;
    background: radial-gradient(80% 140% at 50% 0%, currentColor, transparent 70%);
    pointer-events: none;
}
.verdict__readout {
    font-family: var(--display);
    font-weight: 800;
    font-size: 2.6rem;
    letter-spacing: 6px;
    line-height: 1;
    text-shadow: 0 0 26px currentColor;
}
.verdict__sub {
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 1px;
}
.verdict__sub strong { color: var(--ink); font-weight: 600; }
.verdict.good { color: var(--good); }
.verdict.average { color: var(--average); }
.verdict.poor { color: var(--poor); }

/* ---- Advantage meter ---- */
.meter {
    position: relative;
    height: 6px;
    margin: 1rem auto 0.2rem;
    max-width: 460px;
    background: linear-gradient(90deg,
        var(--poor) 0%, rgba(244, 186, 69, 0.7) 50%, var(--good) 100%);
    border-radius: 3px;
    opacity: 0.85;
}
.meter__needle {
    position: absolute;
    top: -5px;
    width: 3px;
    height: 16px;
    background: var(--ink);
    box-shadow: 0 0 8px var(--ink);
    transform: translateX(-50%);
    transition: left 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.meter__scale {
    display: flex;
    justify-content: space-between;
    max-width: 460px;
    margin: 0.45rem auto 0;
    font-size: 0.62rem;
    letter-spacing: 1.5px;
    color: var(--muted);
    text-transform: uppercase;
}

/* ---- Dossier (recognition cards) ---- */
.dossier {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.dossier__card {
    position: relative;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.85rem;
    border-radius: 2px;
}
.dossier__card--mine {
    border-color: rgba(215, 230, 223, 0.35);
    background: rgba(215, 230, 223, 0.03);
    box-shadow: inset 0 0 0 1px rgba(215, 230, 223, 0.08);
}
.dossier__img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #060908;
    border: 1px solid var(--line);
    border-radius: 1px;
    display: block;
}
.dossier__img--empty {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 2px;
}
.dossier__name {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
    margin-top: 0.6rem;
    line-height: 1.05;
}
.dossier__sub {
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 0.2rem;
}
.dossier__flag {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: var(--bg);
    background: var(--ink);
    padding: 0.15rem 0.4rem;
    border-radius: 1px;
}
.dossier__vs {
    align-self: center;
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: var(--muted);
}

/* ---- Comparison table ---- */
table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--line);
    border-radius: 2px;
    overflow: hidden;
}
th, td {
    padding: 0.7rem 0.95rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
}
thead th {
    background: rgba(255, 255, 255, 0.02);
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}
.col-stat {
    width: 34%;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 1.5px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }

/* your-aircraft column — neutral marker so green stays "winner only" */
.col-mine {
    background: rgba(215, 230, 223, 0.035);
    box-shadow: inset 2px 0 0 rgba(215, 230, 223, 0.4);
}
thead .col-mine { color: var(--ink); }
.you-tag {
    display: inline-block;
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.58rem;
    letter-spacing: 2px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line-bright);
    padding: 0.05rem 0.38rem;
    border-radius: 1px;
    margin-left: 0.45rem;
    vertical-align: 2px;
}

td.win {
    color: var(--good);
    font-weight: 600;
}
td.win::before {
    content: "▲ ";
    font-size: 0.7em;
    vertical-align: 1px;
}
td.lose {
    color: var(--poor);
}
td.lose::before {
    content: "▼ ";
    font-size: 0.7em;
    vertical-align: 1px;
    opacity: 0.8;
}
td.unknown { color: var(--muted); font-style: italic; }

/* ---- Message ---- */
.message {
    text-align: center;
    color: var(--average);
    background: rgba(244, 186, 69, 0.08);
    border: 1px solid rgba(244, 186, 69, 0.4);
    border-radius: 2px;
    padding: 0.85rem;
    letter-spacing: 0.5px;
}

footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 2.5rem 1rem 3rem;
}

/* ---- Responsive ---- */
@media (max-width: 560px) {
    .brand__text h1 { font-size: 1.7rem; letter-spacing: 2px; }
    .dossier { grid-template-columns: 1fr; }
    .dossier__vs { justify-self: center; }
    .verdict__readout { font-size: 2rem; letter-spacing: 3px; }
    .ownship-card { flex-wrap: wrap; }
    .ownship-card__meta { order: 3; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
