#rack-env {
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --primary: #8dff3c;
  --mid: #2fa82f;
  --backdrop: #031c06;
  --dim: #a9c9a4;
  --ink: #e6e2ea;
  --line: rgba(255, 255, 255, 0.14);
  --surface: rgba(12, 10, 16, 0.8);
  --failed: #ff4a5a;
  --restarting: #ffc23d;
  --gutter: 24px;
  position: fixed;
  inset: 0;
  z-index: 91000;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 45%, var(--backdrop) 0%, #050008 70%);
  color: #fff;
  font-family: 'Courier New', monospace;
  transition: opacity 0.25s ease-in;
}

#rack-env.theme-vault {
  --primary: #d46cff;
  --mid: #9d04cc;
  --backdrop: #0e0b12;
  --dim: #a7a1ad;
}

#rack-env.theme-red {
  --primary: #ff5a4a;
  --mid: #b3121f;
  --backdrop: #1c0405;
  --dim: #c9a6a4;
}

#rack-env.theme-blue {
  --primary: #4ab8ff;
  --mid: #0b5fcc;
  --backdrop: #03101c;
  --dim: #a4b6c9;
}

#rack-env.theme-amber {
  --primary: #ffb000;
  --mid: #b36b00;
  --backdrop: #1c1003;
  --dim: #c9b8a4;
}

#rack-env.theme-white {
  --primary: #dfe9ff;
  --mid: #7d8aa6;
  --backdrop: #0c0e14;
  --dim: #b4b8c2;
}

#rack-env.theme-cyan {
  --primary: #3dfff0;
  --mid: #0a9e94;
  --backdrop: #031a19;
  --dim: #a4c9c6;
}

#rack-env[hidden] {
  display: none;
}

#rack-env .rack-header {
  position: relative;
  z-index: 20;
  display: grid;
  gap: 8px;
  padding: 16px var(--gutter) 6px;
}

#rack-env .rack-head-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

#rack-env .rack-title {
  margin: 0;
  font-size: 30px;
  font-weight: bold;
  letter-spacing: -0.04em;
  color: var(--primary);
  text-shadow: 0 0 6px var(--mid);
  white-space: nowrap;
}

#rack-env .rack-title span {
  font-size: 22px;
  font-weight: normal;
  text-transform: uppercase;
}

#rack-env .rack-status {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 6px 16px;
  border: 1px solid var(--primary);
  border-radius: 20px;
  background: var(--surface);
  color: var(--primary);
  font-size: 13px;
  white-space: nowrap;
}

#rack-env .rack-status-name {
  font-weight: bold;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

#rack-env .rack-status-sep {
  padding: 0 0.5em;
}

#rack-env .rack-ticker {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#rack-env .rack-menubar {
  display: flex;
  gap: 4px;
  margin-left: auto;
  font-size: 12px;
}

#rack-env .menu {
  position: relative;
}

#rack-env .menu-title {
  min-width: 0;
  min-height: 0;
  padding: 3px 8px;
  background: none;
  border: 1px solid transparent;
  box-shadow: none;
  color: var(--dim);
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

#rack-env .menu-title[aria-expanded="true"],
#rack-env .menu-title:hover,
#rack-env .menu-title:focus-visible {
  color: #fff;
  border-color: color-mix(in srgb, var(--primary) 60%, transparent);
  outline: none;
}

#rack-env .menu-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 190px;
  padding: 4px;
  background: rgba(10, 0, 18, 0.95);
  border: 1px solid color-mix(in srgb, var(--primary) 60%, transparent);
  box-shadow: 0 0 12px rgba(157, 4, 204, 0.4);
  z-index: 30;
}

#rack-env .menu-drop button {
  display: block;
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 4px 8px 4px 22px;
  background: none;
  border: 0;
  box-shadow: none;
  color: #e9dcf3;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#rack-env .menu-drop button:hover,
#rack-env .menu-drop button:focus-visible {
  background: #4a0080;
  color: #fff;
  outline: none;
}

#rack-env .menu-drop button.checked::before {
  content: "\2713";
  position: absolute;
  left: 7px;
}

