/* ==========================================================================
   Universe Simulation — 3D scene + navigation overlay
   Dark, high contrast, spacey. All overlay classes are namespaced `nv-`.
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background-color: #000;
    color: #d6e2f5;
}

/* the WebGL canvas keeps filling the viewport, below every panel */
canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 0;
    outline: none;
}

/* ==========================================================================
   design tokens
   ========================================================================== */

:root {
    --nv-font: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Fira Mono",
               Menlo, Consolas, "Liberation Mono", monospace;

    --nv-panel-bg: rgba(9, 13, 22, 0.74);
    --nv-panel-bg-solid: rgba(9, 13, 22, 0.94);
    --nv-border: rgba(120, 168, 255, 0.20);
    --nv-border-strong: rgba(120, 168, 255, 0.42);

    --nv-text: #d8e4f7;
    --nv-dim: #7b8aa6;
    --nv-faint: #4d5a72;

    --nv-accent: #6fd3ff;
    --nv-accent-soft: rgba(111, 211, 255, 0.14);
    --nv-gold: #ffc46b;
    --nv-warn: #ff8f7a;

    --nv-radius: 10px;
    --nv-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
}

/* ==========================================================================
   overlay root — never steals pointer events from the 3D view
   ========================================================================== */

.nv-root {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    pointer-events: none;
    font-family: var(--nv-font);
    font-size: 12px;
    line-height: 1.45;
    color: var(--nv-text);
    -webkit-font-smoothing: antialiased;
}

/* only actual widgets capture the mouse */
.nv-panel,
.nv-playback,
.nv-toast,
.nv-help--on {
    pointer-events: auto;
}

.nv-root--paused::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 2px rgba(255, 196, 107, 0.30);
}

/* ==========================================================================
   panels
   ========================================================================== */

.nv-panel {
    position: absolute;
    background: var(--nv-panel-bg);
    border: 1px solid var(--nv-border);
    border-radius: var(--nv-radius);
    box-shadow: var(--nv-shadow);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    overflow: hidden;
}

.nv-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(180deg, rgba(111, 211, 255, 0.09), rgba(111, 211, 255, 0));
    border-bottom: 1px solid var(--nv-border);
}

.nv-panel--collapsed .nv-panel__header {
    border-bottom-color: transparent;
}

.nv-panel__title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--nv-accent);
}

.nv-panel__toggle {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    line-height: 1;
    font-family: inherit;
    font-size: 13px;
    color: var(--nv-dim);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--nv-border);
    border-radius: 5px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.nv-panel__toggle:hover {
    color: var(--nv-accent);
    border-color: var(--nv-border-strong);
}

.nv-panel__body {
    padding: 9px 10px 10px;
}

.nv-panel--collapsed .nv-panel__body {
    display: none;
}

/* ==========================================================================
   stat grids (HUD, inspector, help)
   ========================================================================== */

.nv-stats {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 10px;
    align-items: baseline;
}

.nv-stats dt {
    color: var(--nv-dim);
    font-size: 11px;
    white-space: nowrap;
}

.nv-stats dd {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--nv-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nv-stats__highlight {
    color: var(--nv-gold);
    font-weight: 600;
}

/* ==========================================================================
   HUD — top left
   ========================================================================== */

.nv-hud {
    top: 14px;
    left: 14px;
    width: 258px;
}

/* ==========================================================================
   body navigation panel — top right
   ========================================================================== */

.nv-bodies {
    top: 14px;
    right: 14px;
    width: 346px;
    display: flex;
    flex-direction: column;
    min-height: 130px;
    max-height: calc(100vh - 468px);
}

.nv-bodies.nv-panel--collapsed {
    min-height: 0;
    max-height: none;
    display: block;
}

.nv-bodies .nv-panel__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 7px;
}

.nv-search {
    width: 100%;
    padding: 6px 8px;
    font-family: inherit;
    font-size: 12px;
    color: var(--nv-text);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--nv-border);
    border-radius: 6px;
    outline: none;
}

.nv-search::placeholder {
    color: var(--nv-faint);
}

.nv-search:focus {
    border-color: var(--nv-border-strong);
    background: rgba(111, 211, 255, 0.07);
}

