.hud-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  color: #f4efe6;
  pointer-events: none;
  font-family: "Courier Prime", ui-monospace, monospace;
}

.hud-root,
.hud-root * {
  box-sizing: border-box;
}

.hud-root[hidden] {
  display: none;
}

.hud-root a,
.hud-root button,
.hud-root input {
  pointer-events: auto;
}

.hud-top {
  position: absolute;
  top: 18px;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.hud-home {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 3px 4px;
  background: transparent;
  color: #f4efe6;
  cursor: pointer;
  font: 800 15px/1 Archivo, system-ui, sans-serif;
  font-stretch: 120%;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .82), 0 0 2px rgba(0, 0, 0, .9);
}

.hud-home:hover {
  color: #fff9ef;
}

.hud-nav {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0;
}

.hud-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 8px;
  border-radius: 4px;
  color: rgba(239, 233, 220, .82);
  font: 24px/1 "VT323", ui-monospace, monospace;
  letter-spacing: .12em;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .78);
}

.hud-nav-link:hover,
.hud-nav-link:focus-visible {
  color: #fff8ee;
}

.hud-nav-link.is-active {
  background: #f1ece2;
  color: #15161b;
  text-shadow: none;
}

.hud-bottom {
  position: absolute;
  right: 22px;
  bottom: 20px;
  display: grid;
  justify-items: end;
  gap: 9px;
}

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

.hud-hint {
  max-width: min(760px, calc(100vw - 44px));
  color: rgba(239, 233, 220, .78);
  font: 16px/1.1 "VT323", ui-monospace, monospace;
  letter-spacing: .08em;
  text-align: right;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .9);
  text-transform: uppercase;
}

.hud-pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hud-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  padding: 3px 12px;
  background: rgba(12, 13, 18, .72);
  color: rgba(239, 233, 220, .88);
  cursor: pointer;
  font: 19px/1 "VT323", ui-monospace, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .8);
}

.hud-pill:hover,
.hud-pill:focus-visible {
  color: #fff8ed;
  border-color: rgba(255, 255, 255, .34);
}

/* Reachy's pill only shows on touch screens (with a mouse, the robot itself and the R key do the job) */
.hud-pill.hud-reachy {
  display: none;
}

@media (hover: none) {
  .hud-pill.hud-reachy:not([hidden]) {
    display: inline-flex;
  }
}

.hud-pill.is-sound-on {
  color: #ffb867;
  border-color: rgba(255, 184, 103, .82);
}

.hud-back[hidden] {
  display: none;
}

.hud-tooltip {
  position: fixed;
  z-index: 48;
  max-width: 260px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 5px;
  background: rgba(10, 11, 15, .8);
  color: #f4efe6;
  font: 18px/1 "VT323", ui-monospace, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .9);
  opacity: 0;
  transform: translate3d(0, 4px, 0);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
}

.hud-tooltip.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.hud-card {
  position: absolute;
  top: 64px;
  right: 24px;
  width: min(380px, calc(100vw - 48px));
  max-height: 70vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(9, 10, 14, .78);
  color: #e9e4da;
  box-shadow: 12px 16px 38px rgba(0, 0, 0, .42);
  backdrop-filter: blur(6px) saturate(1.1);
  pointer-events: auto;
}

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

.hud-card-label {
  margin: 0 0 8px;
  color: #ffb867;
  font: 19px/1 "VT323", ui-monospace, monospace;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.hud-card-title {
  margin: 0 0 9px;
  color: #fff8ed;
  font: 700 26px/1.04 Archivo, system-ui, sans-serif;
  font-stretch: 95%;
  letter-spacing: -.02em;
}

.hud-card-subtitle {
  margin: 0 0 12px;
  color: rgba(239, 233, 220, .68);
  font: 18px/1 "VT323", ui-monospace, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hud-card-body {
  color: #e9e4da;
  font: 15px/1.55 "Courier Prime", ui-monospace, monospace;
}

.hud-card-body p {
  margin: 0 0 12px;
}

.hud-card-body ul {
  margin: 0 0 12px;
  padding-left: 1.2em;
}

.hud-card-body a {
  color: #ffb867;
  text-decoration: underline;
  text-decoration-color: rgba(255, 184, 103, .62);
  text-underline-offset: .18em;
}

.hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.hud-card .hud-pill {
  min-height: 26px;
  font-size: 18px;
  background: rgba(18, 19, 25, .86);
}

.hud-cd-status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 11px 0 12px;
  color: #ffb867;
  font: 18px/1 "VT323", ui-monospace, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hud-cd-meter {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}

.hud-cd-meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: #ffb867;
}

.hud-cd-controls {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-top: 12px;
}

.hud-cd-control {
  width: 34px;
  height: 30px;
  padding: 0;
  font-size: 20px;
}

.hud-volume {
  flex: 1;
  min-width: 90px;
  accent-color: #ffb867;
}

.hud-modal-backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .22);
  pointer-events: auto;
}

