/* ==========================================================================
   EVE Universe Explorer — workspace layout (assets: universe-map.js)
   --------------------------------------------------------------------------
   A full-bleed, viewport-height map workspace at /explorer: a slim toolbar
   (breadcrumb · search · view + panel buttons) above a three-column grid
   (layers panel · canvas · details panel).

   Mobile-first: below 768px the grid is a single column and the two panels
   are fixed slide-in drawers (is-layers-open / is-info-open). From 768px up
   they are static grid columns collapsed via is-layers-collapsed /
   is-info-collapsed (column width → 0). universe-map.js always sets both the
   *-collapsed and *-open classes for the current state; the media queries
   decide which pair applies.

   Design tokens come from assets/styles/app.css (@theme), emitted by Tailwind
   v4 as :root custom properties. Every var() carries the token value as a
   fallback so there is no unstyled flash if the main bundle loads late.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Workspace frame — a card that fills the viewport under the nav.
   Height budget (verified against base.html.twig): nav ≈66px (1px accent +
   64px h-16 + 1px border-b) + main py + the (empty) breadcrumb row margin
   above the workspace. Mobile: 66+24+16+24 = 130. Desktop: 66+32+24+32 = 154.
   --------------------------------------------------------------------------- */
.universe-workspace {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 130px);
    min-height: 520px;
    overflow: hidden;
    border: 1px solid var(--color-eve-700, #333);
    border-radius: 0.75rem;
    background: #05060a;
}

@media (min-width: 768px) {
    .universe-workspace {
        height: calc(100vh - 154px);
    }
}

/* Mobile browsers shrink 100vh when the URL bar hides — track the dynamic
   viewport instead where it is supported. */
@supports (height: 100dvh) {
    .universe-workspace {
        height: calc(100dvh - 130px);
    }
    @media (min-width: 768px) {
        .universe-workspace {
            height: calc(100dvh - 154px);
        }
    }
}

/* ---------------------------------------------------------------------------
   Toolbar — breadcrumb (left, grows) · search · view/panel buttons (right).
   --------------------------------------------------------------------------- */
.universe-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.6rem 0.9rem;
    flex: 0 0 auto;
    background: var(--color-eve-900, #1a1a1a);
    border-bottom: 1px solid var(--color-eve-700, #333);
}

/* Live breadcrumb (filled by JS). */
.universe-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.85rem;
}

.universe-breadcrumb li {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    min-width: 0;
}

.universe-breadcrumb a {
    display: inline-block;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.15rem 0.45rem;
    border-radius: 0.375rem;
    color: #c9cdd3;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.universe-breadcrumb a:hover,
.universe-breadcrumb a:focus-visible {
    color: var(--color-eve-primary, #00ceef);
    background: rgba(0, 206, 239, 0.1);
}

.universe-breadcrumb a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 206, 239, 0.35);
}

.universe-breadcrumb [aria-current="page"] {
    display: inline-block;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.15rem 0.45rem;
    color: #fff;
    font-weight: 600;
}

.universe-breadcrumb-sep {
    color: #555;
    flex-shrink: 0;
}

/* Search — icon + input; the results dropdown is positioned under it. */
.universe-search {
    position: relative;
    display: flex;
    align-items: center;
    order: 3;
    flex: 1 1 100%;
}

.universe-search-icon {
    position: absolute;
    left: 0.6rem;
    width: 1rem;
    height: 1rem;
    color: #666;
    pointer-events: none;
}

.universe-search-input {
    width: 100%;
    height: 2.25rem;
    padding: 0 0.75rem 0 2.15rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-eve-700, #333);
    background: #05060a;
    color: #e5e7eb;
    font-size: 0.85rem;
}

.universe-search-input::placeholder {
    color: #666;
}

.universe-search-input:focus {
    outline: none;
    border-color: rgba(0, 206, 239, 0.5);
    box-shadow: 0 0 0 2px rgba(0, 206, 239, 0.2);
}

