/* --== SIGNAL LOST ==-- */

#signalLostScreen.active {
  overflow: hidden;
  color: #b0e0ff;
  background: #000;
  font-family: "3270", sans-serif;
}

#signalLostScreen [hidden] {
  display: none !important;
}

#signalLostHeader {
  flex: 0 0 auto;
}

#signalLostHeader .titleReturn {
  min-width: 0;
}

#signalLostContent {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  width: 100%;
  justify-content: flex-start;
  overflow: hidden;
  font-size: 28px;
}

#sl-status {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 2px;
  color: #91adbd;
  font-size: 24px;
  text-align: center;
}

#sl-status.sl-error {
  color: #e69aa6;
}

.sl-lobby {
  width: min(900px, 100%);
  margin: auto;
  padding: 14px 18px 18px;
  text-align: center;
}

.sl-title {
  margin: 8px 0 18px;
  color: #e9f7ff;
  font-size: clamp(44px, 5vw, 72px);
  line-height: 1;
  letter-spacing: 0.1em;
}

#sl-crew {
  width: min(560px, 100%);
  margin: 18px auto;
  padding: 0;
  text-align: left;
}

#sl-crew li {
  margin: 7px 0;
  padding: 10px 12px;
  border-left: 2px solid currentColor;
  background: #070b0e;
  font-size: 24px;
  list-style: none;
  overflow-wrap: anywhere;
}

.sl-menu-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

#signalLostContent button {
  min-height: 42px;
  padding: 7px 13px;
  color: inherit;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 0;
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}

#signalLostContent button:hover:not(:disabled),
#signalLostContent button:focus-visible {
  color: #000;
  background: #b0e0ff;
}

#signalLostContent button:disabled {
  opacity: 0.38;
  cursor: default;
}

#signalLostContent :focus-visible {
  outline: 2px solid #ffdd55;
  outline-offset: 3px;
}

#signalLostContent .sl-primary {
  color: #ffdd55;
  border-color: #ffdd55;
}

#signalLostContent .sl-primary:hover:not(:disabled),
#signalLostContent .sl-primary:focus-visible {
  color: #000;
  background: #ffdd55;
}

.sl-help {
  margin-top: 16px;
  color: #9cb2bf;
  font-size: 21px;
  line-height: 1.45;
}

.sl-flight {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
}

.sl-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  border: 2px solid #b0e0ff;
  background: #000;
  box-shadow: 0 0 16px rgba(176, 224, 255, 0.08);
}

#sl-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
  cursor: none !important;
}

.sl-message {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10%;
  z-index: 5;
  padding: 12px;
  color: #ffdd55;
  background: rgba(0, 0, 0, 0.9);
  border-block: 1px solid #6b5d2d;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
  font-size: clamp(18px, 2vw, 28px);
}

.sl-results {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: 95%;
  max-height: 95%;
  overflow-y: auto;
  transform: translate(-50%, -50%);
  padding: 18px;
  color: #ffdd55;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #ffdd55;
  text-align: center;
}

.sl-results > strong {
  display: block;
  margin-bottom: 12px;
  font-size: 36px;
  font-weight: normal;
}

.sl-result-summary {
  margin: 0 0 14px;
  color: #d7eefc;
  font-size: 22px;
  line-height: 1.35;
}

.sl-result-scores {
  display: grid;
  gap: 7px;
  margin: 12px 0 16px;
}

.sl-result-score {
  display: grid;
  grid-template-columns: minmax(120px, 0.55fr) minmax(0, 1.45fr) auto;
  gap: 14px;
  align-items: center;
  padding: 8px 10px;
  border-left: 2px solid var(--pilot-color, #b0e0ff);
  color: #fff;
  background: #070b0e;
  text-align: left;
  font-size: 24px;
}


.sl-ready-status {
  margin: 10px 0;
  color: #d7eefc;
  font-size: 23px;
}

.sl-ready-state {
  min-width: 84px;
  color: #ffdd55;
  text-align: right;
  white-space: nowrap;
}

.sl-ready-state.ready {
  color: #9fe4b1;
}

.sl-result-details {
  white-space: nowrap;
}

.sl-result-score span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--pilot-color, #b0e0ff);
}


.sl-result-details {
  min-width: 0;
  color: #fff;
  text-align: right;
  line-height: 1.25;
  overflow-wrap: normal;
}

.sl-touch {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 6;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  color: #b0e0ff;
  text-align: center;
  font-size: 17px;
}

.sl-touch > div {
  pointer-events: auto;
}

.sl-pad {
  --stick-x: 0px;
  --stick-y: 0px;
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 4px;
  border: 1px solid #6e8b9b;
  border-radius: 50%;
  background: rgba(7, 16, 23, 0.88);
  touch-action: none;
  user-select: none;
}

