:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --surface-2: #243044;
    --border: #334155;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #f59e0b;
    --accent-dim: #b45309;
    --ok: #22c55e;
    --warn: #fbbf24;
    --font: 'Segoe UI', system-ui, sans-serif;
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background: radial-gradient(ellipse 120% 80% at 50% -20%, #1e3a5f 0%, var(--bg) 55%);
    color: var(--text);
    line-height: 1.5;
}

.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.hero {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.hero__eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 0.5rem;
}

.hero h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 600;
    margin: 0 0 0.75rem;
    line-height: 1.2;
}

.hero p {
    margin: 0;
    color: var(--muted);
    max-width: 62ch;
}

.model-status {
    margin-top: 1rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.82rem;
    color: var(--muted);
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: 8px;
    max-width: 62ch;
}

.model-status strong {
    color: var(--warn);
}

.share-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1rem;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.share-feedback {
    font-size: 0.8rem;
    color: var(--ok);
}

.site-footer a {
    color: var(--accent);
    margin-left: 0.5rem;
}

.layout {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 900px) {
    .layout {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    .layout__wide {
        grid-column: 1 / -1;
    }
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.panel h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 1rem;
    font-weight: 600;
}

.gun-cards {
    display: grid;
    gap: 0.75rem;
}

.gun-card {
    display: grid;
    gap: 0.15rem;
    text-align: left;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.gun-card:hover {
    border-color: var(--accent-dim);
}

.gun-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.gun-card__tag {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.08em;
}

.gun-card__title {
    font-weight: 600;
    font-size: 0.95rem;
}

.gun-card__meta {
    font-size: 0.8rem;
    color: var(--muted);
}

.field {
    margin-bottom: 1.25rem;
}

.field:last-child {
    margin-bottom: 0;
}

.field label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.field label span:last-child {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.field-note {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0 0 0.75rem;
    line-height: 1.4;
}

.field .field-note:last-of-type {
    margin-bottom: 0.5rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.compass {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

@media (min-width: 420px) {
    .compass {
        grid-template-columns: repeat(8, 1fr);
    }
}

.compass-btn {
    padding: 0.45rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.compass-btn:hover {
    border-color: var(--accent-dim);
}

.compass-btn.is-active {
    border-color: var(--accent);
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent);
}

.field select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

input[type='range'] {
    width: 100%;
    accent-color: var(--accent);
}

.result-grid {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

.result-grid > div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.result-grid dt {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.result-grid dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.muted {
    color: var(--muted);
    font-weight: 400;
}

.fine-print {
    font-size: 0.75rem;
    color: var(--muted);
    margin: 1rem 0 0;
}

.warn {
    font-size: 0.85rem;
    color: var(--warn);
    margin: 0.75rem 0 0;
}

#range-warning {
    font-size: 0.85rem;
    color: var(--warn);
    margin: 0 0 0.75rem;
}

.chart-wrap {
    margin-top: 0.5rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.chart-legend span::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 3px;
    margin-right: 0.35rem;
    vertical-align: middle;
    border-radius: 2px;
}

.legend-coriolis::before {
    background: var(--accent);
}

.legend-vacuum-style::before {
    background: var(--muted);
    opacity: 0.7;
}

.legend-target::before {
    background: var(--ok);
    width: 3px;
    height: 12px;
}

#trajectory-chart {
    width: 100%;
    height: 220px;
    display: block;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.concept-note {
    font-size: 0.9rem;
    color: var(--muted);
}

.concept-note ul {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
}

.compass-rose-wrap {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.compass-rose {
    flex: 0 0 auto;
}

.compass-rose-svg {
    width: 168px;
    height: 168px;
    display: block;
}

.compass-rose-svg__label {
    fill: #94a3b8;
    font-size: 11px;
    font-family: var(--font);
    font-weight: 600;
}

.compass-rose-caption {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.compass-rose-caption__shot {
    color: var(--accent);
    font-weight: 600;
}

.compass-rose-caption__wind {
    color: #38bdf8;
}

.hemso-miss-label {
    background: rgba(15, 20, 25, 0.88);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.65);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font);
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.fire-control-chain {
    margin: 0;
}

.fire-control-parts {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.fire-parts-model-note {
    margin-top: 0;
}

.fire-parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.85rem;
    margin-top: 0.75rem;
}

.fire-parts-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}

.fire-parts-card__title {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
}

.fire-parts-dl {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.fire-parts-dl div {
    display: grid;
    gap: 0.15rem;
}

.fire-parts-dl dt {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
}

.fire-parts-dl dd {
    margin: 0;
    font-size: 0.9rem;
}

.fire-parts-dl__sum dt {
    color: var(--text);
    font-weight: 600;
}

.fire-parts-dl__sum dd {
    font-weight: 600;
}

.air-density-detail strong {
    color: var(--text);
}

.air-density-compare {
    margin-top: 0.35rem;
    font-size: 0.78rem;
}

.fire-parts-footnote {
    margin: 0.75rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.45;
}

.fire-chain {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.35rem 0.5rem;
}

.fire-chain__step {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    flex: 1 1 140px;
    min-width: 0;
}

.fire-chain__step p {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.fire-chain__icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--accent);
    color: #1a1200;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fire-chain__arrow {
    display: flex;
    align-items: center;
    color: var(--muted);
    font-size: 1.1rem;
    padding: 0 0.15rem;
}

@media (max-width: 720px) {
    .fire-chain__arrow {
        display: none;
    }

    .fire-chain__step {
        flex: 1 1 100%;
    }
}

.scenario-map {
    height: 320px;
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    z-index: 0;
}

.scenario-map .leaflet-container {
    font-family: var(--font);
    background: #0c1929;
}

/* Leaflet: ingen standard-nål (annars syns “spökmarkörer”) */
.hemso-leaflet-icon {
    background: transparent !important;
    border: none !important;
}

.hemso-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
    border: 2px solid #fff;
    font-family: var(--font);
}

.hemso-marker--gun-active {
    background: var(--accent);
    color: #1a1200;
}

.hemso-marker--gun-idle {
    background: #64748b;
    color: #f8fafc;
    opacity: 1;
    border-width: 2px;
}

.hemso-marker--target {
    background: #0ea5e9;
    color: #fff;
    border-radius: 4px;
    width: 28px;
    height: 28px;
}

.hemso-marker--target-active {
    background: var(--ok);
    color: #052e16;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    transform: scale(1.08);
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.65rem;
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.map-legend-hint {
    flex-basis: 100%;
    font-size: 0.75rem;
    opacity: 0.9;
}

.map-legend-sample {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
    font-size: 0.55rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.map-legend-sample--gun {
    background: var(--accent);
    color: #1a1200;
}

.map-legend-sample--target {
    background: #0ea5e9;
    color: #fff;
    border-radius: 3px;
}

.map-legend-sample--lead {
    background: #06b6d4;
    color: #042f2e;
    border-radius: 3px;
    font-size: 0.72rem;
}

.hemso-marker--target-lead {
    background: #06b6d4;
    color: #042f2e;
    border: 2px solid #ecfeff;
    font-size: 0.65rem;
    font-weight: 800;
}

.map-legend-sample--projectile {
    background: #e879f9;
    color: #1a0a24;
}

.map-legend-sample--impact-naive {
    background: #ef4444;
    color: #fff;
}

.map-legend-sample--impact-correct {
    background: var(--ok);
    color: #052e16;
}

.hemso-marker--impact-correct {
    background: var(--ok);
    color: #052e16;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.hemso-marker--projectile {
    background: #e879f9;
    color: #1a0a24;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 0 0 3px rgba(232, 121, 249, 0.35), 0 2px 6px rgba(0, 0, 0, 0.5);
}

.range-fit-row {
    margin: 0.35rem 0 0;
}

.range-fit {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.range-fit--comfort {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.45);
}

.range-fit--far {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.4);
}

.range-fit--edge,
.range-fit--extrapolated {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.45);
}

.map-flight-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.map-flight-stack .scenario-map {
    border-radius: 0;
    border: none;
}

.flight-timeline {
    margin-top: 0;
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.flight-timeline--under-map .field {
    margin-bottom: 0.35rem;
}

.chart-flight-hint {
    margin: 0 0 0.65rem;
}

.scenario-height-badge {
    margin: 0.5rem 0 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 8px;
}

.field--target-height.is-scenario-mode input[type='range']#height-diff {
    opacity: 0.75;
    cursor: not-allowed;
}

.target-height-display {
    margin: 0.35rem 0 0;
    padding: 0.55rem 0.75rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 8px;
}

.target-height-scenario .scenario-height-note {
    margin-top: 0.45rem;
    color: var(--muted);
}

.chart-apex-stats {
    margin: 0 0 0.65rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
    color: #fde68a;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.28);
    border-radius: 8px;
}

.flight-timeline__title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.flight-timeline-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.flight-timeline-stats strong {
    color: var(--text);
}

.print-root {
    display: none;
}

@media print {
    body {
        background: #fff;
        color: #111;
    }

    .wrap > :not(.print-root) {
        display: none !important;
    }

    .print-root {
        display: block !important;
        position: static;
        padding: 1.5rem;
        max-width: 720px;
        margin: 0 auto;
    }

    .print-root h1 {
        font-size: 1.35rem;
        margin: 0 0 0.5rem;
    }

    .print-meta {
        margin: 0.15rem 0;
        color: #444;
        font-size: 0.95rem;
    }

    .print-table {
        width: 100%;
        border-collapse: collapse;
        margin: 1rem 0;
        font-size: 0.95rem;
    }

    .print-table th {
        text-align: left;
        padding: 0.35rem 0.75rem 0.35rem 0;
        vertical-align: top;
        width: 42%;
        font-weight: 600;
    }

    .print-table td {
        padding: 0.35rem 0;
    }

    .print-disclaimer {
        font-size: 0.8rem;
        color: #555;
        margin-top: 1.25rem;
    }
}

.hemso-marker--impact-naive {
    background: #ef4444;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.charge-compare-panel {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.charge-compare-panel h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 0.75rem;
    font-weight: 600;
}

.parallax-panel {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.parallax-panel h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 0.75rem;
    font-weight: 600;
}

.parallax-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.parallax-table th,
.parallax-table td {
    padding: 0.45rem 0.5rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.parallax-table th:first-child,
.parallax-table td:first-child {
    text-align: left;
}

.parallax-table tr.is-active {
    background: rgba(245, 158, 11, 0.08);
}

.parallax-table tr.is-active td:first-child {
    color: var(--accent);
    font-weight: 600;
}

.parallax-summary {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0.65rem 0 0;
}

.site-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
}