#rack-env .menu-drop hr {
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  margin: 4px 2px;
}

#rack-env .rack-body {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

#rack-env .rack-stage {
  --c: var(--primary);
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(220px, 0.5fr) minmax(300px, 0.8fr) minmax(340px, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "hive hero details side"
    "marks marks feature side";
  gap: 16px 28px;
  padding: 8px var(--gutter) 16px;
  transition: filter 0.6s var(--ease);
}

#rack-env .rack-stage.stale {
  filter: grayscale(0.85) brightness(0.75);
}

#rack-env .grid-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -2;
}

/* tsubi's spinBG: a slow colour wheel under the cloud, so the mist has something to tint */
#rack-env .spin-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.2;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: -2;
}

#rack-env .spin-bg-wheel {
  position: absolute;
  left: 50%;
  top: 50%;
  /* just enough to cover the corners while it turns; the stops are tsubi's 300% wheel rescaled */
  width: 140%;
  aspect-ratio: 1;
  translate: -50% -50%;
  background:
    radial-gradient(black 10.7%, transparent 42.9%, black 107%),
    conic-gradient(#000, var(--primary), #000, var(--dim), #000, var(--mid), #000, #93afff, #000, var(--primary), #000, var(--dim), #000);
  opacity: 0.3;
  /* 30fps, like the canvases */
  animation: rack-spin-bg 20s steps(150) infinite;
}

@keyframes rack-spin-bg {
  0% { rotate: 0deg; opacity: 0.3; }
  25% { opacity: 0.2; }
  50% { opacity: 0.3; }
  75% { opacity: 0.2; }
  100% { rotate: 360deg; opacity: 0.3; }
}

#rack-env .cloud-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -2;
}

#rack-env .cloud-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: perspective(3.3cm) rotateX(90deg) scaleX(4) translateZ(-300px);
  opacity: 0.25;
  mix-blend-mode: screen;
}

/* scrolled by transform, not background-position, so the filter is painted once, not every frame */
#rack-env .cloud-bg::before {
  content: '';
  position: absolute;
  inset: 0 -50% 0 0;
  background: linear-gradient(180deg, black, transparent), url(../img/rack/cloud.png);
  /* one tile is half the box, a third of this 150% strip */
  background-size: 33.333% 100%;
  animation: rack-cloud-scroll 20s steps(600) infinite;
  /* the filter keeps only the cloud's brighter wisps and tints them with the theme */
  filter: url(#rack-cloud-tint);
  image-rendering: pixelated;
}

#rack-env .rack-cloud-tint {
  flood-color: var(--primary);
}

#rack-env .cat-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -3;
}

#rack-env .cat-spin {
  position: absolute;
  /* centred on the calendar and PVE stats boxes */
  left: 85%;
  top: 34%;
  translate: -50% -50%;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--primary);
  font: bold 10px/10px 'Courier New', monospace;
  white-space: pre;
  opacity: 0.4;
}

@keyframes rack-cloud-scroll {
  to { translate: -33.333% 0; }
}

#rack-env .carousel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, 118%);
  aspect-ratio: 953 / 318;
  transform: translate(-50%, 60%) scale(1.1);
  pointer-events: none;
  background: url(../img/rack/carousel.webp) top / contain no-repeat;
  mix-blend-mode: plus-lighter;
  opacity: 0.4;
}

#rack-env .rack-hive {
  grid-area: hive;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  animation: rack-list-appear 3s var(--ease) both;
}

@keyframes rack-list-appear {
  from { translate: 0 40px; opacity: 0; }
}

/* half a cell per column: a big cell is twice this plus the gap; the vh cap keeps the last row on a 1080p screen under browser chrome */
#rack-env .hive {
  --half-cell: clamp(46px, min(3.2vw, 5.5vh), 64px);
  display: grid;
  /* wide enough that the selection bracket stays clear of the next cell */
  column-gap: 18px;
  /* room for the last row's pull-up, so it does not overlap what follows */
  padding: 14px 0 5%;
}