.sl-pad::before,
.sl-pad::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: #324651;
  transform: translate(-50%, -50%);
}

.sl-pad::before {
  width: 70%;
  height: 1px;
}

.sl-pad::after {
  width: 1px;
  height: 70%;
}

.sl-pad span {
  position: absolute;
  z-index: 1;
  left: calc(50% - 15px);
  top: calc(50% - 15px);
  width: 30px;
  height: 30px;
  border: 1px solid #b0e0ff;
  background: #172932;
  transform: translate(var(--stick-x), var(--stick-y));
  pointer-events: none;
}

.sl-aim-pad {
  border-color: #9c8951;
}

.sl-settings-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.94);
}

.sl-settings-inner {
  width: min(760px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 16px;
  color: #b0e0ff;
  background: #000;
  border: 1px solid #b0e0ff;
}

.sl-settings-inner .titleReturn {
  font-size: 28px;
}

.sl-settings-inner .setting {
  margin: 24px 0 10px;
}

.sl-settings-inner .volumeText {
  width: 42%;
  flex-shrink: 0;
  padding: 0;
  text-align: left;
}

.sl-settings-inner .audioSlider {
  flex: 1;
  min-width: 0;
}

#sl-volume-value {
  width: 4ch;
  margin-left: 14px;
  text-align: right;
}

body:has(#signalLostScreen.active) #custom-pointer {
  display: none;
}

@media (pointer: coarse), (max-width: 1024px) {
  .sl-touch {
    display: flex;
  }
}

@media (max-width: 1024px) {
  #signalLostContent {
    font-size: 24px;
  }

  #sl-status {
    font-size: 20px;
  }

  .sl-title {
    font-size: clamp(38px, 9vw, 58px);
  }

  #sl-crew li {
    font-size: 21px;
  }

  .sl-settings-inner .setting {
    align-items: center;
  }
}

@media (max-width: 600px) {
  .sl-lobby {
    padding: 6px 2px 10px;
  }

  #sl-status,
  .sl-help {
    font-size: 18px;
  }

  .sl-title {
    letter-spacing: 0.05em;
  }

  #sl-crew li {
    font-size: 19px;
  }

  .sl-pad {
    width: 84px;
    height: 84px;
  }

  .sl-touch > div > span {
    display: none;
  }

  .sl-results {
    width: 95%;
    padding: 12px;
  }

  .sl-result-score {
    grid-template-columns: minmax(80px, 0.6fr) minmax(0, 1.4fr) auto;
    gap: 7px;
    font-size: 18px;
  }

  .sl-result-details {
    text-align: left;
    font-size: 16px;
    white-space: nowrap;
  }

  .sl-ready-state {
    min-width: 64px;
    font-size: 16px;
  }

  .sl-settings-panel {
    padding: 8px;
  }

  .sl-settings-inner {
    padding: 12px;
  }

  .sl-settings-inner .titleReturn {
    font-size: 22px;
  }

  .sl-settings-inner .setting {
    flex-wrap: wrap;
    gap: 8px;
  }

  .sl-settings-inner .volumeText {
    width: 100%;
  }
}

@media (max-height: 550px) and (orientation: landscape) {
  .sl-pad {
    width: 68px;
    height: 68px;
  }
}

/* --== Settings / Overflow Guard ==-- */
#signalLostScreen,
#signalLostScreen.active,
#signalLostHeader,
#signalLostContent,
#signalLostContent > *,
.sl-lobby,
.sl-flight,
.sl-viewport,
.sl-settings-panel,
.sl-settings-inner {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

#signalLostScreen.active {
  width: 100%;
  max-width: 100%;
}

#signalLostHeader .titleReturn {
  min-width: 0;
  max-width: 100%;
}

.sl-settings-panel {
  box-sizing: border-box;
  overflow: hidden;
}

.sl-settings-inner {
  box-sizing: border-box;
  width: min(760px, 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sl-settings-inner .setting {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.sl-setting-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.sl-setting-toggle-text {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

#sl-pixelation-status {
  flex: 0 0 auto;
  text-align: right;
}

.sl-settings-inner .mobileAudioSetting {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sl-settings-inner .audioSlider {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 600px) {
  .sl-settings-inner .mobileAudioSetting {
    flex-wrap: wrap;
  }

  .sl-settings-inner .volumeText {
    width: 100%;
    max-width: 100%;
  }

  .sl-settings-inner .audioSlider {
    flex: 1 1 calc(100% - 5ch - 12px);
  }

  #sl-volume-value {
    flex: 0 0 4ch;
    margin-left: 0;
  }
}
