/* 반응형 챗봇 UI - PC/모바일 공통, WCAG 접근성 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: #eef2f7; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; color: #1f2340; }

.app {
  max-width: 720px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; background: #f4f6fb;
  box-shadow: 0 0 40px rgba(0,0,0,.06);
}

.bar {
  background: linear-gradient(180deg, #3f6ee0 0%, #4b7be9 100%);
  color: #fff; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 16px; position: sticky; top: 0; z-index: 5;
}
.bar-close { background: transparent; border: 0; color: #fff; font-size: 20px; cursor: pointer; }

.log { flex: 1; padding: 18px 14px 24px; overflow-y: auto; }

.msg { margin: 12px 0; display: flex; gap: 10px; align-items: flex-end; }
.msg.bot { flex-direction: row; }
.msg.user { flex-direction: row-reverse; }
.msg .avatar { width: 34px; height: 34px; border-radius: 50%; background: #dbe4f6; flex: 0 0 34px; display: grid; place-items: center; font-size: 12px; color: #4b6ba0; }
.msg.bot .bubble {
  background: #fff; padding: 14px 16px; border-radius: 18px; border: 1px solid #e4e9f2;
  max-width: 80%; line-height: 1.55; box-shadow: 0 2px 6px rgba(28, 45, 90, 0.04);
  word-break: keep-all;
}
.msg.user .bubble {
  background: #3f6ee0; color: #fff; padding: 12px 15px; border-radius: 18px; max-width: 80%;
  line-height: 1.55;
}
.msg .ts { font-size: 11px; color: #92a0bc; align-self: flex-end; }

.msg .buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg .buttons button {
  background: #eef2fb; color: #3453a3; border: 1px solid #d4dcf1; padding: 7px 12px;
  border-radius: 999px; cursor: pointer; font-size: 13px;
}
.msg .buttons button:hover { background: #dee6fb; }

.msg .sources { font-size: 12px; color: #6a7a99; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #dfe3ee; }
.msg .sources a { color: #3453a3; text-decoration: none; }
.msg .sources a:hover { text-decoration: underline; }

/* 슬라이드 카드 메뉴 */
.menu { padding: 4px 0 16px; }
.cards {
  display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 10px;
  scroll-snap-type: x mandatory; overflow-x: auto;
}
.card { border-radius: 14px; padding: 12px; scroll-snap-align: start; }
.card h3 { margin: 4px 0 60px; font-weight: 800; color: #23305a; }
.card ul { list-style: none; margin: 0; padding: 8px; background: rgba(255,255,255,.85); border-radius: 12px; }
.card ul li { padding: 8px 6px; cursor: pointer; color: #d95a3d; font-weight: 600; border-bottom: 1px solid #f2ecec; }
.card ul li:last-child { border: 0; }
.card ul li:hover { color: #b7452c; }

.card.c1 { background: linear-gradient(180deg,#ffe4a3 0%,#fff5db 100%); }
.card.c2 { background: linear-gradient(180deg,#ffd8c8 0%,#fff2ec 100%); }
.card.c3 { background: linear-gradient(180deg,#bde9de 0%,#e8f7f3 100%); }

.input-bar {
  position: sticky; bottom: 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex; align-items: end; gap: 8px; background: #fff; border-top: 1px solid #e6ebf3;
}
.input-bar .home, .input-bar .send {
  border: 0; background: #fff; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; font-size: 18px;
  border: 1px solid #e2e6f1; color: #3f6ee0;
}
.input-bar .send { background: #3f6ee0; color: #fff; border: 0; }
.input-bar .send:disabled { background: #b7c3e0; cursor: not-allowed; }
#q {
  flex: 1; resize: none; padding: 10px 12px; font-size: 15px;
  border: 1px solid #e2e6f1; border-radius: 12px; min-height: 42px; max-height: 120px;
  font-family: inherit; outline: none;
}
#q:focus { border-color: #3f6ee0; }

.typing { display: inline-block; }
.typing span { display: inline-block; width: 6px; height: 6px; margin: 0 1px; background: #92a0bc; border-radius: 50%; animation: blink 1.2s infinite; }
.typing span:nth-child(2){ animation-delay: .2s; }
.typing span:nth-child(3){ animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .2 } 40% { opacity: 1 } }

@media (max-width: 640px) {
  .app { max-width: 100%; box-shadow: none; }
  .bar { border-radius: 0; }
  .cards { grid-template-columns: 82% 82% 82%; }
  .card h3 { margin-bottom: 30px; }
}

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