:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101218;
  color: #f0f1f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #101218;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid #262831;
  background: #17191f;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f5f5f6;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand-mark,
.hint-mark {
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #5865f2;
  color: white;
  font-weight: 800;
}

.brand-mark {
  width: 30px;
  height: 30px;
  font-size: 17px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.status {
  color: #a7a9b2;
  font-size: 12px;
}

.status[data-state="connected"] {
  color: #61d79a;
}

.status[data-state="error"] {
  color: #f27b82;
}

.live-indicator,
.live-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #f07c83;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.live-indicator span,
.live-label span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ed5963;
}

.workspace {
  width: min(1500px, 100%);
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 0;
  margin: 0 auto;
}

.lobby {
  padding: 22px 14px;
  border-right: 1px solid #262831;
  background: #17191f;
}

.lobby-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 16px;
}

.lobby-heading h1 {
  margin: 0;
  color: #d5d6dc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.count-badge {
  min-width: 21px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 10px;
  background: #292c35;
  color: #bec0c8;
  font-size: 11px;
  font-weight: 700;
}

.stream-list {
  display: grid;
  gap: 5px;
}

.stream-card {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease;
}

.stream-card:hover {
  background: #22252d;
}

.stream-card.selected {
  border-color: #343849;
  background: #252833;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  background: #343744;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: #dadce5;
  font-size: 15px;
  font-weight: 750;
}

.stream-details {
  min-width: 0;
  display: grid;
  flex: 1;
  gap: 4px;
}

.stream-details strong {
  overflow: hidden;
  color: #e3e4e8;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-watching {
  color: #9699a4;
  font-size: 11px;
}

.card-live {
  align-self: flex-start;
  padding: 3px 5px;
  border-radius: 4px;
  background: #51272d;
  color: #ff8a91;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.empty-state {
  padding: 8px;
  color: #898c97;
  font-size: 12px;
  line-height: 1.5;
}

.stage {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: clamp(16px, 4vw, 52px);
}

.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  overflow: hidden;
  border: 1px solid #30323b;
  border-radius: 12px;
  background: #08090c;
  box-shadow: 0 18px 55px rgb(0 0 0 / 22%);
}

.player:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}

video {
  width: 100%;
  height: 100%;
  grid-area: 1 / 1;
  object-fit: contain;
  background: #08090c;
}

.player-hint {
  z-index: 1;
  grid-area: 1 / 1;
  align-self: center;
  justify-self: center;
  color: #888b95;
  text-align: center;
  pointer-events: none;
}

.player-hint p {
  margin: 12px 0 0;
  font-size: 13px;
}

.hint-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 15px;
  font-size: 23px;
}

.player-overlay {
  z-index: 2;
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  background: linear-gradient(180deg, rgb(0 0 0 / 48%), transparent 24%, transparent 57%, rgb(0 0 0 / 74%));
  pointer-events: none;
}

.stream-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  text-shadow: 0 1px 4px #000;
}

.stream-heading .avatar {
  width: 30px;
  height: 30px;
  border: 1px solid rgb(255 255 255 / 25%);
}

.watching-count {
  margin-left: auto;
  color: #e2e3e8;
  font-size: 11px;
  font-weight: 500;
}

.video-controls {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 11px;
  pointer-events: auto;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 5px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #f5f5f6;
  cursor: pointer;
}

.icon-button:hover {
  background: rgb(255 255 255 / 15%);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

#play-pause .pause-icon,
#mute .muted-icon {
  display: none;
}

#play-pause.is-playing .play-icon,
#mute.is-muted .volume-icon {
  display: none;
}

#play-pause.is-playing .pause-icon,
#mute.is-muted .muted-icon {
  display: block;
}

.live-label {
  margin-left: 2px;
}

.control-spacer {
  flex: 1;
}

.volume {
  width: 90px;
  height: 4px;
  accent-color: #fff;
  cursor: pointer;
}

.message {
  min-height: 1.2em;
  margin: 0;
  color: #c1c3ca;
  font-size: 12px;
  text-align: center;
}

.manual {
  width: min(700px, calc(100% - 32px));
  display: grid;
  gap: 12px;
  margin: 32px auto;
  padding: 20px;
  border: 1px solid #30323b;
  border-radius: 12px;
  background: #17191f;
}

.manual h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

.manual label {
  font-size: 13px;
  font-weight: 650;
}

code {
  color: #b9c2ff;
}

textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  padding: 10px;
  border: 1px solid #343744;
  border-radius: 7px;
  background: #101218;
  color: #e8e9ee;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 8px;
}

.primary,
.secondary {
  min-height: 36px;
  padding: 7px 13px;
  border: 0;
  border-radius: 6px;
  background: #5865f2;
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.secondary {
  border: 1px solid #3a3d48;
  background: #252832;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 760px) {
  .topbar {
    height: 56px;
    padding: 0 14px;
  }

  .workspace {
    min-height: calc(100vh - 56px);
    grid-template-columns: minmax(0, 1fr);
  }

  .stage {
    order: 0;
    align-content: start;
    padding: 14px;
  }

  .lobby {
    order: 1;
    padding: 14px;
    border-top: 1px solid #262831;
    border-right: 0;
  }

  .player {
    border-radius: 8px;
  }

  .player-overlay {
    padding: 10px;
  }

  .stream-heading .avatar {
    width: 25px;
    height: 25px;
  }

  .volume {
    width: 65px;
  }

  .topbar-right {
    gap: 10px;
  }

  .status {
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 430px) {
  .live-indicator {
    display: none;
  }

  .video-controls {
    gap: 5px;
  }

  .icon-button {
    width: 30px;
    height: 30px;
  }

  .volume {
    width: 52px;
  }

  .live-label {
    font-size: 9px;
  }
}
