@font-face {
  font-family: "Pretendard";
  /* src: url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/variable/woff2/PretendardVariable.woff2") format("woff2-variations"); */
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f8f8f8;
  --bg-soft: #9e5757;
  --surface: #ffffff;
  --surface-muted: #f8f8f8;
  --line: #dfdfdf;
  --line-strong: #c9c9c9;
  --text: #353535;
  --text-muted: #676767;
  --accent: #FFCB05;
  --accent-hover: #ecbe04;
  --assistant: transparent;
  --focus: rgba(214, 168, 0, 0.24);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
  color: var(--text);
  background: var(--bg);
  overscroll-behavior: none;
}

.app-shell {
  /* width: min(1200px, 100%); */
  margin: 0 auto;
  padding: 1rem 2rem;
  height: var(--app-vh, 100dvh);
  min-height: var(--app-vh, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view {
  display: none;
  min-height: 0;
}

.view.is-active {
  display: flex;
  flex: 1;
  min-height: 0;
}

.home-view {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow-y: auto;
  gap: 1.4rem;
}

.hero-copy {
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--text-muted);
  font-size: 0.94rem;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.9rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.8rem 0 0;
  color: var(--text-muted);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
}

.composer {
  width: min(780px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  padding: 0.9rem;
  box-shadow: 0 10px 25px rgba(15, 35, 70, 0.05);
}

textarea {
  width: 100%;
  border: 0;
  resize: none;
  min-height: 3rem;
  max-height: 10rem;
  padding: 0.2rem 0.1rem;
  font: inherit;
  color: inherit;
  background: transparent;
  line-height: 1.5;
}

textarea::placeholder {
  color: #8a98ab;
}

textarea:focus {
  outline: none;
}

.composer:focus-within {
  border-color: var(--line-strong);
  box-shadow:
    0 0 0 0.22rem var(--focus),
    0 10px 25px rgba(15, 35, 70, 0.06);
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.55rem;
  gap: 0.75rem;
}

.btn {
  border: 0;
  font: inherit;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary {
  background: var(--accent);
  color: var(--text);
  width: 44px;height: 44px;display: flex;align-items: center;justify-content: center;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:focus-visible,
.chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.2rem var(--focus);
}

.chip-group {
  width: min(780px, 100%);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.chip {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0.5rem 0.86rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.chip:hover {
  background: #f3f0df;
  border-color: #d6c790;
}

.chip:active {
  transform: translateY(1px);
}

.chat-view {
  flex: 1;
  min-height: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  flex-direction: column;
}

.chat-header {
  padding: 0 0 10px;
  margin:0 0 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  /* justify-content: flex-start; */
  justify-content: center;
  background: transparent;
  flex-shrink: 0;
}

.chat-title-button {
  position: absolute;
  left: 0;
}

.chat-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.chat-title-button {
  border: 0;
  background: transparent;
  padding: 0.22rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 0.55rem;
  font: inherit;
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.chat-title-button:hover {
  background: #efefef;
}

.chat-title-button:active {
  transform: translateY(1px);
}

.chat-title-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.2rem var(--focus);
}

.message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.4rem 0.2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: transparent;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.message {
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(78%, 680px);
  border-radius: 1rem;
  padding: 0.72rem 0.85rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.message.user .bubble {
  background: #111111;
  color: #ffffff;
  border-bottom-right-radius: 0.34rem;
}

.message.assistant .bubble {
  background: #ffffff;        /* ← 흰색 배경 */
  border: 1px solid #e5e5e5;  /* ← 테두리 */
  color: #222;
  border-radius: 1rem;
  padding: 0.72rem 0.85rem;   /* ← 기존 bubble 패딩 유지 */
  border-bottom-left-radius: 0.34rem; /* ← 꼬리 느낌 유지 */
}

.message.assistant .bubble a,
.message.user .bubble a {
  color: #2563eb;
  text-decoration: underline;
  word-break: break-all;
}

.typing-bubble {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  min-height: 2.6rem;
}

.typing-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #7e91ad;
  animation: dotPulse 1.2s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

.composer-chat {
  width: calc( 100% - 6px);
  border-radius: 1.05rem;
  border: 1px solid var(--line);
  box-shadow: none;
  background: #ffffff;
  flex-shrink: 0;
  margin-top: auto;
  margin:3px;
  padding-bottom: calc(0.9rem + env(safe-area-inset-bottom));
}

.composer-chat textarea {
  max-height: 8.8rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

*::-webkit-scrollbar {
  width: 0.56rem;
}

*::-webkit-scrollbar-thumb {
  background: #cfd8e6;
  border-radius: 999px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

@keyframes dotPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: 100%;
    margin: 0;
    padding: 0.75rem 0.85rem;
    height: var(--app-vh, 100dvh);
    min-height: var(--app-vh, 100dvh);
  }

  .home-view,
  .chat-view {
    min-height: 0;
  }

  .message-list {
    padding: 0.95rem;
  }

  .bubble {
    max-width: 84%;
  }
}

@media (max-width: 640px) {
  .hero-copy {
    text-align: left;
    width: min(100%, 780px);
  }

  .subtitle {
    margin-top: 0.56rem;
  }

  .home-view {
    justify-content: flex-start;
    padding-top: 2rem;
    padding-bottom: 1rem;
    gap: 1rem;
  }

  .chat-view {
    border-radius: 0;
  }

  .chat-header {
    padding: 0 0 0.7rem;
    margin-bottom: 0.6rem;
  }

  .composer {
    padding: 0.72rem;
  }

  .composer-chat {
    padding-bottom: calc(0.72rem + env(safe-area-inset-bottom));
  }

  .composer-actions {
    margin-top: 0.45rem;
  }

  .btn-primary {
    padding: 0.6rem 0.78rem;
  }

  .chip-group {
    justify-content: flex-start;
  }
}
