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

body {
  background: #111111;
  color: #33ff33;
  font-family: 'Courier New', monospace;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 800px;
  padding: 10px;
}

#title {
  font-family: 'Courier New', monospace;
  font-size: 22px;
  color: #33ff33;
  letter-spacing: 6px;
  margin: 10px 0;
  text-shadow: 0 0 10px #33ff3388, 0 0 20px #33ff3344;
  user-select: none;
}

#monitor-bezel {
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  border: 3px solid #333;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 
    0 0 20px rgba(0,0,0,0.8),
    inset 0 0 30px rgba(0,0,0,0.5);
  margin-bottom: 10px;
}

#crt-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #0a0a0a;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.9);
}

#canvas {
  display: block;
  width: 640px;
  height: 440px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 8px;
}

#scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0,0,0,0.15) 1px,
    rgba(0,0,0,0.15) 2px
  );
  pointer-events: none;
  border-radius: 8px;
}

#controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  flex-wrap: wrap;
  justify-content: center;
}

#reset-btn {
  background: #cc2222;
  color: white;
  border: 2px solid #881111;
  border-radius: 6px;
  padding: 6px 16px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  transition: all 0.1s;
}
#reset-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

#paste-btn {
  background: #444;
  color: #ccc;
  border: 2px solid #555;
  border-radius: 6px;
  padding: 6px 16px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
#paste-btn:active {
  transform: translateY(1px);
}

#paste-input {
  background: #1a1a1a;
  border: 1px solid #33ff33;
  color: #33ff33;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 4px;
  width: 250px;
}

#speed-indicator {
  color: #33ff3388;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

#keyboard-housing {
  width: 100%;
  max-width: 760px;
  background: #2a2a2a;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  margin-bottom: 8px;
}

#keyboard-surface {
  background: linear-gradient(180deg, #8B7355 0%, #6B5335 50%, #5B4325 100%);
  border-radius: 8px;
  padding: 10px 8px;
  position: relative;
}

#keyboard-surface::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 8px;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.03) 3px,
    rgba(0,0,0,0.03) 6px
  );
  pointer-events: none;
}

#keyboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.key-row {
  display: flex;
  gap: 3px;
  justify-content: center;
}

.key {
  background: linear-gradient(180deg, #b0a890 0%, #969080 40%, #868070 100%);
  border: 1px solid #706860;
  border-radius: 5px;
  min-width: 44px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  box-shadow: 
    0 2px 0 #504840,
    0 3px 3px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.05s;
  padding: 2px 3px;
}

.key:active, .key.pressed {
  transform: translateY(2px);
  box-shadow: 
    0 0px 0 #504840,
    0 1px 1px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.1);
  background: linear-gradient(180deg, #a09880 0%, #8a8478 40%, #7a7468 100%);
}

.key .main-label {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  line-height: 1;
}

.key .shift-label {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 8px;
  color: #ddd;
  line-height: 1;
  margin-bottom: 1px;
}

.key .ctrl-label {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 7px;
  color: #ccc;
  line-height: 1;
}

.key-wide {
  min-width: 60px;
}

.key-wider {
  min-width: 75px;
}

.key-space {
  min-width: 300px;
}

.key-shift-active {
  background: linear-gradient(180deg, #c8c0a8 0%, #b0a898 40%, #a09888 100%) !important;
  border-color: #888;
}

.key-ctrl-active {
  background: linear-gradient(180deg, #c8c0a8 0%, #b0a898 40%, #a09888 100%) !important;
  border-color: #888;
}

#status-bar {
  display: flex;
  gap: 20px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #33ff3388;
  margin: 6px 0;
  flex-wrap: wrap;
  justify-content: center;
}

footer {
  margin-top: 10px;
  padding: 10px;
}
footer a {
  color: #444;
  text-decoration: none;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}
footer a:hover {
  color: #666;
}

@media (max-width: 700px) {
  #canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 280/192;
  }
  #monitor-bezel {
    padding: 10px;
    width: 100%;
  }
  #keyboard-housing {
    width: 100%;
  }
  .key {
    min-width: 28px;
    height: 34px;
    font-size: 10px;
  }
  .key .main-label { font-size: 10px; }
  .key .shift-label { font-size: 6px; }
  .key-wide { min-width: 40px; }
  .key-wider { min-width: 52px; }
  .key-space { min-width: 160px; }
  #title { font-size: 16px; letter-spacing: 3px; }
}