#rack-env .hex {
  --c: var(--primary);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  aspect-ratio: 123 / 133;
  /* pulls the next row up into this one's lower points */
  margin-bottom: -13%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: #fff;
  font: 10px 'Courier New', monospace;
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  cursor: crosshair;
}

#rack-env .hex.is-failed {
  --c: var(--failed);
}

#rack-env .hex.is-restarting {
  --c: var(--restarting);
}

#rack-env .hex:focus {
  outline: none;
}

#rack-env .hex > .cell,
#rack-env .hex > .select {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  translate: -50% -50%;
  overflow: visible;
  pointer-events: none;
}

#rack-env .hex > svg.cell {
  fill: color-mix(in srgb, var(--c) 8%, rgba(5, 0, 10, 0.5));
  stroke: var(--c);
  stroke-width: 2.5;
  transition: fill 0.2s var(--ease);
}

#rack-env .hex:hover > svg.cell,
#rack-env .hex:focus-visible > svg.cell,
#rack-env .hex[aria-pressed="true"] > svg.cell {
  fill: color-mix(in srgb, var(--c) 30%, rgba(5, 0, 10, 0.5));
}

#rack-env .hex > svg.select {
  width: 90%;
  height: 90%;
  opacity: 0;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  transition: width 0.2s var(--ease), height 0.2s var(--ease), opacity 0.2s var(--ease);
}

#rack-env .hex:hover > svg.select,
#rack-env .hex:focus-visible > svg.select {
  opacity: 1;
  width: 112%;
  height: 112%;
}

#rack-env .hex[aria-pressed="true"] > svg.select {
  opacity: 1;
  width: 108%;
  height: 108%;
}

#rack-env .hex:active > svg.select {
  opacity: 1;
  width: 104%;
  height: 104%;
  transition-duration: 0.05s;
}

#rack-env .hex-name,
#rack-env .hex-latency {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: 84%;
}

#rack-env .hex-latency {
  color: var(--c);
  font-size: 9px;
}

#rack-env .hive-small {
  --half-cell: clamp(32px, min(2.2vw, 3.8vh), 44px);
}

#rack-env .hive:not(.hive-small) .hex {
  font-size: 13px;
}

#rack-env .hive-small .hex {
  font-size: 11px;
}

#rack-env .hive-small .hex-latency {
  display: none;
}

#rack-env .rack-icons {
  position: absolute;
  width: 0;
  height: 0;
}

#rack-env .hex-icon {
  position: relative;
  width: 34%;
  aspect-ratio: 1;
  object-fit: contain;
}

#rack-env .hex.is-failed .hex-icon {
  filter: grayscale(1) brightness(0.6);
}

#rack-env .led {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c);
  animation: rack-led-blink 1.4s steps(2) infinite;
}

#rack-env .is-failed .led {
  animation-duration: 0.5s;
}

@keyframes rack-led-blink {
  50% { opacity: 0.35; }
}

#rack-env .rack-hero {
  --c: var(--primary);
  grid-area: hero;
  min-height: 0;
  container-type: size;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#rack-env .rack-hero.is-failed {
  --c: var(--failed);
}

#rack-env .rack-hero.is-restarting {
  --c: var(--restarting);
}

#rack-env .rack-hero.is-restarting {
  --c: var(--restarting);
}

#rack-env .hero-meow {
  position: relative;
  width: min(190px, 70cqw, 60cqh);
  aspect-ratio: 123 / 133;
  transition: transform 1s var(--ease);
  margin-top: -24px;
}

#rack-env .hero-meow:hover {
  transform: scale(1.1);
}

#rack-env .hero-cell {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  overflow: visible;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* tsubi's cellGlow: a blurred, screened copy of the outline behind it */
#rack-env .hero-cell-glow {
  mix-blend-mode: screen;
  stroke: var(--c);
  filter: drop-shadow(0 0 4px var(--c)) drop-shadow(0 0 12px var(--c)) drop-shadow(0 0 24px var(--c)) blur(4px);
  opacity: 0.4;
}