.universe-search-results {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 30;
    list-style: none;
    margin: 0;
    padding: 0.25rem;
    max-height: 16rem;
    overflow-y: auto;
    border-radius: 0.5rem;
    border: 1px solid var(--color-eve-700, #333);
    background: rgba(10, 12, 18, 0.98);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* One result row: type badge + name, with a hover/keyboard-active state. */
.universe-search-result {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.375rem;
    cursor: pointer;
}

.universe-search-result:hover,
.universe-search-result.is-active {
    background: rgba(0, 206, 239, 0.12);
}

.universe-search-type {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8b93a1;
    border: 1px solid var(--color-eve-700, #333);
    border-radius: 0.25rem;
    padding: 0.08rem 0.35rem;
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.universe-search-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e5e7eb;
    font-size: 0.85rem;
}

.universe-search-empty {
    padding: 0.5rem;
    color: #8b93a1;
    font-size: 0.8rem;
}

/* View + panel toggle buttons. */
.universe-toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    order: 2;
    flex: 0 0 auto;
}

.universe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-eve-700, #333);
    background: var(--color-eve-800, #262626);
    color: #c9cdd3;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.universe-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}

.universe-btn:hover,
.universe-btn:focus-visible {
    color: var(--color-eve-primary, #00ceef);
    border-color: rgba(0, 206, 239, 0.5);
    background: rgba(0, 206, 239, 0.1);
}

.universe-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 206, 239, 0.35);
}

/* A panel toggle reflects its state (panel open = pressed = lit). */
.universe-btn[aria-pressed="true"] {
    color: var(--color-eve-primary, #00ceef);
    border-color: rgba(0, 206, 239, 0.5);
    background: rgba(0, 206, 239, 0.12);
}

.universe-btn-sep {
    width: 1px;
    height: 1.5rem;
    margin: 0 0.2rem;
    background: var(--color-eve-700, #333);
}

/* ---------------------------------------------------------------------------
   Grid — single column on mobile (panels become drawers).
   --------------------------------------------------------------------------- */
.universe-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    flex: 1 1 auto;
    min-height: 0;
}

/* ---------------------------------------------------------------------------
   Panels — fixed slide-in drawers on mobile.
   --------------------------------------------------------------------------- */
.universe-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 40;
    width: min(85vw, 320px);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--color-eve-800, #262626);
    transition: transform 0.25s ease;
}

.universe-panel--layers {
    left: 0;
    transform: translateX(-100%);
    border-right: 1px solid var(--color-eve-700, #333);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
}

.universe-panel--info {
    right: 0;
    transform: translateX(100%);
    border-left: 1px solid var(--color-eve-700, #333);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
}

.universe-grid.is-layers-open .universe-panel--layers {
    transform: translateX(0);
}

.universe-grid.is-info-open .universe-panel--info {
    transform: translateX(0);
}

.universe-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    flex: 0 0 auto;
    border-bottom: 1px solid var(--color-eve-700, #333);
}

.universe-panel-title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--color-eve-primary, #00ceef);
}

.universe-panel-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.universe-panel-close svg {
    width: 1rem;
    height: 1rem;
}

.universe-panel-close:hover,
.universe-panel-close:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.universe-panel-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 206, 239, 0.35);
}

.universe-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.85rem;
}

/* ---------------------------------------------------------------------------
   Layers panel content — display toggles + security legend.
   --------------------------------------------------------------------------- */
.universe-layers-fieldset {
    border: none;
    margin: 0 0 1.1rem;
    padding: 0;
}

.universe-layers-legend-title {
    padding: 0;
    margin: 0 0 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #777;
}

.universe-layer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.universe-layer {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #c9cdd3;
    transition: background-color 0.15s ease;
}

