.intro {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
}

.intro h1 {
    font-size: 2em;
}

.intro-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1em;
}

.intro-note {
    font-size: .9em;
    font-weight: 400;
    color: #555;
    max-width: 32em;
    margin: 1.2em auto 0;
}

.app {
    display: none;
    flex-direction: column;
    position: relative;
    height: 100vh;
}

#map {
    position: relative;
    flex: 1;
    min-height: 0;
}

#canvas {
    position: absolute;
    top: 10px;
    right: 10px;
    --panel: rgb(17, 19, 22);
    width: max-content;
    max-width: calc(100% - 80px);
    max-height: 45vh;
    display: flex;
    flex-direction: column;
    background: rgba(17, 19, 22, 0.92);
    color: #fff;
    border-radius: 6px;
}

#canvas p {
    margin: 0;
    padding: .5em 1em;
}

.altitude-legend {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 6px 8px;
    border-radius: 4px;
    width: 200px;
    font-size: 11px;
}

.altitude-legend .bar {
    height: 8px;
    border-radius: 2px;
}

.altitude-legend .labels {
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
}

.plane-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.plane-label {
    position: absolute;
    top: 0;
    left: 0;
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    text-shadow: 0 0 3px #000, 0 0 3px #000;
    pointer-events: auto;
    cursor: pointer;
    will-change: transform;
}

.plane-label small {
    font-weight: 400;
    opacity: .85;
}

.tilt-toggle {
    font-family: monospace;
    font-weight: 800;
    font-size: 11px;
    border: none;
    border-radius: 0;
    padding: 0;
}

.maplibregl-popup-content {
    font-family: monospace;
    font-weight: 400;
    line-height: 1.5;
}

body {
    font-family: monospace;
    font-weight: 800;
    margin: 0;
}

button {
    font-family: monospace;
    border: 2px solid rgb(34, 39, 63);
    background: none;
    border-radius: 3px;
    font-size: 1.2em;
    padding: .5em 1em;
    cursor: pointer;
}

p {
    font-size: 1.2em;
}

.blink-me {
    font-size: 1.5em;
    animation: blinker 1.5s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

/* Message table: quiet, data-first (after Tufte). No grid, no zebra; one
   hairline under the header and one at each new minute. */
.data {
    overflow: auto;
    flex: 1;
    padding: 0 .75em .5em;
}

.messages {
    --ink: #e8e8e8;
    --muted: #8a8f96;
    --rule: rgba(255, 255, 255, 0.18);
    border-collapse: collapse;
    font: 400 12px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
    font-variant-numeric: tabular-nums lining-nums;
    color: var(--ink);
    white-space: nowrap;
}

.messages th {
    position: sticky;
    top: 0;
    background: var(--panel);
    color: var(--muted);
    font-weight: 400;
    font-size: 10px;
    letter-spacing: .06em;
    text-align: left;
    padding: .6em 1em .3em 0;
    border-bottom: 1px solid var(--rule);
}

.messages td {
    padding: 0 1em 0 0;
}

.messages .num {
    text-align: right;
}

.messages .time {
    color: var(--muted);
}

.messages tr.minute td {
    border-top: 1px solid var(--rule);
}

.messages a {
    color: inherit;
    text-decoration: none;
}

.messages a:hover {
    text-decoration: underline;
    text-decoration-color: var(--muted);
    text-underline-offset: 2px;
}

/* All data shares the message column; each field has a fixed slot so rows
   of the same message type line up. Widths are in ch, which equals one
   tabular digit. */
.messages .field {
    display: inline-block;
    white-space: nowrap;
}

.messages .field + .field {
    margin-left: .8em;
}

.messages .figure {
    display: inline-block;
    text-align: right;
}

.messages .fraction {
    display: inline-block;
    text-align: left;
}

.messages .unit {
    color: var(--muted);
    margin: 0 .3em;
}

.messages .field .unit:last-child {
    margin-right: 0;
}

.messages .type a {
    letter-spacing: .03em;
}

.messages .df {
    color: var(--muted);
}

.messages .arrow {
    display: inline-block;
    transform: rotate(calc((var(--heading) - var(--bearing)) * 1deg));
    cursor: help;
}

/* Checksum notes in their own column at the right edge. */
.messages td.crc {
    padding-left: 1em;
    padding-right: 0;
}

.messages .crc a {
    color: #ff5c5c;
}

/* Repairs: amber; the label says how (CRC error control or SDD). */
.messages .crc a.crc,
.messages .crc a.sdd {
    color: #e0a84a;
}

.messages tr.located {
    cursor: crosshair;
}

.messages tr.focused td {
    background: rgba(255, 225, 77, 0.12);
}

.messages tr.corrupt td,
.messages tr.corrupt .df {
    color: #5d6168;
}

.messages tr.hovered td {
    background: rgba(255, 255, 255, 0.08);
}

.plane-highlight {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    will-change: transform;
}

.plane-highlight::before,
.plane-highlight::after {
    content: "";
    position: absolute;
    left: -18px;
    top: -18px;
    width: 32px;
    height: 32px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px #000;
}

.plane-highlight::after {
    animation: highlight-pulse 1s ease-out infinite;
}

.plane-highlight.offscreen::before {
    border-style: dashed;
}

@keyframes highlight-pulse {
    from { transform: scale(.6); opacity: 1; }
    to { transform: scale(2); opacity: 0; }
}

.plane-highlight.flash::after {
    animation-duration: .5s;
}

.plane-label.flashing,
.plane-label.highlighted {
    color: #ffe14d;
    z-index: 1;
}

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    padding-right: .75em;
}