.nv-sortbar,
.nv-speeds,
.nv-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.nv-chip {
    padding: 3px 8px;
    font-family: inherit;
    font-size: 11px;
    color: var(--nv-dim);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--nv-border);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.nv-chip:hover {
    color: var(--nv-text);
    border-color: var(--nv-border-strong);
}

.nv-chip--active {
    color: #04121c;
    background: var(--nv-accent);
    border-color: var(--nv-accent);
    font-weight: 600;
}

.nv-chip--active[data-direction="asc"]::after {
    content: " ↑";
}

.nv-chip--active[data-direction="desc"]::after {
    content: " ↓";
}

.nv-chip--action {
    color: var(--nv-gold);
    border-color: rgba(255, 196, 107, 0.32);
}

.nv-chip--action:hover {
    color: #12100a;
    background: var(--nv-gold);
}

/* --- the scrollable list ------------------------------------------------ */

.nv-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0 -4px;
    padding: 0 4px;
}

.nv-list::-webkit-scrollbar {
    width: 8px;
}

.nv-list::-webkit-scrollbar-track {
    background: transparent;
}

.nv-list::-webkit-scrollbar-thumb {
    background: rgba(120, 168, 255, 0.22);
    border-radius: 8px;
}

.nv-list::-webkit-scrollbar-thumb:hover {
    background: rgba(120, 168, 255, 0.40);
}

.nv-row {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto 24px;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 7px;
    padding: 4px 5px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.nv-row:hover {
    background: rgba(111, 211, 255, 0.09);
}

.nv-row--selected {
    background: var(--nv-accent-soft);
    border-color: var(--nv-border-strong);
}

.nv-row--followed {
    border-color: rgba(255, 196, 107, 0.55);
}

.nv-row--followed .nv-row__label {
    color: var(--nv-gold);
}

.nv-swatch {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #8899aa;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.28);
    align-self: center;
}

.nv-swatch--lg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.nv-row__label {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    color: var(--nv-text);
}

.nv-row__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--nv-dim);
    font-size: 11px;
}

.nv-row--selected .nv-row__name {
    color: var(--nv-text);
}

.nv-row__value {
    grid-column: 3;
    grid-row: 1;
    font-variant-numeric: tabular-nums;
    color: var(--nv-accent);
    font-size: 11px;
    white-space: nowrap;
}

.nv-row__numbers {
    grid-column: 2 / 4;
    grid-row: 2;
    font-size: 10px;
    color: var(--nv-faint);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nv-row__follow {
    grid-column: 4;
    grid-row: 1 / 3;
    width: 22px;
    height: 22px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1;
    color: var(--nv-faint);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
}

.nv-row:hover .nv-row__follow {
    color: var(--nv-dim);
    border-color: var(--nv-border);
}

.nv-row__follow:hover {
    color: var(--nv-gold);
    border-color: rgba(255, 196, 107, 0.55);
}

.nv-list__footer {
    flex: 0 0 auto;
    padding-top: 5px;
    border-top: 1px solid var(--nv-border);
    font-size: 10px;
    color: var(--nv-faint);
    text-align: right;
}

/* ==========================================================================
   inspector — bottom right
   ========================================================================== */

.nv-inspector {
    right: 14px;
    bottom: 72px;
    width: 346px;
}

.nv-inspector__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--nv-border);
}

.nv-inspector__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--nv-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nv-panel--empty .nv-inspector__name {
    color: var(--nv-faint);
    font-weight: 400;
}

.nv-actions {
    display: flex;
    gap: 6px;
    margin-top: 9px;
}

.nv-button {
    flex: 1 1 auto;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--nv-text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--nv-border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.nv-button:hover:not(:disabled) {
    background: rgba(111, 211, 255, 0.14);
    border-color: var(--nv-border-strong);
}

.nv-button:disabled {
    opacity: 0.35;
    cursor: default;
}

.nv-button--primary {
    color: var(--nv-accent);
    border-color: rgba(111, 211, 255, 0.40);
}

.nv-button--warn {
    color: var(--nv-gold);
    border-color: rgba(255, 196, 107, 0.50);
    background: rgba(255, 196, 107, 0.10);
}

/* ==========================================================================
   playback bar — bottom centre
   ========================================================================== */

.nv-playback {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 11px;
    background: var(--nv-panel-bg);
    border: 1px solid var(--nv-border);
    border-radius: 999px;
    box-shadow: var(--nv-shadow);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    max-width: calc(100vw - 28px);
    flex-wrap: wrap;
    justify-content: center;
}

.nv-playback__pause {
    flex: 0 0 auto;
    min-width: 84px;
    border-radius: 999px;
}

.nv-speeds,
.nv-modes {
    position: relative;
    padding-left: 10px;
}

.nv-speeds::before,
.nv-modes::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10%;
    height: 80%;
    border-left: 1px solid var(--nv-border);
}

