@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Mono:wght@400;500&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
  color-scheme: dark;
  --bg: #101916;
  --panel: #19241f;
  --border: #34443a;
  --muted: #91a096;
  --text: #edf0df;
  --lime: #d8ed9c;
  --mint: #a7ead1;
  --orange: #f0a884;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
}

button {
  font: inherit;
  cursor: pointer;
}

.app {
  max-width: 1800px;
  margin: auto;
}

.topbar {
  height: 74px;
  border-bottom: 1px solid #2c3b32;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6.1%;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.13em;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  color: var(--lime);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.brand small {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: #7e9084;
  letter-spacing: 0.1em;
  font-weight: 400;
}

.panel-heading-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.connection,
.panel-tag,
.section-label,
.eyebrow,
.stage-caption,
.ship-footer,
.radar-top,
.radar-legend,
.stat,
.control-number,
.control-item strong,
.mission-badge strong {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.09em;
}

.connection {
  color: #a7b6aa;
  display: flex;
  align-items: center;
  gap: 8px;
}

.connection i,
.live-dot {
  width: 7px;
  height: 7px;
  background: #a6e6b9;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 9px #a6e6b966;
}

.connection i.offline {
  background: #eea481;
  box-shadow: none;
}

.invite {
  background: var(--lime);
  color: #18231c;
  border: 0;
  border-radius: 4px;
  padding: 12px 17px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.invite span {
  font-size: 16px;
  margin-right: 8px;
}

.eyebrow {
  color: var(--lime);
  margin-bottom: 13px;
}

.tiny-star {
  font-size: 15px;
  margin-right: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(38px, 4.1vw, 58px);
  line-height: 1.04;
}

h1 em,
h2 em {
  font-weight: 400;
  color: var(--lime);
}

.mission-badge {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 18px;
  border: 1px solid #3b4a3e;
  border-radius: 5px;
  min-width: 239px;
}

.badge-icon {
  font-size: 22px;
  color: var(--lime);
}

.mission-badge strong,
.mission-badge small {
  display: block;
}

.mission-badge strong {
  font-size: 9px;
  color: #d7e3ca;
}

.mission-badge small {
  font-size: 12px;
  color: #92a298;
  margin-top: 5px;
}

.game-grid {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.panel-heading {
  height: 90px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #324238;
}

.section-label {
  color: #83968a;
  font-size: 9px;
}

.section-label span {
  color: var(--lime);
}

footer {
  padding: 20px 0;
}

h2 {
  font-size: 27px;
  margin-top: 5px;
}

.radar-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.ship-footer {
  height: 52px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #91a396;
  font-size: 9px;
  border-top: 1px solid #324238;
}

.controls,
.repair-status,
#encounter-settings summary {
  margin: 0;
  padding: 10px 22px;
  border-top: 1px solid #324238;
  color: #c1d1c3;
  font:
    0.875rem 'DM Mono',
    monospace;
  line-height: 1.5;
}

#encounter-settings summary {
  cursor: pointer;
}

#new-crew {
  color: var(--lime);
}

.repair-status.damaged {
  color: #ffad8d;
}

.encounter-settings {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid #324238;
  color: #a8b7aa;
  font:
    0.875rem 'DM Mono',
    monospace;
}

.encounter-settings label {
  display: grid;
  gap: 5px;
}

.encounter-settings select,
.encounter-settings button {
  padding: 7px 9px;
  border: 1px solid #596b5a;
  border-radius: 3px;
  background: #25372d;
  color: #edf0df;
  font: inherit;
}

.encounter-settings button {
  color: #d8ed9c;
}

.ship-footer strong {
  color: #d8e8d7;
  font-weight: 400;
}

.footer-star {
  font-size: 15px;
  color: var(--lime);
  margin-right: 8px;
}

.radar-stage {
  height: calc(100vh - 142px);
  background: #101b18;
  position: relative;
  overflow: hidden;
}

