:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1f2329;
  --muted: #8a9099;
  --line: #e6e8ec;
  --mine: #2f6df6;
  --mine-ink: #ffffff;
  --other: #eef0f3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
}

/* ── 입장 게이트 ── */
.gate-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
}
.gate h1 { margin: 0 0 4px; font-size: 24px; }
.gate .sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.gate input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
}
.gate button {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border: 0;
  border-radius: 10px;
  background: var(--mine);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.gate .error {
  color: #d23f3f;
  font-size: 14px;
  margin: 0 0 12px;
}

/* ── 채팅방 ── */
.room {
  max-width: 720px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.room-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.room-head .title { font-weight: 700; }
.room-head .me { color: var(--muted); font-size: 13px; margin-left: auto; }
.room-head .logout {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 8px;
}

.status {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 6px;
}
.status.warn { color: #c98a00; background: #fff7e6; }

.messages {
  list-style: none;
  margin: 0;
  padding: 14px 16px;
  flex: 1;
  overflow-y: auto;
}
.msg { margin-bottom: 12px; max-width: 78%; }
.msg .meta {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 3px;
}
.msg .who { font-size: 13px; font-weight: 600; color: #4a5160; }
.msg .time { font-size: 11px; color: var(--muted); }
.msg .bubble {
  display: inline-block;
  padding: 9px 12px;
  border-radius: 14px;
  background: var(--other);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

/* 내 메시지 오른쪽 정렬 */
.msg.mine { margin-left: auto; text-align: right; }
.msg.mine .meta { justify-content: flex-end; }
.msg.mine .bubble {
  background: var(--mine);
  color: var(--mine-ink);
  text-align: left;
}

.composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.composer input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  font-size: 16px;
}
.composer button {
  border: 0;
  border-radius: 22px;
  padding: 0 18px;
  background: var(--mine);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
