/* ── Reset ───────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
}

/* ── Lobby ───────────────────────────────────── */
.lobby-body {
  background: #008080;
  min-height: 100vh;
  overflow: auto;
}

/* ── Game viewport ───────────────────────────── */
.game-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #000;
}

#hud {
  width: 100%;
  max-width: calc(100vh * 4 / 3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  background: #c0c0c0;
  border-bottom: 2px solid #808080;
  font-family: 'Pixelated MS Sans Serif', Arial, sans-serif;
  font-size: 14px;
  flex-shrink: 0;
}

.hud-player {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hud-score {
  font-weight: bold;
}

.hud-combo {
  color: #ff6600;
  font-weight: bold;
}

#hud-threat {
  font-weight: bold;
  color: #cc0000;
}

#viewport {
  aspect-ratio: 4 / 3;
  max-width: 100vw;
  max-height: calc(100vh - 30px);
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #008080;
}

#desktop {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ── Pop-up windows ──────────────────────────── */
.popup-window {
  position: absolute;
  width: 220px;
  min-height: 80px;
  z-index: 10;
  cursor: default;
  transition: opacity 0.1s;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 800px) {
  .popup-window {
    width: 180px;
    min-height: 60px;
  }
}

/* Prevent title text from pushing close button off the window */
.popup-window .title-bar {
  display: flex;
}

.popup-window .title-bar-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.popup-window .title-bar-controls {
  flex-shrink: 0;
}

/* ── Claimed-by-player flash ─────────────────── */
.popup-window.claimed-by-self {
  outline: 3px solid #4444ff;
  outline-offset: -1px;
}

.popup-window.claimed-by-opponent {
  outline: 3px solid #ff4444;
  outline-offset: -1px;
}

/* ── Page Fault animation ────────────────────── */
.popup-window.page-fault {
  animation: pageFaultShake 0.2s ease-in-out;
  outline: 3px solid #ff0000;
}

@keyframes pageFaultShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px) rotate(-2deg); }
  75% { transform: translateX(6px) rotate(2deg); }
}

/* ── Ghost prank ─────────────────────────────── */
.popup-window.prank-ghost {
  animation: ghostFlicker 1.5s ease-in-out infinite;
}

@keyframes ghostFlicker {
  0%, 100% { opacity: 1.0; }
  50% { opacity: 0.2; }
}

/* ── Virus window styling ────────────────────── */
.popup-window.virus-window .title-bar {
  background: linear-gradient(90deg, #aa0000, #cc0000);
}

/* ── Decoy controls ──────────────────────────── */
.decoy-controls {
  display: flex;
  gap: 2px;
}

/* ── Threat level transition banner ──────────── */
.tl-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 32px;
  font-weight: bold;
  z-index: 9998;
  animation: tlBannerFade 2s ease-out forwards;
}

@keyframes tlBannerFade {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

/* ── TL4 nuclear HUD ─────────────────────────── */
.hud-nuclear {
  background: #aa0000 !important;
  color: #fff;
}

.hud-nuclear #hud-threat {
  color: #ffff00;
}

/* ── Prank label (debug/spectator) ───────────── */
.prank-label {
  position: absolute;
  top: -18px;
  left: 4px;
  font-size: 10px;
  color: #ff6600;
  font-family: monospace;
  pointer-events: none;
}

/* ── BSOD end screen ─────────────────────────── */
#end-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bsod {
  background: #0000aa;
  color: #ffffff;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  padding: 60px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.8;
}

.bsod h1 {
  background: #aaaaaa;
  color: #0000aa;
  padding: 2px 12px;
  margin-bottom: 20px;
  font-size: 20px;
}

.victory-screen {
  background: #008080;
  color: #ffffff;
  font-family: 'Courier New', monospace;
  font-size: 20px;
  padding: 60px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.end-buttons {
  margin-top: 30px;
  display: flex;
  gap: 12px;
}

/* ── Pete taunt ──────────────────────────────── */
#pete-taunt {
  width: 300px;
  pointer-events: none;
  animation: tauntFadeIn 0.3s ease-out;
}

@keyframes tauntFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