.hud-modal-backdrop[hidden] {
  display: none;
}

.hud-credits-card {
  width: min(520px, calc(100vw - 40px));
  max-height: min(76vh, 680px);
  overflow: auto;
  padding: 34px 36px 28px;
  border-radius: 3px;
  background:
    linear-gradient(#d75c4e 0 3px, transparent 3px),
    repeating-linear-gradient(#f3ecd9 0 31px, #bad2f0 32px 33px),
    #f3ecd9;
  color: #25201a;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .48);
  transform: rotate(-1deg);
}

.hud-credits-card h2 {
  margin: 0 0 18px;
  color: #1d1a17;
  font: 800 34px/1 Archivo, system-ui, sans-serif;
  font-stretch: 110%;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

.hud-credits-card dl {
  margin: 0;
  font: 15px/1.6 "Courier Prime", ui-monospace, monospace;
}

.hud-credits-card dt {
  margin-top: 12px;
  font-weight: 700;
}

.hud-credits-card dd {
  margin: 0;
}

.hud-credits-card p {
  margin: 16px 0 0;
  font: 15px/1.6 "Courier Prime", ui-monospace, monospace;
}

.hud-credits-card .hud-pill {
  margin-top: 20px;
  background: rgba(21, 22, 27, .88);
  color: #f3ecd9;
}

.hud-toast {
  position: absolute;
  left: 50%;
  bottom: 76px;
  max-width: min(520px, calc(100vw - 40px));
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(12, 13, 18, .76);
  color: #f4efe6;
  font: 18px/1.05 "VT323", ui-monospace, monospace;
  letter-spacing: .09em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.hud-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hud-root :focus-visible {
  outline: 2px solid #ffb867;
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .hud-top {
    top: 12px;
    left: 12px;
    right: 12px;
    gap: 10px;
    align-items: center;
  }

  .hud-home {
    max-width: 42vw;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hud-nav {
    gap: 1px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .hud-nav-link {
    min-height: 25px;
    padding: 2px 6px;
    font-size: 20px;
    letter-spacing: .08em;
  }

  .hud-bottom {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .hud-hint {
    display: none;
  }

  .hud-pill {
    min-height: 25px;
    padding: 3px 9px;
    font-size: 17px;
  }

  .hud-card {
    top: auto;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 55vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 14px 14px 0 0;
    padding: 16px 16px 70px;
  }

  .hud-card-title {
    font-size: 24px;
  }

  .hud-tooltip {
    font-size: 17px;
  }

  .hud-toast {
    bottom: 56px;
  }
}

/* phones in portrait: the name gets its own line instead of being cut off */
@media (max-width: 460px) {
  .hud-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .hud-home {
    max-width: none;
    font-size: 14px;
  }

  .hud-nav {
    margin-left: -6px;
  }
}

/* phones in landscape / short windows: a smaller card that leaves the prop visible */
@media (max-height: 520px) and (min-width: 701px) {
  .hud-top {
    top: 10px;
  }

  .hud-card {
    top: 46px;
    width: min(330px, 42vw);
    max-height: calc(100vh - 104px);
    padding: 12px 14px;
  }

  .hud-card-label {
    margin-bottom: 5px;
    font-size: 17px;
  }

  .hud-card-title {
    margin-bottom: 5px;
    font-size: 21px;
  }

  .hud-card-subtitle {
    margin-bottom: 8px;
    font-size: 16px;
  }

  .hud-card-body {
    font-size: 13px;
    line-height: 1.42;
  }

  .hud-cd-status {
    margin: 6px 0 8px;
  }

  .hud-cd-controls {
    margin-top: 8px;
  }

  .hud-hint {
    display: none;
  }
}

/* keyboard hints mean nothing on a touch screen */
@media (hover: none) and (pointer: coarse) {
  .hud-hint,
  .hud-kbd {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hud-tooltip,
  .hud-toast {
    transition: none;
  }
}
