/* ── Game Emulator Overlay ── */
#game-overlay {
  --game-mobile-kb: 0px;
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 10px calc(10px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
#game-overlay.on { display: flex; }

#game-bezel {
  background: linear-gradient(160deg, #d8d4c4 0%, #b0ac9c 100%);
  border-radius: 12px;
  padding: 16px;
  box-shadow:
    0 0 60px rgba(77,255,110,0.08),
    inset -2px -2px 6px rgba(0,0,0,0.15),
    inset 1px 1px 4px rgba(255,255,255,0.35);
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
}
#game-bezel::after {
  content: 'CTM644';
  position: absolute;
  bottom: 20px;
  right: 22px;
  font-family: var(--mono);
  font-size: 0.55rem;
  color: rgba(0,0,0,0.25);
  letter-spacing: 0.1em;
}

#game-screen {
  background: var(--screen-bg);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.8),
    inset 0 0 80px rgba(0,0,0,0.4);
  width: 768px;
  height: 544px;
  max-width: 85vw;
  max-height: 70vh;
}
#game-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.06) 2px,
    rgba(0,0,0,0.06) 4px
  );
  pointer-events: none;
  z-index: 2;
}
#game-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(77,255,110,0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 2;
}

#game-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

#game-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  background: #cc0000;
  color: white;
  border: 2px solid #aa0000;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: background 0.15s;
}
#game-close:hover { background: #ee2222; }

#game-title-bar {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  padding: 10px 0 0;
  letter-spacing: 0.06em;
}
#game-title-bar span { color: var(--phosphor); }

#game-hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--phosphor);
  text-align: center;
  padding: 10px 16px 0;
  max-width: 90vw;
  line-height: 1.5;
}
#game-hint .cmd {
  display: inline-block;
  background: rgba(77,255,110,0.15);
  border: 1px solid var(--phosphor);
  border-radius: 3px;
  padding: 2px 8px;
  margin: 0 2px;
  font-weight: bold;
}
#game-hint .note {
  display: block;
  margin-top: 6px;
  font-size: 0.6rem;
  opacity: 0.6;
}

@media (max-width: 600px) {
  #game-bezel {
    width: 100%;
    max-width: 96vw;
    padding: 8px;
    border-radius: 8px;
    box-sizing: border-box;
  }
  #game-screen {
    width: 100%;
    max-width: 100%;
    height: min(86vh, calc((96vw - 16px) * 0.7083 + var(--game-mobile-kb)));
  }
  #game-close { top: -10px; right: -10px; width: 28px; height: 28px; font-size: 0.85rem; }
}

