:root {
  color-scheme: light dark;
  --bg: #0d1117;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.62);
  --accent: #8ab4ff;
  --accent-strong: #c3dcff;
  --danger: #ff8f8f;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(71, 111, 166, 0.28), transparent 28%),
    radial-gradient(circle at 95% 10%, rgba(137, 84, 157, 0.18), transparent 30%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--accent-strong);
}

.page {
  max-width: 1380px;
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(20px) saturate(150%);
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.brand {
  font-size: 19px;
  font-weight: 750;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  margin: 0 auto 12px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(18px) saturate(145%);
}

.topnav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 650;
}

.topnav a:hover,
.topnav a.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
}

.subtle,
.hint,
.roomCard span,
.member span {
  color: var(--muted);
  font-size: 12.5px;
}

.customPicker {
  position: relative;
}

.personaControls {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto;
  align-items: end;
  gap: 10px;
}

.personaControls label {
  margin: 0;
}

.personaControls small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11.5px;
}

.modToggle {
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.modToggle.is-on {
  color: #07111f;
  background: linear-gradient(180deg, #c9ddff, #7fb0ff);
  border-color: rgba(255, 255, 255, 0.28);
  font-weight: 750;
}

.modToggle[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.72;
}

.widePicker {
  width: 100%;
}

.pickerButton {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 190px;
  width: 100%;
  padding: 0 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.pickerButton:hover {
  background: rgba(255, 255, 255, 0.08);
}

.pickerButton[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.72;
}

.chevron {
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.pickerMenu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  right: 0;
  width: max(100%, 220px);
  overflow: hidden;
  padding: 6px;
  background: rgba(22, 28, 38, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.widePicker .pickerMenu {
  left: 0;
  right: auto;
  width: 100%;
}

.pickerOption {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.pickerOption:hover,
.pickerOption.is-selected {
  background: rgba(138, 180, 255, 0.16);
  color: var(--accent-strong);
}

.pickerOption em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lobby {
  display: grid;
  grid-template-columns: minmax(300px, 440px) 1fr;
  gap: 14px;
}

.panel {
  padding: 16px;
}

.createPanel h1,
.roomToolbar h1 {
  margin: 4px 0 6px;
  font-size: 24px;
  line-height: 1.12;
}

.createPanel p,
.roomToolbar p {
  margin: 0 0 18px;
  color: var(--muted);
}

.sectionLabel {
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12.5px;
}

input,
select {
  min-height: 38px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(138, 180, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(138, 180, 255, 0.18);
}

.button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button.primary {
  color: #07111f;
  background: linear-gradient(180deg, #b8d6ff, #6ea5f7);
  border-color: rgba(255, 255, 255, 0.28);
  font-weight: 700;
}

.button.danger {
  color: var(--danger);
}

.notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  color: #ffd7d7;
  background: rgba(255, 85, 85, 0.12);
  border: 1px solid rgba(255, 120, 120, 0.25);
  border-radius: 12px;
}

.sectionHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sectionHeader h2 {
  margin: 0;
  font-size: 17px;
}

.count,
.statePill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
}

.roomList {
  display: grid;
  gap: 10px;
}

.roomCard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.roomCard strong,
.roomCard span {
  display: block;
}

.empty {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.changelog {
  max-width: 860px;
  margin: 0 auto;
}

.markdownBody h1 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.markdownBody h2 {
  margin: 24px 0 10px;
  font-size: 18px;
}

.markdownBody h3 {
  margin: 18px 0 8px;
  font-size: 15px;
}

.markdownBody p {
  margin: 0 0 18px;
  color: var(--muted);
}

.markdownBody ul {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.markdownBody li {
  position: relative;
  margin: 0 0 8px;
  padding: 10px 12px 10px 28px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.markdownBody li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 18px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 999px;
}

.markdownBody strong {
  color: var(--text);
}

.markdownBody code {
  padding: 2px 5px;
  color: var(--accent-strong);
  background: rgba(138, 180, 255, 0.12);
  border: 1px solid rgba(138, 180, 255, 0.20);
  border-radius: 6px;
  font-size: 0.92em;
}

.roomShell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
}

.watchStage,
.sideRail {
  display: grid;
  gap: 14px;
  align-content: start;
}

.sideRail {
  grid-template-rows: minmax(0, auto) minmax(0, 1fr);
  max-height: calc(100vh - 138px);
  min-height: 0;
}

.roomToolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.toolbarActions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  white-space: nowrap;
}

.videoFrame {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #000;
  aspect-ratio: 16 / 9;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
}

.videoFrame iframe,
.providerPlayer,
.providerPlayer iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.playerShield {
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: default;
}

.playerShield:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -6px;
}

.playerHelp {
  margin-top: -6px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
}

.liveNote {
  margin-top: -6px;
  padding: 10px 12px;
  color: var(--accent-strong);
  background: rgba(138, 180, 255, 0.10);
  border: 1px solid rgba(138, 180, 255, 0.22);
  border-radius: 12px;
  font-size: 12.5px;
}

.controls {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 14px;
  align-items: center;
}

.statePill.playing {
  color: #b8f7d2;
}

.statePill.paused {
  color: #ffdca8;
}

.time {
  margin-top: 6px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
}

.controlButtons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.providerInstruction {
  max-width: 360px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-align: right;
}

.members {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: clamp(180px, 28vh, 300px);
  overflow: hidden;
}

.membersList {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.membersList::-webkit-scrollbar,
.messages::-webkit-scrollbar {
  width: 8px;
}

.membersList::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.20);
  border-radius: 999px;
}

.membersList::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track {
  background: transparent;
}

.member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.member strong,
.member span {
  display: block;
}

.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: var(--avatar);
  border-radius: 999px;
  font-weight: 800;
}

.avatar.mini {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.chat {
  display: grid;
  block-size: clamp(320px, 56vh, 560px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.messages {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.message {
  display: flex;
  gap: 9px;
}

.message strong {
  display: block;
  font-size: 12.5px;
}

.message p {
  margin: 2px 0 0;
}

.systemMessage {
  align-self: center;
  padding: 5px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
  border-radius: 999px;
  font-size: 12px;
}

.chatForm {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .lobby,
  .roomShell {
    grid-template-columns: 1fr;
  }

  .roomToolbar,
  .controls {
    grid-template-columns: 1fr;
    display: grid;
  }

  .controlButtons {
    justify-content: flex-start;
  }

  .members {
    max-height: 260px;
  }

  .chat {
    block-size: min(440px, 60vh);
  }
}

@media (max-width: 560px) {
  .page {
    padding: 10px;
  }

  .topbar,
  .roomToolbar,
  .roomCard {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbarActions,
  .personaControls,
  .chatForm {
    display: grid;
    grid-template-columns: 1fr;
  }
}
