.rpm-shell {
  min-height: 0;
}

.gauge {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  padding: 0.18rem 0.24rem 0.42rem;
}

.mini-gauge-shell {
  min-height: 0;
}

.gauge-canvas-wrap {
  position: relative;
  min-height: 0;
}

.gauge canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.gauge-footer {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  margin-top: -0.2rem;
}

.gauge-label {
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: 820;
  text-align: center;
}

.gauge.is-large .gauge-label {
  font-size: 1.08rem;
}

.gauge.is-mini {
  padding: 0.12rem 0.16rem 0.22rem;
}

.gauge.is-mini .gauge-footer {
  gap: 0.08rem;
  margin-top: -0.12rem;
}

.gauge.is-mini .gauge-label {
  overflow: hidden;
  width: 100%;
  color: var(--color-muted);
  font-size: 0.58rem;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.digital-readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  min-width: min(72%, 220px);
  min-height: 34px;
  border: 1px solid var(--color-border-strong);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.65);
  box-shadow: inset 0 0 16px rgba(82, 255, 104, 0.08);
  padding: 0.22rem 0.42rem;
}

.gauge.is-mini .digital-readout {
  min-width: min(82%, 112px);
  min-height: 21px;
  padding: 0.12rem 0.24rem;
}

.digital-value {
  color: var(--color-green);
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 12px rgba(82, 255, 104, 0.3);
}

.gauge.is-mini .digital-value {
  font-size: 0.9rem;
}

.digital-value.caution,
.readout-card span.caution {
  color: var(--color-amber);
  text-shadow: 0 0 12px rgba(255, 216, 79, 0.24);
}

.digital-value.danger,
.readout-card span.danger {
  color: var(--color-red);
  text-shadow: 0 0 12px rgba(255, 59, 50, 0.24);
}

.digital-value.unknown,
body.is-stale .digital-value {
  color: var(--color-muted);
  text-shadow: none;
}

.digital-unit {
  margin-left: 0.28rem;
  color: var(--color-muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.gauge.is-mini .digital-unit {
  margin-left: 0.14rem;
  font-size: 0.48rem;
}

.horizon-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.horizon {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  gap: 0.42rem;
  padding: 0.42rem 0.5rem 0.1rem;
}

.horizon-window {
  position: relative;
  overflow: hidden;
  width: min(100%, 184px);
  max-height: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 2px solid rgba(242, 246, 248, 0.72);
  border-radius: 50%;
  background: #06090d;
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.72), 0 0 20px rgba(84, 199, 255, 0.08);
}

.horizon-scene {
  position: absolute;
  inset: -48%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 49.5%, #f2f6f8 49.5% 50.5%, rgba(0, 0, 0, 0.12) 50.5%),
    linear-gradient(180deg, #2770b5 0 50%, #8b573c 50% 100%);
  transform-origin: 50% 50%;
  will-change: transform;
}

.horizon-line {
  position: absolute;
  left: 18%;
  right: 18%;
  height: 2px;
  background: rgba(255, 255, 255, 0.72);
  transform: translateY(-50%);
}

.horizon-line:nth-child(1) {
  top: 35%;
}

.horizon-line:nth-child(2) {
  top: 65%;
}

.horizon-aircraft {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.horizon-aircraft::before,
.horizon-aircraft::after {
  position: absolute;
  content: "";
  background: var(--color-amber);
}

.horizon-aircraft::before {
  width: 58%;
  height: 3px;
  box-shadow: 0 0 12px rgba(255, 216, 79, 0.44);
}

.horizon-aircraft::after {
  width: 3px;
  height: 18%;
}

.horizon-center {
  width: 11px;
  height: 11px;
  border: 2px solid #05070a;
  border-radius: 50%;
  background: var(--color-amber);
  z-index: 1;
}

.horizon-roll {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 2px;
  height: 16px;
  background: var(--color-text);
  transform: translateX(-50%);
}

.horizon-readouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.34rem;
}

.horizon-readout {
  border: 1px solid rgba(83, 96, 109, 0.42);
  border-radius: var(--radius-small);
  background: rgba(5, 7, 10, 0.58);
  padding: 0.32rem 0.24rem;
  text-align: center;
}

.horizon-readout strong {
  display: block;
  color: var(--color-muted);
  font-size: 0.56rem;
  text-transform: uppercase;
}

.horizon-readout span {
  color: var(--color-green);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 850;
}

@media (max-height: 720px) {
  .gauge {
    padding-bottom: 0.32rem;
  }

  .gauge.is-large .gauge-label {
    font-size: 0.94rem;
  }

  .gauge.is-mini {
    padding: 0.08rem 0.12rem 0.16rem;
  }

  .gauge.is-mini .gauge-label {
    font-size: 0.5rem;
  }

  .digital-readout {
    min-height: 30px;
  }

  .digital-value {
    font-size: 1.48rem;
  }

  .gauge.is-mini .digital-readout {
    min-height: 18px;
  }

  .gauge.is-mini .digital-value {
    font-size: 0.76rem;
  }

  .gauge.is-mini .digital-unit {
    font-size: 0.42rem;
  }

  .horizon {
    gap: 0.28rem;
    padding: 0.32rem 0.42rem 0.04rem;
  }

  .horizon-window {
    width: min(100%, 154px);
  }

  .horizon-readout {
    padding: 0.24rem 0.18rem;
  }

  .horizon-readout span {
    font-size: 0.72rem;
  }
}
