:root {
    --bg: #000;
    --fg: #fff;
    --fg-dim: rgba(255,255,255,0.55);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--fg);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overflow: hidden;
}

#blazor-error-ui {
    background: #ff3366;
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.stage {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

#cosmos {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: block;
}

.content {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.orb-area {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    pointer-events: none;   /* canvas underneath catches mouse here */
}

.orb {
    --glow-intensity: 0;  /* 0..1, driven by JS based on perf headroom */
    width: min(60vh, 70vw);
    aspect-ratio: 1;
    border-radius: 50%;
    box-shadow: 0 0 calc(60px * var(--glow-intensity)) rgba(255, 80, 255, calc(0.35 * var(--glow-intensity)));
    cursor: pointer;
    user-select: none;
    transition: transform .25s ease-out, box-shadow 1.2s ease-out, filter 1.2s ease-out;
    pointer-events: auto;
    object-fit: cover;
}
/* Hover brightening is unconditional — the perf-driven --glow-intensity
   only adds *extra* shadow on top, so the orb still lights up to the same
   ratio at low quality tiers as at high. (Previously the entire .glow rule
   multiplied through --glow-intensity, so a backgrounded perf-throttle that
   pinned the variable to 0 silently disabled hover brightening.) */
.orb.glow {
    box-shadow:
        0 0 60px rgba(255, 80, 255, 0.45),
        0 0 calc(140px * var(--glow-intensity)) rgba(255, 80, 255, calc(0.8 * var(--glow-intensity))),
        0 0 calc(40px * var(--glow-intensity)) rgba(255, 255, 255, calc(0.6 * var(--glow-intensity)));
    filter: brightness(1.18) saturate(1.35);
    transform: scale(1.04);
}

.identity {
    flex: 0 0 auto;
    /* Match the orb's width so the identity strip's left/right edges line
       up with the orb's. The heatmap takes the remaining space and clips
       its overflow; name + links stay locked on the right and never wrap. */
    width: min(60vh, 70vw);
    margin: 0 auto;
    padding-bottom: 4vh;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    pointer-events: auto;   /* propagates `auto` to descendants via inherit */
}
.identity-text {
    flex: 0 0 auto;   /* never shrink — name + links must always be readable */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.name {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin: 0;
    color: var(--fg);
}
/* Blazor's <FocusOnNavigate Selector="h1" /> focuses this heading on every
   route render for screen-reader page announcements, which paints the UA
   :focus-visible outline whenever the prior input was keyboard. The heading
   isn't an interactive target, so suppress the ring. */
.name:focus,
.name:focus-visible {
    outline: none;
}

.links {
    display: flex;
    gap: 14px;
}
.links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition:
        transform .18s cubic-bezier(.2, .9, .3, 1.4),
        background .15s ease-out,
        border-color .15s ease-out,
        box-shadow .15s ease-out;
}
.links a:hover,
.links a:focus-visible {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.95);
    transform: scale(1.18) translateY(-3px);
    box-shadow:
        0 0 28px rgba(255, 100, 255, 0.55),
        0 0 14px rgba(255, 255, 255, 0.55),
        0 6px 18px rgba(0, 0, 0, 0.7);
    outline: none;
}
.links a::after {
    content: attr(aria-label);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(20, 20, 30, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 10px;
    letter-spacing: 0.05em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease-out, transform .15s ease-out;
}
.links a:hover::after,
.links a:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.links a {
    position: relative; /* for ::after tooltip anchoring */
}
.links img {
    width: 18px;
    height: 18px;
    filter: invert(1);
    opacity: 0.88;
    transition: opacity .15s ease-out;
}
.links a:hover img,
.links a:focus-visible img {
    opacity: 1;
}

.heatmap {
    /* Take whatever horizontal room remains in the identity strip after the
       name + links claim theirs. Critical: min-width:0 lets the flex item
       shrink below its content size, which is what allows the grid to clip. */
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    color: var(--fg-dim);
}
.heatmap-toggles {
    align-self: center;
    display: flex;
    gap: 12px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--fg-dim);
}
.heatmap-toggles label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}
.heatmap-toggles input[type=checkbox] {
    accent-color: #9af;
    width: 11px;
    height: 11px;
}
/* Window that clips the heatmap horizontally. Edge fades (mask-image) make
   the clip read as intentional rather than chopped, and let the panning
   grid emerge/recede smoothly. The grid is anchored to the right so today's
   column is always at the right edge when the pan animation is at rest. */
