.identity,
.instruments {
  padding: 9px 12px;
  border: 1px solid #85967e;
  border-radius: 6px;
  color: #203f37;
  background: #eee9d0f5;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.oxygen-panel {
  position: absolute;
  z-index: 2;
  right: calc(150px + var(--safe-right));
  bottom: calc(18px + var(--safe-bottom));
  display: grid;
  gap: 0;
  width: min(190px, 38vw);
  padding: 0;
  border: 0;
  color: #f4f0d7;
  background: transparent;
  font: 11px/1.35 'Courier New', monospace;
  text-shadow: 0 1px 3px #061b1de6;
  pointer-events: auto;
}

.virtual-joystick {
  display: none;
}

.virtual-joystick[hidden] {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .virtual-joystick:not([hidden]) {
    position: absolute;
    z-index: 3;
    bottom: calc(76px + var(--safe-bottom));
    left: calc(14px + var(--safe-left));
    display: block;
    width: 144px;
    height: 144px;
    border: 0;
    border-radius: 50%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
}

.instrument-widget {
  min-width: 0;
  padding: 4px 0 5px;
  border-bottom: 1px solid #f4f0d76b;
  background: transparent;
}

.instrument-widget:last-child {
  border-bottom: 0;
}

.oxygen-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.oxygen-heading label {
  font-weight: bold;
}

.oxygen-heading strong {
  font-size: 13px;
  font-weight: normal;
}

.heater-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 5px;
  margin: 5px 0 0;
}

.heater-controls span {
  grid-column: 1 / -1;
  font-size: 9px;
  font-weight: bold;
  white-space: nowrap;
}

.heater-controls button {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 0 3px;
  border: 2px solid #e8d6a2;
  border-radius: 999px;
  color: #f4f0d7;
  background: #102b26;
  box-shadow: inset 0 1px 2px #061b1dcc;
  font: bold 11px 'Courier New', monospace;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.heater-controls button[aria-pressed="true"] {
  border-color: #f4f0d7;
  color: #203f37;
  background: #d4b473;
  box-shadow: inset 0 1px 2px #fff0c488;
}

.heater-off-icon {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.heater-controls button:hover:not(:disabled) {
  background: #31544a;
}

.heater-controls button[aria-pressed="true"]:hover:not(:disabled) {
  background: #e0c582;
}

.heater-controls button:focus-visible {
  outline: 3px solid #fff0c4;
  outline-offset: 2px;
}

.heater-controls button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.low-cabin {
  border-color: #bd6850;
}

.low-cabin #cabin-label,
.low-cabin #cabin-temperature,
.cold-status {
  color: #ffd0b2;
}

.cold-status {
  margin: 4px 0 0;
  font-weight: bold;
}

.cold-status[hidden] {
  display: none;
}

meter {
  display: block;
  width: 100%;
  height: 17px;
  margin: 4px 0 0;
  padding: 2px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid #e8d6a2;
  border-radius: 999px;
  background: #102b26;
  box-shadow: inset 0 2px 3px #061b1dcc, 0 1px 0 #6f542e;
}

meter::-webkit-meter-bar {
  border: 0;
  border-radius: 999px;
  background: #102b26;
}

meter::-webkit-meter-optimum-value {
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0b4 0%, #d9b45d 45%, #a77b34 100%);
  box-shadow: inset 0 1px 2px #fff8d9a8;
}

meter::-moz-meter-bar {
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0b4 0%, #d9b45d 45%, #a77b34 100%);
  box-shadow: inset 0 1px 2px #fff8d9a8;
}

#cabin-meter::-webkit-meter-optimum-value {
  background: linear-gradient(180deg, #d8edb0 0%, #8dbb71 48%, #547c4b 100%);
}

#cabin-meter::-moz-meter-bar {
  background: linear-gradient(180deg, #d8edb0 0%, #8dbb71 48%, #547c4b 100%);
}

#oxygen-meter::-webkit-meter-optimum-value {
  background: linear-gradient(180deg, #c5ead2 0%, #67bd9e 48%, #347c71 100%);
}

#oxygen-meter::-moz-meter-bar {
  background: linear-gradient(180deg, #c5ead2 0%, #67bd9e 48%, #347c71 100%);
}

.low-oxygen #oxygen-label,
.low-oxygen #oxygen-time,
.low-battery #battery-label,
.low-battery #battery-percent {
  color: #ffd0b2;
}

.low-battery #battery-meter::-webkit-meter-optimum-value {
  background: linear-gradient(180deg, #f4c39b 0%, #d77a54 48%, #963d32 100%);
}

.low-battery #battery-meter::-moz-meter-bar {
  background: linear-gradient(180deg, #f4c39b 0%, #d77a54 48%, #963d32 100%);
}

.low-oxygen #oxygen-meter::-webkit-meter-optimum-value {
  background: linear-gradient(180deg, #f4c39b 0%, #d77a54 48%, #963d32 100%);
}

.low-oxygen #oxygen-meter::-moz-meter-bar {
  background: linear-gradient(180deg, #f4c39b 0%, #d77a54 48%, #963d32 100%);
}

.notice-card {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 40px - var(--safe-left) - var(--safe-right)));
  max-height: 62%;
  overflow: auto;
  border: 1px solid #c4cfa7;
  border-radius: 8px;
  padding: 28px;
  color: #f4f0d7;
  background: #24463fed;
  box-shadow: 0 12px 45px #102b2626;
}

