:root {
    --hud-ink: #edf8fb;
    --hud-dim: #a6bbc5;
    --hud-cyan: #8bdcff;
    --hud-green: #86e6b3;
    --hud-amber: #ffcc7b;
    --hud-red: #ff8b96;
    --hud-surface: rgba(9, 18, 24, 0.94);
    --hud-outline: #536f7f;
    --hud-numbers: Consolas, "Courier New", monospace;
}

#guns[hidden], #field[hidden], #right-HUD[hidden], #cockpit-energy[hidden],
#guns [hidden], #right-HUD [hidden], #energy-portrait[hidden] + #cockpit-energy {
    display: none;
}

#guns {
    position: fixed;
    inset: auto 14px 14px;
    z-index: 3;
    padding: 0;
    background: transparent;
    font: 600 13px/1.3 system-ui, sans-serif;
    letter-spacing: normal;
    color: var(--hud-ink);
    pointer-events: none;
}

.hud-dock, #cockpit-weapon, #field, #right-HUD {
    background: var(--hud-surface);
    border: 1px solid var(--hud-outline);
    border-radius: 4px;
    box-shadow: 0 3px 10px #0003;
}

.hud-dock {
    position: absolute;
    left: 0;
    bottom: 0;
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 4px;
}

.cockpit-slot {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: clamp(104px, 14vw, 150px);
    min-height: 49px;
    box-sizing: border-box;
    padding: 7px 6px 7px 8px;
    border-top: 2px solid transparent;
    border-radius: 2px;
    background: #17252e;
}

.cockpit-slot.is-equipped {
    background: #223b49;
    border-top-color: var(--hud-cyan);
}

.hud-slot-info { min-width: 0; }
.hud-slot-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.hud-slot-value {
    margin-top: 3px;
    color: var(--hud-dim);
    font: 600 11px/1.15 var(--hud-numbers);
}

.uses-fuel .hud-slot-value { color: var(--hud-amber); }
.hud-symbol {
    display: inline-block;
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    background: var(--hud-cyan);
    clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

.hud-symbol[data-glyph="fuel"] {
    background: var(--hud-amber);
    clip-path: polygon(60% 0, 72% 40%, 91% 24%, 100% 67%, 80% 94%, 47% 100%, 17% 84%, 3% 58%, 28% 30%, 36% 58%);
}
.hud-symbol[data-glyph="star"], .hud-symbol[data-glyph="arc"] {
    clip-path: polygon(54% 0, 32% 43%, 100% 30%, 47% 100%, 67% 56%, 0 69%);
}
.hud-symbol[data-glyph="blade"], .hud-symbol[data-glyph="rail"] {
    clip-path: polygon(0 68%, 77% 4%, 100% 0, 87% 33%, 13% 100%);
}
.hud-symbol[data-glyph="prism"], .hud-symbol[data-glyph="mine"] {
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.hud-overflow {
    align-self: center;
    padding: 0 4px;
    color: var(--hud-dim);
    font: 600 11px var(--hud-numbers);
}

#cockpit-weapon {
    position: absolute;
    right: 0;
    bottom: 0;
    width: clamp(138px, 24vw, 218px);
    box-sizing: border-box;
    padding: 10px 12px;
    border-top: 2px solid var(--hud-cyan);
}

#cockpit-weapon.uses-fuel { border-top-color: var(--hud-amber); }
.hud-kicker {
    color: var(--hud-dim);
    font: 600 10px/1.2 system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: .095em;
}
#cockpit-weapon .hud-kicker {
    display: flex;
    align-items: center;
    gap: 6px;
}
.hud-weapon-name {
    margin-top: 4px;
    font: 650 16px/1.15 system-ui, sans-serif;
    overflow-wrap: anywhere;
}
.hud-resource {
    display: flex;
    gap: 7px;
    align-items: baseline;
    margin-top: 4px;
}
.hud-resource strong, #cockpit-weapon .cinder-fuel-time {
    color: var(--hud-ink);
    font: 700 clamp(23px, 4.2vw, 34px)/1 var(--hud-numbers);
    font-variant-numeric: tabular-nums;
}
.hud-resource span, .hud-fuel-capacity {
    color: var(--hud-dim);
    font: 500 11px/1.2 system-ui, sans-serif;
}
.hud-status {
    color: var(--hud-green);
    margin-top: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
}
#cockpit-weapon.uses-fuel .hud-status { margin-top: 6px; }
#cockpit-weapon[data-state="low-ammo"] .hud-status,
#cockpit-weapon[data-state="refilling"] .hud-status { color: var(--hud-amber); }
#cockpit-weapon[data-state="empty"] .hud-status { color: var(--hud-red); }