.universe-layer:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Custom checkbox — a small square that fills cyan with a check when on. */
.universe-layer input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
    border-radius: 0.3rem;
    border: 1.5px solid #555;
    background: var(--color-eve-900, #1a1a1a);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.universe-layer input[type="checkbox"]:checked {
    background: var(--color-eve-primary, #00ceef);
    border-color: var(--color-eve-primary, #00ceef);
}

.universe-layer input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 0.32rem;
    top: 0.1rem;
    width: 0.28rem;
    height: 0.55rem;
    border: solid #05060a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.universe-layer input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 206, 239, 0.35);
}

.universe-security-legend {
    border-top: 1px solid var(--color-eve-700, #333);
    padding-top: 0.85rem;
}

.universe-faction-legend {
    border-top: 1px solid var(--color-eve-700, #333);
    padding-top: 0.85rem;
    margin-top: 0.85rem;
}

.universe-legend-hint {
    margin: 0.1rem 0 0.45rem;
    font-size: 0.7rem;
    color: #8a93a6;
}

.universe-faction-legend li {
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    margin: -0.15rem -0.4rem;
    border-radius: 0.25rem;
    transition: background-color 0.15s ease;
}

.universe-faction-legend li:hover {
    background: rgba(255, 255, 255, 0.06);
}

.universe-faction-legend li.is-active {
    background: rgba(0, 206, 239, 0.1);
    color: #eef2f7;
}

.universe-faction-legend li.is-active .universe-swatch {
    box-shadow: 0 0 10px 0 var(--sw);
}

.universe-faction-legend li:focus-visible {
    outline: 2px solid rgba(0, 206, 239, 0.7);
    outline-offset: 1px;
}

.universe-legend-title {
    margin: 0 0 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #777;
}

.universe-legend-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.universe-legend-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #c9cdd3;
}

.universe-swatch {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 0.25rem;
    background: var(--sw);
    flex-shrink: 0;
    box-shadow: 0 0 8px -1px var(--sw);
}

.universe-legend-range {
    margin-left: auto;
    font-size: 0.7rem;
    color: #777;
    font-variant-numeric: tabular-nums;
}

/* Feature #10 activity legend — a compact overlay pinned to the top-left of
   the map canvas (renderActivityLegend() shows it only while the layer is
   on). Sits above the vignette (z 2) and below the tooltip (z 5);
   pointer-events: none so it never blocks pan or zoom. Ring swatches are
   sized + alphaed to match the canvas buckets (ACTIVITY_BUCKETS in
   universe-map.js) — a hollow ring, not a filled swatch, because the layer
   draws rings around the active nodes. */
.universe-activity-legend {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 4;
    max-width: 15rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    background: rgba(4, 6, 12, 0.78);
    border: 1px solid var(--color-eve-700, #333);
    pointer-events: none;
}

.universe-activity-legend .universe-legend-title {
    margin-bottom: 0.3rem;
}

.universe-activity-legend .universe-legend-hint {
    margin: 0 0 0.45rem;
    font-size: 0.68rem;
    line-height: 1.35;
    color: #8a93a6;
}

.universe-activity-legend .universe-legend-list {
    gap: 0.25rem;
}

.universe-activity-legend .universe-legend-list li {
    font-size: 0.72rem;
}

/* Feature #9 system activity overlay — the shared "recent activity" card
   (partial/system-activity.html.twig), top-right of the canvas in the
   system view. Shown only while the activity layer is on and the system
   has kills (loadSystemActivity() hides it otherwise — no "no activity"
   state on the map). The inner <section> carries its own Tailwind card
   styling — this wrapper only positions and bounds it. Links inside stay
   clickable, so pointer-events remain on (unlike the legend). */
.universe-system-activity {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 4;
    width: min(22rem, calc(100% - 1.5rem));
    max-height: calc(100% - 1.5rem);
    overflow-y: auto;
}

.universe-activity-asof {
    margin-left: 0.4rem;
    font-size: 0.62rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #8a93a6;
    font-variant-numeric: tabular-nums;
}

.universe-activity-swatch {
    border-radius: 50%;
    background: transparent;
    border: 2px solid #ff8c42;
    flex-shrink: 0;
    box-shadow: 0 0 8px -1px rgba(255, 140, 66, 0.5);
}

.universe-activity-swatch[data-bucket="0"] {
    width: 0.6rem;
    height: 0.6rem;
    border-color: rgba(255, 140, 66, 0.65);
}

.universe-activity-swatch[data-bucket="1"] {
    width: 0.8rem;
    height: 0.8rem;
    border-color: rgba(255, 140, 66, 0.8);
}

.universe-activity-swatch[data-bucket="2"] {
    width: 1rem;
    height: 1rem;
    border-color: rgba(255, 140, 66, 0.95);
}

/* ---------------------------------------------------------------------------
   Canvas area — the "space" the graph is drawn on.
   --------------------------------------------------------------------------- */
/* Layered nebulae — the canvas stays transparent (cleared each frame) so the
   DOM starfield shows through behind the graph; the nebulae live here. */
.universe-canvas-wrap {
    position: relative;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse 60% 50% at 18% 22%, rgba(0, 206, 239, 0.07), transparent 70%),
        radial-gradient(ellipse 55% 45% at 82% 78%, rgba(94, 74, 226, 0.08), transparent 70%),
        radial-gradient(ellipse 70% 60% at 50% 45%, rgba(0, 206, 239, 0.05), transparent 75%),
        radial-gradient(ellipse 40% 35% at 70% 15%, rgba(46, 204, 113, 0.04), transparent 70%),
        #04050a;
}

/* Vignette above the canvas (z 2, pointer-events: none) — darkens the edges
   so the graph reads as a lit stage in the middle. */
.universe-canvas-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 60%, rgba(2, 3, 6, 0.55) 100%);
}

/* z-index stack inside the canvas wrap (low → high): the JS-appended
   .map-stars layer (0, from map-stars.css) → canvas (1) → vignette ::after
   (2) → hint (3) → activity legend (4) / system activity (4) / noscript
   (4) → data error (5) / .map-tooltip (5, from map-tooltip.css — never
   shown together with the error) → help (6) → context menu (7). */