/* ==========================================================================
   help overlay
   ========================================================================== */

.nv-help {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 4, 9, 0.62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.nv-help--on {
    display: flex;
}

.nv-help__dialog {
    width: min(760px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--nv-panel-bg-solid);
    border: 1px solid var(--nv-border-strong);
    border-radius: 12px;
    box-shadow: var(--nv-shadow);
    overflow: hidden;
}

.nv-help__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-bottom: 1px solid var(--nv-border);
    background: linear-gradient(180deg, rgba(111, 211, 255, 0.10), rgba(111, 211, 255, 0));
}

.nv-help__header h2 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--nv-accent);
}

.nv-help__content {
    padding: 14px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.nv-help__group h3 {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--nv-gold);
    margin-bottom: 6px;
}

.nv-help__group .nv-stats {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 10px;
}

.nv-help__group .nv-stats dd {
    text-align: left;
    color: var(--nv-dim);
    white-space: normal;
}

.nv-help kbd {
    display: inline-block;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 11px;
    color: var(--nv-text);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--nv-border);
    border-bottom-width: 2px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ==========================================================================
   crosshair (free-fly mode) + toasts
   ========================================================================== */

.nv-crosshair {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    display: none;
    pointer-events: none;
}

.nv-crosshair--on {
    display: block;
}

.nv-crosshair::before,
.nv-crosshair::after {
    content: "";
    position: absolute;
    background: rgba(111, 211, 255, 0.75);
}

.nv-crosshair::before {
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    margin-left: -0.5px;
}

.nv-crosshair::after {
    top: 50%;
    left: 0;
    height: 1px;
    width: 100%;
    margin-top: -0.5px;
}

.nv-toasts {
    position: absolute;
    left: 14px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 320px;
    pointer-events: none;
}

.nv-toast {
    padding: 7px 11px;
    font-size: 11px;
    color: var(--nv-text);
    background: var(--nv-panel-bg-solid);
    border: 1px solid var(--nv-border-strong);
    border-left: 3px solid var(--nv-gold);
    border-radius: 7px;
    box-shadow: var(--nv-shadow);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.nv-toast--out {
    opacity: 0;
    transform: translateY(8px);
}

/* ==========================================================================
   physical classes and composition
   --------------------------------------------------------------------------
   One colour per class of body (asteroid -> star) and one per material group
   (gas / ice / rock / metal). The material colours deliberately echo the four
   end members that composition.js blends for the 3D view, so a body reads the
   same in the panel as it does in the scene.
   ========================================================================== */

:root {
    --nv-class-asteroid: #9c9184;
    --nv-class-planet: #79cba8;
    --nv-class-gasGiant: #e3b07a;
    --nv-class-brownDwarf: #c8705a;
    --nv-class-star: #ffd166;
    /* An accretion disk's orange, since the hole itself has no colour to show. */
    --nv-class-blackHole: #ff9a4d;

    --nv-mat-gas: #d8c9a0;
    --nv-mat-ice: #cfe6f2;
    --nv-mat-rock: #8a7a68;
    --nv-mat-metal: #6d7076;
}

/* a row or field the physics layer did not publish */
.nv-hidden {
    display: none !important;
}

/* --- class badge -------------------------------------------------------- */

.nv-badge {
    flex: 0 0 auto;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: rgba(255, 255, 255, 0.05);
    white-space: nowrap;
    color: var(--nv-class-asteroid);
}

.nv-badge--sm {
    padding: 0 6px;
    font-size: 9px;
    letter-spacing: 0.02em;
}

.nv-badge[data-class="asteroid"] { color: var(--nv-class-asteroid); }
.nv-badge[data-class="planet"] { color: var(--nv-class-planet); }
.nv-badge[data-class="gasGiant"] { color: var(--nv-class-gasGiant); }
.nv-badge[data-class="brownDwarf"] { color: var(--nv-class-brownDwarf); }
.nv-badge[data-class="star"] { color: var(--nv-class-star); }
.nv-badge[data-class="blackHole"] { color: var(--nv-class-blackHole); }

/* --- HUD class tally ---------------------------------------------------- */

.nv-classes {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 8px 0;
    padding: 7px 0;
    border-top: 1px solid var(--nv-border);
    border-bottom: 1px solid var(--nv-border);
}

.nv-classchip {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: var(--nv-text);
}

.nv-classchip--zero {
    opacity: 0.38;
}

.nv-classchip__dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--nv-class-asteroid);
    box-shadow: 0 0 6px currentColor;
}

