@font-face {
  font-family: 'PxPlus IBM VGA 8x16';
  src: url('../fonts/PxPlus_IBM_VGA8.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0c0c0f;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --- CRT Monitor --- */

.crt-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(1.3);
  transform-origin: center center;
}

.crt-monitor {
  background: linear-gradient(170deg, #303035 0%, #222225 50%, #1a1a1d 100%);
  border-radius: 18px;
  padding: 28px 32px 0;
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.7),
    0 5px 20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

/* --- Screen --- */

.crt-screen {
  position: relative;
  background: #0a0a0a;
  border-radius: 10px;
  padding: 12px;
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.8),
    inset 0 0 4px rgba(0, 0, 0, 0.9);
}

#terminal {
  position: relative;
  z-index: 1;
}

/* Scanlines */
.crt-scanlines {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 1px,
    rgba(0, 0, 0, 0.04) 1px,
    rgba(0, 0, 0, 0.04) 2px
  );
  pointer-events: none;
  z-index: 10;
}

/* Screen curvature vignette */
.crt-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    ellipse at center,
    transparent 65%,
    rgba(0, 0, 0, 0.25) 100%
  );
  pointer-events: none;
  z-index: 11;
}

/* Glass reflection */
.crt-glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.03) 0%,
    transparent 40%,
    transparent 60%,
    rgba(255, 255, 255, 0.01) 100%
  );
  pointer-events: none;
  z-index: 12;
}

/* --- Chin / branding --- */

.crt-chin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 14px;
}

.crt-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0f0;
  box-shadow: 0 0 4px #0f0, 0 0 8px rgba(0, 255, 0, 0.3);
}

.crt-brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.crt-brand-name {
  font-family: 'PxPlus IBM VGA 8x16', monospace;
  font-size: 13px;
  font-weight: bold;
  color: #6a6a6a;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.crt-brand-maker {
  font-family: 'PxPlus IBM VGA 8x16', monospace;
  font-size: 9px;
  color: #4a4a4a;
  letter-spacing: 1px;
}

/* --- Stand --- */

.crt-stand-neck {
  width: 60px;
  height: 25px;
  background: linear-gradient(180deg, #1a1a1d, #252528);
  clip-path: polygon(10% 0%, 90% 0%, 100% 100%, 0% 100%);
}

.crt-stand-base {
  width: 180px;
  height: 10px;
  background: linear-gradient(180deg, #2a2a2d, #1e1e21);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* --- USR Courier Modem --- */

.modem {
  align-self: stretch;
  margin-top: 20px;
}

.modem-top {
  height: 10px;
  background: linear-gradient(180deg, #38383b, #2d2d30);
  border-radius: 3px 3px 0 0;
}

.modem-front {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 20px 9px;
  background: linear-gradient(180deg, #2a2a2d, #1e1e21);
  border-radius: 0 0 3px 3px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.modem-leds {
  display: flex;
  gap: 14px;
}

.modem-led {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.modem-led-label {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8px;
  font-weight: bold;
  color: #555;
  letter-spacing: 0.5px;
  user-select: none;
}

.modem-led-light {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #162016;
  transition: background 0.05s, box-shadow 0.05s;
}

/* Steady on */
.modem-led.on .modem-led-light {
  background: #0c0;
  box-shadow: 0 0 3px #0c0, 0 0 6px rgba(0, 204, 0, 0.4);
}

/* Data activity flash */
.modem-led.active .modem-led-light {
  background: #0f0;
  box-shadow: 0 0 4px #0f0, 0 0 8px rgba(0, 255, 0, 0.5);
}

.modem-mute {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: auto;
  margin-right: 8px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.modem-mute:hover {
  opacity: 0.9;
}

.modem-mute-icon {
  font-size: 14px;
  line-height: 1;
}

.modem-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.modem-brand-name {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: bold;
  color: #555;
  letter-spacing: 1px;
}

.modem-brand-model {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  color: #444;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* --- xterm scrollbar hiding --- */

.xterm-viewport::-webkit-scrollbar {
  display: none;
}

.xterm-viewport {
  scrollbar-width: none;
}

/* --- Responsive scaling --- */

@media (max-height: 900px), (max-width: 1100px) {
  .crt-container {
    transform: scale(1.0);
  }
}

@media (max-height: 650px), (max-width: 800px) {
  .crt-container {
    transform: scale(0.75);
  }
}

/* -------- Transfer status strip (LCD panel style) -------- */

.modem-xfer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: #001100;
  color: #55ff55;
  font-family: 'PxPlus IBM VGA 8x16', monospace;
  font-size: 12px;
  border: 1px solid #003300;
  border-radius: 3px;
  box-shadow: inset 0 0 8px rgba(85, 255, 85, 0.15);
  text-shadow: 0 0 3px rgba(85, 255, 85, 0.4);
  min-width: 380px;
}

.modem-xfer[hidden] {
  display: none;
}

.modem-xfer-dir {
  font-weight: bold;
  color: #ffff55;
}

.modem-xfer-name {
  flex: 1;
  min-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modem-xfer-pct {
  min-width: 3ch;
  text-align: right;
}

.modem-xfer-bar {
  position: relative;
  display: inline-block;
  width: 120px;
  height: 10px;
  background: #003300;
  border: 1px solid #005500;
}

.modem-xfer-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: #55ff55;
  transition: width 120ms linear;
}

@media (prefers-reduced-motion: reduce) {
  .modem-xfer-fill { transition: none; }
}

.modem-xfer-cps { min-width: 8ch; }
.modem-xfer-eta { color: #55ffff; min-width: 5ch; }
.modem-xfer-batch { color: #aaaaaa; }

.modem-xfer.state-aborted { color: #ff5555; text-shadow: 0 0 3px rgba(255, 85, 85, 0.4); }
.modem-xfer.state-timeout { color: #ffff55; text-shadow: 0 0 3px rgba(255, 255, 85, 0.4); }

/* -------- Download notification bubbles -------- */

.xfer-notifications {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.xfer-notification {
  pointer-events: auto;
  background: #001100;
  color: #55ff55;
  border: 1px solid #005500;
  padding: 8px 12px;
  font-family: 'PxPlus IBM VGA 8x16', monospace;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  box-shadow: 0 0 12px rgba(85, 255, 85, 0.25);
  animation: xfer-slide-in 220ms ease-out;
}

.xfer-notification.error { color: #ff5555; border-color: #550000; }

.xfer-notification button {
  background: #55ff55;
  color: #000;
  border: none;
  padding: 4px 12px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
}

.xfer-notification button:hover { background: #aaffaa; }
.xfer-notification button:focus-visible { outline: 2px solid #ffff55; outline-offset: 2px; }

@keyframes xfer-slide-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .xfer-notification { animation: none; }
}
