* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #000;
  color: #0f0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  overflow: hidden;
  height: 100vh;
}

#remoteVideo {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  background: #050505;
}

#local-container {
  position: fixed;
  bottom: 85px;
  right: 20px;
  width: 110px;
  aspect-ratio: 3/4;
  border: 2px solid #0f0;
  border-radius: 12px;
  z-index: 100;
  overflow: hidden;
  background: #111;
  cursor: move;
  touch-action: none;
}

#localVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

#no-cam-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #444;
  text-align: center;
}

#overlay-container {
  position: fixed;
  bottom: 80px;
  left: 0;
  width: 100%;
  height: 45vh;
  display: flex;
  flex-direction: column-reverse;
  padding: 20px;
  z-index: 5;
  pointer-events: none;
}

#messages {
  overflow-y: auto;
  pointer-events: auto;
  mask-image: linear-gradient(to top, black 85%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 10px;
}

.msg {
  background: rgba(0, 0, 0, 0.75);
  padding: 8px 15px;
  border-radius: 12px;
  width: fit-content;
  max-width: 85%;
  font-size: 12px;
  border-left: 3px solid #0f0;
  color: #fff;
  backdrop-filter: blur(5px);
}

.msg.system {
  color: #ff8800;
  border-left-color: #ff8800;
  font-size: 11px;
  font-family: monospace;
}

.msg.ip-success {
  border-left-color: #00ff00;
  background: rgba(0, 40, 0, 0.9);
  color: #0f0;
  font-weight: bold;
}

.msg b {
  color: #0f0;
  margin-right: 5px;
  text-transform: uppercase;
}

#input-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 75px;
  background: rgba(0,0,0,0.95);
  display: flex;
  padding: 15px;
  gap: 12px;
  z-index: 20;
  border-top: 1px solid #222;
}

input {
  flex: 1;
  background: #111;
  border: 1px solid #333;
  color: #fff;
  padding: 0 15px;
  border-radius: 12px;
  outline: none;
  font-size: 16px;
}

button {
  border: none;
  padding: 0 20px;
  font-weight: bold;
  border-radius: 12px;
  cursor: pointer;
}

#sendBtn {
  background: #0f0;
  color: #000;
}

#skipBtn {
  position: fixed;
  top: 15px;
  right: 15px;
  background: #ff4444;
  color: #fff;
  padding: 12px 25px;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  z-index: 110;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  transition: background 0.2s, transform 0.1s;
}

#skipBtn:hover {
  background: #ff0000;
}

#skipBtn:active {
  transform: scale(0.95);
}

#status-top {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 30;
  font-size: 11px;
  background: rgba(0,0,0,0.6);
  padding: 6px 12px;
  border-radius: 6px;
}

/* Countdown overlay */
#countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #0f0;
  font-family: monospace;
  pointer-events: none;
}

#countdown-number {
  font-size: 120px;
  font-weight: bold;
  text-shadow: 0 0 30px #0f0;
  animation: pulse 1s infinite alternate;
}

#countdown-text {
  font-size: 28px;
  margin-top: 20px;
  opacity: 0.9;
}

@keyframes pulse {
  from { transform: scale(1); opacity: 0.8; }
  to   { transform: scale(1.15); opacity: 1; }
}

/* Autoplay unblocker */
#tap-to-play {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.7);
  display: none; /* hidden until needed */
  align-items: center;
  justify-content: center;
  color: #0f0;
  font-size: 80px;
  font-weight: bold;
  cursor: pointer;
  backdrop-filter: blur(5px);
}

#tap-to-play::before {
  content: "▶ TAP TO START VIDEO";
  text-shadow: 0 0 20px #0f0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* Scrollbar styling */
#messages::-webkit-scrollbar {
  width: 5px;
}
#messages::-webkit-scrollbar-track {
  background: transparent;
}
#messages::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 10px;
}
#messages::-webkit-scrollbar-thumb:hover {
  background: #0f0;
}

/* PWA Install Banner */
.pwa-banner {
  position: fixed;
  bottom: 80px;           /* Above the input bar */
  left: 50%;
  transform: translateX(-50%);
  max-width: 420px;
  width: 90%;
  background: rgba(0, 15, 0, 0.92);
  border: 1px solid #0f0;
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(0, 255, 0, 0.25);
  backdrop-filter: blur(8px);
  z-index: 95;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: #0f0;
  transition: all 0.3s ease;
}

.pwa-banner.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(30px);
  pointer-events: none;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
}

.banner-text strong {
  color: #0f0;
  font-weight: bold;
}

.install-btn {
  background: #0f0;
  color: #000;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.install-btn:hover {
  background: #00ff55;
  transform: scale(1.05);
}

.close-btn {
  background: transparent;
  border: none;
  color: #0f0;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  opacity: 0.7;
}

.close-btn:hover {
  opacity: 1;
  color: #ff4444;
}

/* Mobile adjustments */
@media (max-width: 500px) {
  .pwa-banner {
    bottom: 160px;          /* Give space for input + local video */
    font-size: 13px;
  }
  .banner-content {
    flex-direction: column;
    gap: 12px;
  }
}