.nv-classchip[data-class="asteroid"] .nv-classchip__dot { background: var(--nv-class-asteroid); }
.nv-classchip[data-class="planet"] .nv-classchip__dot { background: var(--nv-class-planet); }
.nv-classchip[data-class="gasGiant"] .nv-classchip__dot { background: var(--nv-class-gasGiant); }
.nv-classchip[data-class="brownDwarf"] .nv-classchip__dot { background: var(--nv-class-brownDwarf); }
.nv-classchip[data-class="star"] .nv-classchip__dot { background: var(--nv-class-star); }

.nv-classchip__name {
    flex: 1 1 auto;
    color: var(--nv-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nv-classchip__count {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* --- inspector heading -------------------------------------------------- */

.nv-inspector__heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.nv-inspector__heading .nv-inspector__name {
    flex: 1 1 auto;
    min-width: 0;
}

/* --- composition breakdown ---------------------------------------------- */

.nv-composition {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid var(--nv-border);
}

.nv-composition__title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--nv-gold);
    margin-bottom: 6px;
}

/* the headline element: four material fractions as one stacked bar */
.nv-compbar {
    display: flex;
    width: 100%;
    height: 12px;
    margin-bottom: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--nv-border);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.45);
}

.nv-compbar__seg {
    display: block;
    height: 100%;
    min-width: 0;
    transition: width 0.25s ease;
    background: var(--nv-mat-rock);
}

.nv-compbar__seg[data-part="gas"] { background: var(--nv-mat-gas); }
.nv-compbar__seg[data-part="ice"] { background: var(--nv-mat-ice); }
.nv-compbar__seg[data-part="rock"] { background: var(--nv-mat-rock); }
.nv-compbar__seg[data-part="metal"] { background: var(--nv-mat-metal); }

.nv-compbar__legend {
    grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
    column-gap: 8px;
}

.nv-compbar__legend dt {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nv-compbar__dot {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--nv-mat-rock);
}

.nv-compbar__dot[data-part="gas"] { background: var(--nv-mat-gas); }
.nv-compbar__dot[data-part="ice"] { background: var(--nv-mat-ice); }
.nv-compbar__dot[data-part="rock"] { background: var(--nv-mat-rock); }
.nv-compbar__dot[data-part="metal"] { background: var(--nv-mat-metal); }

.nv-composition__summary {
    margin-top: 7px;
    font-size: 10px;
    line-height: 1.5;
    color: var(--nv-faint);
}

/* --- orbit controls (HUD panel) ------------------------------------------ */

.nv-orbits {
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid var(--nv-border);
}

.nv-orbits__title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--nv-gold);
    margin-bottom: 6px;
}

.nv-chiprow {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.nv-chip--mini {
    padding: 2px 7px;
    font-size: 10px;
    letter-spacing: 0.01em;
}

/* the scope row is meaningless while orbits are off */
.nv-orbits--off .nv-chiprow + .nv-chiprow {
    opacity: 0.4;
}

.nv-orbits__hint {
    margin-top: 4px;
    font-size: 10px;
    line-height: 1.45;
    color: var(--nv-faint);
}

/* --- playback extras ---------------------------------------------------- */

.nv-extras {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    position: relative;
    padding-left: 10px;
}

.nv-extras::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10%;
    height: 80%;
    border-left: 1px solid var(--nv-border);
}

/* --- the panels grew: let them scroll instead of running off screen ----- */

.nv-hud .nv-panel__body {
    /* the left column is shared with the "Adicionar corpo" panel below it */
    max-height: calc(100vh - 380px);
    overflow-y: auto;
}

.nv-inspector .nv-panel__body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* ==========================================================================
   compact viewports
   ========================================================================== */

