@font-face {
  font-family: "IBM_VGA_8x16";
  src: url("../fonts/Px437_IBM_VGA_8x16.ttf") format("truetype");
  font-display: swap;
}

:root {
  --room-bg-inner: #171b22;
  --room-bg-outer: #090b0f;
  --bezel-bg: #cfc8b8;
  --bezel-edge-hi: #ebe5d8;
  --bezel-edge-lo: #8d8677;
  --bezel-well: #15171a;
  --bezel-ink: #1e1d1a;
  --bezel-sub: #4d4940;
  --btn-bg: #ded8c8;
  --btn-ink: #1d1c19;
  --btn-border-hi: #f5f1e6;
  --btn-border-lo: #7f796b;
  --accent-bg: #1e4d7b;
  --accent-ink: #ffffff;
  --led-pwr: #32e85a;
  --bay-deck-bg: #c2bba9;
  --bay-face-bg: #d7d0c0;
  --bay-slit-bg: #1b1d1f;
  --bay-lcd-bg: #181f1a;
  --bay-lcd-ink: #7cf08f;
}

body[data-os="linux"] {
  --bezel-bg: #22262b;
  --bezel-edge-hi: #383e46;
  --bezel-edge-lo: #101215;
  --bezel-well: #080a0c;
  --bezel-ink: #e4ebf1;
  --bezel-sub: #95a3b1;
  --btn-bg: #2c3138;
  --btn-ink: #e4ebf1;
  --btn-border-hi: #454d58;
  --btn-border-lo: #121519;
  --accent-bg: #1d6f42;
  --accent-ink: #eafff0;
  --bay-deck-bg: #1a1d22;
  --bay-face-bg: #262b32;
  --bay-slit-bg: #07080a;
  --bay-lcd-bg: #0b130e;
  --bay-lcd-ink: #4af662;
}

body[data-os="win95"] {
  --bezel-bg: #c6c9ce;
  --bezel-edge-hi: #e3e6ea;
  --bezel-edge-lo: #7c8087;
  --bezel-well: #141619;
  --bezel-ink: #181a1d;
  --bezel-sub: #454950;
  --btn-bg: #d4d7dc;
  --btn-ink: #16181b;
  --btn-border-hi: #f0f2f5;
  --btn-border-lo: #72767d;
  --accent-bg: #006666;
  --accent-ink: #ffffff;
  --bay-deck-bg: #b8bcc2;
  --bay-face-bg: #cfd3d9;
  --bay-slit-bg: #191b1f;
  --bay-lcd-bg: #141d1d;
  --bay-lcd-ink: #6ef3e6;
}

body[data-os="win98"] {
  --bezel-bg: #c4c8d0;
  --bezel-edge-hi: #e5e8ee;
  --bezel-edge-lo: #767c87;
  --bezel-well: #12151a;
  --bezel-ink: #15181d;
  --bezel-sub: #404652;
  --btn-bg: #d3d7df;
  --btn-ink: #14171c;
  --btn-border-hi: #f1f3f7;
  --btn-border-lo: #6d737f;
  --accent-bg: #003c74;
  --accent-ink: #ffffff;
  --bay-deck-bg: #b6bac3;
  --bay-face-bg: #cdd2dc;
  --bay-slit-bg: #16191f;
  --bay-lcd-bg: #111824;
  --bay-lcd-ink: #72c7ff;
}

body[data-os="c64"] {
  --bezel-bg: #8f826f;
  --bezel-edge-hi: #aba08d;
  --bezel-edge-lo: #544b3e;
  --bezel-well: #1b1713;
  --bezel-ink: #191510;
  --bezel-sub: #362e24;
  --btn-bg: #3b332b;
  --btn-ink: #f2eadf;
  --btn-border-hi: #5c5145;
  --btn-border-lo: #1d1814;
  --accent-bg: #352879;
  --accent-ink: #a59aff;
  --bay-deck-bg: #796d5c;
  --bay-face-bg: #383028;
  --bay-slit-bg: #120e0b;
  --bay-lcd-bg: #1c172e;
  --bay-lcd-ink: #b8afff;
}