#rack-env .ignite .hero-cell {
  animation: rack-cell-ignite 0.6s var(--ease) forwards;
}

#rack-env .ignite .hero-cell-glow {
  animation-name: rack-cell-glow-ignite;
}

@keyframes rack-cell-glow-ignite {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  35% { opacity: 0.2; }
  50% { opacity: 0; }
  90% { opacity: 0.4; }
  100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
}

@keyframes rack-cell-ignite {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  35% { opacity: 0.6; }
  50% { opacity: 0.1; }
  90% { opacity: 1; }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#rack-env .hero-core {
  position: absolute;
  left: -10%;
  top: -10%;
  width: 120%;
  height: 120%;
  mix-blend-mode: screen;
  /* dimmed so the ASCII model in front of it reads */
  filter: brightness(0.6);
  pointer-events: none;
}

#rack-env .ignite .hero-core {
  animation: rack-core-scale 0.8s var(--ease) 0.1s both;
}

@keyframes rack-core-scale {
  0% { opacity: 0; translate: 0 30px; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); translate: 0 0; }
}

#rack-env .hero-ascii {
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  overflow: visible;
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  margin: 0;
  color: #fff;
  font: bold 5px/5px 'Courier New', monospace;
  white-space: pre;
  text-shadow: 0 0 4px var(--c), 0 0 10px var(--c);
  pointer-events: none;
}

#rack-env .ignite .hero-ascii {
  animation: rack-ascii-ignite 0.8s var(--ease) 0.25s both;
}

@keyframes rack-ascii-ignite {
  0% { opacity: 0; scale: 0.6; }
  100% { opacity: 1; scale: 1; }
}

#rack-env .hero-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150%;
  aspect-ratio: 1;
  translate: -50% -50%;
  overflow: visible;
  pointer-events: none;
  animation: rack-ring-spin 60s steps(1800) infinite;
}

#rack-env .hero-ring-ticks {
  fill: none;
  stroke: var(--c);
  stroke-width: 3;
  stroke-dasharray: 1 5;
  opacity: 0.45;
}

#rack-env .hero-ring-text {
  fill: var(--c);
  font: 7px 'Courier New', monospace;
  letter-spacing: 2px;
  opacity: 0.7;
}

@keyframes rack-ring-spin {
  to { rotate: 360deg; }
}

#rack-env .hero-label {
  position: absolute;
  left: 50%;
  top: -44px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #fff;
}

#rack-env .indicator {
  position: absolute;
  top: 7%;
  left: 50%;
  width: 16px;
  height: 12px;
  margin-left: -8px;
  animation: rack-indicator-bob 3s steps(8) infinite;
  pointer-events: none;
  z-index: 3;
}

#rack-env .indicator-shape {
  width: 100%;
  height: 100%;
  background: #fff;
  clip-path: polygon(100% 0, 0 0, 50% 100%);
}

@keyframes rack-indicator-bob {
  0% { translate: 0 -10px; opacity: 0.8; }
  50% { translate: 0 10px; opacity: 1; }
  100% { translate: 0 -10px; opacity: 0.8; }
}

#rack-env .hero-nav {
  position: absolute;
  top: 10%;
  bottom: 10%;
  width: 50%;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  cursor: crosshair;
  z-index: 2;
}

#rack-env .hero-nav.prev {
  left: 0;
}

#rack-env .hero-nav.next {
  right: 0;
}

#rack-env .hero-nav:focus {
  outline: none;
}

#rack-env .hero-nav:focus-visible {
  outline: 1px dotted var(--c);
  outline-offset: -24px;
}

#rack-env .rack-details {
  --c: var(--primary);
  grid-area: details;
  position: relative;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--c);
  border-radius: 4px;
  color: var(--c);
  font-size: 13px;
}

#rack-env .rack-details.is-failed {
  --c: var(--failed);
}

#rack-env .rack-details.is-restarting {
  --c: var(--restarting);
}

#rack-env .rack-details > * {
  animation: rack-appear 0.2s var(--ease) both;
}