.notice-card h2 {
  margin: 14px 0 12px;
  font-size: 28px;
  font-weight: normal;
  line-height: 1.12;
}

.notice-card p {
  margin: 0 0 20px;
  font: 13px/1.65 'Courier New', monospace;
}

#notice-body {
  white-space: pre-line;
}

.notice-card .notice-result {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid #c4cfa7;
  font-size: 14px;
}

.notice-card .notice-result[hidden] {
  display: none;
}

.notice-result strong {
  font-size: 20px;
}

.notice-card button {
  background: #d4b473;
  color: #203f37;
  border-color: #d4b473;
}

.notice-photos {
  margin: 14px 0;
  padding-top: 10px;
  border-top: 1px solid #c4cfa7;
}

.notice-photos h3,
.photo-album-panel h3 {
  margin: 0 0 9px;
  font: bold 12px/1.45 'Courier New', monospace;
}

.photo-archive-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-archive-card {
  overflow: hidden;
  border: 1px solid #a7ad91;
  border-radius: 4px;
  background: #071a20;
}

.photo-archive-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.photo-archive-caption {
  display: grid;
  gap: 3px;
  padding: 5px 7px;
  color: #203f37;
  background: #eee9d0;
  font: 10px/1.35 'Courier New', monospace;
}

.photo-archive-caption strong {
  overflow-wrap: anywhere;
}

.photo-archive-caption span {
  text-align: right;
}

.photo-album-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #a7ad91;
}

.photo-album-panel>p {
  margin: 0 0 8px;
}

.photo-album-panel .photo-archive-list {
  max-height: min(34dvh, 260px);
}

[hidden] {
  display: none !important;
}

.actions {
  display: grid;
  grid-template-columns: auto;
  gap: 7px;
}

.actions button {
  min-height: 36px;
  padding: 8px 12px;
}

.hud-icon-button,
.instrument-icon-button,
.mobile-photo-control {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 7px;
  border: 1px solid #d4b473;
  border-radius: 50%;
  color: #f4f0d7;
  background: #24463fdd;
  box-shadow: 0 2px 7px #102b2670;
}

.hud-icon-button svg,
.instrument-icon-button svg,
.mobile-photo-control svg {
  display: block;
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hud-icon-button:hover:not(:disabled),
.instrument-icon-button:hover:not(:disabled),
.mobile-photo-control:hover:not(:disabled) {
  background: #3a6156;
}

.hud-icon-button:active:not(:disabled),
.instrument-icon-button:active:not(:disabled),
.mobile-photo-control:active:not(:disabled) {
  background: #52786a;
}

.hud-icon-button:focus-visible,
.instrument-icon-button:focus-visible,
.mobile-photo-control:focus-visible {
  outline: 2px solid #f4f0d7;
  outline-offset: 3px;
}

.mission-button[aria-expanded="true"] {
  border-color: #f4f0d7;
  color: #203f37;
  background: #d4b473;
}

.instrument-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 0 0 2px;
}

