* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: calc(var(--vh, 1vh) * 100);
  max-width: 100vw;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: none;
  touch-action: manipulation;
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(to bottom, #021024, #05314d);
  color: #fff;
  position: relative;
  transition: height 0.3s ease;
}

/* 헤더 */
#header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: #00162f;
  text-align: center;
  padding: 16px 0;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.header-logo {
  width: 420px;
  height: 58px;
  object-fit: contain;
}

/* 채팅 박스 */
#chat-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  padding-top: 100px;
  margin-bottom: 100px;
  z-index: 2;
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

#chat-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

/* 메시지 */
.message {
  display: inline-block;
  max-width: 90%;
  min-width: 50px;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  word-break: break-word;
}

.message.user {
  align-self: flex-end;
  background-color: #0e4c77;
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  text-align: center;
}

.message.bot {
  align-self: flex-start;
  background-color: transparent;
  color: #ffffff;
  text-align: left;
  padding: 0;
  border-radius: 0;
  margin-right: auto;
}

.message-divider {
  width: 100%;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 20px auto;
}

/* 입력창 */
#input-container {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0);
  left: 0;
  width: 100%;
  max-width: 100vw;
  padding: 12px 0;
  border-top: 1px solid #00446c;
  background-color: #002a47;
  display: flex;
  justify-content: center;
  z-index: 20;
}

#input-container-inner {
  width: 100%;
  max-width: 800px;
  display: flex;
  gap: 8px;
  padding: 0 16px;
}

#input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 20px;
  font-size: 15px;
  background-color: #003b60;
  border: 1px solid #009bd6;
  color: #fff;
  resize: none;
  overflow: hidden;
  max-width: 100%;
}

#input:focus {
  outline: none;
}

#send-btn {
  padding: 0 20px;
  border: none;
  background-color: #009bd6;
  color: #fff;
  border-radius: 20px;
  font-size: 15px;
  cursor: pointer;
  max-width: 100%;
}

#send-btn:hover {
  background-color: #21c1fe;
}

/* 스피너 */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: rgba(255,255,255,0.5);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 12px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 배경 로고 */
.background-logo {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("/poseidon.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 35%;
  opacity: 0.1;
  z-index: 0;
  pointer-events: none;
}

/* iOS Safari 대응 */
@supports (-webkit-touch-callout: none) {
  html, body {
    height: -webkit-fill-available;
  }
}

/* 반응형 */
@media (max-width: 600px) {
  .message {
    font-size: 14px;
    max-width: 95%;
  }

  #send-btn {
    font-size: 14px;
    padding: 0 16px;
  }

  #input {
    font-size: 14px;
    padding: 10px 12px;
  }

  .background-logo {
    background-size: 80%;
  }

  #chat-container {
    padding-top: 110px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .header-logo {
    width: 93%;
    height: auto;
  }

  #input-container-inner {
    padding: 0 12px;
  }
}