@media (max-width: 900px), (max-height: 620px) {
    .nv-hud {
        width: 220px;
    }

    .nv-bodies {
        width: 300px;
        max-height: calc(100vh - 420px);
    }

    .nv-inspector {
        width: 300px;
        bottom: 64px;
    }
}

@media (max-width: 680px) {
    .nv-hud,
    .nv-bodies,
    .nv-inspector {
        width: calc(100vw - 28px);
    }

    .nv-bodies {
        top: auto;
        bottom: 64px;
        max-height: 46vh;
    }

    .nv-inspector {
        display: none;
    }
}

/* ==========================================================================
   launch screen — scenario picker, shown before the simulation starts
   --------------------------------------------------------------------------
   Same tokens as the overlay panels, but at dialog scale: this is the first
   thing the user sees, so it reads as a title screen rather than as a form.
   ========================================================================== */

.nv-launch {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: var(--nv-font);
    font-size: 12px;
    line-height: 1.5;
    color: var(--nv-text);
    background:
        radial-gradient(1200px 700px at 50% -10%, rgba(60, 110, 190, 0.22), transparent 70%),
        rgba(2, 4, 9, 0.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    -webkit-font-smoothing: antialiased;
}

.nv-launch--on {
    display: flex;
}

.nv-launch__dialog {
    display: flex;
    flex-direction: column;
    width: min(1040px, 100%);
    max-height: 100%;
    background: var(--nv-panel-bg-solid);
    border: 1px solid var(--nv-border-strong);
    border-radius: 14px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.nv-launch__header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--nv-border);
    background: linear-gradient(180deg, rgba(111, 211, 255, 0.10), rgba(111, 211, 255, 0));
}

.nv-launch__title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: var(--nv-accent);
}

.nv-launch__subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: var(--nv-dim);
}

.nv-launch__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
}

.nv-launch__left {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 0;
    padding: 14px 16px 16px;
    border-right: 1px solid var(--nv-border);
}

.nv-launch__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 0 0 auto;
}

.nv-launch__cards {
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 52vh;
    overflow-y: auto;
    margin: 0 -4px;
    padding: 2px 4px;
}

.nv-launch__cards::-webkit-scrollbar,
.nv-launch__right::-webkit-scrollbar {
    width: 8px;
}

.nv-launch__cards::-webkit-scrollbar-thumb,
.nv-launch__right::-webkit-scrollbar-thumb {
    background: rgba(120, 168, 255, 0.22);
    border-radius: 8px;
}

/* --- one card per scenario ---------------------------------------------- */

.nv-scenario {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    padding: 9px 11px;
    text-align: left;
    font-family: inherit;
    font-size: 12px;
    color: var(--nv-text);
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--nv-border);
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s, transform 0.14s;
}

.nv-scenario:hover {
    background: rgba(111, 211, 255, 0.09);
    border-color: var(--nv-border-strong);
}

.nv-scenario:focus-visible,
.nv-launch__dialog button:focus-visible,
.nv-launch__dialog select:focus-visible,
.nv-launch__dialog input:focus-visible {
    outline: 2px solid var(--nv-accent);
    outline-offset: 2px;
}

.nv-scenario--active {
    background: var(--nv-accent-soft);
    border-color: var(--nv-accent);
}

.nv-scenario__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.nv-scenario__name {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.nv-scenario__description {
    color: var(--nv-dim);
    font-size: 11px;
}

.nv-scenario__category,
.nv-launch__category {
    flex: 0 0 auto;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--nv-gold);
    background: rgba(255, 196, 107, 0.12);
    border: 1px solid rgba(255, 196, 107, 0.30);
    border-radius: 999px;
    white-space: nowrap;
}

.nv-scenario__category[data-category="colisao"],
.nv-launch__category[data-category="colisao"] {
    color: var(--nv-warn);
    background: rgba(255, 143, 122, 0.12);
    border-color: rgba(255, 143, 122, 0.32);
}

.nv-scenario__category[data-category="multiplo"],
.nv-launch__category[data-category="multiplo"],
.nv-scenario__category[data-category="aglomerado"],
.nv-launch__category[data-category="aglomerado"] {
    color: var(--nv-accent);
    background: rgba(111, 211, 255, 0.12);
    border-color: rgba(111, 211, 255, 0.32);
}

