:root {
    --bg: #070b1a;
    --panel: #0f1630;
    --panel-edge: #1f2a52;
    --text: #e6e9f5;
    --muted: #8d96b8;
    --accent: #7aa2ff;
    --accent-strong: #a8c1ff;
    --ok: #4fd18b;
    --warn: #f2c14e;
    --error: #ff6b6b;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(ellipse at top, #121a3a 0%, var(--bg) 60%) fixed;
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

h1:focus {
    outline: none;
}

a {
    color: var(--accent);
}

.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--panel-edge);
    background: rgba(7, 11, 26, 0.8);
    backdrop-filter: blur(6px);
}

.brand {
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--accent-strong);
}

.session {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.commander {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content {
    width: 100%;
    max-width: 44rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-top: 1rem;
}

.card.narrow {
    max-width: 26rem;
    margin: 2rem auto 0;
}

.card h1 {
    margin-top: 0;
}

.card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.muted, .hint {
    color: var(--muted);
}

.hint {
    font-size: 0.9rem;
}

.ok {
    color: var(--ok);
}

.error {
    color: var(--error);
}

form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

form.inline {
    flex-direction: row;
}

form.inline input {
    flex: 1;
    min-width: 0;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: var(--muted);
}

input {
    font: inherit;
    color: var(--text);
    background: #0a1024;
    border: 1px solid var(--panel-edge);
    border-radius: 0.5rem;
    padding: 0.55rem 0.7rem;
}

input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    border-radius: 0.5rem;
    padding: 0.55rem 1rem;
    background: var(--accent);
    color: #050815;
    font-weight: 600;
}

button:disabled {
    opacity: 0.5;
    cursor: default;
}

button.ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--panel-edge);
    padding: 0.35rem 0.75rem;
}

button.link {
    background: none;
    color: var(--accent);
    padding: 0;
    font-weight: 500;
}

.switch {
    margin-bottom: 0;
    color: var(--muted);
}

