:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #141820;
  --muted: #667085;
  --border: #d8dde6;
  --video: #0b0d10;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

.player-area,
.chat {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.player-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.3;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
}

.status.live {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.status.offline {
  color: var(--danger);
  background: #fff4f2;
  border-color: #fecdca;
}

.video-shell {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 420px;
  background: var(--video);
}

video {
  width: 100%;
  height: 100%;
  min-height: 420px;
  background: var(--video);
  object-fit: contain;
}

.watch-button {
  position: absolute;
  z-index: 2;
  align-self: center;
  justify-self: center;
}

.watch-button[hidden] {
  display: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  color: #eef2f6;
  text-align: center;
  pointer-events: none;
}

.empty-state strong {
  font-size: 18px;
}

.empty-state span {
  color: #b9c2cf;
  font-size: 14px;
}

.empty-state.hidden {
  display: none;
}

.chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.messages {
  flex: 1;
  min-height: 320px;
  overflow-y: auto;
  padding: 12px 16px;
}

.message {
  padding: 10px 0;
  border-bottom: 1px solid #eef0f4;
}

.message:last-child {
  border-bottom: 0;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.message-name {
  max-width: 180px;
  overflow: hidden;
  color: var(--accent-strong);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-text {
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.chat-form {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.field {
  display: grid;
  gap: 4px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

button {
  align-self: end;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

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

  .chat {
    min-height: 420px;
  }
}

@media (max-width: 560px) {
  .room {
    padding: 8px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .video-shell,
  video {
    min-height: 260px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}