.flight-status {
  position: absolute;
  bottom: 16px;
  left: 20px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: #a7ead1;
  font:
    10px 'DM Mono',
    monospace;
  pointer-events: none;
}

.flight-status strong {
  color: #ffad8d;
}

.radar-top {
  position: absolute;
  top: 17px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  color: #71877a;
  font-size: 9px;
  pointer-events: none;
}

.radar-legend {
  position: absolute;
  bottom: 15px;
  left: 20px;
  display: flex;
  gap: 18px;
  color: #a8b7aa;
  font-size: 9px;
  pointer-events: none;
}

.legend-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 5px;
}

.friend {
  background: var(--mint);
}

.hostile {
  background: var(--orange);
}

.status-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 22px;
  padding: 20px 24px 23px;
  margin: 0 24px;
  border-right: 1px solid #324238;
  border-bottom: 1px solid #324238;
  border-left: 1px solid #324238;
  border-radius: 0 0 7px 7px;
  background: rgba(16, 27, 24, 0.25);
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
}

.stat > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  color: #94a398;
  font-size: 9px;
}

.stat strong {
  font-weight: 400;
  color: #dce7d7;
}

.meter {
  height: 4px;
  background: #34443a;
  border-radius: 5px;
  margin-top: 11px;
  overflow: hidden;
}

.meter i {
  height: 100%;
  width: 100%;
  display: block;
  background: var(--lime);
  transition: width 0.2s;
}

.stat:nth-child(2) .meter i {
  background: var(--mint);
}

.enemy-stat .meter i {
  background: var(--orange);
}

kbd {
  display: inline-block;
  border: 1px solid #596b5a;
  background: #344338;
  color: #e5efdb;
  border-radius: 3px;
  font:
    10px 'DM Mono',
    monospace;
  padding: 3px 5px;
  line-height: 1;
  margin: 0 2px;
}

.controls {
  display: grid;
  grid-template-columns: 1.08fr repeat(3, 1fr);
  gap: 20px;
  align-items: center;
  padding: 35px 0 40px;
}

.controls-heading h2 {
  font-size: 27px;
}

.control-item {
  display: flex;
  gap: 13px;
  border-left: 1px solid #3b4b40;
  padding-left: 22px;
  min-height: 48px;
  align-items: flex-start;
}

.control-number {
  color: #758a7b;
  font-size: 9px;
  padding-top: 1px;
}

.control-item strong {
  font-size: 10px;
  color: #dce7d7;
}

.control-item p {
  color: #92a397;
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.5;
}

.control-item kbd {
  padding: 3px 4px;
  margin: 0 1px;
}

.result {
  position: absolute;
  inset: 0;
  background: #101b18e8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.result[hidden] {
  display: none;
}

.result div {
  font:
    italic 32px 'DM Serif Display',
    Georgia,
    serif;
  color: var(--lime);
}

.result p {
  margin: 9px 0 17px;
  color: #a8b8aa;
}

.result button {
  border: 0;
  border-radius: 3px;
  background: var(--lime);
  color: #18231c;
  padding: 11px 16px;
  font:
    10px 'DM Mono',
    monospace;
}

@media (max-width: 900px) {
  .topbar {
    padding: 0 4%;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .controls-heading {
    grid-column: 1 / -1;
  }

  .control-item:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .topbar {
    height: 64px;
  }

  .brand small,
  .connection span {
    display: none;
  }

  .panel-heading-right {
    gap: 8px;
  }

  .mission-badge {
    margin-top: 20px;
    display: inline-flex;
  }

  .panel-heading {
    padding: 16px;
    height: 82px;
  }

  .panel-tag {
    font-size: 8px;
  }

  .radar-stage {
    height: 420px;
  }

  .status-row {
    gap: 10px;
    padding: 18px 14px;
  }

  .stat > div:first-child {
    font-size: 8px;
    display: block;
  }

  .stat strong {
    display: block;
    margin-top: 4px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .controls-heading,
  .control-item:last-child {
    grid-column: auto;
  }

  .control-item {
    padding-left: 14px;
  }
}
