/* 채팅 화면 */
#chat-screen > * { width: min(100%, 520px); }

.hud {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 78px;
  padding: max(env(safe-area-inset-top), 12px) 14px 0;
}
.hud-left { justify-self: start; display: flex; }
.hud-right { justify-self: end; display: flex; }

.room-info { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.room-code {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding-left: 0.14em;
  line-height: 1.05;
  background: linear-gradient(180deg, hsl(var(--h0) 85% 70%), hsl(var(--h1) 80% 58%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.22));
}
.user-count { color: var(--muted); font-weight: 600; font-size: 14px; letter-spacing: 0.06em; }

/* 접속자 팝업 */
.users-panel {
  position: absolute;
  top: 74px;
  right: 12px;
  z-index: 6;
  width: 210px !important;
  max-height: 50%;
  overflow: auto;
  padding: 16px 18px;
  border-radius: 26px;
  background: linear-gradient(#3a3f52, #313546);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
}
.users-panel h2 { margin: 0 0 8px; font-size: 14px; font-weight: 600; letter-spacing: 0.2em; color: var(--muted); }
.users-panel ul { list-style: none; margin: 0; padding: 0; }
.users-panel li { position: relative; padding: 6px 0 6px 22px; font-size: 18px; font-weight: 500; }
.users-panel li::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 12px; height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 26%, #fff, var(--jelly-green) 55%, #1f9d62);
  box-shadow: 0 0 10px rgba(95, 220, 140, 0.7);
}

/* 메시지 목록 */
.messages {
  flex: 1;
  min-height: 0;
  list-style: none;
  margin: 0;
  padding: 10px 16px 18px;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.messages::-webkit-scrollbar { display: none; }

.msg { max-width: 80%; display: flex; flex-direction: column; gap: 4px; }
.msg .nick { padding: 0 8px; font-size: 14px; font-weight: 600; letter-spacing: 0.06em; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3); }
.nick.c0 { color: var(--jelly-green); }
.nick.c1 { color: var(--jelly-teal); }
.nick.c2 { color: var(--jelly-blue); }
.nick.c3 { color: var(--jelly-purple); }
.nick.c4 { color: var(--jelly-pink); }

.msg .bubble {
  position: relative;
  overflow: hidden;
  padding: 11px 17px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.38;
  white-space: pre-wrap;
  word-break: break-word;
  background: #4a5163;
  border-radius: 22px 22px 22px 8px;
  box-shadow: 0 5px 0 #383d4e;
  -webkit-user-select: text;
  user-select: text;
  animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.msg .bubble::before {
  content: "";
  position: absolute;
  left: 6%; right: 6%; top: 4%;
  height: 38%;
  border-radius: 999px;
  background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
  pointer-events: none;
}
@keyframes pop { from { transform: scale(0.8) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.msg .time { padding: 0 8px; font-size: 12px; font-weight: 500; color: #6f768a; letter-spacing: 0.04em; }

.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.mine .bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 22px 22px 8px 22px;
  box-shadow: 0 5px 0 var(--accent-shadow);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
}
.msg.mine .bubble::before { background: var(--gloss); height: 40%; }

.sys {
  align-self: center;
  padding: 5px 16px;
  border-radius: 999px;
  background: var(--field);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* 입력줄 */
.composer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(#3a3f52, #313546);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.3);
}
.composer .field { flex: 1; padding: 2px 16px; }
.composer .field input { height: 46px; font-size: 17px; }

.composer .send { height: 54px; min-width: 62px; padding: 0 14px; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  z-index: 30;
  margin: 0;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(14, 16, 24, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
  animation: pop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
