:root {
  --bg: #f4f9ff;
  --surface: #ffffff;
  --ink: #0f1f36;
  --accent: #1c7ed6;
  --accent-2: #0f5ca5;
  --line: #d8e5f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "SF Pro Text", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 0% 0%, #ffffff 0, #e9f3ff 35%, #dfeeff 100%);
}

.app-shell {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
}

.panel,
.video-area {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(15, 31, 54, 0.08);
}

.panel {
  padding: 16px;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.muted {
  margin: 0 0 12px;
  opacity: 0.75;
}

label {
  display: block;
  margin-top: 10px;
  font-size: 0.9rem;
}

input,
textarea {
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: #eef4fb;
  color: var(--ink);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#status {
  margin-top: 12px;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f0f4f8;
}

#status.status-success {
  background: #d3f9d8;
  color: #2b8a3e;
}

#status.status-error {
  background: #ffe3e3;
  color: #c92a2a;
}

#status.status-warning {
  background: #fff3bf;
  color: #e67700;
}

#status.status-info {
  background: #e7f5ff;
  color: #1971c2;
}

.video-area {
  padding: 12px;
  position: relative;
  min-height: 560px;
}

#subscribers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 540px;
}

#subscribers-grid:empty::before {
  content: 'Waiting for participants...';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 540px;
  background: #0f1f36;
  border-radius: 12px;
  color: #a0aec0;
  font-size: 1.1rem;
}

.subscriber-video {
  border-radius: 12px;
  background: #0f1f36;
  overflow: hidden;
  min-height: 280px;
  position: relative;
}

.subscriber-video .OT_root {
  width: 100% !important;
  height: 100% !important;
  min-height: 280px;
}

.subscriber-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 10;
}

.video-box {
  border-radius: 12px;
  background: #0f1f36;
  overflow: hidden;
}

.video-box.publisher-pip {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 180px;
  height: 240px;
  border: 2px solid #fff;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 940px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .video-area {
    min-height: 420px;
  }

  #subscribers-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    min-height: 400px;
  }

  #subscribers-grid:empty::before {
    min-height: 400px;
  }

  .subscriber-video {
    min-height: 200px;
  }

  .video-box.publisher-pip {
    width: 120px;
    height: 160px;
    right: 14px;
    bottom: 14px;
  }
}