.nv-launch__empty {
    padding: 10px 2px;
    color: var(--nv-faint);
}

/* --- the parameter column ----------------------------------------------- */

.nv-launch__right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding: 14px 16px 16px;
    overflow-y: auto;
    max-height: 60vh;
}

.nv-launch__detailhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.nv-launch__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--nv-text);
}

.nv-launch__description {
    color: var(--nv-dim);
    font-size: 11px;
}

.nv-launch__kept {
    padding: 6px 9px;
    font-size: 11px;
    color: var(--nv-gold);
    background: rgba(255, 196, 107, 0.08);
    border: 1px solid rgba(255, 196, 107, 0.28);
    border-radius: 7px;
}

.nv-params {
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding-top: 3px;
}

.nv-params__empty {
    color: var(--nv-faint);
    font-size: 11px;
}

.nv-param {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 9px 11px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--nv-border);
    border-radius: 9px;
}

.nv-param__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.nv-param__label {
    color: var(--nv-text);
    font-size: 11px;
}

.nv-param__value {
    color: var(--nv-accent);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.nv-param__inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nv-param__range {
    flex: 1 1 auto;
    min-width: 0;
    height: 18px;
    accent-color: var(--nv-accent);
    background: transparent;
    cursor: pointer;
}

.nv-param__number {
    flex: 0 0 auto;
    width: 84px;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 11px;
    color: var(--nv-text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--nv-border);
    border-radius: 6px;
    outline: none;
    font-variant-numeric: tabular-nums;
}

.nv-param__select {
    flex: 1 1 auto;
    min-width: 0;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 11px;
    color: var(--nv-text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--nv-border);
    border-radius: 6px;
    outline: none;
}

.nv-param__select option {
    background: #0b111c;
    color: var(--nv-text);
}

.nv-param__check {
    width: 16px;
    height: 16px;
    accent-color: var(--nv-accent);
    cursor: pointer;
}

.nv-param__unit {
    flex: 0 0 auto;
    color: var(--nv-faint);
    font-size: 11px;
}

.nv-param__help {
    color: var(--nv-faint);
    font-size: 10px;
}

/* --- error banner and footer -------------------------------------------- */

.nv-launch__error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 16px;
    padding: 9px 12px;
    color: var(--nv-warn);
    background: rgba(255, 143, 122, 0.10);
    border: 1px solid rgba(255, 143, 122, 0.36);
    border-radius: 8px;
}

.nv-launch__error p {
    min-width: 0;
}

.nv-launch__error .nv-button {
    flex: 0 0 auto;
}

.nv-launch__footer {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--nv-border);
}

.nv-launch__spacer {
    flex: 1 1 auto;
}

.nv-launch__start {
    min-width: 172px;
    padding: 8px 18px;
    font-size: 12px;
}

/* the stage itself could not be built */
.nv-fatal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    font-family: var(--nv-font);
    color: var(--nv-text);
    background: #05070d;
}

.nv-fatal h1 {
    font-size: 14px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--nv-warn);
}

.nv-fatal p {
    max-width: 520px;
    font-size: 12px;
    color: var(--nv-dim);
}

.nv-fatal__detail {
    color: var(--nv-faint);
    font-size: 11px;
}

@media (max-width: 820px), (max-height: 620px) {
    .nv-launch {
        padding: 10px;
    }

    .nv-launch__body {
        grid-template-columns: minmax(0, 1fr);
    }

    .nv-launch__left {
        border-right: none;
        border-bottom: 1px solid var(--nv-border);
    }

    .nv-launch__cards {
        max-height: 28vh;
    }

    .nv-launch__right {
        max-height: 38vh;
    }

    .nv-launch__footer {
        flex-wrap: wrap;
    }

    .nv-launch__start {
        min-width: 120px;
        flex: 1 1 auto;
    }
}


/* ==========================================================================
   "Adicionar corpo" — click-to-place tool, bottom left
   --------------------------------------------------------------------------
   Shares the left column with the HUD, which is why .nv-hud's body is capped
   above. Starts collapsed: it is a tool, not a readout, and the header alone
   is 30px tall.
   ========================================================================== */

.nv-spawn {
    left: 14px;
    bottom: 72px;
    width: 268px;
    max-height: calc(100vh - 340px);
}

