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

:root {
  --blue-50: #D9E6FF;
  --blue-200: #C5D7FB;
  --blue-400: #7096F8;
  --blue-600: #3460FB;
  --blue-900: #0017C1;
  --blue-1200: #000060;
  --text-primary: #000000;
  --text-label: #626264;
  --text-on-dark: #FFFFFF;
  --bg-standard: #F8F8FB;
  --bg-card: #FFFFFF;
  --bg-highlight: #D9E6FF;
  --bg-control: #F1F1F4;
  --border-accent: #C5D7FB;
  --border-neutral: #CCCCCC;
  --semantic-positive: #197A4B;
  --semantic-negative: #CE0000;
  --secondary-600: #D2A400;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background: #F8F8FB;
  color: #000000;
  height: 100dvh;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  background: #FFFFFF;
}

/* ヘッダー */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #0017C1;
  flex-shrink: 0;
}

.header__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header__title {
  font-size: 17px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 0.03em;
}

.header__subtitle {
  font-size: 11px;
  color: #C5D7FB;
  font-weight: 500;
}

.header__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.header__reset {
  background: transparent;
  color: #C5D7FB;
  border: 1px solid #7096F8;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.header__reset:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

/* ナビゲーション */
.nav {
  display: flex;
  background: #F8F8FB;
  border-bottom: 1px solid #CCCCCC;
  flex-shrink: 0;
}

.nav__link {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #626264;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav__link:hover {
  color: #0017C1;
  background: rgba(52, 96, 251, 0.05);
}

.nav__link--active {
  color: #0017C1;
  border-bottom-color: #0017C1;
}

/* 学習フロー案内 */
.learning-flow {
  padding: 14px 16px;
  background: #F8F8FB;
  border-bottom: 1px solid #CCCCCC;
  flex-shrink: 0;
}

.learning-flow__label {
  font-size: 11px;
  font-weight: 700;
  color: #626264;
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}

.learning-flow__steps {
  display: flex;
  align-items: center;
  gap: 6px;
}

.learning-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #FFFFFF;
  border: 1px solid #C5D7FB;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
}

.learning-step:hover {
  border-color: #3460FB;
  background: #D9E6FF;
}

.learning-step--current {
  background: #D9E6FF;
  border-color: #3460FB;
}

.learning-step__num {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0017C1;
  color: #FFFFFF;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.learning-step__text {
  font-size: 10px;
  font-weight: 600;
  color: #374151;
  line-height: 1.3;
}

.learning-flow__arrow {
  color: #C5D7FB;
  font-size: 12px;
  flex-shrink: 0;
}

/* サジェストカード */
.suggest-cards {
  padding: 14px 16px;
  background: #F8F8FB;
  border-bottom: 1px solid #CCCCCC;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.suggest-cards--hidden {
  display: none;
}

.suggest-cards__label {
  font-size: 12px;
  font-weight: 700;
  color: #3460FB;
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}

.suggest-cards__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.suggest-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  background: #FFFFFF;
  border: 1px solid #C5D7FB;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.suggest-card:hover {
  border-color: #3460FB;
  background: #D9E6FF;
  transform: translateY(-1px);
}

.suggest-card__text {
  font-size: 11px;
  font-weight: 600;
  color: #0017C1;
  text-align: center;
  line-height: 1.3;
}

/* チャットエリア */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #FFFFFF;
}

/* メッセージ */
.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.7;
  font-size: 14px;
  word-break: break-word;
  white-space: pre-wrap;
  animation: fadeIn 0.25s ease;
}

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

.message--bot {
  align-self: flex-start;
  background: #D9E6FF;
  color: #000000;
  border: 1px solid #C5D7FB;
  border-bottom-left-radius: 4px;
}

.message--user {
  align-self: flex-end;
  background: #3460FB;
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.message__name {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.message--bot .message__name {
  color: #3460FB;
}

.message--user .message__name {
  color: #C5D7FB;
}

/* 入力中インジケーター */
.typing-indicator {
  align-self: flex-start;
  padding: 12px 16px;
  background: #D9E6FF;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  border: 1px solid #C5D7FB;
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-indicator__dot {
  width: 7px;
  height: 7px;
  background: #3460FB;
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.typing-indicator__dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator__dot:nth-child(3) { animation-delay: 0.4s; }

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

/* 免責事項 */
.disclaimer {
  padding: 6px 16px;
  font-size: 11px;
  color: #626264;
  text-align: center;
  background: #F8F8FB;
  border-top: 1px solid #CCCCCC;
  flex-shrink: 0;
}

/* 入力エリア */
.input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid #CCCCCC;
  flex-shrink: 0;
}

.input-area__textarea {
  flex: 1;
  resize: none;
  background: #F1F1F4;
  border: 1px solid #CCCCCC;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  max-height: 120px;
  outline: none;
  color: #000000;
  transition: border-color 0.2s, background 0.2s;
}

.input-area__textarea::placeholder {
  color: #626264;
}

.input-area__textarea:focus {
  border-color: #3460FB;
  background: #FFFFFF;
}

.input-area__send {
  background: #3460FB;
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.input-area__send:hover {
  opacity: 0.85;
}

.input-area__send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* RAGチャンク出典表示 */
.message__sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(52, 96, 251, 0.2);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.sources__label {
  font-size: 10px;
  color: #3460FB;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-right: 2px;
}

.sources__chip {
  font-size: 10px;
  background: #D9E6FF;
  color: #0017C1;
  border: 1px solid #C5D7FB;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

/* スマホ対応 */
@media (max-width: 480px) {
  .message {
    max-width: 90%;
    font-size: 13px;
  }

  .header__title {
    font-size: 15px;
  }

  .input-area__send {
    padding: 10px 14px;
    font-size: 13px;
  }

  .suggest-cards__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav__link {
    font-size: 12px;
    padding: 8px 4px;
  }
}
