:root {
  --wood-1: #5a3820;
  --wood-2: #3b2211;
  --wall-1: #3b3022;
  --wall-2: #201a12;
  --cream-1: #e7e0cc;
  --cream-2: #cdc3a6;
  --cream-dark: #a69c82;
  --charcoal-1: #23252a;
  --charcoal-2: #15171b;
  --keycap-bg: #292c33;
  --keycap-top: #3a3e47;
  --accent-amber: #f59e0b;
  --led-red: #ef4444;
  --led-green: #22c55e;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #14100c;
  color: #f4efe6;
  min-height: 100vh;
  overflow-x: hidden;
}

.room-backdrop {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 210, 115, 0.24), transparent 46%),
    linear-gradient(180deg, var(--wall-1) 0%, var(--wall-2) 64%, #160f09 100%);
  transition: background 0.4s ease;
}

body:not(.lamp-on) .room-backdrop {
  background:
    radial-gradient(circle at 50% 42%, rgba(70, 175, 255, 0.16), transparent 52%),
    linear-gradient(180deg, #0b0a0c 0%, #050507 100%);
}

/* Barra superior */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 16px;
  background: rgba(16, 12, 9, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

.dot-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--led-green);
  box-shadow: 0 0 8px var(--led-green);
}

.badge {
  font-size: 0.66rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.4);
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #efe7da;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.pill-btn.active {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.5);
  color: #bbf7d0;
}

.pill-btn.accent {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fde68a;
}

/* Palco principal da mesa */
.desk-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px 16px;
}

.desk-surface {
  width: 100%;
  max-width: 1240px;
  display: grid;
  grid-template-columns: 245px minmax(490px, 650px) 235px;
  gap: 16px;
  align-items: end;
  padding: 18px 20px 20px;
  border-radius: 18px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.014) 0px,
      rgba(255, 255, 255, 0.014) 2px,
      transparent 2px,
      transparent 16px
    ),
    linear-gradient(180deg, #684125 0%, var(--wood-1) 40%, var(--wood-2) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 225, 185, 0.18),
    0 24px 60px rgba(0, 0, 0, 0.68);
  position: relative;
  transition: outline 0.15s ease;
}

.desk-surface.drag-over {
  outline: 3px dashed #fbbf24;
  outline-offset: -6px;
}