#cockpit-weapon #cinder-fuel {
    position: static;
    width: auto;
    padding: 0;
    margin-top: 5px;
    background: transparent;
    border: 0;
}
#cockpit-weapon .cinder-fuel-label {
    align-items: baseline;
    justify-content: flex-start;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
#cockpit-weapon .cinder-fuel-track { height: 5px; border-radius: 1px; }
#cockpit-weapon .cinder-fuel-fill {
    background: linear-gradient(90deg, #d28a38, var(--hud-amber));
}
#cockpit-weapon.uses-fuel:not([hidden]) {
    display: flex;
    flex-direction: column;
}
#cockpit-weapon .hud-fuel-mount { order: 1; }
#cockpit-weapon .hud-status { order: 2; }

#energy-portrait, #health {
    border-color: var(--hud-outline);
    box-shadow: 0 3px 10px #0003;
}
#cockpit-energy {
    position: absolute;
    z-index: 3;
    top: 12px;
    left: 19px;
    max-width: calc(var(--energy-portrait-size) - 8px);
    padding: 1px 3px;
    border-radius: 2px;
    background: #070e15e8;
    color: var(--hud-cyan);
    font: 600 9px/1.2 var(--hud-numbers);
    text-transform: uppercase;
    pointer-events: none;
}
#health[data-warning="caution"] #condition-value { color: var(--hud-amber); }
#health[data-warning="critical"] #condition-value { color: var(--hud-red); }
#field {
    top: calc(21px + var(--energy-portrait-offset) + var(--energy-portrait-size));
    left: 15px;
    max-width: min(245px, calc(100vw - 30px));
    box-sizing: border-box;
    padding: 5px 7px;
    opacity: 1;
    text-align: left;
    color: var(--hud-ink);
    font: 600 11px/1.25 system-ui, sans-serif;
    overflow-wrap: anywhere;
}
#field .hud-field-status {
    color: var(--hud-cyan);
    margin-left: 6px;
    text-transform: uppercase;
    font: 700 10px var(--hud-numbers);
}
#field .hud-field-status:empty { display: none; }
#field.without-condition {
    top: calc(17px + var(--energy-portrait-size));
}

#right-HUD {
    top: 14px;
    right: 14px;
    max-width: min(180px, 40vw);
    box-sizing: border-box;
    padding: 7px 9px;
    color: var(--hud-ink);
    opacity: 1;
    text-align: left;
    font: 600 12px/1.25 system-ui, sans-serif;
}
#right-HUD .hud-kicker { display: block; }
.hud-tech-total { font: 700 20px/1.15 var(--hud-numbers); }
.hud-tech-pickup {
    display: block;
    border-top: 1px solid var(--hud-outline);
    margin-top: 4px;
    padding-top: 4px;
    color: var(--hud-cyan);
    overflow-wrap: anywhere;
}
.hud-ammo-pickup {
    position: absolute;
    top: 0;
    right: 3px;
    transform: translateY(-86%);
    padding: 2px 4px;
    border: 1px solid var(--hud-outline);
    border-radius: 3px;
    background: #142b34;
    color: var(--hud-green);
    font: 700 12px/1.1 var(--hud-numbers);
}
[data-warning="critical"] .hud-ammo-pickup, [data-warning="critical"] .hud-tech-pickup {
    display: none;
}
body:has(#guns:not([hidden])) #text-log {
    bottom: 93px;
    max-width: min(440px, 68vw);
    max-height: 18vh;
    overflow: hidden;
    padding: 4px 6px;
    font-size: 12px;
    overflow-wrap: anywhere;
}

#cockpit-inspector {
    color: var(--hud-ink);
    background: #12212a;
    border: 1px solid var(--hud-outline);
    padding: 10px;
    display: grid;
    gap: 6px;
    font: 500 14px/1.4 system-ui, sans-serif;
    min-width: 0;
    overflow-wrap: anywhere;
}
#cockpit-inspector label { color: var(--hud-dim); }
#cockpit-inspector select {
    color: var(--hud-ink);
    background: #243a48;
    border: 1px solid var(--hud-outline);
    font: inherit;
    width: 100%;
    padding: 5px;
}
#cockpit-inspector .hud-inspection-resource { color: var(--hud-cyan); }
.hud-inspection-description { padding-block: 3px; }
.hud-upgrade-list {
    list-style: none;
    display: grid;
    gap: 6px;
    margin: 2px 0 0;
    padding: 0;
}
.hud-upgrade-list li { border-top: 1px solid #36515f; padding-top: 6px; }
.hud-upgrade-list li > strong { color: var(--hud-amber); }

@media (max-width: 540px) {
    #guns { inset: auto 8px 8px; }
    #field { font-size: 10px; }
    #right-HUD { right: 8px; top: 8px; }
    #cockpit-weapon { padding: 7px 8px; }
    .cockpit-slot { gap: 5px; }
}
