.a500-page {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(17, 18, 38, 0.92), rgba(17, 18, 38, 0.72)),
    var(--pink);
}

.a500-main {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 72px;
}

body.a500-overlay-open {
  overflow: hidden;
}

.a500-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(rgba(5, 5, 16, 0.84), rgba(5, 5, 16, 0.9)),
    rgba(242, 138, 209, 0.2);
  backdrop-filter: blur(5px);
}

.a500-overlay[hidden] {
  display: none;
}

.a500-overlay-main {
  width: min(1180px, calc(100vw - 28px));
  height: calc(100vh - 28px);
  max-height: calc(100vh - 28px);
  margin: 0;
  overflow: hidden;
  overscroll-behavior: contain;
}

.a500-shell {
  background: var(--ink);
  color: var(--paper);
  border: 6px solid var(--line);
  box-shadow: 12px 12px 0 var(--blue-dark);
}

.a500-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 6px solid var(--line);
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  color: var(--ink);
}

.a500-titlebar .eyebrow {
  color: var(--ink);
}

.a500-titlebar h1,
.a500-titlebar h2 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.82;
  text-transform: uppercase;
  text-shadow:
    4px 4px 0 var(--paper),
    8px 8px 0 rgba(17, 18, 38, 0.32);
}

.a500-overlay-close {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  color: var(--ink);
  background: var(--yellow);
  border: 4px solid var(--line);
  box-shadow: 5px 5px 0 var(--blue-dark);
  cursor: pointer;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.a500-overlay-close:hover,
.a500-overlay-close:focus-visible {
  background: var(--paper);
  outline: none;
  transform: translate(-2px, -2px);
}

.a500-leds {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 280px;
}

.a500-led {
  min-width: 58px;
  padding: 7px 8px;
  color: var(--paper);
  background: var(--ink);
  border: 4px solid var(--line);
  box-shadow: 4px 4px 0 var(--blue-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.a500-led.is-active {
  color: var(--ink);
  background: var(--green);
}

.a500-machine {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 18px;
}

.a500-screen-panel,
.a500-desk,
.a500-terminal {
  border: 5px solid var(--line);
  background: #050510;
}

.a500-screen-panel {
  min-width: 0;
  padding: 16px;
}

.a500-screen-bezel {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 18px;
  background:
    linear-gradient(rgba(102, 255, 243, 0.08) 2px, transparent 2px),
    #03030a;
  background-size: 100% 8px;
  border: 5px solid var(--blue-dark);
  box-shadow: inset 0 0 0 8px rgba(126, 181, 255, 0.12);
}

.a500-video {
  width: min(100%, 720px);
  height: auto;
  aspect-ratio: 360 / 284;
  background: #050510;
  image-rendering: pixelated;
  border: 4px solid var(--cyan);
  box-shadow: 8px 8px 0 var(--blue-dark);
}

.a500-video:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 4px;
}

.a500-status-text {
  margin: 14px 0 0;
  color: var(--yellow);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.45;
}

.a500-desk {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}

.a500-slot,
.a500-controls button {
  width: 100%;
  min-height: 56px;
  color: var(--ink);
  background: var(--paper);
  border: 4px solid var(--line);
  box-shadow: 5px 5px 0 var(--blue-dark);
  cursor: pointer;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.a500-slot {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.a500-slot span {
  color: var(--blue-dark);
  font-size: 0.68rem;
}

.a500-slot strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.a500-slot.is-critical {
  background: var(--yellow);
}

.a500-slot.is-loaded {
  background: var(--green);
}

.a500-slot.is-dragging,
.a500-slot:hover,
.a500-slot:focus-visible,
.a500-controls button:hover,
.a500-controls button:focus-visible {
  background: var(--cyan);
  outline: none;
  transform: translate(-2px, -2px);
}

.a500-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.a500-controls button {
  min-height: 48px;
  text-align: center;
}

.a500-controls button:first-child {
  grid-column: 1 / -1;
  background: var(--green);
}

.a500-note {
  padding: 12px;
  color: var(--paper);
  background: rgba(255, 249, 220, 0.08);
  border: 4px solid var(--line);
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.45;
}

.a500-note p {
  margin: 0 0 10px;
}

.a500-note a {
  color: var(--cyan);
}

.a500-terminal {
  margin: 0 18px 18px;
  padding: 14px;
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.55;
}

.a500-terminal p {
  margin: 0 0 8px;
  color: var(--cyan);
}

.a500-log {
  display: grid;
  gap: 4px;
  min-height: 92px;
  max-height: 180px;
  margin: 0;
  padding-left: 22px;
  overflow: auto;
}

.a500-log li::marker {
  color: var(--pink);
}

@media (max-width: 980px) {
  .a500-titlebar,
  .a500-machine {
    grid-template-columns: 1fr;
  }

  .a500-machine {
    display: grid;
  }

  .a500-leds {
    justify-content: flex-start;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .a500-main {
    width: min(100% - 18px, 1180px);
    margin-top: 14px;
  }

  .a500-titlebar,
  .a500-machine {
    padding: 12px;
  }

  .a500-screen-bezel {
    min-height: 240px;
    padding: 10px;
  }

  .a500-controls {
    grid-template-columns: 1fr;
  }

  .a500-terminal {
    margin: 0 12px 12px;
  }
}

.a500-overlay .a500-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  overflow: hidden;
}

.a500-overlay .a500-titlebar {
  align-items: center;
  padding: clamp(10px, 1.5vh, 16px);
}

.a500-overlay .a500-titlebar h2 {
  font-size: clamp(2.2rem, 5.8vw, 4.8rem);
}

.a500-overlay .a500-led {
  min-width: 52px;
  padding: 5px 7px;
  border-width: 3px;
  box-shadow: 3px 3px 0 var(--blue-dark);
}

.a500-overlay .a500-overlay-close {
  width: 46px;
  height: 46px;
}

.a500-overlay .a500-machine {
  min-height: 0;
  gap: clamp(10px, 1.4vh, 16px);
  padding: clamp(10px, 1.4vh, 16px);
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  overflow: hidden;
}

.a500-overlay .a500-screen-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  padding: clamp(10px, 1.3vh, 14px);
}

.a500-overlay .a500-screen-bezel {
  min-height: 0;
  height: 100%;
  padding: clamp(8px, 1.2vh, 14px);
  overflow: hidden;
}

.a500-overlay .a500-video {
  width: min(100%, 640px);
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@media (min-height: 860px) {
  .a500-overlay .a500-video {
    width: min(100%, 720px);
  }
}

.a500-overlay .a500-status-text {
  margin-top: 8px;
  font-size: 0.78rem;
}

.a500-overlay .a500-desk {
  min-height: 0;
  gap: 8px;
  padding: 10px;
  overflow: hidden;
}

.a500-overlay .a500-slot {
  min-height: 44px;
  padding: 8px;
}

.a500-overlay .a500-controls {
  gap: 6px;
}

.a500-overlay .a500-controls button {
  min-height: 40px;
  padding: 6px;
  font-size: 0.78rem;
}

.a500-overlay .a500-note {
  padding: 8px;
  font-size: 0.72rem;
  line-height: 1.3;
}

.a500-overlay .a500-note p {
  margin-bottom: 6px;
}

.a500-overlay .a500-terminal {
  min-height: 0;
  max-height: 86px;
  margin: 0 clamp(10px, 1.4vh, 16px) clamp(10px, 1.4vh, 16px);
  padding: 8px 10px;
  overflow: hidden;
  font-size: 0.76rem;
  line-height: 1.35;
}

.a500-overlay .a500-terminal p {
  margin-bottom: 4px;
}

.a500-overlay .a500-log {
  min-height: 0;
  max-height: 42px;
  overflow: hidden;
}

@media (max-width: 980px) {
  .a500-overlay .a500-machine {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .a500-overlay .a500-desk {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .a500-overlay .a500-controls {
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .a500-overlay .a500-controls button:first-child {
    grid-column: auto;
  }

  .a500-overlay .a500-note {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px), (max-height: 760px) {
  .a500-overlay {
    padding: 10px;
  }

  .a500-overlay-main {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
  }

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

  .a500-overlay .a500-titlebar {
    gap: 10px;
  }

  .a500-overlay .a500-titlebar .eyebrow,
  .a500-overlay .a500-note,
  .a500-overlay .a500-terminal {
    display: none;
  }

  .a500-overlay .a500-titlebar h2 {
    font-size: clamp(1.8rem, 7vw, 3.3rem);
  }

  .a500-overlay .a500-leds {
    gap: 5px;
  }

  .a500-overlay .a500-led {
    min-width: 46px;
    font-size: 0.64rem;
  }

  .a500-overlay .a500-overlay-close {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .a500-overlay .a500-machine {
    gap: 8px;
    padding: 8px;
  }

  .a500-overlay .a500-status-text {
    margin-top: 6px;
    font-size: 0.7rem;
    line-height: 1.25;
  }

  .a500-overlay .a500-desk {
    gap: 6px;
  }

  .a500-overlay .a500-slot,
  .a500-overlay .a500-controls button {
    min-height: 36px;
    font-size: 0.68rem;
  }
}
