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

body {
  background: #0d0d1a;
  font-family: 'JetBrains Mono', monospace;
  color: #ccc;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

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

/* Toolbar */
#toolbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}
.toolbar-left, .toolbar-right { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

#toolbar button, .file-btn, #speed-select {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #2a2a3e;
  color: #ddd;
  cursor: pointer;
  transition: background 0.15s;
}
#toolbar button:hover, .file-btn:hover { background: #3a3a5e; }
#btn-power.active { background: #2a5a2a; border-color: #4a8a4a; color: #8f8; }
.crt-toggle { font-size: 11px; display:flex; align-items:center; gap:4px; cursor:pointer; }
.crt-toggle input { cursor:pointer; }

#speed-select { background: #2a2a3e; }
#speed-select option { background: #1a1a2e; }

/* Monitor */
#monitor {
  margin-bottom: 8px;
}

#bezel {
  background: linear-gradient(160deg, #3a3a3a 0%, #2a2a2a 50%, #1a1a1a 100%);
  border-radius: 18px;
  padding: 16px 20px 12px;
  border: 2px solid #444;
  box-shadow: 0 0 40px rgba(50,180,220,0.08), inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
}

.rainbow-stripe {
  display: flex;
  gap: 0;
  margin-bottom: 8px;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}
.rs { flex:1; }
.rs.r { background: #c43030; }
.rs.o { background: #d87020; }
.rs.y { background: #c8b830; }
.rs.g { background: #30a030; }

#screen-wrap {
  position: relative;
  /* 284:234 aspect ratio ≈ 1.214, scaled up for display */
  width: 568px;
  height: 468px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(50,200,255,0.06), inset 0 0 60px rgba(0,0,0,0.5);
}

#screen {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  display: block;
}

#crt-overlay {
  position: absolute;
  top:0; left:0; right:0; bottom:0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.4) 100%);
  z-index: 2;
}

#scanlines {
  position: absolute;
  top:0; left:0; right:0; bottom:0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0,0,0,0.15) 1px,
    rgba(0,0,0,0.15) 2px
  );
  z-index: 3;
}

#scanlines.off, #crt-overlay.off { display: none; }

.bezel-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-left: 4px;
}

#power-led {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #333;
  box-shadow: none;
  transition: all 0.3s;
}
#power-led.on {
  background: #3f3;
  box-shadow: 0 0 6px #3f3, 0 0 12px #3f3;
}

.bezel-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #888;
  letter-spacing: 2px;
}

/* Keyboard */
#keyboard {
  width: 100%;
  max-width: 860px;
  background: linear-gradient(180deg, #8b7355 0%, #6d5a3e 100%);
  border-radius: 10px;
  padding: 10px 8px;
  border: 2px solid #5a4a30;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  margin-bottom: 6px;
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-bottom: 3px;
}

.key {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  color: #eee;
  background: linear-gradient(180deg, #5a4a35 0%, #4a3a28 100%);
  border: 1px solid #3a2a18;
  border-radius: 4px;
  min-width: 38px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 0 #2a1a08, 0 3px 4px rgba(0,0,0,0.3);
  transition: all 0.06s;
  text-align: center;
  padding: 2px 4px;
  line-height: 1.1;
  position: relative;
}

.key:hover { background: linear-gradient(180deg, #6a5a45 0%, #5a4a38 100%); }
.key.pressed, .key:active {
  box-shadow: 0 0 0 #2a1a08, 0 1px 2px rgba(0,0,0,0.3);
  transform: translateY(2px);
  background: linear-gradient(180deg, #3a2a18 0%, #4a3a28 100%);
}

.key.wide { min-width: 58px; }
.key.wider { min-width: 72px; }
.key.space { flex: 1; max-width: 320px; min-width: 200px; }
.key.return-key { min-width: 68px; background: linear-gradient(180deg,#5a5040 0%,#4a4030 100%); }
.key.shift-key { min-width: 52px; }
.key.special { background: linear-gradient(180deg,#6a5545 0%,#5a4535 100%); }
.key.func-key {
  min-width: 36px;
  height: 34px;
  background: linear-gradient(180deg,#7a6a55 0%,#6a5a45 100%);
  font-size: 8px;
}
.key.cbm-key::before { content: '⌂'; margin-right: 2px; }

/* Status Bar */
#status-bar {
  width: 100%;
  max-width: 860px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 4px;
}

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #444;
  margin: 0 4px 0 2px;
  vertical-align: middle;
  transition: background 0.3s;
}
.dot.loaded { background: #3f3; box-shadow: 0 0 4px #3f3; }

#disk-activity {
  color: #888;
  min-width: 80px;
  text-align: right;
}
#disk-activity.active { color: #f84; animation: blink 0.3s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

footer {
  font-size: 11px;
  color: #555;
  padding: 8px;
  text-align: center;
}
footer a { color: #6af; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 640px) {
  #screen-wrap { width: 356px; height: 294px; }
  #bezel { padding: 10px 12px 8px; border-radius: 12px; }
  .key { min-width: 24px; height: 28px; font-size: 7px; }
  .key.wide { min-width: 38px; }
  .key.wider { min-width: 48px; }
  .key.space { min-width: 120px; }
  #keyboard { padding: 6px 4px; }
  .kb-row { gap: 2px; margin-bottom: 2px; }
}