body:not(.lamp-on) .desk-surface {
  background: linear-gradient(180deg, #28180e 0%, #1a1009 45%, #100905 100%);
}

.peripheral-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

/* Luminária amarela */
.desk-lamp {
  position: relative;
  height: 62px;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  padding-left: 14px;
}

.lamp-arm {
  width: 7px;
  height: 54px;
  background: linear-gradient(90deg, #b45309, #fbbf24);
  border-radius: 4px;
  transform: rotate(-18deg);
  transform-origin: bottom center;
}

.lamp-shade {
  position: relative;
  width: 54px;
  height: 33px;
  margin-left: -4px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #fde047 0%, #eab308 65%, #ca8a04 100%);
  border-radius: 26px 26px 8px 8px;
  transform: rotate(22deg);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.lamp-bulb {
  width: 20px;
  height: 7px;
  background: #fef9c3;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 0 18px 6px rgba(254, 240, 138, 0.75);
  transition: opacity 0.3s ease;
}

body:not(.lamp-on) .lamp-bulb {
  opacity: 0.15;
  box-shadow: none;
}

.lamp-cone {
  position: absolute;
  left: 32px;
  top: 40px;
  width: 140px;
  height: 100px;
  background: radial-gradient(ellipse at top left, rgba(254, 240, 138, 0.24), transparent 72%);
  pointer-events: none;
  transition: opacity 0.35s ease;
}

body:not(.lamp-on) .lamp-cone {
  opacity: 0;
}

/* Gravador K7 */
.cassette-deck {
  background: linear-gradient(180deg, #353840 0%, #1e2026 100%);
  border: 2px solid #4d515b;
  border-radius: 10px;
  padding: 9px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.deck-header,
.drive-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.deck-brand,
.drive-brand {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #e5e2dc;
}

.deck-telemetry {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tape-counter {
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  font-weight: 800;
  background: #090b0d;
  color: #e2e8f0;
  border: 1px solid #475569;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.08em;
}

.mini-led,
.drive-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3f1818;
  border: 1px solid #18181b;
  transition: all 0.15s ease;
}

.mini-led.active,
.drive-led.active {
  background: var(--led-red);
  box-shadow: 0 0 10px var(--led-red);
}

.mini-led.green-on {
  background: var(--led-green);
  box-shadow: 0 0 10px var(--led-green);
}

.tape-window {
  background: #0e1014;
  border: 2px solid #575c66;
  border-radius: 6px;
  padding: 7px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inserted-tape {
  width: 100%;
  height: 100%;
  background: #27272a;
  border-radius: 4px;
  border: 1px solid #52525b;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.inserted-tape.empty {
  opacity: 0.45;
}

.tape-label-strip {
  background: #fef08a;
  color: #18181b;
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
  border-radius: 2px;
  padding: 1px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inserted-tape.empty .tape-label-strip {
  background: #3f3f46;
  color: #d4d4d8;
}

.tape-reels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.reel {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #18181b;
  border: 2px solid #e4e4e7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel span {
  width: 9px;
  height: 2px;
  background: #e4e4e7;
  display: block;
}

.cassette-deck.playing .reel,
.cassette-deck.recording .reel {
  animation: spin 0.65s linear infinite;
}

.tape-window-center {
  flex: 1;
  height: 9px;
  margin: 0 8px;
  background: repeating-linear-gradient(90deg, #3f3f46 0 4px, #18181b 4px 8px);
  border-radius: 2px;
}

.deck-controls.four-btns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 8px;
}

.mech-btn {
  background: linear-gradient(180deg, #52525b, #3f3f46);
  color: #fafafa;
  border: 1px solid #71717a;
  border-radius: 4px;
  padding: 5px 3px;
  font-size: 0.6rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #18181b;
}

.mech-btn.rec {
  color: #fca5a5;
}

.mech-btn.pressed {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #18181b;
  background: linear-gradient(180deg, #27272a, #18181b);
  border-color: #fbbf24;
}

.mech-btn.rec.pressed {
  background: linear-gradient(180deg, #991b1b, #7f1d1d);
  color: #fff;
}

.deck-file-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  margin-top: 8px;
}

.file-upload-btn,
.autoload-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f4f4f5;
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 0.64rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.file-upload-btn:hover,
.autoload-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.autoload-btn {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde68a;
}

/* Racks de fitas e disquetes */
.media-rack {
  background: rgba(15, 12, 9, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px;
}

.rack-title {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #e7dcc8;
  margin-bottom: 7px;
  opacity: 0.88;
}

.tape-rack,
.floppy-rack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 330px;
  overflow-y: auto;
  overflow-x: hidden;
}

.tape-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-left: 6px solid var(--tape-color, #eab308);
  border-radius: 6px;
  padding: 5px 7px;
  color: #f4f4f5;
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.tape-mini-icon {
  width: 30px;
  height: 19px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.tape-item-info {
  flex: 1;
  min-width: 0;
}

.catalog-k7-icon {
  width: 22px;
  height: 14px;
  object-fit: contain;
  vertical-align: -2px;
  margin-right: 4px;
}

.tape-item:hover {
  border-color: #fde047;
  background: #303036;
}

.tape-item.active {
  box-shadow: 0 0 0 2px #fde047;
}

.tape-item strong {
  display: block;
  font-size: 0.7rem;
}

.tape-item small {
  display: block;
  font-size: 0.58rem;
  color: #a1a1aa;
}

.tape-dl-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e4e4e7;
  font-size: 0.58rem;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
}

.tape-dl-btn:hover {
  background: #3b82f6;
  color: #fff;
}

/* Joystick box */
.joystick-box {
  background: linear-gradient(180deg, #272930 0%, #1a1c21 100%);
  border: 2px solid #454954;
  border-radius: 10px;
  padding: 9px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}

.joy-toggle-btn {
  width: 100%;
  background: #334155;
  color: #f8fafc;
  border: 1px solid #64748b;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  text-align: center;
}

.joy-toggle-btn.active {
  background: #15803d;
  border-color: #4ade80;
}

.joy-hint {
  display: block;
  margin-top: 5px;
  font-size: 0.6rem;
  color: #a1a1aa;
  text-align: center;
}

/* Caixa de Packs de Arquivos & Manuais (entre Joystick e Manuais) */
.desk-packs-box {
  background: linear-gradient(180deg, #272930 0%, #1a1c21 100%);
  border: 2px solid #454954;
  border-radius: 10px;
  padding: 9px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}

.packs-led {
  background: #22c55e;
  box-shadow: 0 0 7px rgba(34, 197, 94, 0.75);
}

body.machine-apple2 .packs-led {
  background: #3b82f6;
  box-shadow: 0 0 7px rgba(59, 130, 246, 0.75);
}

.desk-packs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.desk-pack-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 7px;
  text-decoration: none;
  background: linear-gradient(180deg, #1b1d24 0%, #12141a 100%);
  border: 1px solid #3f4350;
  border-left: 3px solid #22c55e;
  color: #f4f4f5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 3px 8px rgba(0, 0, 0, 0.28);
  transition: transform 0.14s ease, border-color 0.14s ease, filter 0.14s ease;
}

.desk-pack-btn.pack-media.a2 {
  border-left-color: #3b82f6;
}

.desk-pack-btn.pack-manuals {
  border-left-color: #eab308;
  background: linear-gradient(180deg, #24211a 0%, #171511 100%);
  border-color: #574c34;
  border-left-width: 3px;
}

.desk-pack-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  border-color: #71717a;
}

.desk-pack-btn.pack-manuals:hover {
  border-color: #ca8a04;
}

.pack-glyph {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(74, 222, 128, 0.28);
}

.desk-pack-btn.pack-media.a2 .pack-glyph {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(96, 165, 250, 0.34);
}

.desk-pack-btn.pack-manuals .pack-glyph {
  background: rgba(245, 240, 225, 0.12);
  border-color: rgba(250, 204, 21, 0.32);
}

.pack-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.pack-meta strong {
  font-size: 0.67rem;
  font-weight: 800;
  color: #f4f4f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pack-meta small {
  font-size: 0.56rem;
  color: #a1a1aa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desk-pack-btn.pack-manuals .pack-meta small {
  color: #e7dec8;
}

.pack-dl-pill {
  font-size: 0.55rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  background: linear-gradient(180deg, #16a34a, #15803d);
  border: 1px solid #4ade80;
  color: #ffffff;
}

.desk-pack-btn.pack-media.a2 .pack-dl-pill {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border-color: #60a5fa;
}

.desk-pack-btn.pack-manuals .pack-dl-pill {
  background: linear-gradient(180deg, #f5f0e1, #e5dcc5);
  border-color: #d6c9a9;
  color: #1c1917;
}

/* Drive 5.25" */
.floppy-drive {
  background: linear-gradient(180deg, var(--cream-1) 0%, var(--cream-2) 100%);
  color: #27272a;
  border: 2px solid #9e947a;
  border-radius: 10px;
  padding: 9px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.floppy-drive .drive-brand {
  color: #27272a;
}

.drive-faceplate {
  background: #18181b;
  border-radius: 6px;
  padding: 10px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drive-slot {
  flex: 1;
  height: 9px;
  background: #09090b;
  border: 1px solid #3f3f46;
  border-radius: 2px;
  position: relative;
}

.inserted-disk-edge {
  position: absolute;
  left: 5px;
  right: 5px;
  top: 2px;
  height: 5px;
  background: #27272a;
  border-radius: 1px;
  opacity: 0;
  transform: translateY(-7px);
  transition: all 0.25s ease;
}

.inserted-disk-edge.visible {
  opacity: 1;
  transform: translateY(0);
  background: var(--disk-color, #2563eb);
}

.drive-latch {
  width: 22px;
  height: 20px;
  background: #52525b;
  border: 1px solid #71717a;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.22s ease, background 0.22s ease;
}

.drive-latch.open {
  transform: rotate(-28deg);
  background: #71717a;
}

.drive-latch.closed {
  transform: rotate(0deg);
  background: #e4e4e7;
}

.drive-status-text {
  margin-top: 5px;
  font-size: 0.62rem;
  font-weight: 800;
  color: #44403c;
  text-align: center;
}

.drive-file-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  margin-top: 7px;
}

.drive-file-actions .file-upload-btn {
  background: #292524;
  border-color: #57534e;
  color: #f5f5f4;
}

.drive-file-actions .file-upload-btn:hover {
  background: #44403c;
}

.drive-file-actions .rom-btn {
  color: #fde68a;
  border-color: #78350f;
}

.drive-rom-status {
  font-size: 0.56rem;
  font-weight: 700;
  color: #57534e;
  text-align: center;
  margin-top: 4px;
}

/* Disquetes */
.floppy-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-left: 6px solid var(--disk-color, #2563eb);
  border-radius: 6px;
  padding: 5px 7px;
  color: #f4f4f5;
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.floppy-item:hover {
  border-color: #60a5fa;
  background: #303036;
}

.floppy-item.active {
  box-shadow: 0 0 0 2px #60a5fa;
}

.floppy-mini-icon,
.floppy-icon {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  background: #09090b;
  border: 1px solid #52525b;
  position: relative;
  flex-shrink: 0;
}

.floppy-mini-icon::before,
.floppy-icon::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 3px;
  right: 3px;
  height: 6px;
  background: var(--disk-color, #2563eb);
  border-radius: 1px;
}

.floppy-mini-icon::after,
.floppy-icon::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 2px solid #d4d4d8;
}

.floppy-item strong {
  display: block;
  font-size: 0.7rem;
}

.floppy-item small {
  display: block;
  font-size: 0.58rem;
  color: #a1a1aa;
}

/* Manual */
.desk-manual {
  display: flex;
  align-items: stretch;
  background: #f5f0e1;
  color: #1c1917;
  border: 1px solid #a8a29e;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}

.desk-manual:hover {
  transform: translateY(-2px);
}

.manual-spiral {
  width: 11px;
  background: repeating-linear-gradient(180deg, #52525b 0 4px, #d6d3d1 4px 8px);
}

.manual-cover {
  padding: 6px 9px;
  display: flex;
  flex-direction: column;
}

.manual-mini {
  font-size: 0.54rem;
  font-weight: 800;
  color: #b45309;
  letter-spacing: 0.08em;
}

.manual-cover strong {
  font-size: 0.74rem;
}

.manual-cover small {
  font-size: 0.58rem;
  color: #57534e;
}

.desk-manual.basic-booklet {
  background: #1e293b;
  color: #f8fafc;
  border-color: #475569;
}

.desk-manual.basic-booklet .manual-mini {
  color: #38bdf8;
}

.desk-manual.basic-booklet .manual-cover small {
  color: #cbd5e1;
}

.desk-manual.basic-booklet .manual-spiral {
  background: repeating-linear-gradient(180deg, #94a3b8 0 4px, #334155 4px 8px);
}

/* Estação central */
.center-station {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.crt-monitor {
  width: 100%;
  max-width: 590px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.crt-bezel {
  width: 100%;
  background: linear-gradient(180deg, #eae3cf 0%, #cfc5aa 100%);
  border: 3px solid #9f9478;
  border-radius: 20px 20px 14px 14px;
  padding: 15px 18px 9px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    0 20px 42px rgba(0, 0, 0, 0.58);
}

.crt-screen-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 280 / 192;
  background: #040608;
  border: 12px solid #16181d;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.95),
    0 0 34px rgba(56, 189, 248, 0.16);
}

#crt-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: contrast(1.06) brightness(1.04) drop-shadow(0 0 2px rgba(255, 255, 255, 0.18));
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.crt-monitor.off #crt-canvas {
  transform: scaleY(0.015);
  opacity: 0;
}

.crt-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.28) 2px,
    rgba(0, 0, 0, 0.28) 3px
  );
}

.crt-scanlines.hidden {
  display: none;
}

.crt-glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 12px;
  background:
    radial-gradient(circle at 26% 18%, rgba(255, 255, 255, 0.11), transparent 50%),
    radial-gradient(circle at 50% 50%, transparent 68%, rgba(0, 0, 0, 0.42) 100%);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.65);
}

.crt-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  padding: 0 4px;
}

.crt-brand {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #3f3a30;
}

.crt-knobs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crt-switch,
.crt-power-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #27272a;
  color: #f4f4f5;
  border: 1px solid #52525b;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.64rem;
  font-weight: 700;
  cursor: pointer;
}

.power-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #451a1a;
}

.crt-power-btn.on .power-led {
  background: var(--led-green);
  box-shadow: 0 0 7px var(--led-green);
}

.crt-stand {
  width: 52%;
  height: 11px;
  background: linear-gradient(180deg, #9f9478, #786e57);
  border-radius: 0 0 8px 8px;
}

/* Microdigital TK 2000 II */
.tk2000-unit {
  width: 100%;
  max-width: 635px;
  background: linear-gradient(180deg, var(--cream-1) 0%, var(--cream-2) 35%, #1d1f24 35.5%, #14161a 100%);
  border: 2px solid #8a8068;
  border-radius: 12px 12px 14px 14px;
  padding: 9px 13px 13px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 16px 34px rgba(0, 0, 0, 0.6);
}

.tk-top-deck {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  padding: 2px 4px;
}

.tk-vent {
  width: 64px;
  height: 14px;
  background: repeating-linear-gradient(90deg, #a69c82 0 3px, transparent 3px 6px);
  border-radius: 2px;
}

.tk-nameplate {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: linear-gradient(180deg, #d4d4d8, #a1a1aa);
  color: #18181b;
  padding: 3px 12px;
  border-radius: 4px;
  border: 1px solid #52525b;
}

.tk-logo {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.tk-model {
  font-size: 0.84rem;
  font-weight: 900;
}

.tk-sub {
  font-size: 0.56rem;
  font-weight: 700;
  color: #3f3f46;
}

.tk-status-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tk-power-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.64rem;
  font-weight: 800;
  color: #27272a;
}

.tk-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #451a1a;
}

.tk-led.on {
  background: var(--led-red);
  box-shadow: 0 0 8px var(--led-red);
}

.tk-reset-btn {
  background: #dc2626;
  color: #fff;
  border: 1px solid #991b1b;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 0.58rem;
  font-weight: 800;
  cursor: pointer;
}

.tk-keywell {
  background: #0e1013;
  border: 2px solid #2e323b;
  border-radius: 8px;
  padding: 7px;
}

.tk-keyboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.tk-key {
  min-width: 34px;
  height: 31px;
  padding: 2px 4px;
  background: linear-gradient(180deg, var(--keycap-top) 0%, var(--keycap-bg) 100%);
  color: #f4f4f5;
  border: 1px solid #52525b;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  cursor: pointer;
  box-shadow: 0 3px 0 #090a0d;
  transition: transform 0.05s ease, box-shadow 0.05s ease, background 0.05s ease;
}

.tk-key .sub-legend {
  font-size: 0.48rem;
  color: #cbd5e1;
  font-weight: 600;
}

.tk-key.wide {
  min-width: 52px;
  font-size: 0.58rem;
}

.tk-key.wider {
  min-width: 66px;
  font-size: 0.58rem;
}

.tk-key.space {
  flex: 1;
  max-width: 220px;
}

.tk-key.special {
  background: linear-gradient(180deg, #4b5563 0%, #374151 100%);
  color: #fde68a;
}

.tk-key.arrow {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: #93c5fd;
}

.tk-key.active,
.tk-key:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #090a0d;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #111827;
}

/* Modal Manual */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 6, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 820px;
  background: #faf5e8;
  color: #1c1917;
  border: 3px solid #78716c;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #e7dec8;
  border-bottom: 2px solid #c4b89b;
}

.modal-header h2 {
  font-size: 1rem;
}

.modal-close {
  background: #dc2626;
  color: #fff;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

.modal-body {
  padding: 16px 20px;
  max-height: 76vh;
  overflow-y: auto;
}

.manual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.manual-grid h3 {
  font-size: 0.9rem;
  margin-bottom: 7px;
  color: #9a3412;
}

.manual-grid ul,
.manual-grid ol {
  padding-left: 18px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.manual-grid code {
  background: #e7e5e4;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
}

.basic-modal-card {
  max-width: 920px;
}

.basic-modal-header {
  background: #1e293b;
  color: #f8fafc;
  border-bottom-color: #334155;
}

.basic-search-bar {
  margin-bottom: 14px;
}

.basic-search-bar input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: 0.85rem;
  outline: none;
}

.basic-search-bar input:focus {
  border-color: #0284c7;
}

.basic-sec.hidden {
  display: none;
}

.basic-sec li.hidden {
  display: none;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 1080px) {
  html,
  body,
  .room-backdrop,
  .desk-stage {
    max-width: 100%;
    overflow-x: hidden;
  }

  .desk-stage {
    width: 100%;
  }

  .desk-surface {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    width: 100%;
    max-width: 680px;
  }

  .desk-surface > *,
  .center-station,
  .peripheral-col,
  .crt-monitor,
  .crt-bezel,
  .tk2000-unit,
  .tk-keywell,
  .mobile-touch-controls {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .center-station { order: 1; }
  .left-col { order: 2; }
  .right-col { order: 3; }
  .desk-lamp { display: none; }
  .manual-grid { grid-template-columns: 1fr; }
}

.keys-help {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #18181b;
  border: 1px solid #3f3f46;
  color: #e4e4e7;
  font-size: 11px;
  line-height: 1.5;
}
.keys-help .kh-title {
  display: block;
  font-weight: 700;
  color: #fde047;
  margin-bottom: 3px;
  letter-spacing: 0.04em;
}
.keys-help .kh-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.keys-help kbd {
  background: #3f3f46;
  border-radius: 3px;
  padding: 0 4px;
  font-family: monospace;
  color: #fff;
  white-space: nowrap;
}

/* Seletor de Computador (TK 2000 II vs Apple II+) */
.machine-switcher {
  display: inline-flex;
  background: #14161a;
  border: 1px solid #3f3f46;
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.machine-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: #a1a1aa;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.machine-count-pill {
  font-size: 0.61rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fde047;
  letter-spacing: 0.01em;
}

.machine-switch-btn.active .machine-count-pill {
  background: rgba(0, 0, 0, 0.26);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.machine-switch-btn:hover {
  color: #f4f4f5;
}

.machine-switch-btn.active {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

body.machine-tk2000 .machine-switch-btn#btn-mode-tk2000.active {
  background: linear-gradient(180deg, #22c55e, #15803d);
}

/* Visibilidade exclusiva por computador */
body.machine-tk2000 #floppy-drive-section,
body.machine-tk2000 #floppy-rack-section,
body.machine-tk2000 .a2-only {
  display: none;
}

body.machine-apple2 #cassette-deck,
body.machine-apple2 #tape-rack-section,
body.machine-apple2 .tk-only {
  display: none;
}

/* Visual autêntico do Apple II+ quando no modo Apple II */
body.machine-apple2 .tk2000-unit {
  background: linear-gradient(180deg, #e5dec9 0%, #d4cbb0 36%, #2a241f 36.5%, #1c1714 100%);
  border-color: #9e9378;
}

body.machine-apple2 .tk-vent {
  background: repeating-linear-gradient(90deg, #9a8f75 0 2px, transparent 2px 5px);
}

body.machine-apple2 .tk-nameplate {
  background: linear-gradient(180deg, #1b1b1e, #0f0f12);
  color: #f4f4f5;
  border-color: #3f3f46;
}

body.machine-apple2 .tk-apple-rainbow {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    #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%
  );
  flex-shrink: 0;
}

body.machine-apple2 .tk-sub {
  color: #a1a1aa;
}

body.machine-apple2 .tk-keywell .tk-key:not(.special):not(.arrow) {
  background: linear-gradient(180deg, #3b312a 0%, #241d18 100%);
  border-color: #54463c;
  color: #f5efe6;
}

body.machine-apple2 .crt-bezel {
  background: linear-gradient(180deg, #dfd7c0 0%, #c8bea2 100%);
  border-color: #8f846b;
}

/* Mantém a proporção exata da coluna esquerda idêntica entre TK 2000 e Apple II+ */
body.machine-apple2 .floppy-drive {
  padding: 9px;
}

body.machine-apple2 .floppy-rack {
  max-height: 338px;
}

.tape-empty-hint {
  font-size: 0.65rem;
  color: #a1a1aa;
  text-align: center;
  padding: 10px 8px;
  border: 1px dashed #3f3f46;
  border-radius: 6px;
  line-height: 1.4;
}

/* Cabeçalho, Busca e Filtros dos Racks de Mídia */
.rack-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.rack-header-row .rack-title {
  margin-bottom: 0;
  font-size: 0.61rem;
  white-space: nowrap;
}

.rack-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.rack-catalog-btn,
.rack-zip-link {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  border: 1px solid #60a5fa;
  color: #ffffff;
  font-size: 0.56rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  transition: filter 0.15s ease;
}

.rack-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(9, 11, 15, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.61rem;
  color: #d4d4d8;
}

.rack-stats-main {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.rack-stats-main strong {
  color: #fde047;
  font-weight: 800;
}

.rack-stats-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.75);
  flex-shrink: 0;
}

#floppy-rack-section .rack-stats-dot {
  background: #3b82f6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.75);
}

#floppy-rack-section .rack-stats-main strong {
  color: #93c5fd;
}

.rack-stats-tag {
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.rack-zip-link {
  background: linear-gradient(180deg, #16a34a, #15803d);
  border-color: #4ade80;
}

.rack-catalog-btn:hover,
.rack-zip-link:hover {
  filter: brightness(1.15);
}

.rack-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 7px;
}

.rack-search-input {
  width: 100%;
  background: rgba(9, 11, 15, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 0.64rem;
  color: #f4f4f5;
  outline: none;
}

.rack-search-input:focus {
  border-color: #fde047;
  box-shadow: 0 0 0 1px rgba(253, 224, 71, 0.35);
}

.rack-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.rack-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #d4d4d8;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.rack-pill:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.rack-pill.active {
  background: #eab308;
  border-color: #fde047;
  color: #18181b;
}

.media-item-badge {
  font-size: 0.52rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, 0.16);
  margin-left: 4px;
  vertical-align: middle;
}

.catalog-top-btn {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.32), rgba(29, 78, 216, 0.38));
  border-color: rgba(96, 165, 250, 0.55);
  color: #dbeafe;
}

/* Modal Gaveta de Fitas K7 / Caixa de Disquetes */
.catalog-modal-card {
  width: min(1080px, 95vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.catalog-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.catalog-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.catalog-total-badge {
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: #fde047;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
}

.catalog-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.catalog-zip-btn {
  background: linear-gradient(180deg, #16a34a, #15803d);
  border: 1px solid #4ade80;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 7px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.35);
}

.catalog-zip-btn:hover {
  filter: brightness(1.12);
}

.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(9, 10, 14, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.catalog-search-input {
  flex: 1 1 260px;
  background: #12141c;
  border: 1px solid #3f3f46;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: #f4f4f5;
  outline: none;
}

.catalog-search-input:focus {
  border-color: #fde047;
  box-shadow: 0 0 0 2px rgba(253, 224, 71, 0.25);
}

.catalog-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.catalog-tab-btn {
  background: #27272a;
  border: 1px solid #3f3f46;
  color: #e4e4e7;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.catalog-tab-btn:hover {
  background: #3f3f46;
}

.catalog-tab-btn.active {
  background: #eab308;
  border-color: #fde047;
  color: #18181b;
}

.catalog-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 12px;
}

.catalog-card {
  background: linear-gradient(180deg, #24262d 0%, #181a20 100%);
  border: 1px solid #3f3f46;
  border-top: 5px solid var(--card-accent, #eab308);
  border-radius: 9px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.catalog-card:hover {
  transform: translateY(-2px);
  border-color: #fde047;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.catalog-card.active {
  box-shadow: 0 0 0 2px #4ade80;
}

.catalog-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.catalog-card-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fafafa;
  line-height: 1.25;
}

.catalog-card-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.catalog-card-desc {
  font-size: 0.68rem;
  color: #a1a1aa;
  line-height: 1.35;
}

.catalog-card-controls {
  font-size: 0.62rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  padding: 4px 6px;
}

.catalog-card-play {
  margin-top: 2px;
  width: 100%;
  background: rgba(234, 179, 8, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #fde047;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 5px 8px;
  border-radius: 5px;
  text-align: center;
}

.catalog-card:hover .catalog-card-play {
  background: #eab308;
  color: #18181b;
}

/* Rodapé & Modal 4u-Labs (14 links oficiais + PayPal) */
.eco-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 8px 18px;
  background: rgba(10, 9, 8, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  color: #a1a1aa;
}

.eco-footer strong {
  color: #e4e4e7;
}

.eco-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
}

.eco-footer-links a {
  color: #a1a1aa;
  text-decoration: none;
  transition: color 0.15s ease;
}

.eco-footer-links a:hover {
  color: #fde047;
}

.eco-modal-card {
  max-width: 720px;
}

.eco-modal-desc {
  margin: 0 0 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #44403c;
}

.links-grid-14 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 8px;
}

.links-grid-14 a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f5efe0;
  border: 1px solid #d6ccb4;
  color: #1c1917;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.links-grid-14 a:hover {
  background: #fef3c7;
  border-color: #d97706;
}

.eco-support-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.eco-support-btn {
  background: linear-gradient(180deg, #0ea5e9, #0369a1);
  border-color: #38bdf8;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.3);
}


/* ============================================================
   Otimização Mobile / Touch (Celulares e Tablets)
   ============================================================ */
.room-backdrop {
  overflow-x: hidden;
}

button,
a,
label,
.tk-key,
.touch-pad-btn,
.tape-item,
.floppy-item {
  touch-action: manipulation;
}

.mobile-touch-controls {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 635px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(14, 16, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42);
}

.mobile-dpad {
  display: flex;
  align-items: center;
  gap: 4px;
  touch-action: none;
}

.mobile-action-cluster {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}

.touch-pad-btn {
  min-width: 38px;
  height: 38px;
  border-radius: 7px;
  border: 1px solid #475569;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: #f8fafc;
  font-weight: 800;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 2px 0 #090a0d;
}

.touch-pad-btn.active {
  transform: translateY(1px);
  background: #fbbf24;
  color: #111827;
  border-color: #fde047;
}

.touch-joy-btn {
  height: 38px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #e4e4e7;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.touch-joy-btn.active {
  background: rgba(34, 197, 94, 0.24);
  border-color: #4ade80;
  color: #bbf7d0;
}

.touch-fire-btn {
  padding: 0 10px;
  font-size: 0.68rem;
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  border-color: #f87171;
}

.touch-enter-btn {
  padding: 0 9px;
  font-size: 0.66rem;
  background: linear-gradient(180deg, #4b5563 0%, #374151 100%);
  border-color: #9ca3af;
  color: #fde68a;
}

@media (max-width: 1080px) {
  #btn-lamp {
    display: none;
  }

  body.machine-tk2000 .desk-packs-list.tk-only,
  body.machine-apple2 .desk-packs-list.a2-only {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
}

@media (max-width: 520px) {
  body.machine-tk2000 .desk-packs-list.tk-only,
  body.machine-apple2 .desk-packs-list.a2-only {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px), (hover: none) and (pointer: coarse) {
  .mobile-touch-controls {
    display: flex;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 6px 10px;
    gap: 6px;
  }

  .topbar-brand {
    width: 100%;
    justify-content: space-between;
    font-size: 0.8rem;
  }

  .machine-switcher {
    width: 100%;
  }

  .machine-switch-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    min-height: 36px;
    font-size: 0.72rem;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;
  }

  .topbar-actions::-webkit-scrollbar {
    display: none;
  }

  .topbar-actions .pill-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .desk-stage {
    padding: 6px 6px 12px;
  }

  .desk-surface {
    padding: 10px 8px 12px;
    gap: 10px;
    border-radius: 12px;
  }
}

@media (max-width: 640px) {
  #engine-badge {
    font-size: 0.58rem;
    padding: 2px 6px;
  }

  .crt-bezel {
    padding: 8px 8px 6px;
    border-radius: 14px 14px 10px 10px;
    border-width: 2px;
  }

  .crt-screen-frame {
    border-width: 6px;
    border-radius: 10px;
  }

  .crt-brand {
    font-size: 0.56rem;
    letter-spacing: 0.06em;
  }

  .tk2000-unit {
    padding: 7px 6px 8px;
    border-radius: 10px;
  }

  .tk-vent,
  .tk-sub {
    display: none;
  }

  .tk-nameplate {
    padding: 2px 7px;
    gap: 5px;
  }

  .tk-keywell {
    padding: 4px;
  }

  .tk-keyboard {
    gap: 3px;
  }

  .kb-row {
    gap: 2px;
    width: 100%;
  }

  .tk-key {
    flex: 1 1 0;
    min-width: 0;
    height: 34px;
    padding: 1px;
    font-size: 0.6rem;
    border-radius: 3px;
    box-shadow: 0 2px 0 #090a0d;
  }

  .tk-key .sub-legend {
    font-size: 0.42rem;
  }

  .tk-key.wide {
    flex: 1.45 1 0;
    min-width: 0;
    font-size: 0.48rem;
  }

  .tk-key.wider {
    flex: 1.75 1 0;
    min-width: 0;
    font-size: 0.48rem;
  }

  .tk-key.space {
    flex: 5 1 0;
    max-width: none;
  }

  .tape-rack,
  .floppy-rack {
    max-height: 265px;
  }

  .tape-item,
  .floppy-item {
    min-height: 44px;
    padding: 7px 8px;
  }

  .modal-overlay {
    padding: 8px;
  }

  .modal-card,
  .catalog-modal-card {
    width: 100%;
    max-height: 92vh;
  }

  .modal-header {
    padding: 10px 12px;
  }

  .modal-body {
    padding: 12px;
  }

  .catalog-toolbar {
    padding: 8px 12px;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .eco-footer {
    padding: 10px 12px;
    justify-content: center;
    text-align: center;
  }

  .eco-footer-links {
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .mobile-touch-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 6px;
  }

  .mobile-dpad,
  .mobile-action-cluster {
    justify-content: space-between;
  }

  .mobile-dpad .touch-pad-btn,
  .mobile-action-cluster button {
    flex: 1;
  }

  .tk-key {
    height: 32px;
    font-size: 0.56rem;
  }
}