.universe-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
}

.universe-canvas:active {
    cursor: grabbing;
}

.universe-hint {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    margin: 0;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: rgba(5, 6, 10, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.7rem;
    color: #7a828e;
    white-space: nowrap;
    pointer-events: none;
}

.universe-noscript {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: #999;
}

/* ---------------------------------------------------------------------------
   Data error overlay — shown (by JS) when a level's graph request fails.
   --------------------------------------------------------------------------- */
.universe-data-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    max-width: min(20rem, calc(100% - 2rem));
    padding: 0.6rem 1rem;
    border-radius: 8px;
    background: rgba(10, 12, 18, 0.9);
    border: 1px solid rgba(255, 107, 91, 0.4);
    color: #c9cdd3;
    font-size: 0.8rem;
    text-align: center;
    pointer-events: none;
}

/* ---------------------------------------------------------------------------
   Details panel — empty state (content is injected by JS per selection).
   --------------------------------------------------------------------------- */
.universe-info-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 10rem;
    padding: 2rem 1rem;
    text-align: center;
}

/* The author's display:flex above overrides the UA [hidden] rule. */
.universe-info-empty[hidden] {
    display: none;
}

.universe-info-empty svg {
    width: 2.5rem;
    height: 2.5rem;
    color: #444;
}

.universe-info-empty p {
    margin: 0;
    font-size: 0.9rem;
    color: #999;
}

.universe-info-empty-sub {
    font-size: 0.78rem !important;
    color: #666 !important;
    line-height: 1.5;
}

/* ---------------------------------------------------------------------------
   Details panel — info card (injected by JS on selection).
   --------------------------------------------------------------------------- */
.universe-info-card {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.25rem 0.25rem 0.5rem;
    border-top: 2px solid rgba(255, 255, 255, 0.15);
}

/* Security-tier accent (set by JS): high → green, mid → gold, low → red. */
.universe-info-card--high {
    border-top-color: #2ecc71;
}

.universe-info-card--mid {
    border-top-color: #f5a623;
}

.universe-info-card--low {
    border-top-color: #ff6b5b;
}

.universe-info-type {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #00ceef;
}

.universe-info-name {
    margin-top: -0.45rem;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.25;
    color: #fff;
    overflow-wrap: anywhere;
}

.universe-info-stats {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
}

.universe-info-stats dt {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #888;
}

.universe-info-stats dd {
    margin: 0;
    text-align: right;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: #ddd;
    overflow-wrap: anywhere;
}

.universe-info-stats dd.universe-info-stat--accent {
    font-weight: 600;
    color: #f0a84e;
}

.universe-info-secbar {
    position: relative;
    display: inline-block;
    width: 3.5rem;
    height: 0.25rem;
    margin-left: 0.5rem;
    vertical-align: middle;
    border-radius: 9999px;
    background: linear-gradient(to right, #ff6b5b, #f5a623, #2ecc71);
}

.universe-info-secbar-marker {
    position: absolute;
    top: -0.1875rem;
    width: 0.125rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: #fff;
}

.universe-info-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.universe-info-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #888;
}

.universe-info-section-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 11rem;
    overflow-y: auto;
}

.universe-info-section-list li {
    font-size: 0.8rem;
    color: #ddd;
    overflow-wrap: anywhere;
}

.universe-info-note {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #999;
    font-style: italic;
}

.universe-info-hierarchy {
    font-size: 0.75rem;
    line-height: 1.5;
    color: #777;
}

.universe-info-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.universe-info-link {
    font-size: 0.8rem;
    color: #00ceef;
    text-decoration: none;
}