body[data-os="amiga"] {
  --bezel-bg: #d4cfc3;
  --bezel-edge-hi: #ece8de;
  --bezel-edge-lo: #8c877b;
  --bezel-well: #17181b;
  --bezel-ink: #1c1b18;
  --bezel-sub: #4c4941;
  --btn-bg: #e1ddd2;
  --btn-ink: #1a1917;
  --btn-border-hi: #f7f4ec;
  --btn-border-lo: #858075;
  --accent-bg: #0055aa;
  --accent-ink: #ffffff;
  --bay-deck-bg: #c7c1b3;
  --bay-face-bg: #dcd7ca;
  --bay-slit-bg: #1a1b1d;
  --bay-lcd-bg: #121c29;
  --bay-lcd-ink: #ffaa44;
}

body[data-os="mac"] {
  --bezel-bg: #dad4c5;
  --bezel-edge-hi: #f0ece0;
  --bezel-edge-lo: #918b7c;
  --bezel-well: #181818;
  --bezel-ink: #1d1c19;
  --bezel-sub: #4f4b43;
  --btn-bg: #e6e1d3;
  --btn-ink: #1b1a17;
  --btn-border-hi: #faf7ef;
  --btn-border-lo: #888274;
  --accent-bg: #222222;
  --accent-ink: #ffffff;
  --bay-deck-bg: #cdc6b6;
  --bay-face-bg: #e2dccd;
  --bay-slit-bg: #191816;
  --bay-lcd-bg: #1b1b19;
  --bay-lcd-ink: #e8e4d8;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 28%, var(--room-bg-inner) 0%, var(--room-bg-outer) 82%);
  font-family: "IBM Plex Mono", "IBM_VGA_8x16", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--bezel-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.workstation-shell {
  width: 100%;
  max-width: 1260px;
  height: 100%;
  max-height: 920px;
  background: var(--bezel-bg);
  border-radius: 14px;
  border-top: 3px solid var(--bezel-edge-hi);
  border-left: 3px solid var(--bezel-edge-hi);
  border-right: 4px solid var(--bezel-edge-lo);
  border-bottom: 5px solid var(--bezel-edge-lo);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.72),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Top hardware nameplate strip */
.bezel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
  min-height: 26px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-stripe {
  display: none;
  width: 28px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

body[data-os="c64"] .brand-stripe {
  display: inline-block;
  background: linear-gradient(
    to bottom,
    #d03830 0% 20%,
    #e88828 20% 40%,
    #e8d030 40% 60%,
    #48b848 60% 80%,
    #3878c8 80% 100%
  );
}

body[data-os="mac"] .brand-stripe {
  display: inline-block;
  width: 18px;
  background: linear-gradient(
    to bottom,
    #61bb46 0% 16.6%,
    #fdb827 16.6% 33.3%,
    #f5821f 33.3% 50%,
    #e03a3e 50% 66.6%,
    #963d97 66.6% 83.3%,
    #009ddc 83.3% 100%
  );
}

body[data-os="amiga"] .brand-stripe {
  display: inline-block;
  width: 20px;
  background: linear-gradient(135deg, #ff5500 0% 48%, #0055aa 52% 100%);
}

.brand-model {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-spec {
  font-size: 12px;
  color: var(--bezel-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-right-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Recessed CRT aperture */
.crt-well {
  flex: 1;
  min-height: 0;
  background: var(--bezel-well);
  border-radius: 10px;
  padding: 8px;
  border-top: 4px solid rgba(0, 0, 0, 0.65);
  border-left: 4px solid rgba(0, 0, 0, 0.55);
  border-right: 2px solid rgba(255, 255, 255, 0.2);
  border-bottom: 2px solid rgba(255, 255, 255, 0.25);
  position: relative;
  display: flex;
}

.crt-aperture {
  flex: 1;
  width: 100%;
  height: 100%;
  background: #000000;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

#emu-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000000;
}

/* Optional subtle CRT scanline glass */
.crt-glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0) 0px,
      rgba(255, 255, 255, 0) 2px,
      rgba(0, 0, 0, 0.16) 3px,
      rgba(0, 0, 0, 0.16) 4px
    ),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 68%, rgba(0, 0, 0, 0.34) 100%);
  opacity: 0.75;
  transition: opacity 150ms ease;
}

body.scanlines-off .crt-glass {
  opacity: 0;
}

/* Quick CV Command / Helper Strip */
.quick-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 2px;
  scrollbar-width: thin;
}

.quick-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bezel-sub);
  flex-shrink: 0;
  margin-right: 2px;
}

