/* ----- 리셋 ----- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== 모바일 텍스트 자동 확대 방지 ===== */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* ----- 기본 설정 ----- */
html, body {
  height: var(--screen-height, 100vh);
  overflow: hidden;
  font-family: 'Arial', sans-serif;
  background: #fff;
  color: #222;
}

/* ----- 전체 컨테이너 ----- */
.chat-container {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ----- 메시지 리스트 영역 ----- */
.chat-display {
  flex: 1;
  width: 100%;
  max-width: 480px;
  padding: 0 15px;
  overflow-y: auto;
}

/* ----- 입력 폼 (중앙 고정) ----- */
.message-form {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* ----- 헤더 ----- */
.message-form .museum-header {
  width: 100%;
  text-align: left;
  margin-bottom: 12px;
}
.message-form .museum-header small {
  display: block;
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.message-form .museum-header h2 {
  font-size: 1.25rem;
  color: #222;
  line-height: 1.2;
}

/* ----- 입력 및 버튼 행 ----- */
.input-row {
  display: flex;
  width: 100%;
  gap: 10px;
}

/* ----- 입력창 ----- */
.input-group {
  position: relative;
  flex: 1;
  height: 48px;
}
.input-group::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('res/피스메세지뮤지엄_MessageBox.png') no-repeat center/100% 100%;
  z-index: 0;
}
#chat-input {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 12px 20px;
  border: none;
  outline: none;
  font-size: 16px; /* 키보드 확대 방지 */
  background: transparent;
}
#chat-input:focus {
  outline: none;
}

/* 글자 수 카운트 */
#char-count {
  position: absolute;
  z-index: 1;
  right: 20px;
  bottom: 8px;
  color: #888;
  font-size: 0.85rem;
  user-select: none;
}

/* ----- 전송 버튼 ----- */
#send-btn {
  position: relative;
  width: 72px;
  height: 48px;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
}
.btn-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
}
.btn-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: auto;
  z-index: 2;
}

/* ----- 하단 로고 그룹 ----- */
.logo-group {
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-between;
}
.logo-group img {
  width: 48%;
  height: auto;
  object-fit: contain;
}

/* ----- 전송 피드백 토스트 ----- */
.feedback {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 123, 255, 0.9);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
.feedback.show {
  opacity: 1;
}

/* ===== 반응형: 화면 너비 480px 이하 ===== */
@media (max-width: 480px) {
  .chat-display {
    padding: 0 10px;
  }

  .message-form {
    top: calc(50% - 20px);
    gap: 16px;
    padding: 0 20px;
  }

  .message-form .museum-header small {
    font-size: 0.7rem;
  }
  .message-form .museum-header h2 {
    font-size: 1rem;
  }

  .input-row {
    gap: 8px;
  }

  .input-group {
    height: 40px;
  }
  #chat-input {
    padding: 10px 16px;
    font-size: 16px;
  }
  #char-count {
    right: 16px;
    bottom: 6px;
    font-size: 0.75rem;
  }

  #send-btn {
    width: 60px;
    height: 40px;
  }
  .btn-text {
    width: 50%;
  }

  .logo-group {
    gap: 12px;
  }
  .logo-group img {
    width: 49%;
    height: auto;
  }

  .feedback {
    bottom: calc(60px + env(safe-area-inset-bottom));
    padding: 8px 16px;
    font-size: 0.9rem;
  }
}
