:root {
  --bg: #0e0f13;
  --panel: #16181f;
  --panel-2: #1c1f29;
  --line: #272b36;
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --accent: #7c5cff;
  --online: #22c55e;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

/* ── 합본(watch) 레이아웃 ── */
.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  height: 100vh;
}
.stage {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ── 채팅 패널 ── */
.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
body.chat-page .chat {
  height: 100vh;
  max-width: 520px;
  margin: 0 auto;
  border-left: none;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.chat-head .title { font-weight: 600; }
.chat-head .meta { color: var(--muted); font-size: 13px; }
#status.online { color: var(--online); }

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.msg { font-size: 14px; line-height: 1.45; word-break: break-word; }
.msg-nick { color: var(--accent); font-weight: 600; margin-right: 3px; }
.msg-system { color: var(--muted); font-style: italic; font-size: 13px; }

.composer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
}
.composer .nick { flex: 0 0 96px; min-width: 0; }
.composer .text { flex: 1; min-width: 120px; }
.composer input {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  outline: none;
}
.composer input:focus { border-color: var(--accent); }
.composer button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
}
.composer button:hover { filter: brightness(1.08); }

/* ── 영상 단독(video) — OBS 브라우저 소스용 ── */
body.video-only { background: #000; }
body.video-only video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 56vw 1fr;
  }
  .chat { border-left: none; border-top: 1px solid var(--line); }
}