#rack-env .d-title {
  margin: 0;
  width: max-content;
  padding: 0 4px;
  background: var(--c);
  color: var(--backdrop);
  font-size: 20px;
  font-weight: 100;
  text-transform: uppercase;
  animation-delay: 0s;
}

#rack-env .d-status {
  display: flex;
  align-items: baseline;
  gap: 8px;
  animation-delay: 0.06s;
}

#rack-env .d-state {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
}

#rack-env .d-latency {
  font-size: 16px;
  color: #fff;
  animation: rack-appear 0.2s var(--ease) 0.12s both;
}

#rack-env .d-desc {
  margin: 0;
  padding: 8px;
  border: 1px solid transparent;
  border-left-color: currentColor;
  border-radius: 6px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.6;
  animation-delay: 0.18s;
}

#rack-env .d-desc b {
  color: var(--c);
  font-weight: normal;
}

#rack-env .d-scope {
  position: relative;
  margin-top: 6px;
  padding: 10px 7px 5px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.7);
  font-size: 11px;
  letter-spacing: 0.04em;
  animation-delay: 0.24s;
}

#rack-env .scope-head {
  position: absolute;
  top: -7px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
  line-height: 12px;
  text-transform: uppercase;
}

#rack-env .scope-title,
#rack-env .scope-now {
  padding: 0 4px;
  background: #05000a;
}

#rack-env .scope-now {
  color: #fff;
}

#rack-env .scope-alert {
  color: var(--c);
  animation: rack-led-blink 0.8s steps(2) infinite;
}

#rack-env .scope-graph {
  display: block;
  width: 100%;
  height: 160px;
  image-rendering: pixelated;
}

#rack-env .scope-row {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  color: color-mix(in srgb, var(--c) 70%, white);
  white-space: nowrap;
}

#rack-env .d-actions {
  display: flex;
  gap: 14px;
  animation-delay: 0.3s;
}

#rack-env .glow-button {
  min-width: 0;
  min-height: 0;
  padding: 2px 0;
  background: none;
  box-shadow: none;
  color: var(--c);
  font-family: 'Courier New', monospace;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: crosshair;
  transition: color 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

#rack-env .glow-button::before {
  content: "> ";
  opacity: 0.6;
}

#rack-env .glow-button:hover:not(:disabled),
#rack-env .glow-button:focus-visible {
  color: #fff;
  outline: none;
}

#rack-env .glow-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#rack-env .d-actions a {
  text-decoration: none;
}

#rack-env .d-term {
  margin: 0;
  min-height: 110px;
  max-height: 130px;
  overflow: hidden;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: none;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  color: color-mix(in srgb, var(--c) 70%, white);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  animation-delay: 0.36s;
}

@keyframes rack-appear {
  from { translate: 30px 0; opacity: 0; }
}

#rack-env .stale-banner {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  padding: 3px 10px;
  background: rgba(30, 20, 0, 0.85);
  border: 1px solid var(--restarting);
  color: var(--restarting);
  font-size: 11px;
  white-space: nowrap;
  z-index: 5;
  animation: rack-banner-flicker 2.4s steps(1) infinite;
}

@keyframes rack-banner-flicker {
  0%, 100% { opacity: 1; }
  48% { opacity: 1; }
  50% { opacity: 0.4; }
  52% { opacity: 1; }
}

#rack-env .rack-footer {
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  padding: 5px var(--gutter);
  border-top: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  background: #05000a;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.06em;
}

#rack-env .rack-footer p {
  margin: 0;
}

#rack-env .rack-side {
  grid-area: side;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}

#rack-env .panel-calendar,
#rack-env .panel-pve {
  font-size: 14px;
}

#rack-env .panel {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-size: 12px;
}

#rack-env .panel-title {
  margin: 0 0 10px;
  color: var(--dim);
  font-size: 12px;
  font-weight: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#rack-env .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 30px;
  gap: 4px;
  text-align: center;
}

#rack-env .cal-grid span {
  display: grid;
  place-items: center;
}

#rack-env .cal-head {
  color: var(--dim);
  text-transform: uppercase;
}