.quick-hint {
  font-size: 12px;
  color: var(--bezel-sub);
  white-space: nowrap;
}

.chip-btn {
  appearance: none;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border-top: 1px solid var(--btn-border-hi);
  border-left: 1px solid var(--btn-border-hi);
  border-right: 1px solid var(--btn-border-lo);
  border-bottom: 1px solid var(--btn-border-lo);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.chip-btn:hover {
  filter: brightness(1.06);
}

.chip-btn:active {
  border-top-color: var(--btn-border-lo);
  border-left-color: var(--btn-border-lo);
  transform: translateY(1px);
}

/* Sculpted Removable Media Drive Bay Deck */
.drive-bay-deck {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  background: var(--bay-deck-bg);
  border-top: 2px solid var(--bezel-edge-lo);
  border-left: 2px solid var(--bezel-edge-lo);
  border-right: 2px solid var(--bezel-edge-hi);
  border-bottom: 2px solid var(--bezel-edge-hi);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.22);
}

.drive-bay-slots {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 1 auto;
}

.drive-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 248px;
  max-width: 340px;
  padding: 4px 8px;
  border-radius: 3px;
  background: var(--bay-face-bg);
  color: var(--btn-ink);
  border-top: 2px solid var(--btn-border-hi);
  border-left: 2px solid var(--btn-border-hi);
  border-right: 2px solid var(--btn-border-lo);
  border-bottom: 2px solid var(--btn-border-lo);
  cursor: pointer;
  user-select: none;
  transition: transform 90ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.drive-slot:hover {
  filter: brightness(1.03);
}

body.file-drag-active .drive-slot {
  box-shadow: 0 0 0 2px var(--accent-bg), 0 3px 10px rgba(0, 0, 0, 0.35);
}

.drive-slot.drag-over {
  background: var(--accent-bg);
  color: var(--accent-ink);
  border-top-color: rgba(255, 255, 255, 0.55);
  border-left-color: rgba(255, 255, 255, 0.55);
  transform: translateY(-1px);
}

.drive-face-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.drive-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.92;
}

.drive-badge {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(0, 0, 0, 0.22);
  white-space: nowrap;
}

body[data-os="linux"] .drive-badge,
body[data-os="c64"] .drive-badge {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.drive-slot.drag-over .drive-badge {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--accent-ink);
}

/* Physical drive throat / slot slit + inserted media edge */
.drive-throat-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.drive-slit {
  position: relative;
  height: 5px;
  width: 100%;
  border-radius: 1px;
  background: var(--bay-slit-bg);
  border-top: 1px solid rgba(0, 0, 0, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.32);
  overflow: hidden;
}

.drive-slit::after {
  content: "";
  position: absolute;
  inset: 1px 10% 1px 10%;
  border-radius: 1px;
  opacity: 0;
  transition: opacity 150ms ease;
}

/* Inserted floppy diskette shutter edge inside slot */
.drive-slot.has-media[data-kind="floppy"] .drive-slit::after {
  opacity: 1;
  background: linear-gradient(
    90deg,
    #2b5ea8 0% 62%,
    #cfd6de 62% 86%,
    #2b5ea8 86% 100%
  );
}

/* Inserted optical CD/DVD polycarbonate iridescent disc edge */
.drive-slot.has-media[data-kind="optical"] .drive-slit::after {
  opacity: 1;
  inset: 1px 4% 1px 4%;
  background: linear-gradient(
    90deg,
    #8fa8b8 0%,
    #d6f7ea 32%,
    #d8d2ff 58%,
    #eef8ff 78%,
    #8fa8b8 100%
  );
}