.light-button {
  justify-self: end;
  margin: 0;
}

#light-toggle[aria-pressed="true"] {
  border-color: #f4f0d7;
  color: #203f37;
  background: #d4b473;
  box-shadow: 0 0 0 2px #d4b47355, 0 2px 7px #102b2670;
}

.mobile-photo-control {
  display: grid;
  margin: 0;
}

#photo-touch[aria-pressed="true"] {
  border-color: #f4f0d7;
  color: #203f37;
  background: #d4b473;
  box-shadow: 0 0 0 2px #d4b47355, 0 2px 7px #102b2670;
}

button:disabled {
  opacity: .78;
  cursor: not-allowed;
}

.dashboard button {
  border-color: #d4b473;
  color: #f4f0d7;
  background: #24463fdd;
  box-shadow: 0 2px 5px #102b2655;
}

#action:not(:disabled) {
  background: #d4b473;
  color: #203f37;
  border-color: #d4b473;
}

dialog {
  width: min(540px, calc(100% - 36px - var(--safe-left) - var(--safe-right)));
  max-height: calc(100dvh - 48px - var(--safe-top) - var(--safe-bottom));
  overflow: auto;
  border: 1px solid #49624b;
  border-radius: 8px;
  padding: 30px;
  color: #203f37;
  background: #eee9d0;
  box-shadow: 0 20px 80px #102b264d;
}

dialog::backdrop {
  background: #102b2699;
}

.photo-dialog {
  width: min(760px, calc(100% - 28px - var(--safe-left) - var(--safe-right)));
  padding: 22px;
}

.photo-dialog h2 {
  margin: 0 0 8px;
  font-size: 25px;
}

.photo-dialog>p {
  margin: 0 0 8px;
}

.photo-species {
  color: #53684c;
  font-weight: bold !important;
}

.photo-capture-stage {
  position: relative;
}

#photo-viewfinder {
  display: block;
  width: 100%;
  height: min(52dvh, 420px);
  min-height: 210px;
  border: 1px solid #839378;
  background: #071a20;
}

.photo-prints {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 9px;
  display: grid;
  gap: 7px;
  width: min(142px, 32%);
  max-height: calc(100% - 18px);
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.photo-print {
  overflow: hidden;
  border: 1px solid #e8dcb4;
  border-radius: 4px;
  background: #071a20eF;
  box-shadow: 0 2px 9px #0009;
}

.photo-print-image {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: top left;
}

.photo-print-score {
  display: block;
  padding: 3px 6px;
  color: #f4f0d7;
  font: bold 11px/1.2 'Courier New', monospace;
  text-align: right;
}

.photo-readout {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 0 0 !important;
}

.photo-readout>span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.photo-readout strong {
  font-size: 16px;
}

.photo-readout strong.is-photo-ready {
  color: #24794a;
}

.photo-bonus-readout {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 14px;
  margin-top: 8px;
  font: 10px/1.4 'Courier New', monospace;
}

.photo-bonus-readout label {
  margin: 0;
}

.photo-bonus-readout progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 10px;
  accent-color: #24794a;
}

.photo-bonus-readout strong {
  font-size: 12px;
  font-weight: normal;
}

.photo-dialog .dialog-actions {
  justify-content: flex-end;
  margin-top: 13px;
}

.photo-dialog .dialog-actions button:first-child {
  background: transparent;
  color: inherit;
}

.photo-dialog button:disabled {
  opacity: .42;
}

.photo-feedback {
  position: absolute;
  left: 50%;
  bottom: calc(112px + var(--safe-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 36px);
  margin: 0;
  padding: 10px 15px;
  border: 1px solid #c4cfa7;
  border-radius: 5px;
  color: #f4f0d7;
  background: #24463fed;
  font: 12px/1.5 'Courier New', monospace;
  text-align: center;
}

dialog h2 {
  font-size: 30px;
  font-weight: normal;
  margin: 12px 0 25px;
}

dialog label {
  display: block;
  font: bold 11px 'Courier New', monospace;
  margin: 18px 0 7px;
}

dialog select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #839378;
  border-radius: 4px;
  background: #f8f5e5;
  color: #203f37;
  font: 13px 'Courier New', monospace;
}