.nv-spawn .nv-panel__body {
    max-height: calc(100vh - 384px);
    overflow-y: auto;
}

/* an armed tool has to be unmistakable, in the panel and over the canvas */
.nv-spawn--armed {
    border-color: var(--nv-border-strong);
    box-shadow: var(--nv-shadow), 0 0 0 1px rgba(111, 211, 255, 0.35);
}

.nv-spawn__arm {
    width: 100%;
    margin-bottom: 4px;
}

.nv-spawn__heading {
    margin-top: 9px;
    margin-bottom: 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--nv-gold);
}

.nv-spawn__massrow {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nv-spawn__number {
    flex: 1 1 auto;
    min-width: 0;
    padding: 5px 7px;
    font-family: inherit;
    font-size: 12px;
    color: var(--nv-text);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--nv-border);
    border-radius: 6px;
    outline: none;
}

.nv-spawn__number:focus {
    border-color: var(--nv-border-strong);
    background: rgba(111, 211, 255, 0.07);
}

.nv-spawn__unit {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--nv-dim);
}

.nv-spawn__slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 18px;
    margin-top: 5px;
    background: transparent;
    cursor: pointer;
    outline: none;
}

.nv-spawn__slider::-webkit-slider-runnable-track {
    height: 3px;
    border-radius: 999px;
    background: rgba(120, 168, 255, 0.28);
}

.nv-spawn__slider::-moz-range-track {
    height: 3px;
    border-radius: 999px;
    background: rgba(120, 168, 255, 0.28);
}

.nv-spawn__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    margin-top: -5px;
    border: none;
    border-radius: 50%;
    background: var(--nv-accent);
}

.nv-spawn__slider::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border: none;
    border-radius: 50%;
    background: var(--nv-accent);
}

.nv-spawn__range {
    margin-top: 3px;
    font-size: 10px;
    color: var(--nv-faint);
}

.nv-spawn__preview {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--nv-border);
}

.nv-spawn__hint {
    margin-top: 6px;
    font-size: 10px;
    line-height: 1.5;
    color: var(--nv-faint);
}

/* --- while the tool is armed -------------------------------------------- */

/* the cursor is the only feedback that reaches the user mid-gesture */
body.nv-armed canvas {
    cursor: crosshair;
}

.nv-root--spawning::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 2px rgba(111, 211, 255, 0.28);
}

@media (max-width: 900px), (max-height: 620px) {
    .nv-spawn {
        width: 220px;
        bottom: 64px;
        max-height: calc(100vh - 300px);
    }

    .nv-spawn .nv-panel__body {
        max-height: calc(100vh - 344px);
    }
}

/* Below this the left column has no room left at all, and placing a body by
   touch on a 300px-wide viewport is not a thing anyone can aim. */
@media (max-width: 680px) {
    .nv-spawn {
        display: none;
    }

    /* the tool is gone, so the HUD gets the whole left column back */
    .nv-hud .nv-panel__body {
        max-height: calc(100vh - 140px);
    }
}

/* ==========================================================================
   mobile — semi-fixed view
   --------------------------------------------------------------------------
   `body.nv-mobile` is set by main.js from a coarse pointer plus a small
   viewport, or forced with ?mobile=1 / ?mobile=0. It is deliberately keyed off
   the CLASS and not off a media query, so the mode can be inspected at any
   window size on a desktop browser and so the two never disagree with the
   JavaScript about which build is running.

   There are no camera controls on a phone: each scenario is shown from a fixed
   viewpoint of its own. So everything that exists to act on the camera or on a
   body - the body list, the inspector, the orbit controls, the "Adicionar
   corpo" tool, the playback bar and the keyboard help - is hidden outright
   rather than shrunk, and what is left is a read-only strip plus two buttons.
   ========================================================================== */

body.nv-mobile .nv-hud,
body.nv-mobile .nv-bodies,
body.nv-mobile .nv-inspector,
body.nv-mobile .nv-spawn,
body.nv-mobile .nv-playback,
body.nv-mobile .nv-help,
body.nv-mobile .nv-crosshair {
    display: none;
}

/* nothing on a touch screen has a hover state to lose, and the grey flash on
   every tap makes the buttons feel broken */
body.nv-mobile {
    -webkit-tap-highlight-color: transparent;
}

.nv-root--mobile {
    font-size: 13px;
}

