:root {
  --bg: #0f1117;
  --panel: #171a23;
  --border: #262b38;
  --text: #e8eaf0;
  --muted: #8a90a3;
  --primary: #4f8cff;
  --primary-hover: #6ba0ff;
  --accent: #8b5cf6;
  --danger: #ef4444;
  --success: #22c55e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 16px 16px 0;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 12px;
}

.logo {
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: 0.3px;
}

.status {
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.status--offline { color: #f87171; border-color: #7f1d1d; }
.status--online { color: #4ade80; border-color: #14532d; }

.stage {
  position: relative;
  flex: 1;
  display: flex;
  gap: 16px;
  min-height: 0;
}

.video-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

.video-wrap--remote {
  flex: 1;
  aspect-ratio: 4 / 3;
  max-height: 100%;
}

.video-wrap--local {
  width: 220px;
  aspect-ratio: 3 / 4;
  align-self: flex-end;
}

@media (max-width: 720px) {
  .stage {
    flex-direction: column;
  }
  .video-wrap--remote {
    width: 100%;
    aspect-ratio: 16 / 10;
  }
  .video-wrap--local {
    width: 130px;
    position: absolute;
    right: 8px;
    bottom: 8px;
    border: 2px solid var(--panel);
  }
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-wrap--local video {
  transform: scaleX(-1);
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  background: radial-gradient(circle at center, #1c2030, #0f1117);
  font-size: 0.95rem;
}

.placeholder__icon {
  font-size: 2.4rem;
}

.local-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.55);
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
}

.hud {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  height: 180px;
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-messages .msg {
  max-width: 75%;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  word-break: break-word;
}

.msg--me {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
}

.msg--them {
  align-self: flex-start;
  background: #262b38;
}

.msg--system {
  align-self: center;
  color: var(--muted);
  font-size: 0.8rem;
  background: transparent;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  outline: none;
  font-size: 0.95rem;
}

.chat-form input:focus {
  border-color: var(--primary);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 16px 0;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s, opacity 0.15s;
}

.btn:hover:not(:disabled) {
  background: #20242f;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn--ghost.on {
  background: var(--danger);
  border-color: var(--danger);
}