dialog select:focus-visible {
  outline: 3px solid #bd813d;
  outline-offset: 3px;
}

dialog p {
  font: 12px/1.6 'Courier New', monospace;
}

.option-preview {
  color: #53684c;
}

.editor-link {
  display: inline-block;
  margin: 10px 0;
  border: 1px solid #85967e;
  border-radius: 5px;
  padding: 9px 12px;
  color: #203f37;
  background: #eee9d0;
  text-decoration: none;
}

.editor-link:hover {
  background: #e3dcbf;
}

.option-controls {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid #a7ad91;
}

.option-controls h3 {
  margin: 0 0 9px;
  font: bold 12px/1.4 'Courier New', monospace;
}

.option-controls p {
  margin: 5px 0;
}

.option-controls .key-guide {
  font: 10px/1.5 'Courier New', monospace;
}

.control-settings {
  display: grid;
  gap: 10px;
  margin: 10px 0;
}

.binding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  margin: 0;
  padding: 10px;
  border: 1px solid #a7ad91;
  border-radius: 5px;
}

.binding-grid legend {
  padding: 0 5px;
  font: bold 10px 'Courier New', monospace;
}

.binding-field {
  display: grid;
  min-width: 0;
  gap: 4px;
  font: 10px/1.3 'Courier New', monospace;
}

.binding-field button,
.binding-field select {
  width: 100%;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid #768b72;
  border-radius: 4px;
  background: #f8f5e5;
  color: var(--ink);
  font: 10px 'Courier New', monospace;
  text-align: left;
}

.binding-capture {
  cursor: pointer;
}

.binding-grid :focus-visible,
.secondary-control:focus-visible {
  outline: 3px solid #a56330;
  outline-offset: 2px;
}

.control-binding-status {
  min-height: 1.4em;
  margin: 0;
  font: 10px/1.4 'Courier New', monospace;
}

.secondary-control {
  justify-self: start;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #768b72;
  border-radius: 4px;
  background: #f8f5e5;
  color: var(--ink);
  font: 10px 'Courier New', monospace;
  cursor: pointer;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 25px;
}

.dialog-actions button:first-child {
  background: #24463f;
  color: #f4f0d7;
}

@media (max-width: 600px) {
  .binding-grid {
    grid-template-columns: 1fr;
  }

  .identity,
  .instruments {
    padding: 8px;
  }

  .oxygen-panel {
    right: calc(100px + var(--safe-right));
    width: min(190px, calc(100vw - 32px - var(--safe-left) - var(--safe-right)));
  }

  .notice-card {
    padding: 20px;
  }

  .notice-card h2 {
    font-size: 24px;
  }

  .notice-card p {
    font-size: 11px;
  }

  .photo-archive-list {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    max-height: 150px;
  }

  .actions {
    grid-template-columns: minmax(0, 1fr);
    width: min(135px, calc(100vw - 190px - var(--safe-left) - var(--safe-right)));
    max-width: 135px;
  }

  .actions button {
    width: 100%;
    font-size: 9px;
    padding: 7px 8px;
  }

  .hud-icon-button,
  .instrument-icon-button,
  .mobile-photo-control {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
  }

  .mobile-photo-control {
    display: grid;
  }

  .heater-controls {
    gap: 4px;
  }

  .heater-controls button {
    min-height: 40px;
  }

  dialog {
    padding: 23px;
  }
}

@media (max-width: 380px) {

  .hud-icon-button,
  .instrument-icon-button,
  .mobile-photo-control {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 6px;
  }

  .hud-icon-button svg,
  .instrument-icon-button svg,
  .mobile-photo-control svg {
    width: 22px;
    height: 22px;
  }
}

@media (max-height: 500px) {
  .oxygen-panel {
    padding: 6px 9px;
  }

  .notice-card {
    top: 48%;
    max-height: 78%;
    padding: 18px 24px;
  }

  .notice-card h2 {
    font-size: 22px;
    margin: 8px 0;
  }

  .notice-card p {
    font-size: 11px;
    margin-bottom: 12px;
  }
}