#rack-env .cal-other {
  opacity: 0.35;
}

#rack-env .cal-today {
  background: var(--primary);
  color: var(--backdrop);
  font-weight: bold;
}

#rack-env .pve-row {
  display: flex;
  height: 34px;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

#rack-env .pve-row span:last-child {
  color: #fff;
}

#rack-env .pve-note {
  margin: 10px 0 0;
  color: var(--dim);
  font-size: 11px;
}

#rack-env .panel-time {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px 32px;
  color: var(--dim);
}

#rack-env .time-now {
  color: #fff;
  font-size: 38px;
  letter-spacing: -0.04em;
  text-shadow: 0 0 6px var(--mid);
}

#rack-env .weather {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  font-size: 13px;
}

#rack-env .weather-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#rack-env .weather > .weather-icon {
  width: 40px;
  height: 40px;
  color: #fff;
}

#rack-env .weather-temp {
  color: #fff;
  font-size: 26px;
}

#rack-env .weather-range {
  margin-left: auto;
  color: var(--dim);
  text-align: right;
}

#rack-env .forecast {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

#rack-env .weather-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
}

#rack-env .weather-day b {
  color: var(--dim);
  font-weight: normal;
  text-transform: uppercase;
}

#rack-env .weather-day .weather-icon {
  color: var(--ink);
}

#rack-env .trinket-globe {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: none;
  border: 0;
  box-shadow: none;
  font: bold 6px/6px 'Courier New', monospace;
  white-space: pre;
}

#rack-env .globe-land {
  color: #6fe05a;
  text-shadow: 0 0 4px #1f8a2a;
}

#rack-env .globe-sea {
  color: #3d8cff;
  text-shadow: 0 0 4px #0b3fa8;
}

#rack-env .panel-fleet {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#rack-env .panel-fleet .panel-title {
  display: flex;
  justify-content: space-between;
}

#rack-env .fleet-now {
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: none;
}

#rack-env .panel-fleet canvas {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

#rack-env .rack-marks {
  grid-area: marks;
}

#rack-env .mark-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

#rack-env .mark-list a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 10px 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

#rack-env .mark-icon img {
  display: block;
  width: 76px;
  height: 76px;
  object-fit: contain;
}

#rack-env .mark-list a:hover,
#rack-env .mark-list a:focus-visible {
  border-color: #fff;
  box-shadow: 0 0 12px var(--primary);
  outline: none;
}

#rack-env .rack-feature {
  --c: var(--primary);
  grid-area: feature;
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 200px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  border-top: 2px solid var(--c);
  border-radius: 4px;
  color: #fff;
  text-decoration: none;
  cursor: crosshair;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

#rack-env .rack-feature.is-failed {
  --c: var(--failed);
}

#rack-env .rack-feature:hover,
#rack-env .rack-feature:focus-visible {
  border-color: #fff;
  box-shadow: 0 0 14px var(--c);
  outline: none;
}

#rack-env .feature-boot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#rack-env .feature-label {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  font-size: 15px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

#rack-env .feature-label .hex-latency {
  letter-spacing: 0.04em;
  text-transform: none;
}

#rack-env .sound-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  min-width: 0;
  min-height: 0;
  padding: 2px 6px;
  background: none;
  border: 1px solid transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

#rack-env .sound-toggle:hover,
#rack-env .sound-toggle:focus-visible {
  color: #fff;
  border-color: color-mix(in srgb, var(--primary) 60%, transparent);
  outline: none;
}

#rack-env .rack-splash {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #000;
  font-family: 'Courier New', monospace;
}

#rack-env .rack-splash-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#rack-env .rack-splash-title {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  text-align: center;
  color: #fff;
  pointer-events: none;
  white-space: nowrap;
}

#rack-env .rack-splash-title .line-1 {
  font-size: 15px;
  letter-spacing: 0.6em;
  text-transform: uppercase;
}

#rack-env .rack-splash-title .line-1:not(:empty) {
  background: #d46cff;
  color: #170024;
  padding: 0 0.3em 0 0.9em;
}

