/* ===== 기본 설정 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  background: #f5f5f7;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* ===== 상단 바 ===== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.friend-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.friend-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffe4e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.friend-name {
  font-weight: bold;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.level-badge {
  font-size: 11px;
  background: #ffd700;
  color: #333;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: normal;
}

.menu-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
}

/* ===== 채팅 영역 ===== */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafafa;
}

.message {
  display: flex;
  max-width: 80%;
}

.message.friend {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
}

.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.message.friend .bubble {
  background: #fff;
  border: 1px solid #eee;
  border-bottom-left-radius: 4px;
}

.message.user .bubble {
  background: #ffe4e1;
  border-bottom-right-radius: 4px;
}

/* ===== 입력 영역 ===== */
.input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: #fff;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
}

#userInput {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

#userInput:focus {
  border-color: #ffb6c1;
}

.send-btn {
  background: #ffb6c1;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.send-btn:hover {
  background: #ff9eb0;
}

/* ===== 안전장치 모달 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.modal h3 {
  margin-bottom: 12px;
  color: #d9534f;
}

.modal p {
  font-size: 14px;
  color: #555;
  margin-bottom: 12px;
  line-height: 1.6;
}

.hotline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.hotline a {
  display: block;
  padding: 12px;
  background: #ffe4e1;
  color: #d9534f;
  text-decoration: none;
  border-radius: 10px;
  font-weight: bold;
}

.warm-msg {
  font-weight: bold;
  color: #d9534f;
  margin-top: 12px;
}

.modal button {
  margin-top: 16px;
  padding: 10px 24px;
  background: #666;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}