.checks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.checks li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.link-state {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.link-state.up {
    background: var(--ok);
    box-shadow: 0 0 6px var(--ok);
}

.link-state.pending {
    background: var(--warn);
}

.link-state.down {
    background: var(--error);
}

#blazor-error-ui {
    background: #3a1020;
    color: var(--text);
    bottom: 0;
    box-sizing: border-box;
    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;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #1f2a52;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: var(--muted);
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

@media (max-width: 30rem) {
    form.inline {
        flex-direction: column;
    }
}

/* ---------- Navigation ---------- */

a.brand {
    text-decoration: none;
}

.mainnav {
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
    gap: 0.25rem;
    margin-right: auto;
    margin-left: 1rem;
}

.mainnav a {
    color: var(--muted);
    text-decoration: none;
    padding: 0.3rem 0.7rem;
    border-radius: 0.5rem;
}

.mainnav a.active {
    color: var(--text);
    background: var(--panel);
}

.content.wide, .content:has(.galaxy-layout) {
    max-width: 72rem;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.page-head h1 {
    margin: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.page-head p {
    margin: 0;
    width: 100%;
}

.crumbs {
    margin: 0;
}

.crumbs a {
    text-decoration: none;
}

.tabs {
    display: flex;
    gap: 0.25rem;
}

.tab {
    color: var(--muted);
    text-decoration: none;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    font-size: 0.9rem;
}

.tab.active {
    color: var(--text);
    border-color: var(--accent);
}

a.button {
    display: inline-block;
    text-decoration: none;
    border-radius: 0.5rem;
    padding: 0.55rem 1rem;
    background: var(--accent);
    color: #050815;
    font-weight: 600;
}

a.button.secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.small {
    font-size: 0.85rem;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.75rem;
    color: var(--accent);
}

.notice {
    border-left: 3px solid var(--warn);
    padding: 0.5rem 0.75rem;
    background: rgba(242, 193, 78, 0.08);
    border-radius: 0 0.5rem 0.5rem 0;
    color: var(--muted);
}

/* ---------- Homeworld & founding ---------- */

.founding p {
    color: var(--muted);
}

.homeworld-head {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.homeworld-head h2 {
    margin: 0;
    font-size: 1.3rem;
}

.homeworld-head p {
    margin: 0;
}

.species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

button.species {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
    background: #0a1024;
    color: var(--text);
    font-weight: 400;
    border: 1px solid var(--panel-edge);
    padding: 0.85rem;
}

button.species:hover {
    border-color: var(--accent);
}

button.species.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(122, 162, 255, 0.25);
}

.species-head {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.species-head strong,
.species-head .small {
    display: block;
}

.species .tagline {
    color: var(--muted);
    font-size: 0.9rem;
}

.traits {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
}

.traits li {
    padding-left: 1.1rem;
    position: relative;
    margin-top: 0.25rem;
}

.traits li::before {
    position: absolute;
    left: 0;
}

.traits li.strength::before {
    content: "+";
    color: var(--ok);
}

.traits li.drawback::before {
    content: "−";
    color: var(--warn);
}

.traits li.drawback strong {
    color: var(--warn);
}

.species-detail {
    border-left: 3px solid var(--accent);
    padding-left: 0.85rem;
    margin-bottom: 1rem;
}

.species-detail p {
    margin: 0;
    color: var(--text);
}

dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.75rem;
    margin: 1rem 0 0;
}

dl .wide {
    grid-column: 1 / -1;
}

dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

dd {
    margin: 0.15rem 0 0;
}

.chip, .badge {
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--panel-edge);
    background: #0a1024;
    margin: 0 0.3rem 0.3rem 0;
}

.chip.trait {
    border-color: var(--warn);
    color: var(--warn);
}

.badge {
    margin: 0 0 0 auto;
    border-color: var(--ok);
    color: var(--ok);
    white-space: nowrap;
}

/* ---------- Galaxy map ---------- */

.galaxy-layout {
    display: grid;
    grid-template-columns: 1fr 18rem;
    gap: 1rem;
    margin-top: 1rem;
}

.starmap {
    position: relative;
    background: radial-gradient(ellipse at center, #0d1430 0%, #050816 70%);
    border: 1px solid var(--panel-edge);
    border-radius: 0.75rem;
    overflow: hidden;
    aspect-ratio: 1;
    max-height: 78vh;
    width: 100%;
}

.starmap-svg {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
    user-select: none;
}

.starmap-svg:active {
    cursor: grabbing;
}

.system {
    cursor: pointer;
    transition: r 0.15s;
}

.system:hover {
    stroke: #fff;
    stroke-width: 2;
}

.system.selected {
    stroke: #fff;
    stroke-width: 3;
}

.companion {
    pointer-events: none;
}

.star-dot.small {
    width: 0.5rem;
    height: 0.5rem;
    margin-left: -0.2rem;
    vertical-align: top;
}

.home-ring {
    fill: none;
    stroke: var(--ok);
    stroke-width: 2.5;
    stroke-dasharray: 6 4;
    pointer-events: none;
}

.map-label {
    fill: var(--text);
    font-size: 22px;
    text-anchor: middle;
    pointer-events: none;
    paint-order: stroke;
    stroke: #050816;
    stroke-width: 5px;
}

.map-label.subtle {
    fill: var(--muted);
    font-size: 18px;
}

/* Nebulae: soft clouds along the spiral arms. */

.nebula {
    pointer-events: none;
}

/* Opacity is on the whole cloud, so overlapping puffs don't stack into a solid blot. */
.nebula.emission {
    opacity: 0.2;
}

.nebula.emission circle {
    fill: #ff4f86;
}

.nebula.dark {
    opacity: 0.5;
}

.nebula.dark circle {
    fill: #040205;
}

.map-label.nebula-label {
    font-style: italic;
    font-size: 20px;
    fill: #ff9ab8;
}

.map-label.nebula-label.dark {
    fill: #a39a8c;
}

.nebula-swatch.emission {
    background: radial-gradient(circle, #ff8fb0, rgba(255, 79, 134, 0.2));
}

.nebula-swatch.dark {
    background: radial-gradient(circle, #050306 40%, #3a302a);
    box-shadow: inset 0 0 0 1px #6b6158;
}

.notice.nebula-notice.emission {
    border-left-color: #ff4f86;
}

.notice.nebula-notice.dark {
    border-left-color: #6b6158;
}

/* Universe map: galaxies drawn as their own spirals, in units of a galaxy's radius (1000). */

.galaxy {
    cursor: pointer;
}

.galaxy .arm {
    fill: none;
    stroke: #8fb8ff;
    stroke-opacity: 0.22;
    stroke-width: 150;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.galaxy .arm.bright {
    stroke: #dfe8ff;
    stroke-opacity: 0.55;
    stroke-width: 45;
}

.galaxy .hit {
    fill: transparent;
}

.galaxy:hover .arm.bright,
.galaxy.selected .arm.bright {
    stroke-opacity: 0.9;
}

.galaxy.selected .hit {
    stroke: #fff;
    stroke-width: 25;
    stroke-opacity: 0.6;
}

.galaxy.uncharted {
    opacity: 0.3;
    filter: grayscale(1);
}

.universe-ring {
    stroke-width: 40;
    stroke-dasharray: 120 80;
}

.map-label.universe-label {
    font-size: 260px;
    stroke-width: 40px;
}

.map-label.universe-label.subtle {
    font-size: 220px;
}

.uncharted-dot {
    background: #4a5068;
}

.core-glow {
    pointer-events: none;
}

.map-controls {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.map-controls button {
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    background: rgba(7, 11, 26, 0.85);
    font-size: 1.1rem;
}

.system-card {
    margin-top: 0;
    align-self: start;
}

.system-card h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.home-swatch {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    border: 2px dashed var(--ok);
}

/* Star colours: shared by map circles (fill) and inline dots (background). */
.star-dot {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.star-dot.large {
    width: 1.4rem;
    height: 1.4rem;
}

.star-red { fill: #ff7b6b; background: #ff7b6b; }
.star-yellow { fill: #ffe08a; background: #ffe08a; }
.star-orange { fill: #ffb26b; background: #ffb26b; }
.star-blue { fill: #8fb8ff; background: #8fb8ff; }
.star-neutron { fill: #d6f4ff; background: #d6f4ff; }
.star-nebula { fill: #6bdcc4; fill-opacity: 0.55; background: rgba(107, 220, 196, 0.55); }
.star-blackhole { fill: #05030a; stroke: #b48cff; stroke-width: 2.5; background: #05030a; box-shadow: inset 0 0 0 2px #b48cff; }
.star-smbh { fill: #05030a; stroke: #ffcf8a; stroke-width: 4; background: #05030a; box-shadow: inset 0 0 0 2px #ffcf8a; }

/* ---------- System view ---------- */

.system-map {
    margin: 1rem 0;
    aspect-ratio: 1 / 1;
    max-height: 70vh;
}

.orbit-ring {
    fill: none;
    stroke: var(--panel-edge);
    stroke-width: 2;
    stroke-dasharray: 6 8;
    pointer-events: none;
}

.orbit-ring.belt {
    stroke: #8d8578;
    stroke-opacity: 0.6;
    stroke-width: 14;
    stroke-dasharray: 2 10;
}

.body-marker {
    cursor: pointer;
}

.body-marker:hover .planet {
    stroke: #fff;
    stroke-width: 3;
}

.map-label.system-label {
    font-size: 42px;
    stroke-width: 9px;
}

.card.body.picked,
.moon.picked {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.orbit-strip {
    width: 100%;
    height: auto;
    margin: 1rem 0 0.5rem;
}

.orbit-line {
    stroke: var(--panel-edge);
    stroke-width: 1;
    stroke-dasharray: 3 4;
}

.planet.held {
    stroke: var(--ok);
    stroke-width: 2;
}

.bodies {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: 0 1rem;
}

.card.body header {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.card.body h2 {
    margin: 0;
}

.card.body header p {
    margin: 0;
    font-size: 0.85rem;
}

.card.body.held {
    border-color: var(--ok);
}

.planet-dot {
    display: inline-block;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.planet-dot.small {
    width: 1.1rem;
    height: 1.1rem;
}

.moons {
    margin-top: 1rem;
    border-top: 1px solid var(--panel-edge);
    padding-top: 0.75rem;
}

.moons h3 {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.moon {
    border-left: 2px solid var(--panel-edge);
    padding: 0.25rem 0 0.25rem 0.75rem;
    margin-bottom: 0.75rem;
}

.moon.held {
    border-left-color: var(--ok);
}

.moon header {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.moon h4 {
    margin: 0;
    font-size: 0.95rem;
}

.moon header p {
    margin: 0;
    font-size: 0.8rem;
}

.moon dl {
    margin-top: 0.5rem;
    grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
}

.planet-dot.large {
    width: 3rem;
    height: 3rem;
}

.body-terran { fill: #4f9d69; background: radial-gradient(circle at 35% 35%, #7fd18f, #2f6f8f); }
.body-ocean { fill: #3f7fd1; background: radial-gradient(circle at 35% 35%, #7fb2ff, #1f4f9f); }
.body-desert { fill: #d1a35f; background: radial-gradient(circle at 35% 35%, #f2cf8a, #a8743a); }
.body-arctic { fill: #cfe7f2; background: radial-gradient(circle at 35% 35%, #ffffff, #9fc6dd); }
.body-volcanic { fill: #c4513a; background: radial-gradient(circle at 35% 35%, #ff8a5c, #5a1f16); }
.body-barren { fill: #8d8578; background: radial-gradient(circle at 35% 35%, #bdb5a8, #57504a); }
.body-gasgiant { fill: #d9a873; background: repeating-linear-gradient(170deg, #e8c08f 0 6px, #b98a5a 6px 11px); }
.body-browndwarf { fill: #8a3b2e; background: radial-gradient(circle at 40% 40%, #d0603f, #5a1e1a 70%, #2a0e0c); box-shadow: 0 0 6px #b0452f; }
.body-asteroidbelt { fill: #8d8578; background: radial-gradient(circle, #a39a8c 0 2px, transparent 3px) 0 0 / 7px 7px, #262330; }

/* ---------- Holdings: resources, queue, buildings ---------- */

.meter {
    display: block;
    height: 0.4rem;
    border-radius: 999px;
    background: #0a1024;
    border: 1px solid var(--panel-edge);
    overflow: hidden;
}

.meter > span {
    display: block;
    height: 100%;
    background: var(--accent);
    transition: width 0.9s linear;
}

.meter.ok > span {
    background: var(--ok);
}

.meter.warn > span {
    background: var(--warn);
}

.resource-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.resource {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
}

.resource .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.resource strong {
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
}

.queue h2 {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.orders {
    list-style: none;
    margin: 0;
    padding: 0;
}

.order {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.4rem 0.75rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--panel-edge);
}

.order:first-child {
    border-top: none;
}

.order .paused-reason {
    grid-column: 1 / -1;
}

.order.paused .order-name {
    color: var(--warn);
}

.order .meter {
    grid-column: 1 / -1;
}

.order .muted {
    font-variant-numeric: tabular-nums;
}

.buildings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    gap: 0 1rem;
}

.card.building header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.card.building h2 {
    margin: 0;
}

.card.building .level {
    color: var(--accent-strong);
    white-space: nowrap;
}

.card.building.unbuilt .level {
    color: var(--muted);
}

.build-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.build-row .cost.short {
    color: var(--warn);
}

.quest-step {
    border-left: 3px solid var(--accent);
    padding-left: 0.85rem;
    margin: 0.75rem 0 1rem;
}

.quest-step.ready {
    border-left-color: var(--ok);
}

.quest-step h3 {
    margin: 0 0 0.25rem;
}

.quest-step p {
    margin: 0 0 0.5rem;
}

.objective {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-weight: 600;
}

.quest-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.quest-steps li {
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--panel-edge);
    color: var(--muted);
}

.quest-steps li.claimed {
    color: var(--ok);
    border-color: var(--ok);
}

.quest-steps li.claimed::before {
    content: "✓ ";
}

.quest-steps li.inprogress,
.quest-steps li.readytoclaim {
    color: var(--text);
    border-color: var(--accent);
}

a.badge {
    text-decoration: none;
}

/* ---------- Shipyard, launch and fleets ---------- */

.shipyard h2 {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.small-button {
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    margin-left: auto;
}

.notice .small-button,
.body-actions .small-button {
    margin-left: 0.5rem;
}

.body-actions {
    margin-top: 0.6rem;
    display: flex;
    gap: 0.4rem;
}

.body-actions .small-button {
    margin-left: 0;
}

.ship-types {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.ship-type {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border: 1px solid var(--panel-edge);
    border-radius: 0.6rem;
    padding: 0.6rem 0.75rem;
}

.ship-type button {
    align-self: flex-start;
}

.launch label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.launch select,
.launch input {
    font: inherit;
    color: var(--text);
    background: #0a1024;
    border: 1px solid var(--panel-edge);
    border-radius: 0.5rem;
    padding: 0.45rem 0.6rem;
}

.ship-picker {
    border: 1px solid var(--panel-edge);
    border-radius: 0.6rem;
    padding: 0.6rem 0.8rem;
    margin: 0 0 0.75rem;
}

.ship-count {
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
}

.ship-count input {
    width: 5rem;
}

.fleets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: 0 1rem;
}

.card.fleet header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.card.fleet h2 {
    margin: 0;
    font-size: 1.05rem;
}

.card.fleet.done {
    opacity: 0.7;
}

.routes {
    margin-top: 2rem;
}

/* ---------- Battles ---------- */

.threats {
    border-color: #b4553c;
}

.threats h2 {
    margin-top: 0;
    color: #ff9b80;
}

.battle-log {
    margin-top: 2rem;
}

.battle-log ul {
    list-style: none;
    padding: 0.75rem 1rem;
}

.battle-log li + li {
    margin-top: 0.4rem;
}

.battle-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: baseline;
}

.forces {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 0 1rem;
}

.card.force header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.card.force.mine {
    border-color: var(--accent);
}

.card.force.destroyed,
.card.force.retreated {
    opacity: 0.7;
}

.meter.loss span {
    background: #c8553d;
}

.doctrine {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.doctrine select {
    font: inherit;
    color: var(--text);
    background: #0a1024;
    border: 1px solid var(--panel-edge);
    border-radius: 0.5rem;
    padding: 0.25rem 0.4rem;
}

.rounds ol {
    padding-left: 1.25rem;
}

.rounds li + li {
    margin-top: 0.5rem;
}

.ship-stats {
    color: var(--muted);
}

.defences .shield {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
}

.shield-meter span {
    background: #5ec8ff;
}

.draw {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.draw select {
    font: inherit;
    color: var(--text);
    background: #0a1024;
    border: 1px solid var(--panel-edge);
    border-radius: 0.5rem;
    padding: 0.25rem 0.4rem;
}

.mines {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid #6c7aa6;
    color: var(--muted);
}

.mines.hostile {
    border-color: #c8553d;
    color: #ff9b80;
}

.badge.rival {
    border-color: #c8553d;
}

.badge.faction {
    color: #ff9b80;
}

.badge.dormant {
    border-color: var(--muted);
    color: var(--muted);
}

.card.occupied {
    border-color: var(--warn);
}

.notice.control {
    border-color: var(--accent);
}

.defence-unit + .defence-unit::before {
    content: " · ";
    color: var(--muted);
}

.card.route header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.card.route.paused {
    opacity: 0.7;
}

.new-route h3 {
    margin-top: 0;
}

.route-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0 1rem;
}

/* ---------- Research ---------- */

.access-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.5rem;
}

.access-list li {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--panel-edge);
    border-radius: 0.6rem;
}

.access-list li.has {
    border-color: var(--ok);
}

.access-list li.has strong::after {
    content: " ✓";
    color: var(--ok);
}

.era h2 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.75rem;
    margin: 1.5rem 0 0.5rem;
}

.era.locked .tech {
    opacity: 0.6;
}

.badge.locked {
    margin: 0;
    border-color: var(--panel-edge);
    color: var(--muted);
}

.techs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 0 1rem;
}

.card.tech header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.card.tech h3 {
    margin: 0;
    font-size: 1.05rem;
}

.card.tech p {
    margin: 0.4rem 0;
}

.card.tech .effect {
    color: var(--accent-strong);
    font-size: 0.9rem;
}

.tech-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    white-space: nowrap;
}

.breakthroughs {
    list-style: none;
    margin: 0.5rem 0;
    padding: 0.5rem 0.6rem;
    border: 1px dashed var(--warn);
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

.breakthroughs li {
    padding-left: 1.2rem;
    position: relative;
}

.breakthroughs li::before {
    content: "○";
    position: absolute;
    left: 0;
    color: var(--warn);
}

.breakthroughs li.met::before {
    content: "✓";
    color: var(--ok);
}

.card.tech.researched {
    border-color: var(--ok);
}

.card.tech.researched .tech-status {
    color: var(--ok);
}

.card.tech.queued {
    border-color: var(--accent);
}

.card.tech.queued .tech-status,
.card.tech.available .tech-status {
    color: var(--accent-strong);
}

@media (max-width: 48rem) {
    .galaxy-layout {
        grid-template-columns: 1fr;
    }

    .topbar {
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }

    .brand {
        letter-spacing: 0.12em;
        font-size: 0.9rem;
    }

    .mainnav {
        margin-left: 0;
    }

    .mainnav a {
        padding: 0.3rem 0.5rem;
    }

    .session {
        gap: 0.5rem;
    }

    .session button.ghost {
        padding: 0.3rem 0.55rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .commander {
        display: none;
    }
}

.contract {
    border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08));
    padding: 0.75rem 0;
}

.contract header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.contract.done strong {
    color: var(--accent-strong);
}

.guild-standing {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.guild-standing .meter {
    flex: 1 1 10rem;
}

.licences li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.badge.ally {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.chat {
    list-style: none;
    padding: 0;
    max-height: 20rem;
    overflow-y: auto;
}

form.stack {
    display: grid;
    gap: 0.5rem;
    max-width: 28rem;
}

.gateway-ring {
    fill: none;
    stroke: #c58aff;
    stroke-width: 3;
    stroke-dasharray: 6 4;
}

li.mine strong {
    color: var(--accent-strong);
}

label.perk {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.6rem;
    align-items: start;
}

label.perk input {
    margin-top: 0.2rem;
}

label.perk .muted {
    grid-column: 2;
}

article.product {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0;
    border-top: 1px solid var(--panel-edge);
}

article.product:first-of-type {
    border-top: none;
}

article.product p {
    margin: 0.2rem 0 0;
}

article.product button {
    flex-shrink: 0;
}

/* A banner (cosmetic): the empire's colour beside its name. */
.banner-swatch {
    display: inline-block;
    width: 0.7em;
    height: 0.7em;
    margin-right: 0.3em;
    border-radius: 2px;
    vertical-align: baseline;
}

/* The season pass's tracks. */
table.pass {
    width: 100%;
    border-collapse: collapse;
}

table.pass th, table.pass td {
    padding: 0.35rem 0.5rem;
    text-align: left;
    border-top: 1px solid var(--panel-edge);
}

table.pass tr.reached td:first-child {
    color: var(--accent);
    font-weight: 600;
}

/* Progressive disclosure: a dot on a nav link whose tutorial card hasn't been read. */
.new-dot {
    display: inline-block;
    width: 0.4em;
    height: 0.4em;
    margin-left: 0.25em;
    border-radius: 50%;
    background: var(--warn);
    vertical-align: super;
}

.card.tutorial {
    border-color: var(--accent);
}

/* The Advisor (GameDesign §15.3). */
.card.advisor ul {
    margin: 0;
    padding-left: 1.1rem;
}

.card.advisor li {
    margin: 0.25rem 0;
}

.card.advisor li.warning,
.advisor-line {
    color: var(--warn);
}

.advisor-line {
    display: block;
}

/* Admin tools: compact rows of inputs. */
form.admin-grant {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

form.admin-grant input[type=number] {
    width: 7rem;
}