/* Inserted 1541 5.25" diskette sleeve edge */
.drive-slot.has-media[data-kind="c64"] .drive-slit::after {
  opacity: 1;
  background: linear-gradient(90deg, #3c3733 0% 42%, #cc5522 42% 58%, #3c3733 58% 100%);
}

.drive-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.drive-slot-led {
  width: 7px;
  height: 5px;
  border-radius: 1px;
  background: #2f362f;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
  flex-shrink: 0;
}

.drive-slot.has-media .drive-slot-led {
  background: #2ee856;
  box-shadow: 0 0 5px #2ee856;
}

.drive-slot.busy .drive-slot-led {
  background: #ffaa22;
  box-shadow: 0 0 7px #ffaa22;
}

.drive-caption {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}

/* Tactile mechanical eject button on right edge of drive faceplate */
.drive-eject-btn {
  appearance: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 2px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border-top: 1px solid var(--btn-border-hi);
  border-left: 1px solid var(--btn-border-hi);
  border-right: 1px solid var(--btn-border-lo);
  border-bottom: 1px solid var(--btn-border-lo);
  cursor: pointer;
  flex-shrink: 0;
}

.drive-eject-btn:hover {
  filter: brightness(1.08);
}

.drive-eject-btn:active {
  transform: translateY(1px);
}

.drive-eject-btn[hidden] {
  display: none !important;
}

/* Recessed Retro LCD / Vacuum-Fluorescent Media Status Readout */
.drive-bay-readout {
  flex: 1 1 220px;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--bay-lcd-bg);
  color: var(--bay-lcd-ink);
  border-top: 2px solid rgba(0, 0, 0, 0.7);
  border-left: 2px solid rgba(0, 0, 0, 0.7);
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.drive-bay-readout.is-error {
  color: #ff7b72;
}

.readout-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
  flex-shrink: 0;
}

.readout-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CRT Drag-and-Drop Overlay (active only while dragging host files over window) */
.crt-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(7, 11, 15, 0.72);
  backdrop-filter: blur(2px);
  padding: 20px;
}

body.file-drag-active .crt-drop-overlay {
  display: flex;
}

.crt-drop-panel {
  width: min(640px, 94%);
  background: var(--bezel-bg);
  color: var(--bezel-ink);
  border-radius: 8px;
  border-top: 3px solid var(--bezel-edge-hi);
  border-left: 3px solid var(--bezel-edge-hi);
  border-right: 3px solid var(--bezel-edge-lo);
  border-bottom: 4px solid var(--bezel-edge-lo);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crt-drop-header {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--bezel-sub);
}

.crt-drop-targets {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.crt-drop-card {
  flex: 1 1 220px;
  padding: 16px 14px;
  border-radius: 5px;
  background: var(--bay-face-bg);
  color: var(--btn-ink);
  border: 2px dashed var(--btn-border-lo);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  transition: transform 100ms ease, background 100ms ease, border-color 100ms ease;
}

.crt-drop-card.drag-over {
  background: var(--accent-bg);
  color: var(--accent-ink);
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.02);
}

.crt-drop-card-title {
  font-size: 13px;
  font-weight: 700;
}

.crt-drop-card-sub {
  font-size: 11.5px;
  opacity: 0.84;
}

/* Bottom tactile hardware control bar */
.bezel-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 2px 4px 0;
}

.led-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.led-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--bezel-sub);
}

.led-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2b332d;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.led-dot.power-on {
  background: var(--led-pwr);
  box-shadow: 0 0 7px var(--led-pwr);
}

.led-dot.drive-active {
  background: #ffaa22;
  box-shadow: 0 0 7px #ffaa22;
}

.hw-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hw-btn,
.hw-select {
  appearance: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border-top: 2px solid var(--btn-border-hi);
  border-left: 2px solid var(--btn-border-hi);
  border-right: 2px solid var(--btn-border-lo);
  border-bottom: 2px solid var(--btn-border-lo);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
}

.hw-select {
  padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 11px) 52%, calc(100% - 6px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.hw-btn:hover,
.hw-select:hover {
  filter: brightness(1.05);
}

.hw-btn:active {
  transform: translateY(1px);
}

.hw-btn.primary {
  background: var(--accent-bg);
  color: var(--accent-ink);
  border-top-color: rgba(255, 255, 255, 0.35);
  border-left-color: rgba(255, 255, 255, 0.35);
  border-right-color: rgba(0, 0, 0, 0.55);
  border-bottom-color: rgba(0, 0, 0, 0.55);
}

.hw-btn[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  html, body {
    padding: 4px;
  }
  .workstation-shell {
    padding: 8px;
    border-radius: 8px;
  }
  .brand-model {
    font-size: 11px;
    letter-spacing: 0.03em;
  }
  .brand-spec {
    display: none;
  }
  .drive-bay-deck {
    flex-direction: column;
    gap: 5px;
  }
  .drive-slot {
    min-width: 0;
    max-width: none;
    flex: 1 1 180px;
  }
  .drive-bay-readout {
    flex: 0 0 auto;
  }
}
