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

body {
  background: #1a1410;
  background-image: 
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      rgba(0,0,0,0.03) 40px,
      rgba(0,0,0,0.03) 41px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 40px,
      rgba(0,0,0,0.03) 40px,
      rgba(0,0,0,0.03) 41px
    ),
    linear-gradient(135deg, #2a2018 0%, #1a1410 30%, #221c14 60%, #1a1410 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Sans', sans-serif;
  overflow-x: hidden;
  padding: 10px;
}

#app-container {
  position: relative;
  width: 100%;
  max-width: 960px;
}

/* Monitor Bezel */
.monitor-bezel {
  background: linear-gradient(180deg, #E8DEC8 0%, #D4C9A8 15%, #CFC3A0 50%, #C4B894 85%, #B8AC88 100%);
  border-radius: 18px;
  padding: 28px 32px 24px;
  box-shadow: 
    0 8px 32px rgba(0,0,0,0.6),
    0 2px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -1px 0 rgba(0,0,0,0.1);
  position: relative;
  border: 1px solid #A89C78;
}

.monitor-bezel::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
  border-radius: 16px 16px 0 0;
  pointer-events: none;
}

/* IBM Logo */
.ibm-logo {
  position: absolute;
  top: 8px;
  left: 18px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 4px;
  color: #3a3520;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  z-index: 2;
}

.model-label {
  position: absolute;
  top: 10px;
  right: 18px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 300;
  font-size: 10px;
  color: #7a7050;
  letter-spacing: 1px;
  z-index: 2;
}

/* CRT Screen Container */
.crt-container {
  background: #0a0a0a;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 
    inset 0 0 30px rgba(0,0,0,0.8),
    inset 0 0 6px rgba(0,0,0,0.9),
    0 1px 0 rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
}

.crt-screen {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

#crt-display {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 6px;
}

/* CRT Effects Overlay */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  border-radius: 6px;
  z-index: 5;
}

.crt-overlay.scanlines::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.15) 2px,
    rgba(0,0,0,0.15) 4px
  );
  z-index: 2;
}

.crt-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0,0,0,0.3) 100%
  );
  z-index: 3;
}

.crt-glare {
  position: absolute;
  top: 5%;
  left: 10%;
  width: 80%;
  height: 40%;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.03) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 6;
  border-radius: 50%;
}

/* Bottom Panel */
.bottom-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 0 4px;
  gap: 12px;
  flex-wrap: wrap;
}

/* Floppy Drive */
.floppy-drive {
  background: linear-gradient(180deg, #D0C5A5 0%, #C4B894 100%);
  border: 1px solid #A89C78;
  border-radius: 4px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  min-width: 200px;
  transition: all 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.1);
}

.floppy-drive:hover {
  background: linear-gradient(180deg, #D8CDB0 0%, #CCC0A0 100%);
}

.floppy-drive.drag-over {
  background: linear-gradient(180deg, #E0D8B8 0%, #D4C8A8 100%);
  border-color: #8a8060;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.15);
}

.floppy-slot {
  width: 60px;
  height: 4px;
  background: #2a2a2a;
  border-radius: 2px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.floppy-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3a3a2a;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.3);
  transition: all 0.1s;
}

.floppy-led.active {
  background: #44ff44;
  box-shadow: 0 0 6px #44ff44, 0 0 12px rgba(68,255,68,0.3);
}

.floppy-led.reading {
  background: #ff4444;
  box-shadow: 0 0 6px #ff4444, 0 0 12px rgba(255,68,68,0.3);
}

.floppy-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: #5a5030;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.drive-letter {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 9px;
  font-weight: 600;
  color: #5a5030;
}

/* Controls */
.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ctrl-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  padding: 4px 10px;
  border: 1px solid #A89C78;
  border-radius: 3px;
  background: linear-gradient(180deg, #D8CDB0 0%, #C4B894 100%);
  color: #3a3520;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.1s;
  white-space: nowrap;
  user-select: none;
}

.ctrl-btn:hover {
  background: linear-gradient(180deg, #E0D8B8 0%, #CCC0A0 100%);
}

.ctrl-btn:active {
  background: linear-gradient(180deg, #B8AC88 0%, #C4B894 100%);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
  transform: translateY(1px);
}

.ctrl-btn.active {
  background: linear-gradient(180deg, #a09470 0%, #8a7e60 100%);
  color: #E8DEC8;
  border-color: #706840;
}

.ctrl-btn.power {
  background: linear-gradient(180deg, #c44 0%, #a33 100%);
  color: #fff;
  border-color: #833;
  font-weight: 600;
}

.ctrl-btn.power.on {
  background: linear-gradient(180deg, #4a4 0%, #383 100%);
  border-color: #262;
  box-shadow: 0 0 8px rgba(68,170,68,0.3), 0 1px 2px rgba(0,0,0,0.15);
}

.ctrl-btn.power:hover {
  filter: brightness(1.1);
}

/* Volume Knob */
.knob-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.knob-label {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 7px;
  color: #7a7050;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.knob {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #B8AC88 0%, #8a7e60 50%, #B8AC88 100%);
  border: 2px solid #706840;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

.knob::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 8px;
  background: #3a3520;
  border-radius: 1px;
}

/* Clock Display */
.clock-display {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #88cc88;
  background: #1a2a1a;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid #2a3a2a;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
  white-space: nowrap;
}

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding: 6px 12px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  flex-wrap: wrap;
}

.status-item {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: #8a8060;
  white-space: nowrap;
}

.status-item span {
  color: #b0a880;
}

/* Footer */
.app-footer {
  margin-top: 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #5a5030;
  text-align: center;
}

.app-footer a {
  color: #88aa66;
  text-decoration: none;
}

.app-footer a:hover {
  color: #aacc88;
  text-decoration: underline;
}

/* Hidden file input */
.hidden-input {
  display: none;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .monitor-bezel {
    border-radius: 10px;
    padding: 16px 12px 12px;
  }
  
  .bottom-panel {
    flex-direction: column;
    align-items: stretch;
  }
  
  .controls-row {
    justify-content: center;
  }
  
  .status-bar {
    justify-content: center;
  }

  .floppy-drive {
    min-width: unset;
  }
}

/* CRT Power animations */
@keyframes crt-on {
  0% { opacity: 0; transform: scaleY(0.005); filter: brightness(3); }
  30% { opacity: 1; transform: scaleY(0.005); filter: brightness(3); }
  50% { transform: scaleY(1.1); filter: brightness(1.5); }
  70% { transform: scaleY(0.95); filter: brightness(1.1); }
  100% { transform: scaleY(1); filter: brightness(1); }
}

@keyframes crt-off {
  0% { transform: scale(1); filter: brightness(1); opacity: 1; }
  20% { transform: scaleY(0.005) scaleX(1); filter: brightness(3); opacity: 1; }
  60% { transform: scaleY(0.005) scaleX(0.1); filter: brightness(3); opacity: 0.8; }
  100% { transform: scaleY(0.005) scaleX(0); filter: brightness(0); opacity: 0; }
}

.crt-power-on {
  animation: crt-on 0.6s ease-out forwards;
}

.crt-power-off {
  animation: crt-off 0.5s ease-in forwards;
}