/* Basic reset and utilities */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: #fff;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Screen transitions */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.off {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

/* Welcome screen styles */
.welcome-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px);
  border-radius: 32px;
  border: 1px solid rgba(120, 189, 232, 0.35);
  padding: 56px 72px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(74, 163, 217, 0.14);
  max-width: 480px;
  width: 90%;
  animation: fadeUp 0.7s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo-wrap {
  width: 110px;
  height: 110px;
  margin: 0 auto 20px;
}

.logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.jai-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 52px;
  font-weight: 600;
  color: #1A3A5C;
  letter-spacing: 12px;
  margin-bottom: 6px;
}

.jai-tagline {
  font-size: 13px;
  color: #8ABACF;
  letter-spacing: 1.5px;
  margin-bottom: 48px;
}

.mode-row {
  display: flex;
  gap: 18px;
  justify-content: center;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 32px;
  border-radius: 20px;
  border: 1.5px solid #78BDE8;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.25s;
  color: #1A3A5C;
  font-size: 12px;
  font-family: 'Noto Sans KR', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  min-width: 130px;
}

.mode-btn:hover {
  background: #EAF5FC;
  border-color: #4AA3D9;
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(74, 163, 217, 0.22);
}

.mode-btn svg {
  width: 36px;
  height: 36px;
}

/* Chat screen styles */
.chat-wrap {
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(24px);
  border-radius: 28px;
  border: 1px solid rgba(120, 189, 232, 0.28);
  width: 90%;
  max-width: 760px;
  height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 70px rgba(74, 163, 217, 0.12);
  animation: fadeUp 0.5s ease both;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 26px;
  border-bottom: 1px solid rgba(120, 189, 232, 0.2);
  background: rgba(255, 255, 255, 0.6);
}

.chat-header .mini-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.chat-header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  font-weight: 600;
  color: #1A3A5C;
  letter-spacing: 5px;
  flex: 1;
}

.mode-tag {
  font-size: 11px;
  background: #EAF5FC;
  color: #2B7DB8;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #B8DCF5;
  letter-spacing: 0.5px;
}

.voice-switch-btn {
  background: none;
  border: 1.5px solid #78BDE8;
  cursor: pointer;
  color: #4AA3D9;
  padding: 7px 10px;
  border-radius: 10px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-switch-btn:hover {
  background: #4AA3D9;
  border-color: #4AA3D9;
  color: #fff;
}

.back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #8ABACF;
  padding: 8px;
  border-radius: 10px;
  transition: all 0.2s;
  font-size: 20px;
  line-height: 1;
}

.back-btn:hover {
  background: #EAF5FC;
  color: #2B7DB8;
}

.messages {
  flex: 1;
  padding: 28px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
  width: 4px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: #B8DCF5;
  border-radius: 4px;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}