.universe-info-link:hover,
.universe-info-link:focus-visible {
    text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Backdrop behind an open mobile drawer.
   --------------------------------------------------------------------------- */
.universe-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

/* ==========================================================================
   Desktop (≥768px) — three static columns, collapse via column width → 0.
   ========================================================================== */
@media (min-width: 768px) {
    .universe-toolbar {
        flex-wrap: nowrap;
    }

    .universe-search {
        order: 0;
        flex: 0 1 240px;
        min-width: 150px;
    }

    .universe-toolbar-buttons {
        order: 0;
        margin-left: auto;
    }

    .universe-grid {
        grid-template-columns: 224px minmax(0, 1fr) 304px;
        transition: grid-template-columns 0.25s ease;
    }

    .universe-grid.is-layers-collapsed {
        grid-template-columns: 0 minmax(0, 1fr) 304px;
    }

    .universe-grid.is-info-collapsed {
        grid-template-columns: 224px minmax(0, 1fr) 0;
    }

    .universe-grid.is-layers-collapsed.is-info-collapsed {
        grid-template-columns: 0 minmax(0, 1fr) 0;
    }

    .universe-panel {
        position: static;
        width: auto;
        transform: none;
        box-shadow: none;
        transition: opacity 0.2s ease;
    }

    .universe-grid.is-layers-collapsed .universe-panel--layers,
    .universe-grid.is-info-collapsed .universe-panel--info {
        opacity: 0;
        pointer-events: none;
    }
}

/* ---------------------------------------------------------------------------
   Fullscreen — the workspace takes over the whole screen.
   --------------------------------------------------------------------------- */
.universe-workspace:fullscreen {
    height: 100vh;
    border: none;
    border-radius: 0;
}

@supports (height: 100dvh) {
    .universe-workspace:fullscreen {
        height: 100dvh;
    }
}

/* ---------------------------------------------------------------------------
   Reduced motion — no panel/grid transitions.
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .universe-panel,
    .universe-grid {
        transition: none;
    }
}

/* ---------------------------------------------------------------------------
   Context menu — right-click actions on the canvas (injected by JS).
   --------------------------------------------------------------------------- */
.universe-context-menu {
    position: absolute;
    z-index: 7;
    min-width: 11rem;
    padding: 0.25rem 0;
    background: #1a2938;
    border: 1px solid #29394a;
    border-radius: 8px;
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.55),
        0 2px 8px rgba(0, 0, 0, 0.4);
}

.universe-context-item {
    display: block;
    width: 100%;
    padding: 0.375rem 0.875rem;
    border: none;
    background: transparent;
    color: #e5edf5;
    font: 400 0.8rem/1.2 "Roboto Condensed", Helvetica, Arial, sans-serif;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.universe-context-item:hover,
.universe-context-item:focus-visible {
    background: #29394a;
    color: #fff;
    outline: none;
}

.universe-context-sep {
    height: 1px;
    margin: 0.25rem 0;
    background: #29394a;
}

/* Stargate destination picker (click a gate): each item stacks the
   destination name over a "Region · Constellation" subline. */
.universe-context-item.gate-dest {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    white-space: normal;
}

.gate-dest-name {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gate-dest-sub {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.68rem;
    color: #8a93a6;
}

.universe-context-item.gate-dest:hover .gate-dest-sub,
.universe-context-item.gate-dest:focus-visible .gate-dest-sub {
    color: #aab4c4;
}

/* Note-only picker row (wormhole / Pochven — no static connections):
   informational, not actionable. */
.universe-context-item.is-note {
    color: #8a93a6;
    cursor: default;
}

.universe-context-item.is-note:hover,
.universe-context-item.is-note:focus-visible {
    background: transparent;
    color: #8a93a6;
}

/* Geographic mode — the faction legend is schematic-only. */
.universe-workspace.is-geo .universe-faction-legend {
    display: none;
}

/* ---------------------------------------------------------------------------
   Map help — a transient overlay on the canvas, above the tooltip (z 5).
   --------------------------------------------------------------------------- */
.universe-help {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 6;
    width: min(21rem, calc(100% - 1.5rem));
    max-height: calc(100% - 1.5rem);
    overflow-y: auto;
    background: rgba(17, 27, 39, 0.97);
    border: 1px solid var(--color-eve-700, #333);
    border-radius: 0.75rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    color: #91a4b8;
}

.universe-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(51, 51, 51, 0.6);
}

.universe-help-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #e5edf5;
}

.universe-help-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    color: #91a4b8;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.universe-help-close svg {
    width: 1rem;
    height: 1rem;
}

.universe-help-close:hover,
.universe-help-close:focus-visible {
    color: var(--color-eve-primary, #00ceef);
    background: rgba(0, 206, 239, 0.1);
}

.universe-help-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 206, 239, 0.35);
}

.universe-help-body {
    padding: 0.5rem 1rem 0.75rem;
}

.universe-help-sub {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #7a828e;
}

.universe-help-list {
    margin: 0;
}

.universe-help-list > div {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(122, 130, 142, 0.15);
}

.universe-help-list > div:last-child {
    border-bottom: none;
}

.universe-help-list dt {
    flex: 0 0 auto;
    min-width: 7.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #c9cdd3;
}

.universe-help-list dd {
    margin: 0;
    font-size: 0.75rem;
    color: #91a4b8;
}

.universe-help-list kbd {
    display: inline-block;
    padding: 0.05rem 0.35rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.7rem;
    color: #c9cdd3;
    background: var(--color-eve-800, #262626);
    border: 1px solid var(--color-eve-700, #333);
    border-bottom-width: 2px;
    border-radius: 0.25rem;
}
