body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#viewport {
  position: fixed;
  inset: 0;
  z-index: 0;
  /* Containing block for absolute overlay children (frame + video) */
  isolation: isolate;
}

/* Placeholder when no frame received yet */
#viewport::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #1e1e1e 0%, #2a2a2a 100%);
  z-index: 0;
}

#viewport::after {
  content: 'Stream expected…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.05em;
  z-index: 0;
}

#viewport:has(#frame[src])::before,
#viewport:has(#frame[src])::after {
  display: none;
}

#frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111;
  z-index: 1;
}

#video {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 370px;
  height: auto;
  max-width: 370px;
  max-height: 50vh;
  object-fit: contain;
  border-radius: 8px 0 0 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.4);
  z-index: 9999;
}

.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.6);
  color: #fff;
  z-index: 2;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.status-bar:hover {
  background: rgba(0,0,0,0.75);
}

.status-bar .muted {
  color: rgba(255,255,255,0.9);
}

.status-bar .status-socket {
  color: rgba(255,255,255,0.7);
  font-size: 0.9em;
}

video, canvas {
  max-width: 100%;
  border-radius: 8px;
}

.row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.card {
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 12px;
}

label {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

input[type="number"],
input[type="range"],
input[type="text"] {
  width: 120px;
}

/* Make the prompt stretch full width */
.row label:has(#promptText) {
  width: 100%;
}

#promptText {
  flex: 1 1 auto;
  width: 100%;
}

button {
  padding: .5rem .9rem;
  border-radius: 10px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.muted {
  color: #666;
}