html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #050816;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
}

.app {
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.room-card {
  width: 100%;
  padding: 16px 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 14px 36px rgba(2, 6, 23, 0.26);
  backdrop-filter: blur(14px);
}

.room-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.room-title-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.room-title {
  max-width: 60vw;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-status-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.room-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 700;
}

.room-pill.live {
  background: rgba(34, 197, 94, 0.16);
  color: #bbf7d0;
}

.room-info {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  color: #bfdbfe;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-meta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.room-meta-chip {
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  font-size: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  font-size: 14px;
  flex-shrink: 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
}

.timer {
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  font-weight: 700;
}

.live-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.hud-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.hud-chip.subtle {
  background: rgba(37, 99, 235, 0.22);
  color: #dbeafe;
}

.permission {
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.permission.hidden {
  display: none;
}

.permission-title {
  font-weight: 800;
  color: #fff;
}

.permission-detail {
  margin-top: 6px;
  line-height: 1.7;
  color: #cbd5e1;
  font-size: 14px;
}

.stage {
  position: relative;
  flex: 1;
  border-radius: 24px;
  overflow: hidden;
  background: #0f172a;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.36);
}

.device-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(12px);
}

.device-label {
  font-size: 12px;
  color: #cbd5e1;
}

.device-select {
  min-width: 240px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  outline: none;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0f172a;
}

.mask-layer,
.overlay,
.fallback {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mask-layer {
  z-index: 3;
}

.mask-layer::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 24px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 40px rgba(37, 99, 235, 0.08);
}

.mask-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.18), transparent 18%),
    linear-gradient(180deg, transparent 76%, rgba(15, 23, 42, 0.30));
  mix-blend-mode: screen;
}

.mask-border {
  position: absolute;
  inset: 18px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}

.mask-band {
  position: absolute;
  left: 18px;
  right: 18px;
  border-radius: 18px;
}

.mask-top {
  top: 18px;
  height: 76px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.04));
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mask-center {
  top: 50%;
  transform: translateY(-50%);
  height: 128px;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.16), rgba(59, 130, 246, 0.16));
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(2px);
}

.mask-bottom {
  bottom: 18px;
  height: 96px;
  background: linear-gradient(180deg, rgba(244, 114, 182, 0.04), rgba(244, 114, 182, 0.18));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.mask-corner {
  position: absolute;
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.18);
}

.mask-tl { top: 18px; left: 18px; border-right: 0; border-bottom: 0; border-top-left-radius: 16px; }
.mask-tr { top: 18px; right: 18px; border-left: 0; border-bottom: 0; border-top-right-radius: 16px; }
.mask-bl { bottom: 18px; left: 18px; border-right: 0; border-top: 0; border-bottom-left-radius: 16px; }
.mask-br { bottom: 18px; right: 18px; border-left: 0; border-top: 0; border-bottom-right-radius: 16px; }

.mask-label {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.overlay,
.fallback {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px;
  box-sizing: border-box;
}

.overlay {
  z-index: 4;
}

.template,
.hint {
  display: inline-flex;
  align-self: flex-start;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.62);
  font-size: 14px;
}

.hint {
  background: rgba(37, 99, 235, 0.28);
  color: #dbeafe;
}

.fallback {
  justify-content: center;
  align-items: center;
  text-align: center;
  background: rgba(15, 23, 42, 0.88);
  pointer-events: auto;
}

.fallback-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.fallback-desc {
  max-width: 560px;
  margin-top: 12px;
  line-height: 1.7;
  color: #cbd5e1;
}

.hidden {
  display: none !important;
}

.chip,
.btn {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
}

.chip.accent {
  background: rgba(37, 99, 235, 0.32);
}

.btn {
  cursor: pointer;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

@media (max-width: 640px) {
  .app {
    padding: 10px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .room-title {
    max-width: 52vw;
    font-size: 16px;
  }
}

body.fullscreen .app {
  padding: 0;
}

body.fullscreen .topbar,
body.fullscreen .toolbar,
body.fullscreen .permission,
body.fullscreen .live-hud,
body.fullscreen .device-panel {
  display: none;
}

body.fullscreen .stage {
  border-radius: 0;
  box-shadow: none;
}
