@font-face {
  font-family: "USR OLED";
  src: url("./assets/DejaVuSansMono-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  background: #171918;
  --red: #ff3b32;
  --red-hot: #ff554b;
  --red-dim: #7e1d1a;
  --mono: "USR OLED", "DejaVu Sans Mono", "SFMono-Regular", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

html {
  background-color: #171918;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: transparent;
}

.page-texture {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  display: block;
  object-fit: cover;
  object-position: center;
  filter: brightness(.75);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

button,
a {
  font: inherit;
}

.stage {
  /* --v = rendered width of the VISIBLE console (alpha bbox 357,60 → 1564,981 of the 1920×1080 art).
     Spectrogram box = .18·v tall; at rest it only draws its bottom band (.62h → .95h), and peaks
     rise into the space above. Negative margins make the flex layout space the console and that
     resting band, so top / between / bottom gaps are visually equal at every viewport size.
     Height budget: .76305v + .0594v (band) + 3·(.1116v peak headroom + gap) → divisor 1.1562. */
  --gap-min: 1.25rem;
  --v: min(92vw, 1000px, calc((100vh - 3 * var(--gap-min)) / 1.1562));
  --v: min(92vw, 1000px, calc((100svh - 3 * var(--gap-min)) / 1.1562));
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

@supports (height: 100dvh) {
  .stage {
    --v: min(92vw, 1000px, calc((100dvh - 3 * var(--gap-min)) / 1.1562));
    height: 100dvh;
  }
}

/* Box the visible part of the art; the full artboard hangs inside it, offset by the transparent margins. */
.console {
  position: relative;
  flex: none;
  width: var(--v);
  height: calc(var(--v) * .76305);
}

.artboard {
  position: absolute;
  container-type: inline-size;
  left: calc(var(--v) * -.29578);
  top: calc(var(--v) * -.04971);
  width: calc(var(--v) * 1.59072);
  height: calc(var(--v) * .89478);
  margin: 0;
}

.audio-control {
  position: fixed;
  top: clamp(1rem, 2.2vw, 2rem);
  right: clamp(2.5rem, 4vw, 5rem);
  z-index: 4;
  display: grid;
  place-items: center;
  width: clamp(2.6rem, 3.2vw, 3.5rem);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(255, 74, 63, .42);
  border-radius: 50%;
  background: rgba(6, 4, 5, .68);
  color: #ff4b41;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}

.audio-control svg {
  width: 44%;
  height: 44%;
  fill: currentColor;
  filter: drop-shadow(0 0 .24rem rgba(255, 52, 43, .58));
}

.audio-control .icon-stop,
.audio-control.is-playing .icon-play {
  display: none;
}

.audio-control.is-playing .icon-stop {
  display: block;
}

.audio-control:hover,
.audio-control:focus-visible {
  border-color: rgba(255, 92, 80, .88);
  background: rgba(20, 4, 5, .82);
  outline: 0;
}

.audio-control.is-blocked {
  animation: audio-prompt 2.4s ease-in-out infinite;
}

@keyframes audio-prompt {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 0 0 0 rgba(255,55,46,0); }
  50% { box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 0 1.1rem .12rem rgba(255,55,46,.34); }
}

.spectrogram {
  position: relative;
  flex: none;
  width: min(calc(var(--v) * 1.1), 96vw);
  height: calc(var(--v) * .18);
  margin: calc(var(--v) * -.1116) 0 calc(var(--v) * -.009);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.spectrogram canvas {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 .8rem rgba(220, 47, 89, .22));
}

.master-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.screen {
  position: absolute;
  left: 23.47%;
  top: 23.66%;
  width: 53.0662%;
  height: 41.8238%;
  overflow: hidden;
  border: 1px solid #3a2524;
  background-color: #050101;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 54, 45, .025) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 54, 45, .018) 0 1px, transparent 1px 3px);
  color: #ff4b41;
  font-family: var(--mono);
  font-weight: 700;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  text-shadow:
    0 0 .018cqw rgba(255, 225, 220, .66),
    0 0 .065cqw rgba(255, 58, 48, .48),
    0 0 .13cqw rgba(255, 28, 22, .1);
}

.screen-status {
  height: 2.787cqw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 1.336cqw;
  border-bottom: .053cqw solid var(--red-dim);
  color: #db3d35;
  font-size: .733cqw;
  letter-spacing: .06em;
  line-height: 1;
}

.screen-status time {
  justify-self: end;
}

.screen-status b {
  color: var(--red-hot);
}

.screen-body {
  height: calc(100% - 2.787cqw);
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: .596cqw;
  padding: 1.26cqw 1.527cqw 1.145cqw;
  overflow: hidden;
}

.command,
.hostname,
.state,
.description,
.screen-footer p {
  margin: 0;
}

.command {
  color: #b73530;
  font-size: .779cqw;
  line-height: 1.2;
}

.command span {
  color: var(--red-hot);
}

.project-row {
  min-height: 5.23cqw;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.527cqw;
}

h1 {
  margin: .229cqw 0 0;
  color: var(--red-hot);
  font-size: 3.55cqw;
  font-weight: 700;
  line-height: .88;
  letter-spacing: -.07em;
  white-space: nowrap;
  text-shadow:
    0 0 .035cqw rgba(255, 235, 228, .88),
    0 0 .12cqw rgba(255, 65, 54, .72),
    0 0 .3cqw rgba(255, 29, 22, .22);
}

.hostname {
  margin-top: .55cqw;
  color: #e2443b;
  font-size: .802cqw;
  line-height: 1;
}

.state {
  margin-top: .802cqw;
  padding: .397cqw .565cqw;
  border: .053cqw solid var(--red-dim);
  color: var(--red-hot);
  font-size: .703cqw;
  letter-spacing: .05em;
  line-height: 1;
  white-space: nowrap;
}

.signal-rule {
  height: .504cqw;
  border-block: .053cqw solid #4f1210;
}

.signal-rule span {
  display: block;
  width: 28%;
  height: 100%;
  background: #a72521;
}

.description {
  align-self: start;
  max-width: 46.575cqw;
  color: #eb4a40;
  font-size: .825cqw;
  line-height: 1.55;
}

.screen-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.527cqw;
}

.screen-footer p {
  color: #b62d28;
  font-size: .672cqw;
  letter-spacing: .03em;
  white-space: nowrap;
}

.screen-footer a {
  min-width: 8.017cqw;
  padding: .496cqw .672cqw;
  border: .053cqw solid var(--red-dim);
  color: var(--red-hot);
  font-size: .672cqw;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.screen-footer a[hidden] {
  visibility: hidden;
}

.screen-footer a:hover,
.screen-footer a:focus-visible {
  background: #c82b25;
  color: #120202;
  outline: 0;
  text-shadow: none;
}

.programs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.selector {
  position: absolute;
  left: var(--x);
  top: 72.26%;
  width: 6.87%;
  height: 15.1%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.selector::before {
  content: "";
  position: absolute;
  left: 73.04%;
  top: 15.85%;
  width: .473cqw;
  height: .473cqw;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  z-index: 1;
}

.program-number-mask {
  position: absolute;
  left: var(--x);
  top: 46.6cqw;
  width: 2.55cqw;
  height: 1.04cqw;
  transform: translateX(-50%);
  border-radius: 50%;
  background-image: url("./assets/usr-console-oled-etched-alpha-1920-ledclean.png");
  background-repeat: no-repeat;
  background-size: 100cqw 56.25cqw;
  background-position: calc(1.275cqw - var(--x)) -47.85cqw;
  -webkit-mask-image: radial-gradient(ellipse, #000 0 45%, rgba(0, 0, 0, .82) 64%, transparent 86%);
  mask-image: radial-gradient(ellipse, #000 0 45%, rgba(0, 0, 0, .82) 64%, transparent 86%);
}

.selector.is-active::before {
  opacity: 1;
  background: #ff3029;
  box-shadow: 0 0 .496cqw .137cqw rgba(255, 44, 37, .72);
}

.selector[data-project="photon"]:not(.is-active)::before {
  opacity: 1;
  background: radial-gradient(circle at 42% 36%, #941712 0 13%, #720c09 30%, #4b0504 68%, #260101 100%);
  box-shadow:
    0 0 0 .035cqw rgba(28, 21, 21, .62),
    inset 0 .042cqw .056cqw rgba(132, 31, 26, .52);
}

.selector:focus-visible {
  outline: .092cqw solid rgba(255, 78, 68, .92);
  outline-offset: -.611cqw;
}

@media (max-width: 720px) {
  .audio-control {
    top: 1rem;
    right: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .audio-control.is-blocked {
    animation: none;
  }
}
