:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #f5f5f7;
  color: #1d1d1f;
  -webkit-font-smoothing: antialiased;
}

.viewer-shell {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.viewer-bar {
  display: flex;
  flex: 0 0 52px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  border-bottom: 1px solid rgb(0 0 0 / 8%);
  background: rgb(255 255 255 / 82%);
  box-shadow: 0 1px 0 rgb(255 255 255 / 65%) inset;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  font-size: 13px;
  font-weight: 500;
}

.channel-status,
.viewer-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.viewer-meta {
  flex: 0 0 auto;
  color: #6e6e73;
}

.status-indicator {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ff9f0a;
  box-shadow: 0 0 0 3px rgb(255 159 10 / 12%);
}

.status-indicator[data-state="connected"] {
  background: #30d158;
  box-shadow: 0 0 0 3px rgb(48 209 88 / 12%);
}

.status-indicator[data-state="error"] {
  background: #ff453a;
  box-shadow: 0 0 0 3px rgb(255 69 58 / 12%);
}

.status-divider {
  width: 1px;
  height: 14px;
  background: #d2d2d7;
}

.channel-name {
  overflow: hidden;
  color: #6e6e73;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #86868b;
  font-size: 15px;
  font-weight: 500;
  pointer-events: none;
}

#remote-playerlist {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--grid-columns, 1), var(--tile-width, 100%));
  grid-template-rows: repeat(var(--grid-rows, 1), var(--tile-height, 100%));
  align-content: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}

.player-wrapper {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgb(0 0 0 / 10%);
  border-radius: 8px;
  background: #000;
  box-shadow: 0 4px 18px rgb(0 0 0 / 10%);
}

.player-wrapper .player-name {
  position: absolute;
  z-index: 1;
  bottom: 8px;
  left: 8px;
  max-width: calc(100% - 16px);
  padding: 3px 7px;
  margin: 0;
  overflow: hidden;
  border-radius: 3px;
  background: rgb(29 29 31 / 72%);
  color: #f5f5f7;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#remote-playerlist .player {
  width: 100%;
  height: 100%;
}

#remote-playerlist .player video {
  object-fit: contain !important;
}

@media (max-width: 640px) {
  .viewer-bar {
    flex-basis: 46px;
    gap: 12px;
    padding: 0 12px;
  }

  #local-player-name {
    display: none;
  }

  #remote-playerlist {
    gap: 6px;
    padding: 8px;
  }
}