/* the overlay root is pointer-events: none; these two are real widgets */
.nv-root--mobile .nv-mobile-top,
.nv-root--mobile .nv-mobile-bar {
    pointer-events: auto;
}

/* --- the read-only strip, top of the screen ----------------------------- */

.nv-mobile-top,
.nv-mobile-bar {
    display: none;
}

.nv-root--mobile .nv-mobile-top {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: var(--nv-panel-bg);
    border: 1px solid var(--nv-border);
    border-radius: var(--nv-radius);
    box-shadow: var(--nv-shadow);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.nv-mobile-top__name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--nv-accent);
}

/* meta.mobileNotes: one sentence explaining what this fixed view is showing */
.nv-mobile-top__note {
    font-size: 11px;
    line-height: 1.4;
    color: var(--nv-dim);
}

.nv-mobile-top__stats {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.nv-mobile-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nv-mobile-stat__label {
    font-size: 10px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--nv-faint);
}

.nv-mobile-stat__value {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--nv-text);
}

/* --- the two buttons, bottom of the screen ------------------------------ */

.nv-root--mobile .nv-mobile-bar {
    position: absolute;
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 10px;
}

.nv-mobile-bar__button {
    flex: 1 1 0;
    min-height: 48px;          /* a thumb, not a mouse pointer */
    font-size: 14px;
    border-radius: var(--nv-radius);
    box-shadow: var(--nv-shadow);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* toasts sit above the button bar instead of underneath it */
.nv-root--mobile .nv-toasts {
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    max-width: none;
}

.nv-root--mobile .nv-toast {
    font-size: 12px;
}

/* ==========================================================================
   mobile — the scenario picker
   --------------------------------------------------------------------------
   The picker is the ONLY real interaction on a phone, so it gets the whole
   screen: one scrolling column, full-width cards, a footer pinned to the
   bottom, and tap targets sized for a thumb. Text inputs go to 16px because
   anything smaller makes iOS Safari zoom the page when they take focus.
   ========================================================================== */

body.nv-mobile .nv-launch {
    padding: 0;
    font-size: 13px;
}

body.nv-mobile .nv-launch__dialog {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border: none;
    border-radius: 0;
}

body.nv-mobile .nv-launch__header {
    padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px;
}

body.nv-mobile .nv-launch__subtitle {
    font-size: 12px;
}

/* one column, and ONE scroll region: two nested scrollers on a touch screen
   means the wrong one moves half the time */
body.nv-mobile .nv-launch__body {
    display: block;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.nv-mobile .nv-launch__left {
    border-right: none;
    border-bottom: 1px solid var(--nv-border);
}

body.nv-mobile .nv-launch__cards,
body.nv-mobile .nv-launch__right {
    max-height: none;
    overflow: visible;
}

body.nv-mobile .nv-launch__filters {
    gap: 7px;
}

body.nv-mobile .nv-launch__filters .nv-chip {
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
}

body.nv-mobile .nv-scenario {
    padding: 12px 13px;
    font-size: 13px;
    border-radius: 10px;
}

body.nv-mobile .nv-scenario__description {
    font-size: 12px;
}

body.nv-mobile .nv-launch__name {
    font-size: 14px;
}

body.nv-mobile .nv-launch__description,
body.nv-mobile .nv-launch__kept,
body.nv-mobile .nv-param__help {
    font-size: 12px;
}

body.nv-mobile .nv-param__label,
body.nv-mobile .nv-param__value {
    font-size: 12px;
}

/* a 4px range track cannot be grabbed with a fingertip */
body.nv-mobile .nv-param__range {
    height: 34px;
}

body.nv-mobile .nv-param__number,
body.nv-mobile .nv-param__select {
    min-height: 40px;
    font-size: 16px;
}

body.nv-mobile .nv-param__check {
    width: 22px;
    height: 22px;
}

body.nv-mobile .nv-launch__footer {
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--nv-panel-bg-solid);
}

/* the spacer would push the buttons off a narrow screen */
body.nv-mobile .nv-launch__spacer {
    display: none;
}

body.nv-mobile .nv-launch__footer .nv-button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 46px;
    padding: 8px 10px;
    font-size: 13px;
}

body.nv-mobile .nv-launch__error .nv-button {
    min-height: 44px;
}

body.nv-mobile .nv-param__number {
    width: 96px;
}