.reset-button {
    font: 400 11px system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #e8e8e8;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    padding: .15em .7em;
    margin-top: .6em;
}

.reset-button:hover {
    background: rgba(255, 92, 92, 0.18);
    border-color: rgba(255, 92, 92, 0.6);
}

#canvas .rate {
    font: 400 11px system-ui, -apple-system, "Segoe UI", sans-serif;
    font-variant-numeric: tabular-nums;
    color: #8a8f96;
    padding: .6em 1em 0;
}

.rate:empty {
    display: none;
}

.pause-badge {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding: .4em 1em;
    border: 1px solid rgba(255, 225, 77, 0.6);
    border-radius: 999px;
    background: rgba(17, 19, 22, 0.92);
    color: #ffe14d;
    font: 400 12px system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Chevron in front of the message shown in the signal view; click to lock. */
.chevron {
    all: unset;
    display: inline-block;
    width: 1.2em;
    text-align: center;
    font: 700 14px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--muted, #8a8f96);
    cursor: pointer;
    border-radius: 3px;
}

.chevron:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.chevron.locked,
.messages tr.locked .chevron {
    color: #111316;
    background: #ffe14d;
}

.messages td.lock {
    padding-right: .3em;
}

.messages td.lock .chevron {
    visibility: hidden;
}

.messages tr.hovered td.lock .chevron,
.messages tr.shown td.lock .chevron,
.messages tr.locked td.lock .chevron {
    visibility: visible;
}

.messages tr.shown:not(.hovered) td {
    background: rgba(255, 255, 255, 0.05);
}

.signal-detail-title .chevron {
    margin-right: .4em;
}

/* Signal panel, docked under the map. */
.signal {
    --ink: #e8e8e8;
    --muted: #8a8f96;
    position: relative;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 16px 8px;
    background: rgb(17, 19, 22);
    color: var(--ink);
    font: 400 11px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
    font-variant-numeric: tabular-nums;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.signal-header {
    display: flex;
    gap: 1em;
    align-items: baseline;
}

.signal-title {
    font-weight: 600;
}

.signal-actions {
    margin-left: auto;
    display: flex;
    gap: .5em;
}

.signal-button {
    font: 400 11px system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    padding: .15em .7em;
}

.signal-button:hover {
    background: rgba(255, 255, 255, 0.14);
}

.signal-button:disabled {
    color: #ffe14d;
    border-color: rgba(255, 225, 77, 0.6);
}

.signal-detector {
    color: var(--muted);
}

.signal-detector select {
    font: 400 11px system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    margin-left: .3em;
}

.signal-info,
.signal-muted {
    color: var(--muted);
}

.signal-corrupt {
    color: #ff5c5c;
}

.signal-candidate {
    color: #e0a84a;
}

.signal-body {
    display: flex;
    gap: 16px;
    min-width: 0;
}

.signal-plots {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.signal canvas {
    display: block;
}

.signal-overview {
    width: 100%;
    height: 50px;
}

.signal-detail-title {
    margin: 6px 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.signal-type {
    cursor: help;
}

.signal-bytes {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 10px;
    color: var(--muted);
}

.signal-bytes span {
    cursor: default;
}

.signal-bytes span:hover,
.signal-bytes span.active {
    color: #ffe14d;
}

/* The detail keeps a fixed scale; scroll sideways on narrow screens. */
.signal-detail-scroll {
    overflow-x: auto;
}

.signal-side {
    width: 140px;
    flex: none;
    display: flex;
    align-items: flex-end;
}

.signal-constellation {
    width: 140px;
    height: 140px;
}

.signal-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    max-width: 420px;
    padding: 6px 8px;
    background: rgba(30, 32, 36, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    pointer-events: none;
    line-height: 1.5;
}

.signal-tooltip code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    color: #ffe14d;
}

@media (max-width: 700px) {
    .signal-side {
        display: none;
    }
}

footer {
    position: absolute;
    bottom: 1em;
    text-align: center;
    width: 100%;
}