.sparkle-anim {
  margin-bottom: 24px;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

.empty-state h2 {
  font-size: 20px;
  color: #1A3A5C;
  font-weight: 400;
  margin-bottom: 28px;
}

.sug-label {
  font-size: 11px;
  color: #8ABACF;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.sug-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.sug-chip {
  background: #fff;
  border: 1px solid rgba(120, 189, 232, 0.4);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 12.5px;
  color: #3A6080;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 220px;
  text-align: center;
  line-height: 1.4;
}

.sug-chip:hover {
  background: #EAF5FC;
  border-color: #78BDE8;
  color: #2B7DB8;
  transform: translateY(-2px);
}

/* Message bubbles */
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.msg.user {
  flex-direction: row-reverse;
}

.msg-av {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: #EAF5FC;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.msg.ai .msg-av {
  width: 72px;
  height: 72px;
  border-radius: 14px;
}

.msg.ai .msg-av img {
  object-position: top center;
  object-fit: cover;
}

.msg-av .av-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.bubble {
  max-width: 68%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.65;
}

.msg.ai .bubble {
  background: #EAF5FC;
  color: #1A3A5C;
  border-bottom-left-radius: 4px;
}

.msg.user .bubble {
  background: #4AA3D9;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
}

.dot {
  width: 7px;
  height: 7px;
  background: #78BDE8;
  border-radius: 50%;
  animation: bounce 1.2s ease infinite;
}

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

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

@keyframes bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* Input area */
.input-area {
  padding: 16px 24px;
  border-top: 1px solid rgba(120, 189, 232, 0.18);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #EAF5FC;
  border-radius: 16px;
  padding: 8px 8px 8px 18px;
  border: 1px solid rgba(120, 189, 232, 0.3);
  transition: border-color 0.2s;
}

.input-row:focus-within {
  border-color: #78BDE8;
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: #1A3A5C;
  font-family: 'Noto Sans KR', sans-serif;
}

.chat-input::placeholder {
  color: #8ABACF;
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #4AA3D9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.2s;
}

.send-btn:hover {
  background: #2B7DB8;
  transform: scale(1.06);
}

/* Voice screen styles */
.voice-wrap {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px);
  border-radius: 32px;
  border: 1px solid rgba(120, 189, 232, 0.35);
  width: 90%;
  max-width: 480px;
  padding: 56px 40px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(74, 163, 217, 0.14);
  animation: fadeUp 0.5s ease both;
}

.voice-logo {
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
}

.voice-logo img {
  width: 100%;
  object-fit: contain;
}

.voice-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  color: #1A3A5C;
  letter-spacing: 5px;
  margin-bottom: 6px;
}

.voice-sub {
  font-size: 12px;
  color: #8ABACF;
  margin-bottom: 40px;
  letter-spacing: 1px;
}

.mic-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 32px;
}

.mic-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid rgba(120, 189, 232, 0.35);
  transform: translate(-50%, -50%) scale(1);
  animation: ripple 2s ease-out infinite;
}

.mic-ring:nth-child(2) {
  animation-delay: 0.5s;
}

.mic-ring:nth-child(3) {
  animation-delay: 1s;
}

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

.mic-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #4AA3D9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.3s;
  box-shadow: 0 8px 28px rgba(74, 163, 217, 0.4);
  z-index: 5;
}

.mic-btn:hover {
  background: #2B7DB8;
  transform: translate(-50%, -50%) scale(1.08);
}

.mic-btn.listening {
  background: #1A5A8A;
  animation: glow 1s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 8px 28px rgba(74, 163, 217, 0.4);
  }
  to {
    box-shadow: 0 8px 48px rgba(74, 163, 217, 0.8);
  }
}

.voice-status {
  font-size: 13px;
  color: #3A6080;
  margin-bottom: 28px;
  min-height: 20px;
}

.wave-canvas {
  width: 100%;
  height: 50px;
  margin-bottom: 28px;
  border-radius: 8px;
}

.voice-back {
  background: none;
  border: 1.5px solid #B8DCF5;
  color: #3A6080;
  padding: 10px 28px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.voice-back:hover {
  background: #EAF5FC;
  border-color: #78BDE8;
  color: #2B7DB8;
}

/* Background brush strokes */
.brush-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Responsive design */
@media (max-width: 768px) {
  /* 모바일: 세로 중앙 정렬 + 스크롤 */
  body { overflow-y: auto; }
  #welcome {
    position: relative;
    min-height: 100vh;
    align-items: center;
    padding: 20px 16px;
    overflow-y: auto;
  }

  .welcome-card {
    padding: 36px 24px;
    margin: auto;
  }

  .jai-name {
    font-size: 36px;
    letter-spacing: 8px;
  }

  .mode-row {
    flex-direction: row !important;
    gap: 10px;
    justify-content: center;
  }
  .mode-btn {
    min-width: 0 !important;
    flex: 1;
    padding: 20px 10px;
    font-size: 11px;
    gap: 10px;
  }

  .chat-wrap {
    width: 95%;
    height: 90vh;
  }

  .voice-wrap {
    width: 95%;
    padding: 40px 24px;
  }
}