:root {
  --random-bg: ghostwhite;
  --random-text: #000;
  --ftth-pad-y: .7vw;
  --ftth-pad-x: 1vw;
}

body,
.dark body {
  --ftth-bg: var(--random-bg);
  --ftth-text: var(--random-text);
  --ftth-border: var(--random-text);
}

body > .fixed {
  padding: 0 !important;
}

/* 배포된 FTTH nav 선언과 동일 */
.site-nav {
  position: relative;
  width: 100%;
  height: fit-content;
  min-height: 0;
  margin: 0 !important;
  padding: .7vw 1vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-nav a {
  color: var(--ftth-text);
  font-family: 'Playfair Display', 'Nanum Myeongjo', serif;
  font-size: 1.2vw;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}

.site-nav .header {
  padding: 0;
}

.chat-nav {
  display: flex;
  align-items: center;
  gap: 1vw;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  opacity: .55;
  outline: none;
}

.model-status {
  position: absolute;
  z-index: 30;
  top: calc(100% + .5vw);
  left: 50%;
  width: max-content;
  max-width: calc(100vw - (var(--ftth-pad-x) * 2));
  padding: .05em .75em;
  transform: translateX(-50%);
  border: 1px solid var(--ftth-border);
  border-radius: 999px;
  background: var(--ftth-text);
  color: var(--ftth-bg);
  font-family: 'Nanum Myeongjo', serif;
  font-size: .9vw;
  line-height: 1.8;
  letter-spacing: 1px;
  text-align: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 180ms ease;
}

.model-status[hidden] { display: none; }
.model-status.is-hiding { opacity: 0; }

#messages {
  padding: var(--ftth-pad-y) var(--ftth-pad-x) !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
}

#messages > div,
#messages > div.ml-auto {
  max-width: 72% !important;
  padding: .32em .9em !important;
  border-radius: 1.35em !important;
}

#messages > :not([hidden]) ~ :not([hidden]) {
  margin-top: .45vw !important;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  min-width: 1.8em;
  justify-content: space-between;
}

.typing-dots span {
  animation: typing-dot 900ms ease-in-out infinite;
  opacity: .25;
}

.typing-dots span:nth-child(2) { animation-delay: 150ms; }
.typing-dots span:nth-child(3) { animation-delay: 300ms; }

@keyframes typing-dot {
  0%, 60%, 100% { opacity: .25; }
  30% { opacity: 1; }
}

#quick-questions {
  gap: .45vw !important;
  margin: 0 !important;
  padding: var(--ftth-pad-y) var(--ftth-pad-x) 0;
}

#quick-questions + .flex {
  gap: .45vw !important;
  padding: var(--ftth-pad-y) var(--ftth-pad-x) !important;
  border-top: 0 !important;
}

#input,
#sendBtn {
  border-radius: 999px !important;
}

.question-btn,
#sendBtn {
  line-height: 1.4;
}

/* 현재 FTTH 홈 검색창의 제목형 입력 스타일과 일치 */
#input {
  padding: .25em 2.5em !important;
  background: transparent !important;
  color: var(--ftth-text) !important;
  font-family: 'Playfair Display', 'Nanum Myeongjo', serif;
  font-size: 1.2vw !important;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

#input::placeholder {
  color: transparent !important;
  opacity: 0 !important;
}

#input:focus {
  background: var(--ftth-text) !important;
  color: var(--ftth-bg) !important;
  box-shadow: none !important;
}

#input:focus::placeholder {
  color: transparent !important;
}

#sendBtn:disabled,
.question-btn:disabled {
  cursor: wait;
  opacity: .45;
}

.scroll-controls {
  position: fixed;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: .45vw;
  pointer-events: none;
}

.scroll-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25em;
  height: 2.25em;
  padding: 0;
  border: 1px solid var(--ftth-border);
  border-radius: 50%;
  background: var(--ftth-bg);
  color: var(--ftth-text);
  font-family: 'Nanum Myeongjo', serif;
  font-size: .9vw;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.scroll-control:hover,
.scroll-control:focus-visible {
  background: var(--ftth-text);
  color: var(--ftth-bg);
  outline: none;
}

@media screen and (max-width: 750px) {
  :root {
    --ftth-pad-y: 1.7vw;
    --ftth-pad-x: 2.5vw;
  }

  .site-nav {
    padding: 1.7vw 2.5vw;
  }

  .site-nav a {
    font-size: 3.5vw;
  }

  .chat-nav {
    gap: 1vw;
  }

  .model-status {
    top: calc(100% + 1.5vw);
    font-size: 3vw;
  }

  #messages > div {
    max-width: 86% !important;
    font-size: 3vw !important;
  }

  #messages > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1.5vw !important;
  }

  #quick-questions,
  #quick-questions + .flex {
    gap: 1.5vw !important;
  }

  .question-btn,
  #sendBtn,
  .scroll-control {
    font-size: 3vw !important;
  }

  #input {
    font-size: 3.5vw !important;
  }

  .scroll-controls {
    gap: 1.5vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing-dots span {
    animation: none;
    opacity: 1;
  }
}