.heatmap-window {
    overflow: hidden;
    /* Fade only the LEFT edge — today's column on the right must be fully
       legible at rest, not faded into the background. The left fade still
       gives older history a soft entry edge as it pans into view. */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 100%);
    display: flex;
    justify-content: flex-end;   /* today on the right */
}
.heatmap-grid {
    /* Static at rest with today's column on the right (justify-content
       on the parent). Pan is driven by JS in heatmap-pan.js: hovering near
       the left edge of the window slowly pans the grid rightward (revealing
       older history); hovering near the right edge pans it back toward
       today. Stops at the bounds — no looping or auto-marquee. */
    flex: 0 0 auto;
    will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
    .heatmap-grid { transform: none !important; }
}
.heatmap-state {
    font-family: ui-monospace, monospace;
    font-size: 10px;
    color: var(--fg-dim);
    height: 42px;
    display: flex;
    align-items: center;
}
/* Per-rect :hover + transition removed: with 4500 cells and rapid mouse
   traversal, the browser tracking concurrent opacity transitions on each
   one was a significant main-thread cost. The tooltip already provides
   per-cell feedback.
   pointer-events:none on the rects skips per-cell SVG hit-testing on every
   mousemove (the heatmap-pan.js handler computes the cell from cursor
   coords directly via cell-grid math — see resolveCellTip there). Scoped
   tightly to .heatmap-grid rect so nothing else loses interactivity. */
.heatmap-grid rect {
    pointer-events: none;
}
.heatmap-tooltip {
    position: fixed;
    z-index: 100;
    pointer-events: none;
    background: rgba(20, 20, 30, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 11px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

#cosmos-hud {
    position: fixed;
    top: 10px;
    right: 14px;
    z-index: 50;
    color: rgba(255, 255, 255, 0.55);
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 10px;
    letter-spacing: 0.04em;
    line-height: 1.55;
    text-align: right;
    pointer-events: none;
    user-select: none;
}
#cosmos-hud .hud-big {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
#cosmos-hud .hud-dim {
    color: rgba(255, 255, 255, 0.35);
}

/* Inline action chips inside the HUD (ship +/-, audio on/off). The HUD root
   is pointer-events:none so clicks pass through; we re-enable here so only
   the chips themselves catch the click. Colors are intentionally muted — the
   green/red are tinted gray-ish so they read as part of the dim HUD palette
   rather than calling attention to themselves. */
#cosmos-hud .hud-btn {
    pointer-events: auto;
    display: inline-block;
    min-width: 14px;
    padding: 0 4px;
    height: 14px;
    line-height: 13px;
    text-align: center;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    border-radius: 3px;
    border: 1px solid transparent;
    margin-left: 3px;
    vertical-align: 0;
    cursor: pointer;
    user-select: none;
    /* Match the orb's 1.2s ease-out brightening so the chips share its
       slow, deliberate "warming up" feel rather than snapping. */
    transition:
        color 1.2s ease-out,
        background-color 1.2s ease-out,
        border-color 1.2s ease-out,
        box-shadow 1.2s ease-out,
        opacity 1.2s ease-out;
}
#cosmos-hud .hud-btn--plus {
    color: rgba(140, 220, 150, 0.55);
    background-color: rgba(140, 220, 150, 0.10);
    border-color: rgba(140, 220, 150, 0.22);
}
#cosmos-hud .hud-btn--plus:hover {
    color: rgba(160, 240, 170, 0.95);
    background-color: rgba(140, 220, 150, 0.22);
    border-color: rgba(140, 220, 150, 0.65);
    box-shadow: 0 0 12px rgba(140, 220, 150, 0.35);
}
#cosmos-hud .hud-btn--minus {
    color: rgba(230, 130, 130, 0.55);
    background-color: rgba(230, 130, 130, 0.10);
    border-color: rgba(230, 130, 130, 0.22);
}
#cosmos-hud .hud-btn--minus:hover {
    color: rgba(245, 150, 150, 0.95);
    background-color: rgba(230, 130, 130, 0.22);
    border-color: rgba(230, 130, 130, 0.65);
    box-shadow: 0 0 12px rgba(230, 130, 130, 0.35);
}
#cosmos-hud .hud-btn[aria-disabled="true"] {
    opacity: 0.30;
    cursor: not-allowed;
    pointer-events: none;
}