#rack-env .rack-splash-title .line-2 {
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: #b9a4c9;
}

#rack-env .rack-splash-skip {
  position: absolute;
  right: 12px;
  bottom: 10px;
  min-width: 0;
  min-height: 0;
  background: none;
  border: 1px solid #444;
  box-shadow: none;
  color: #888;
  font: 11px 'Courier New', monospace;
  padding: 3px 8px;
  cursor: pointer;
}

#rack-env .rack-splash-skip[hidden] {
  display: none;
}

#rack-env .rack-splash-skip:hover,
#rack-env .rack-splash-skip:focus-visible {
  color: #fff;
  border-color: #d46cff;
  outline: none;
}

#net-server-list tr {
  cursor: pointer;
}

#net-server-list tr:hover,
#net-server-list tr:focus {
  background: navy;
  color: #fff;
  outline: none;
}

#net-server-list .net-dot-online {
  color: #00cc44;
}

/* smaller desktop windows: weather stacks under the clock, leaving no room for the globe or fleet scope */
@media (max-width: 1600px) {
  #rack-env .panel-fleet,
  #rack-env .trinket-globe {
    display: none;
  }

  #rack-env .panel-time {
    grid-template-columns: 1fr;
  }
}

/* shorter windows: compact calendar and stats leave room for the fleet scope */
@media (max-height: 960px) {
  #rack-env .cal-grid {
    grid-auto-rows: 22px;
  }

  #rack-env .pve-row {
    height: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #rack-env *,
  #rack-env *::before,
  #rack-env *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* phones: the ui.devsvault.xyz layout, one scrolling column with the hive as a swipe strip on top */
@media screen and (max-width: 768px) {
  #rack-env {
    --gutter: 12px;
  }

  #rack-env .rack-header {
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 8px 10px 4px;
  }

  #rack-env .rack-head-row {
    display: contents;
  }

  #rack-env .rack-menubar {
    justify-self: end;
  }

  #rack-env .rack-title {
    font-size: 22px;
  }

  #rack-env .rack-title span,
  #rack-env .rack-status,
  #rack-env .cat-wrap,
  #rack-env .spin-bg,
  #rack-env .cloud-wrap {
    display: none;
  }

  #rack-env .rack-stage {
    grid-template-columns: minmax(0, 1fr);
    /* max-content, not auto: the stage has a fixed height, so auto rows would shrink the hive and side to nothing */
    grid-template-rows: max-content 340px repeat(4, max-content);
    grid-template-areas: "hive" "hero" "details" "side" "marks" "feature";
    gap: 12px;
    padding: 4px var(--gutter) 18px;
    overflow-y: auto;
  }

  #rack-env .rack-hive {
    flex-direction: row;
    align-items: center;
    gap: 2px;
    max-height: none;
    margin: 0 calc(-1 * var(--gutter));
    padding: 10px var(--gutter) 4px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, black 6%, black 94%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, black 6%, black 94%, transparent 100%);
  }

  /* flex, so the hexes ignore the honeycomb rows and columns rack.js sets inline */
  #rack-env .hive {
    display: flex;
    gap: 2px;
    padding: 0;
  }

  #rack-env .hive .hex {
    flex: 0 0 66px;
    width: 66px;
    margin: 0;
    font-size: 10px;
  }

  #rack-env .hive-small .hex {
    flex-basis: 56px;
    width: 56px;
    font-size: 9px;
  }

  #rack-env .hive .hex[aria-pressed="true"] {
    margin: 0 8px;
  }

  #rack-env .hero-meow {
    width: min(260px, 64%);
  }

  #rack-env .hero-ring {
    width: 125%;
  }

  #rack-env .rack-details {
    padding: 14px 16px;
  }

  #rack-env .rack-side {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  #rack-env .time-now {
    font-size: 30px;
  }

  #rack-env .mark-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #rack-env .mark-icon img {
    width: 48px;
    height: 48px;
  }

  #rack-env .rack-feature {
    min-height: 160px;
  }

  #rack-env .rack-footer {
    gap: 12px;
  }
}
