/* The resource cells occupy y=4..40 inside the shared 43-unit HUD. */
#game { --flight-status-height: var(--hud-height,43px); }
#game:has(.flight-arrival:not([hidden])) { --flight-status-height: calc(var(--hud-height,43px) + 70px); }
#flight-status {
  --standing-color: #858585;
  --flight-color: var(--standing-color);
  position: absolute;
  z-index: 5;
  top: calc(4px * var(--game-scale,1));
  left: calc(7px * var(--game-scale,1));
  width: min(calc(256px * var(--game-scale,1)), calc(100% - var(--hud-width,47%) - 18px));
  color: #d7f0ef;
  font-family: Arial, sans-serif;
  pointer-events: none;
  user-select: none;
}
#flight-status[hidden], #flight-status [hidden], body:not(.playing) #flight-status { display: none; }
.flight-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: calc(10px * var(--game-scale,1));
  height: calc(36px * var(--game-scale,1));
  overflow: clip;
  padding: calc(4px * var(--game-scale,1)) calc(7px * var(--game-scale,1));
  background: linear-gradient(115deg, #102637dc, #091923d9);
  border: 1px solid color-mix(in srgb, var(--flight-color) 52%, #29424d);
  border-radius: clamp(3px, calc(4px * var(--game-scale,1)), 9px);
  box-shadow: inset 0 1px #b9edec1c, 0 2px 8px #0003;
  isolation: isolate;
  transition: border-color .6s ease;
}
.flight-panel::before { content: ''; position: absolute; top: 0; left: calc(8px * var(--game-scale,1)); width: calc(24px * var(--game-scale,1)); height: 1px; background: var(--flight-color); opacity: .8; box-shadow: 0 0 8px var(--flight-color); animation: flight-edge 6s ease-in-out infinite; transition: background-color .6s ease, box-shadow .6s ease; }
.flight-event-sweep { position: absolute; z-index: 0; inset: 0 auto 0 0; width: 45%; opacity: 0; pointer-events: none; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--event-color) 22%, transparent), #e1f9ff12, transparent); }
.flight-event-halo { position: absolute; z-index: 0; inset: 0; opacity: 0; border: 1px solid var(--event-color); border-radius: inherit; box-shadow: inset 0 0 18px color-mix(in srgb, var(--event-color) 35%, transparent); pointer-events: none; }
.flight-location, .flight-speed { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; gap: calc(2px * var(--game-scale,1)); min-width: 0; }
.flight-details { display: flex; align-items: center; justify-content: space-between; gap: clamp(4px,calc(6px * var(--game-scale,1)),12px); min-width: 0; }
.flight-coordinates { display: inline-flex; flex: none; gap: clamp(4px,calc(5px * var(--game-scale,1)),8px); color: #91d1df; font-size: clamp(8px,calc(5.5px * var(--game-scale,1)),11px); line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.flight-heading { position: relative; display: flex; align-items: baseline; gap: calc(7px * var(--game-scale,1)); min-width: 0; }
#flight-status :is(.flight-name,.flight-name-ghost) { min-width: 0; margin: 0; color: #d9eeed; font-size: clamp(10px, calc(13px * var(--game-scale,1)), 23px); font-weight: 600; line-height: 1.1; letter-spacing: .025em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#flight-status .flight-name-ghost { position: absolute; top: 0; left: 0; max-width: 80%; opacity: 0; pointer-events: none; }
.flight-code { flex: none; color: #7cabb9; font-size: clamp(7px, calc(5.5px * var(--game-scale,1)), 10px); letter-spacing: .06em; white-space: nowrap; }
.flight-reputation { display: flex; align-items: center; gap: calc(4px * var(--game-scale,1)); min-width: 0; font-size: clamp(9px, calc(6.5px * var(--game-scale,1)), 12px); line-height: 1; white-space: nowrap; pointer-events: auto; cursor: help; }
.flight-beacon { position: relative; width: clamp(4px, calc(4px * var(--game-scale,1)), 7px); height: clamp(4px, calc(4px * var(--game-scale,1)), 7px); flex: none; border-radius: 50%; color: var(--standing-color); background-color: var(--standing-color); box-shadow: 0 0 4px currentColor, 0 0 9px color-mix(in srgb, currentColor 45%, transparent); animation: flight-beacon 4s ease-in-out infinite; transition: color .55s ease, background-color .55s ease, box-shadow .55s ease; }
.flight-beacon::after { content: ''; position: absolute; inset: -3px; border: 1px solid currentColor; border-radius: 50%; opacity: 0; animation: flight-beacon-ring 4s ease-out infinite; }
#flight-status[data-standing="hostile"] .flight-beacon { animation: flight-hostile 2.6s ease-in-out infinite; }
#flight-status[data-standing="hostile"] .flight-beacon::after { animation-duration: 2.6s; }
#flight-status[data-standing="owned"] .flight-beacon { animation: flight-owned 5s ease-in-out infinite; }
#flight-status[data-standing="owned"] .flight-beacon::after { animation-duration: 5s; }
#flight-status[data-standing="neutral"] .flight-beacon { animation-duration: 6s; }
#flight-status[data-standing="neutral"] .flight-beacon::after { animation-duration: 6s; }
.flight-reputation-label { color: #97b3be; font-size: .8em; letter-spacing: .08em; }
.flight-standing { font-weight: 600; font-variant-numeric: tabular-nums; }
.flight-standing-label { margin-left: 2px; color: #92aaaF; font-size: .85em; }
#flight-status:is([data-standing="unavailable"],[data-standing="unknown"]) .flight-reputation { opacity: .55; }
#flight-status:is([data-standing="unavailable"],[data-standing="unknown"]) .flight-beacon { animation: none; box-shadow: none; }
#flight-status:is([data-standing="unavailable"],[data-standing="unknown"]) .flight-beacon::after { animation: none; }
.flight-speed { align-items: flex-end; }
.flight-mode { color: #97b3be; font-size: clamp(7px, calc(5.5px * var(--game-scale,1)), 10px); line-height: 1; letter-spacing: .08em; white-space: nowrap; }
.flight-speed-value { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.flight-velocity { color: #e8d28c; font-family: Consolas, monospace; font-weight: 600; font-size: clamp(11px, calc(12px * var(--game-scale,1)), 22px); line-height: 1; font-variant-numeric: tabular-nums; }
.flight-speed small { color: #90b7c6; font-size: clamp(7px, calc(5px * var(--game-scale,1)), 9px); letter-spacing: .03em; }
.flight-sync { min-width: 0; color: #e8cc81; font-family: Consolas, monospace; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flight-sync:empty { display: none; }
.flight-drive { position: absolute; height: 1px; bottom: 0; left: calc(7px * var(--game-scale,1)); right: calc(7px * var(--game-scale,1)); overflow: hidden; background: #28475466; }
.flight-drive span { position: relative; display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left; background: var(--flight-color); opacity: .7; transition: transform .15s linear, background-color .55s ease; }
.flight-drive span::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, #ecffff, transparent); opacity: 0; }
#flight-status:is([data-mode="flight"],[data-mode="warp"]) .flight-drive span::after { animation: flight-drive-flow 2.4s linear infinite; }
#flight-status[data-mode="warp"] .flight-drive span::after { animation-duration: 1.2s; }
#flight-status[data-region="interstellar"] { --flight-color: #e2c886; }
#flight-status[data-mode="warp"] { --flight-color: #b3adf0; }
.flight-arrival { position: relative; display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px 12px; overflow: hidden; background: linear-gradient(110deg, color-mix(in srgb, var(--flight-color) 12%, #0b2633), #071b25f2); border: 1px solid color-mix(in srgb, var(--flight-color) 55%, #2b4956); border-left: 3px solid var(--flight-color); border-radius: 2px 9px 2px 2px; }
.flight-arrival[data-kind="leave"] { background: #28271df2; border-color: #978559; border-left-color: #e2c886; }
.flight-arrival-mark { font-size: 24px; letter-spacing: -5px; color: var(--flight-color); padding-right: 5px; }
.flight-arrival[data-kind="leave"] .flight-arrival-mark { color: #e2c886; }
.flight-arrival > div { min-width: 0; }
.flight-arrival-label { display: block; color: #95b9c2; font-size: 8px; letter-spacing: .15em; }
.flight-arrival-name { display: block; margin-top: 4px; font-size: 17px; line-height: 1.1; letter-spacing: .08em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }
.flight-arrival-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; transform-origin: left; background: linear-gradient(90deg, var(--flight-color), #e3fffc); }
#flight-status[data-paused="true"] *, #flight-status[data-paused="true"] *::before, #flight-status[data-paused="true"] *::after, #flight-status[hidden] * { animation-play-state: paused; }
@keyframes flight-beacon { 0%, 100% { opacity: .6; } 45%, 60% { opacity: 1; } }
@keyframes flight-beacon-ring { 0%, 15% { opacity: 0; transform: scale(.6); } 28% { opacity: .5; } 60%, 100% { opacity: 0; transform: scale(1.7); } }
@keyframes flight-hostile { 0%, 8%, 20%, 100% { opacity: 1; } 4%, 14% { opacity: .3; } 32%, 80% { opacity: .65; } }
@keyframes flight-owned { 0%, 100% { opacity: .85; } 50% { opacity: 1; } }
@keyframes flight-edge { 0%, 70%, 100% { opacity: .55; transform: translateX(0); } 85% { opacity: 1; transform: translateX(20%); } }
@keyframes flight-drive-flow { 0% { opacity: 0; transform: translateX(-100%); } 30% { opacity: .65; } 100% { opacity: 0; transform: translateX(100%); } }
@media (max-width: 900px) { .flight-standing-label { display: none; } }
@media (max-width: 620px), (max-height: 520px) {
  .flight-panel { grid-template-rows: auto auto; align-content: center; column-gap: 4px; row-gap: 0; padding: 0 6px; }
  .flight-location { display: contents; }
  .flight-heading { grid-column: 1; grid-row: 1; gap: 4px; }
  .flight-details { grid-column: 1 / -1; grid-row: 2; gap: 4px; }
  .flight-coordinates { gap: 4px; font-size: clamp(7px,calc(7px * var(--game-scale,1)),9px); }
  #flight-status :is(.flight-name,.flight-name-ghost) { font-size: 10px; line-height: 1; }
  .flight-code, .flight-standing-label, .flight-mode { display: none; }
  .flight-sync { flex: none; width: 6px; font-size: 0; }
  .flight-sync:not(:empty)::after { content: '↻'; color: #e8cc81; font-size: 7px; }
  .flight-reputation { flex: none; gap: 3px; font-size: 9px; }
  .flight-speed { grid-column: 2; grid-row: 1; }
  .flight-velocity { font-size: 11px; }
  .flight-speed small { font-size: 7px; }
  .flight-arrival { gap: 7px; padding: 8px; }
  .flight-arrival-name { font-size: 13px; }
}
@media (max-width: 440px) {
  .flight-reputation { font-size: 8px; }
  .flight-reputation-label { display: none; }
  .flight-velocity { font-size: 10px; }
  .flight-speed small { font-size: 6px; }
}
@media (max-width: 340px) {
  #flight-status :is(.flight-name,.flight-name-ghost), .flight-velocity { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  #flight-status *, #flight-status *::before, #flight-status *::after { animation: none !important; transition: none !important; }
}
