html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ========== Human Future レイアウト（元デザイン再現） ========== */
.hf-body {
  margin: 0;
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  font-family: 'Noto Sans JP', sans-serif;
  background: #f5f7fa;
  overflow: hidden;
}

/* スクロールバーを薄い色に */
.hf-body ::-webkit-scrollbar {
  width: 2px;
  height: 2px;
}
.hf-body ::-webkit-scrollbar-track {
  background: #fafbfc;
}
.hf-body ::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 3px;
}
.hf-body ::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}
.hf-chat-section,
.hf-sidebar-left,
.hf-studio-column,
.hf-avatar-list,
.hf-references-list {
  scrollbar-color: #e2e8f0 #fafbfc;
}

.hf-header {
  background: #fff;
  border-top: 3px solid #202586;
  padding: 0.75rem 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.hf-header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: none;
}

.hf-header-inner .hf-header-logo {
  justify-self: start;
}

.hf-header-inner .hf-header-tabs {
  justify-self: center;
}

.hf-header-inner .hf-header-icons {
  justify-self: end;
  margin-left: 0;
}

.hf-header-logo {
  color: #202586;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
}

.hf-header-logo-img {
  display: block;
  height: 36px;
  width: auto;
  object-fit: contain;
}

.hf-header-tabs {
  display: flex;
  gap: 0.5rem;
}

.hf-tab {
  color: #64748b;
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 0.9rem;
}

.hf-tab:hover {
  color: #475569;
  background: #cbd5e1;
}

.hf-tab.active {
  color: #fff;
  background: #202586;
}

.hf-header-icons {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
}

.hf-icon {
  font-size: 1.1rem;
  cursor: pointer;
  color: #475569;
}

/* ヘッダー右上: ユーザー画像＋クリックで右からドロップダウン */
.hf-header-user-wrap {
  position: relative;
}
.hf-header-user-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
}
.hf-header-user-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.hf-header-user-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  /* スタジオ列（z-index 1201）や学習オーバーレイより上で、ドロップダウン操作を阻害しない */
  z-index: 1300;
}
.hf-header-user-overlay.is-open {
  display: block;
}
.hf-header-user-dropdown {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1301;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}
.hf-header-user-dropdown.is-open {
  transform: translateX(0);
}
.hf-header-user-dropdown-inner {
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.hf-header-user-dropdown-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.hf-header-user-link {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  color: #1e293b;
  text-decoration: none;
  font-size: 0.95rem;
  border-radius: 8px;
  text-align: left;
  transition: background 0.2s;
}
.hf-header-user-link:hover {
  background: #f1f5f9;
}
.hf-header-user-link-signout {
  margin-top: 0.5rem;
  color: #64748b;
}

.hf-app {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #f5f7fa;
}

/* 左ペインラッパー: 20% + 隙間8px + ボタン20px。縮小時は 10% */
.hf-left-pane-wrap {
  flex: 0 0 calc(20% + 28px);
  min-width: 0;
  display: flex;
  align-self: stretch;
  margin-left: 8px;
  margin-right: 0;
  margin-top: 8px;
  margin-bottom: 8px;
  transition: flex-basis 0.25s ease;
}

.hf-left-pane-wrap.collapsed {
  flex: 0 0 10%;
  min-width: 56px;
}
.hf-left-pane-wrap.collapsed .hf-sidebar-left {
  padding-right: 1rem;
}

/* 左ペイン: ネイビー背景・白文字。アコーディオン展開時は内側でスクロール。
   アバターとスクロールバーの間に 8px 隙間（padding-right で実施。ラッパーを 8px 広げているので実質の横幅は 20% のまま） */
.hf-sidebar-left {
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #202586;
  color: #fff;
  padding: 1rem;
  padding-right: calc(1rem + 8px);
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 12px 0 0 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* 左ペイン縮小ボタン（学習サイトの並びの右端） */
.hf-pane-collapse-btn.hf-pane-collapse-left {
  flex-shrink: 0;
  width: 20px;
  min-width: 20px;
  background: #202586;
  color: #fff;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  transition: background 0.2s;
}

.hf-pane-collapse-btn.hf-pane-collapse-left:hover {
  background: #2d3599;
}

.hf-pane-collapse-btn.hf-pane-collapse-left .hf-pane-collapse-icon {
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.25s ease;
}

.hf-left-pane-wrap.collapsed .hf-pane-collapse-btn.hf-pane-collapse-left .hf-pane-collapse-icon {
  transform: rotate(180deg);
}

.hf-sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: #fff;
}

.hf-avatar-strip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  width: 100%;
}

.hf-avatar-scroll {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.hf-avatar-all-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hf-avatar-all-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.hf-avatar-list {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 左サイドバー: アバターは10個表示し、同時に見えるのは6つ（従来通り） */
.hf-avatar-list.hf-avatar-list-show-6 {
  max-width: calc(40px * 6 + 0.5rem * 5);
}

.hf-avatar-list::-webkit-scrollbar {
  display: none;
}

.hf-avatar-chip {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.hf-avatar-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hf-avatar-chip-selected {
  border-color: #ea580c !important;
  box-shadow: inset 0 0 0 2px #ea580c;
}

/* AIコーチ: マウスオーバーで拡大プレビュー（右矢印ボタンの外側＝右隣に表示） */
.hf-coach-avatar-preview {
  display: none;
  position: fixed;
  width: 140px;
  height: 140px;
  /* 左ペイン内の右矢印ボタン右端の外側: 8px(margin) + 1rem(padding) + 24(prev) + 0.25rem + リスト幅 + 0.25rem + 24(next) + 8px(隙間) */
  left: calc(8px + 1rem + 24px + 0.25rem + (40px * 6 + 0.5rem * 5) + 0.25rem + 24px + 8px);
  /* ストリップのチップ(40px)中心とプレビュー(140px)中心を揃える: ストリップ上端 115px + 20px - 70px = 65px */
  top: 65px;
  z-index: 1000;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  background: #fff;
  pointer-events: none;
}
.hf-left-pane-wrap.collapsed .hf-coach-avatar-preview {
  /* 折りたたみ時: ペイン幅 min 56px の右外側に表示 */
  left: calc(8px + 56px + 8px);
  top: 65px;
}
.hf-coach-avatar-preview.is-visible {
  display: block;
}
.hf-coach-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hf-coach-avatar-list .hf-avatar-chip {
  position: relative;
  z-index: 1;
}

/* AIアドバイザー: マウスオーバーで拡大プレビュー（右矢印ボタンの外側＝右隣に表示） */
.hf-advisor-avatar-preview {
  display: none;
  position: fixed;
  width: 140px;
  height: 140px;
  left: calc(8px + 1rem + 24px + 0.25rem + (40px * 6 + 0.5rem * 5) + 0.25rem + 24px + 8px);
  top: 65px;
  z-index: 1000;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  background: #fff;
  pointer-events: none;
}
.hf-left-pane-wrap.collapsed .hf-advisor-avatar-preview {
  left: calc(8px + 56px + 8px);
  top: 65px;
}
.hf-advisor-avatar-preview.is-visible {
  display: block;
}
.hf-advisor-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hf-advisor-avatar-list .hf-avatar-chip {
  position: relative;
  z-index: 1;
}

.hf-course-bar {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.hf-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.hf-menu-placeholder {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.5rem 0;
  margin: 0;
}

/* Coach: 中分類のみのリスト（小分類なし） */
.hf-menu-list.hf-coach-category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.hf-coach-category-item {
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: #e2e8f0;
  cursor: pointer;
  user-select: none;
}
.hf-coach-category-item:hover {
  color: #fff;
  text-decoration: underline;
}
.hf-coach-category-item.hf-coach-category-selected {
  color: #93c5fd;
  font-weight: 500;
}

.hf-menu-group {
  margin-bottom: 0.25rem;
}

.hf-menu-group summary {
  cursor: pointer;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.hf-menu-group summary:hover {
  color: #fff;
  text-decoration: underline;
}

.hf-menu-sub {
  list-style: none;
  padding-left: 1rem;
  margin: 0.25rem 0 0.75rem 0;
}

.hf-menu-sub-item {
  padding: 0.25rem 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

/* 小分類が「クリックできる」ことを明示 */
.hf-menu-sub-item:hover {
  color: #fff;
  text-decoration: underline;
}

.hf-menu-sub-bullet {
  flex-shrink: 0;
  font-size: 0.65em;
  line-height: 1;
  opacity: 0.9;
}

.hf-menu-check {
  flex-shrink: 0;
}

.hf-menu-sub-item.active {
  color: #93c5fd;
  font-weight: 500;
}

/* 中央・右ペイン用コンテナ - 画面全体に広がる */
.hf-main {
  flex: 1;
  min-width: 0;
  display: flex;
  overflow: hidden;
  margin: 8px 8px 8px 0;
}

.hf-index-root {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.hf-index-root > .hf-content-columns {
  flex: 1;
  min-width: 0;
}

.hf-content-columns {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* 右ペインラッパー: 30% → 20% で縮小可能 */
.hf-right-pane-wrap {
  flex: 0 0 30%;
  min-width: 0;
  display: flex;
  align-self: stretch;
  transition: flex-basis 0.25s ease;
}

.hf-right-pane-wrap.collapsed {
  flex: 0 0 20%;
  min-width: 160px;
}

/* 中央ペイン: 角丸白カード・独立スクロール（残り幅を占有して広めに） */
.hf-chat-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1rem 1.5rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 0 6px 0 0;
}

/* Coach: 左上の固定コーチアバター6種（gpt_male, gpt_female, gemini_male, gemini_female, claude_male, claude_female） */
.hf-coach-avatar-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}
.hf-coach-avatar-chip {
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #e2e8f0;
  box-sizing: border-box;
}
.hf-coach-avatar-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hf-chat-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
}

/* チャット欄（中央ペイン内で独立スクロール。参照資料は下に固定表示） */
.hf-chat-section {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
}

.hf-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  min-width: 0;
}

.hf-chat-placeholder {
  color: #94a3b8;
  font-size: 0.9rem;
  padding: 1.5rem 0;
  margin: 0;
  text-align: center;
}

#hf-chat-result:not(:empty) ~ .hf-chat-placeholder { display: none; }

/* サンプル準拠: history-item（1メッセージ行）— 重なり防止。メッセージ内の日付と吹き出しは適度に詰める */
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
}

.history-item + .history-item {
  margin-top: 0.9rem;
}

.history-item.reverse .message-category {
  margin-left: auto;
}

/* アバターのメッセージの直後にユーザーメッセージが続くとき、その上の余白を広げる */
.history-item:not(.reverse) + .history-item.reverse {
  margin-top: 1rem;
}

/* ユーザーのメッセージの直後にアバターメッセージが続くとき、その上の余白を広げる */
.history-item.reverse + .history-item:not(.reverse) {
  margin-top: 1rem;
}

.history-date {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: #64748b;
  margin: 0.25rem 0 0 0;
  min-width: 2.5rem;
}

/* メッセージ本体: send=AIアバター（左・幅広）、sendto=生徒（右・幅狭） */
.message-category {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  max-width: 100%;
}

/* AIアバター返答: 幅を大きく取る（左側・広い吹き出し）— はみ出し防止 */
.message-category.send {
  max-width: 85%;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-x: hidden;
}

/* 1行目: send＋アバター と Re:枠を横一列に（テーブルで確実に）。アバター側はタイトルと本文の間を詰める */
.hf-send-header-table {
  width: 100%;
  border: none;
  border-collapse: collapse;
  margin: 0 0 0.2rem 0;
  padding: 0;
  table-layout: fixed;
  vertical-align: middle;
  display: table;
  min-height: 3rem;
}

.hf-send-header-table tbody,
.hf-send-header-table tr {
  display: table-row;
}

.hf-send-header-table td {
  border: none;
  padding: 0;
  vertical-align: middle;
}

.hf-send-header-cell-left {
  width: 1%;
  min-width: 5rem;
  white-space: nowrap;
  padding-right: 0.75rem;
  vertical-align: middle;
}

.hf-send-header-cell-left .message-send,
.hf-send-header-cell-left .myFigure3 {
  display: inline-block;
  vertical-align: middle;
  margin: 0;
}

.hf-send-header-cell-left .myFigure3 {
  margin-left: 0.35rem;
}

/* Re: の枠 — アバターと離し、重ならないように */
.hf-send-header-cell-right {
  width: 99%;
  min-width: 0;
  padding-left: 0.25rem;
  vertical-align: middle;
}

.hf-send-header-cell-right .message-title {
  margin: 0;
  display: block;
}

/* 従来の flex 版（テーブル未使用時のフォールバック） */
.hf-body .message-category.send .hf-send-header {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
}

/* send: とアバターを横並びに（display:block / unicode-bidi の上書き） */
.hf-body .message-category.send .hf-send-header .message-container.hf-send-avatar-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  unicode-bidi: normal;
}

.hf-body .message-category.send .hf-send-header .message-container.hf-send-avatar-row > .message-send,
.hf-body .message-category.send .hf-send-header .message-container.hf-send-avatar-row > .myFigure3 {
  flex: 0 0 auto;
  min-width: 0;
}

.message-category.send .hf-send-header .message-title {
  flex: 1 1 0%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.message-category.send .message-text-summary,
.message-category.send .message-title {
  background: #e8f4fc;
  border: 1px solid #b8d4e8;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0;
}

.message-category.send .message-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

/* 2行目: 本文（テーブルの下に余白は最小に詰める） */
.message-category.send .message-text-summary {
  min-width: 0;
  margin-top: 0.65rem;
  margin-bottom: 0;
}

.message-category.send .message-text-summary {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #334155;
}

.message-category.send .summary-text {
  margin: 0;
  white-space: pre-line;
  word-break: break-word;
}

.message-send {
  font-size: 0.7rem;
  color: #94a3b8;
  margin: 0;
}

/* 生徒の送信: 幅を狭く（右側・狭い吹き出し） */
.message-category.sendto {
  max-width: 48%;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  overflow-x: hidden;
}

.message-category.sendto .message-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.message-category.sendto .message-container {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.message-category.sendto .message-title,
.message-category.sendto .message-text {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #334155;
}

/* 受講者側（右側）のテキストも、AI側と同様に“短く表示→全文モーダル”にする */
.message-category.sendto .message-text-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #334155;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-category.sendto .message-text-summary .summary-text {
  margin: 0;
  white-space: pre-line;
  word-break: break-word;
}

.message-category.sendto .message-title {
  font-weight: 600;
}

/* 自由質問対話（MESSAGE_TYPE=30）: 件名と「タップで続き」要約の吹き出しの間を確保 */
.history-item.hf-chat-dialogue-json .message-category.sendto .message-content > .message-title + .message-text-summary {
  margin-top: 0.85rem;
}

/* エクササイズのやり取り：薄いオレンジの枠・背景（自由な質問は水色のまま） */
/* 自由な設問（EXERCISE_FLG=1）: 青枠 */
.hf-chat-free .message-category.send .message-text-summary,
.hf-chat-free .message-category.send .message-title {
  background: #e8f4fc;
  border-color: #7eb8da;
}
.hf-chat-free .message-category.sendto .message-title,
.hf-chat-free .message-category.sendto .message-text {
  background: #f0f8fc;
  border-color: #b8d4e8;
}
.hf-chat-free .message-category.sendto .message-text-summary {
  background: #f0f8fc;
  border-color: #b8d4e8;
}

.hf-chat-exercise .message-category.send .message-text-summary,
.hf-chat-exercise .message-category.send .message-title {
  background: #fef3e6;
  border-color: #e8c4a0;
}

/* エクササイズ右側（社員）は社長より薄いオレンジ */
.hf-chat-exercise .message-category.sendto .message-title,
.hf-chat-exercise .message-category.sendto .message-text {
  background: #fefaf5;
  border-color: #f0ddc8;
}
.hf-chat-exercise .message-category.sendto .message-text-summary {
  background: #fefaf5;
  border-color: #f0ddc8;
}

.message-text-summary.hf-summary-clickable {
  cursor: pointer;
}

/* 要約クリックで全文モーダルを開く */
.hf-summary-clickable {
  cursor: pointer;
}
.hf-summary-clickable:hover {
  filter: brightness(0.98);
}

/* 全文表示モーダル */
.hf-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s;
}
.hf-modal.hf-modal-open {
  visibility: visible;
  opacity: 1;
}
.hf-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.hf-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.hf-modal-title {
  flex-shrink: 0;
  margin: 0;
  padding: 1rem 3rem 0.5rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}
.hf-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  color: #475569;
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hf-modal-close:hover {
  background: #e2e8f0;
}
.hf-modal-body {
  padding: 0 1.25rem 1.25rem;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #334155;
}
.hf-modal-body p {
  margin: 0 0 0.75rem 0;
}
.hf-modal-body p:last-child {
  margin-bottom: 0;
}
.hf-modal-footer {
  flex-shrink: 0;
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  text-align: right;
}
.hf-modal-footer .hf-session-body-modal-close,
.hf-modal-footer .hf-modal-close {
  position: static;
  width: auto;
  height: auto;
  font-size: 0.95rem;
  padding: 0.5rem 1.25rem;
}

/* 参照資料プレビュー（PDF・画像・動画）実験用 */
.hf-ref-preview-modal .hf-modal-content {
  max-width: 90vw;
  max-height: 90vh;
  width: 720px;
}
.hf-ref-preview-body {
  display: flex;
  flex-direction: column;
  padding: 0 1.25rem 1.25rem;
  overflow: hidden;
}
.hf-ref-preview-content {
  flex: 1;
  min-height: 200px;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 8px;
  overflow: auto;
}
.hf-ref-preview-iframe {
  width: 100%;
  min-height: 400px;
  height: 70vh;
  border: none;
  border-radius: 8px;
}
.hf-ref-preview-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}
.hf-ref-preview-video {
  max-width: 100%;
  max-height: 70vh;
}
.hf-ref-preview-office-fallback {
  padding: 1rem 1.25rem;
  max-width: 100%;
  text-align: left;
}
.hf-ref-preview-office-msg {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #334155;
}
.hf-ref-preview-open-link {
  margin: 0.75rem 0 0 0;
  font-size: 0.9rem;
}
.hf-ref-preview-open-link a {
  color: #0369a1;
  text-decoration: underline;
}

/* アバター一覧モーダル */
.hf-avatar-all-modal .hf-avatar-all-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.hf-avatar-all-modal .hf-avatar-all-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 90vw;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hf-avatar-all-modal .hf-avatar-all-modal-title {
  flex-shrink: 0;
  margin: 0;
  padding: 1rem 3rem 0.5rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
}
.hf-avatar-all-modal .hf-avatar-all-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: none;
  background: #ea580c;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hf-avatar-all-modal .hf-avatar-all-modal-close:hover {
  background: #c2410c;
}
.hf-avatar-all-modal .hf-avatar-all-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
}
.hf-avatar-all-modal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.hf-avatar-all-modal-item:hover {
  background: #f1f5f9;
}
.hf-avatar-all-modal-item-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #e2e8f0;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.hf-avatar-all-modal-item-name {
  font-size: 0.8rem;
  color: #334155;
  text-align: center;
  line-height: 1.3;
}

/* アバター画像（サンプル myFigure3 互換） */
.myFigure3.hf-chat-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e2e8f0;
  background-size: cover;
  background-position: center;
  margin: 0;
}

.hf-chat-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e2e8f0;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.hf-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* 参照資料枠（チャット欄と別エリア・左右ボタン＋スワイプ） */
.hf-references-section {
  flex-shrink: 0;
  border-top: 1px solid #e2e8f0;
  padding-top: 1rem;
  margin-top: 0.5rem;
  background: #f8fafc;
  border-radius: 0 0 12px 12px;
  margin-left: -1rem;
  margin-right: -1.5rem;
  margin-bottom: -1rem;
  padding-left: 1rem;
  padding-right: 1.5rem;
  padding-bottom: 1rem;
}

.hf-references-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.hf-references-strip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.hf-ref-scroll {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  transition: background 0.2s, color 0.2s;
}

.hf-ref-scroll:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.hf-references-list {
  display: flex;
  gap: 0.75rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.hf-references-list.hf-swiper {
  cursor: grab;
  user-select: none;
}

.hf-references-list.hf-swiper:active,
.hf-references-list.hf-swiper.hf-swiper-dragging {
  cursor: grabbing;
}

.hf-ref-thumb {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.hf-ref-thumb-img {
  width: 80px;
  height: 60px;
  background: #e0e0e0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 6px;
  display: block;
  object-fit: cover;
}
.hf-ref-thumb-img[src] {
  /* img タグでサムネイル表示時 */
  font-size: 0;
  vertical-align: top;
}

.hf-ref-thumb-label {
  font-size: 0.8rem;
  color: #333;
}

/* 参照資料：小分類ドキュメント（サムネイル＋リンク） */
a.hf-ref-doc {
  text-decoration: none;
  color: inherit;
  max-width: 100px;
}
a.hf-ref-doc:hover .hf-ref-thumb-label { text-decoration: underline; }

.hf-ref-docs-placeholder {
  margin: 0;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: #64748b;
}

/* 左ペイン・参照資料のスワイパー共通（マウス/ペンでドラッグスクロール） */
.hf-avatar-list.hf-swiper {
  cursor: grab;
  user-select: none;
}

.hf-avatar-list.hf-swiper:active,
.hf-avatar-list.hf-swiper.hf-swiper-dragging {
  cursor: grabbing;
}

/* 右ペイン: 角丸白カード・独立スクロール */
.hf-studio-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1rem 1.25rem;
  background: #fff;
  border-radius: 12px 0 0 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow-y: auto;
}

/* 右ペイン縮小ボタン（スタジオの右端） */
.hf-pane-collapse-btn.hf-pane-collapse-right {
  flex-shrink: 0;
  width: 20px;
  min-width: 20px;
  background: #e2e8f0;
  color: #475569;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.06);
  transition: background 0.2s;
}

.hf-pane-collapse-btn.hf-pane-collapse-right:hover {
  background: #cbd5e1;
}

.hf-pane-collapse-btn.hf-pane-collapse-right .hf-pane-collapse-icon {
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.25s ease;
}

.hf-right-pane-wrap.collapsed .hf-pane-collapse-btn.hf-pane-collapse-right .hf-pane-collapse-icon {
  transform: rotate(180deg);
}

.hf-studio-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
}

.hf-studio-mode {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.hf-studio-meta {
  font-size: 0.85rem;
  color: #444;
  margin: 0 0 0.25rem 0;
}

.hf-studio-meta-unselected {
  color: #94a3b8;
}

.hf-studio-note {
  display: flex;
  gap: 1rem;
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
}

.hf-studio-note label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.hf-answer-box {
  background: #fde4d4;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.hf-answer-box-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.hf-answer-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hf-answer-title-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
}

.hf-answer-title-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.hf-answer-question {
  font-size: 0.85rem;
  margin: 0 0 1.5rem 0;
  line-height: 1.5;
  color: #1e293b;
  background: #fff;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

.hf-answer-question-label {
  font-weight: 600;
}

.hf-answer-question-body {
  display: inline;
}

.hf-answer-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

/* スタジオ「質問を書く」モード時: 枠全体の背景を薄い水色に（タイトル・入力枠は白のまま） */
.hf-answer-box.hf-answer-box--question {
  background: #e6f4f8;
}

/* ドロップゾーン: 質問・回答エリアにファイルをドロップ可能 */
.hf-answer-box-dropzone.drag-over {
  outline: 2px dashed #ea580c;
  outline-offset: 2px;
  background: #fff5f0;
}

.hf-answer-drop-hint {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0 0 0.5rem 0;
}

.hf-answer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  min-height: 0;
}

.hf-answer-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.8rem;
  max-width: 180px;
}

.hf-answer-attachment-chip .hf-attachment-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.hf-answer-attachment-chip .hf-attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hf-answer-attachment-chip .hf-attachment-remove {
  flex-shrink: 0;
  padding: 0 0.2rem;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.hf-answer-attachment-chip .hf-attachment-remove:hover {
  color: #dc2626;
}

/* ファイルアップロードモーダル */
.hf-upload-modal .hf-modal-content {
  max-width: min(520px, 92vw);
}

.hf-upload-modal-desc {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.hf-upload-file-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.5rem;
}

.hf-upload-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}

.hf-upload-file-list li:last-child {
  border-bottom: none;
}

.hf-upload-modal-progress,
.hf-upload-modal-error {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.hf-upload-modal-error {
  color: #dc2626;
}

.hf-upload-modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hf-answer-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.hf-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
}

.hf-btn-back {
  background: #d1d5db;
  color: #374151;
}

.hf-btn-submit {
  background: #ea580c;
  color: #fff;
}

/* Coach 右ペイン: 入力部分（受信者・新規/継承・メッセージを書く・カテゴリ・送信/戻る） */
.hf-coach-studio .hf-coach-compose {
  margin-top: 1rem;
}
.hf-coach-recipient {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.hf-coach-recipient-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fde4d4;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hf-coach-recipient-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hf-coach-recipient-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: #1e293b;
}
.hf-coach-message-type {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.hf-coach-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #334155;
}
.hf-coach-radio input { margin: 0; }
.hf-coach-write-box {
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid #e2e8f0;
}
.hf-coach-write-header {
  background: #ea580c;
  color: #fff;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}
.hf-coach-write-body {
  background: #fde4d4;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.hf-coach-subject {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9rem;
  box-sizing: border-box;
}
.hf-coach-body {
  width: 100%;
  min-height: 120px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9rem;
  resize: vertical;
  box-sizing: border-box;
}
.hf-coach-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.hf-coach-category-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid #ea580c;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
  color: #334155;
  min-width: 160px;
}
.hf-coach-buttons {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}
.hf-coach-btn-send {
  background: #ea580c;
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
}
.hf-coach-btn-send:hover {
  background: #c2410c;
}

/* AIアドバイザー右ペイン — 対話解析（TKT-C1） */
.hf-advisor-analytics {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid #fed7aa;
  background: linear-gradient(180deg, #fffbeb 0%, #fff7ed 100%);
}
.hf-advisor-analytics-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #9a3412;
  margin: 0 0 0.5rem 0;
}
.hf-advisor-analytics-status {
  margin: 0;
  font-size: 0.85rem;
  color: #78716c;
}
.hf-advisor-analytics-body[hidden] { display: none !important; }
.hf-advisor-analytics-error[hidden] { display: none !important; }
.hf-advisor-analytics-error {
  margin: 0.5rem 0 0 0;
  font-size: 0.85rem;
  color: #b91c1c;
}
.hf-advisor-analytics-retry {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  border: none;
  color: #9a3412;
  background: transparent;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.hf-advisor-analytics-tips[hidden] { display: none !important; }
.hf-advisor-analytics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  color: #44403c;
}
.hf-advisor-analytics-label {
  font-weight: 600;
  color: #57534e;
  min-width: 3.5rem;
}
.hf-advisor-analytics-value {
  text-transform: lowercase;
  font-weight: 600;
  color: #c2410c;
}
.hf-advisor-analytics-score-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.hf-advisor-analytics-tip {
  margin: 0;
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

/* AIアドバイザー右ペイン（選択アドバイザー・あなた/相手・質問を書く） */
.hf-advisor-recipient {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.hf-advisor-recipient-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fde4d4;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hf-advisor-recipient-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hf-advisor-recipient-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: #1e293b;
}
.hf-advisor-studio .hf-advisor-role-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}
.hf-advisor-role-label { font-weight: 600; color: #334155; font-size: 0.9rem; }
.hf-advisor-select {
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
  min-width: 120px;
}
.hf-advisor-write-box {
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid #e2e8f0;
}
.hf-advisor-write-header {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #fff;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}
.hf-advisor-write-body {
  background: #fde4d4;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.hf-advisor-subject, .hf-advisor-body {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9rem;
  box-sizing: border-box;
}
.hf-advisor-body { min-height: 120px; resize: vertical; }
.hf-advisor-message-type { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.hf-advisor-radio { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; color: #334155; }
.hf-advisor-radio input { margin: 0; }
.hf-advisor-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.hf-advisor-category-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid #ea580c;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
  color: #334155;
  min-width: 160px;
}
.hf-advisor-buttons { display: flex; gap: 0.5rem; margin-left: auto; }
.hf-advisor-btn-send {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
}
.hf-advisor-btn-send:hover { background: #c2410c; }

.hf-studio-features-intro {
  font-size: 0.85rem;
  color: #444;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.hf-studio-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
  font-size: 0.85rem;
}

.hf-studio-features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.hf-feature-icon {
  font-size: 1rem;
}

.hf-studio-links {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
}

.hf-studio-links li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
}

.hf-link-icon {
  font-size: 1rem;
}

/* ========== ログイン画面（Human Future ロゴ・サインイン） ========== */
.hf-login-body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  font-family: 'Noto Sans JP', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hf-login-root {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  box-sizing: border-box;
}

.hf-login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.hf-login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.hf-login-brand-icon {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
}

.hf-login-brand-icon svg {
  display: block;
  width: 40px;
  height: 40px;
}

.hf-login-brand-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333333;
  letter-spacing: 0.02em;
}

.hf-login-logo {
  margin-bottom: 0.5rem;
}

.hf-login-logo-img {
  display: block;
  height: auto;
  max-width: 220px;
  width: 100%;
}

.hf-login-logo-text {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: #202586;
  letter-spacing: 0.02em;
  text-align: center;
}

.hf-login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.25rem;
}

.hf-login-error {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #ffebee;
  color: #c62828;
  font-size: 0.875rem;
  border-radius: 8px;
  box-sizing: border-box;
}

.hf-login-field {
  width: 100%;
}

.hf-login-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: #333;
  background: #e8f0fe;
  border: 1px solid #dadce0;
  border-radius: 24px;
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s;
}

.hf-login-input::placeholder {
  color: #5f6368;
}

.hf-login-input:hover {
  border-color: #c4c7cc;
}

.hf-login-input:focus {
  outline: none;
  border-color: #3683f2;
  background: #e8f0fe;
}

.hf-login-submit {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #232895;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(35, 40, 149, 0.35);
  transition: background 0.2s, box-shadow 0.2s;
}

.hf-login-submit:hover {
  background: #1e2480;
  box-shadow: 0 3px 6px rgba(35, 40, 149, 0.4);
}

.hf-login-submit:active {
  box-shadow: 0 1px 2px rgba(35, 40, 149, 0.3);
}

/* ========== 共通エラー画面（HF_Login/Error） ========== */
.hf-error-root {
  width: 100%;
  max-width: 2700px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2rem;
}

.hf-error-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.hf-error-logo-img {
  display: block;
  height: 48px;
  width: auto;
  object-fit: contain;
}

.hf-error-breadcrumb {
  font-size: 1.125rem;
  color: #475569;
  margin: 0;
  font-weight: 500;
}

.hf-error-card {
  width: 100%;
  border-radius: 14px;
  box-sizing: border-box;
}

.hf-error-message-card {
  background: #f1f5f9;
  padding: 1.75rem 2rem;
  text-align: center;
}

.hf-error-message {
  margin: 0;
  font-size: 1.25rem;
  color: #1e293b;
  font-weight: 500;
}

.hf-error-content-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hf-error-content-label {
  display: inline-block;
  background: #f1f5f9;
  color: #475569;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  width: fit-content;
  font-weight: 500;
}

.hf-error-content-body {
  min-height: 120px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fafbfc;
  padding: 1rem 1.25rem;
}

.hf-error-content-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.hf-error-content-empty {
  margin: 0;
  font-size: 1rem;
  color: #94a3b8;
}

.hf-error-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 0.75rem;
}

.hf-error-btn {
  display: inline-block;
  padding: 0.75rem 2.5rem;
  font-size: 1.0625rem;
  font-weight: 500;
  color: #fff;
  background: #202586;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(32, 37, 134, 0.25);
  transition: background 0.2s, box-shadow 0.2s;
}

.hf-error-btn:hover {
  background: #1e2480;
  box-shadow: 0 3px 6px rgba(32, 37, 134, 0.35);
  color: #fff;
}

.hf-error-btn:active {
  box-shadow: 0 1px 2px rgba(32, 37, 134, 0.3);
}

/* ========== ダッシュボード（大元画像準拠・_LayoutDashboard） ========== */
.hf-db-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Noto Sans JP', sans-serif;
  background: #f5f7fa;
}

.hf-db-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.hf-db-header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.hf-db-header-logo {
  height: 48px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
}

.hf-db-header-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: #475569;
}

.hf-db-header-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* ダッシュボードヘッダー: メイン画面と同様のユーザーメニュー（右スライド）・アバター寸法を従来プロフィールに合わせる */
.hf-db-header .hf-header-user-img {
  width: 40px;
  height: 40px;
  border: 2px solid #e2e8f0;
}

.hf-db-main {
  flex: 1;
  min-height: 0;
  padding: 1rem 1.5rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.hf-db-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* オレンジ枠プレースホルダー（後から追加予定のためタグは残し非表示） */
.hf-db-placeholder {
  display: none !important;
  border: 2px solid #ff8b36;
  border-radius: 12px;
  min-height: 80px;
}

.hf-db-placeholder-left,
.hf-db-placeholder-right {
  flex: 0 0 120px;
}

.hf-db-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.hf-db-cards {
  display: flex;
  gap: 2rem;
  flex-wrap: nowrap;
  justify-content: center;
}

.hf-db-card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hf-db-card-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  overflow: hidden;
  border-radius: 24px;
}

.hf-db-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.2s;
}

.hf-db-card-img-bright {
  opacity: 0;
}

.hf-db-card:hover .hf-db-card-img-bright {
  opacity: 1;
}

.hf-db-card:hover .hf-db-card-img:not(.hf-db-card-img-bright) {
  opacity: 0;
}

.hf-db-layout {
  display: grid;
  grid-template-columns: minmax(0, 28%) minmax(0, 1fr) minmax(0, 28%);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
  flex: 1;
  min-height: 0;
  width: 100%;
  align-content: stretch;
}

.hf-db-layout-row-icons {
  grid-column: 1 / -1;
  grid-row: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.hf-db-layout-row-desc {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.hf-db-agent-desc-panel {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  padding: 0.55rem 0.65rem;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.hf-db-agent-desc-cols {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
}

.hf-db-agent-desc-item {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.6rem;
  border-right: 1px solid #e2e8f0;
}

.hf-db-agent-desc-item:last-child {
  border-right: none;
}

.hf-db-agent-desc-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: #334155;
  margin: 0 0 0.3rem 0;
}

.hf-db-agent-desc-body {
  font-size: 0.625rem;
  line-height: 1.45;
  color: #64748b;
  margin: 0;
}

@media (max-width: 900px) {
  .hf-db-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .hf-db-layout-row-icons,
  .hf-db-layout-row-desc,
  .hf-db-col-left,
  .hf-db-col-center,
  .hf-db-col-right {
    grid-column: 1;
    grid-row: auto;
  }

  .hf-db-agent-desc-cols {
    flex-direction: column;
  }

  .hf-db-agent-desc-item {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0.4rem;
  }

  .hf-db-agent-desc-item:last-child {
    border-bottom: none;
  }
}

.hf-db-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #eef1f5;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.hf-db-col-left {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  border: 1px solid #cbd5e1;
}

.hf-db-col-center {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
}

.hf-db-col-right {
  grid-column: 3;
  grid-row: 2;
  min-height: 0;
  border: 1px solid #cbd5e1;
}

.hf-db-ops-gap {
  height: 1rem;
  flex-shrink: 0;
}

.hf-db-panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  flex-shrink: 0;
}

.hf-db-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  background: #eef1f5;
}

.hf-db-col-right .hf-db-scroll {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin: 0 0.75rem 0.75rem;
  margin-top: 0;
  padding: 0.75rem 1rem;
  box-sizing: border-box;
}

/* 左カラム: 各AIエージェントからのメッセージ（青ヘッダー＋白メッセージボックス） */
.hf-db-agent-block {
  margin-bottom: 1rem;
}

.hf-db-agent-block:last-child {
  margin-bottom: 0;
}

.hf-db-agent-head {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.35rem 0;
  padding: 0.5rem 0.75rem;
  background: #202586;
  color: #fff;
  border-radius: 8px 8px 0 0;
}

.hf-db-agent-msg-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.hf-db-agent-msg {
  font-size: 0.875rem;
  color: #475569;
  margin: 0 0 0.5rem 0;
  line-height: 1.6;
}

.hf-db-agent-msg:last-child {
  margin-bottom: 0;
}

/* 中央カラム: 当月のセッション数（縦区切り線）＋学習進捗グラフ */
.hf-db-session-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.hf-db-session-panel .hf-db-panel-title {
  background: transparent;
  border-bottom: none;
  padding-top: 0;
}

.hf-db-session-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.hf-db-session-item {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: #475569;
}

.hf-db-session-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: #202586;
}

.hf-db-session-divider {
  width: 1px;
  align-self: stretch;
  background: #e2e8f0;
  min-height: 40px;
}

.hf-db-chart-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.hf-db-chart-panel .hf-db-panel-title {
  flex-shrink: 0;
}

.hf-db-chart-subtitle {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 1rem 0.5rem;
  flex-shrink: 0;
}

.hf-db-chart-wrap {
  flex: 1;
  min-height: 240px;
  padding: 1rem;
  width: 100%;
  box-sizing: border-box;
}

/* 右カラム: 運営からのメッセージ（長文箇条書き） */
.hf-db-ops-list {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.7;
}

.hf-db-ops-list li {
  margin-bottom: 1rem;
}

.hf-db-ops-list li:last-child {
  margin-bottom: 0;
}

/* 自由質問対話: 枠（.hf-dialogue-dashboard*）は下のブロックに一本化。ここからはログ用コンポーネント等。 */

.hf-dialogue-avatar-stage {
  position: relative;
  /* レクチャーダッシュボードと同じサイズ感 */
  flex: 0 0 auto;
  width: 100%;
  height: clamp(260px, 32vh, 380px);
  min-height: 260px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #dbeafe 0%, #e0e7ff 45%, #f8fafc 100%);
  box-shadow: 0 4px 24px rgba(30, 41, 59, 0.12);
}

.hf-dialogue-avatar-figure {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-color: #cbd5e1;
}

.hf-dialogue-avatar-mouth {
  position: absolute;
  /* learning と同じ比率に揃える */
  left: 48.2%;
  top: 42%;
  width: 21%;
  min-width: 36px;
  max-width: 96px;
  height: 9.5%;
  min-height: 12px;
  transform: translateX(-50%) scaleY(calc(0.58 + var(--hf-mouth-open, 0) * 1.45));
  transform-origin: center center;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.45) 0%, rgba(15, 23, 42, 0.65) 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  opacity: 1;
  pointer-events: none;
  z-index: 2;
}

.hf-dialogue-avatar-mouth-img {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  background-image: var(--hf-overlay-mouth-image, none);
  opacity: 1;
}

.hf-dialogue-avatar-eyes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.hf-dialogue-avatar-eye-img {
  position: absolute;
  top: 43%;
  width: 18%;
  height: 15%;
  transform: translateX(-50%);
  transform-origin: center center;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  background-color: transparent;
  opacity: 1;
  z-index: 4;
  animation: hf-learning-eye-overlay-blink 4.2s ease-in-out infinite;
}

.hf-dialogue-avatar-eye-img--l {
  left: 38%;
  background-image: var(--hf-overlay-eye-l-image, none);
}

.hf-dialogue-avatar-eye-img--r {
  left: 58%;
  background-image: var(--hf-overlay-eye-r-image, none);
}

.hf-dialogue-speaking-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.55);
  color: #0f172a;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.hf-dialogue-dashboard-speaking .hf-dialogue-speaking-badge {
  opacity: 1;
}

.hf-dialogue-tts-actions {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.hf-dialogue-turn {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.hf-dialogue-turn:last-child {
  margin-bottom: 0;
}

.hf-dialogue-turn--user {
  margin-left: 2rem;
  background: #dbeafe;
  color: #1e3a8a;
}

.hf-dialogue-turn--assistant {
  margin-right: 2rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
}

.hf-dialogue-dashboard-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hf-dialogue-conversation-row {
  margin-bottom: 0.15rem;
}

.hf-dialogue-conversation-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
}

.hf-dialogue-conversation-label input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.hf-dialogue-conversation-hint {
  margin: 0.35rem 0 0 1.5rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #64748b;
}

.hf-studio-input-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.35rem;
}

button.hf-studio-dialogue-tool-btn--inactive {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.hf-dialogue-input-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.hf-dialogue-action-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem 0.65rem;
}

.hf-dialogue-action-row .hf-dialogue-action-send {
  flex: 1.65 1 9rem;
  min-width: 7.5rem;
  max-width: 100%;
  font-weight: 600;
  padding-left: 1.1rem;
  padding-right: 1.1rem;
}

.hf-dialogue-action-row .hf-dialogue-action-aux {
  flex: 1 1 5.25rem;
  min-width: 4.75rem;
}

.hf-dialogue-dashboard {
  position: fixed;
  inset: 0 40% 0 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(1px);
}

.hf-dialogue-dashboard[hidden] {
  display: none !important;
}

.hf-dialogue-dashboard-inner {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 1rem;
  width: min(100%, 960px);
  height: clamp(520px, min(88vh, 860px), 900px);
  max-height: 90vh;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.hf-dialogue-dashboard-header {
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.hf-dialogue-dashboard-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
  min-width: 0;
}

.hf-dialogue-dashboard-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 1rem;
  align-items: stretch;
  overflow: hidden;
}

.hf-dialogue-dashboard-left {
  flex: 0 0 42%;
  min-width: 0;
  max-width: 42%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/*
 * 対話ダッシュボードの口位置はここで調整する（#hf-dialogue-dashboard 配下に限定）。
 * - レクチャー用の .hf-learning-avatar-mouth とは別セレクタで、混線しない。
 * - 写真アバターに「描かれた口」とは別に、.hf-dialogue-avatar-mouth がオーバーレイ口（楕円/PNG）を載せている。
 * - 下げる: top の % を大きくする。上げる: 小さくする。
 */
#hf-dialogue-dashboard .hf-dialogue-avatar-mouth {
  top: 64%;
}

#hf-dialogue-dashboard .hf-dialogue-avatar-eye-img {
  top: 40.7%;
}

/* 対話ダッシュ: Live2D（学習ダッシュと同じく model3.json + Cubism4） */
.hf-dialogue-live2d-canvas {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.hf-dialogue-dashboard--live2d .hf-dialogue-avatar-figure,
.hf-dialogue-dashboard--live2d .hf-dialogue-avatar-mouth,
.hf-dialogue-dashboard--live2d .hf-dialogue-avatar-eyes {
  display: none !important;
}

.hf-dialogue-dashboard--live2d.hf-dialogue-dashboard--live2d-face-overlay .hf-dialogue-avatar-mouth,
.hf-dialogue-dashboard--live2d.hf-dialogue-dashboard--live2d-face-overlay .hf-dialogue-avatar-eyes {
  display: block !important;
  z-index: 6;
}

.hf-dialogue-dashboard--live2d .hf-dialogue-live2d-canvas {
  display: block;
}

.hf-dialogue-dashboard-right {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
}

/* 件名ブロックは常に確保。対話履歴ブロックは残り高さのみ使用し、内部でスクロール */
.hf-dialogue-dashboard-right .hf-dialogue-log-section {
  flex: 0 0 auto;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.hf-dialogue-dashboard-right .hf-dialogue-ref-section {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  gap: 0.4rem;
}

#hf-dialogue-dashboard .hf-dialogue-ref-section > .hf-dialogue-section-title {
  flex-shrink: 0;
}

/* 対話ログ: 高さは親に固定され、中身だけ縦スクロール */
#hf-dialogue-dashboard .hf-dialogue-ref-section .hf-dialogue-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.4rem 0.5rem 0.55rem;
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

/* 参照ドキュメント: 高さ上限で固定し、はみ出しはスクロール */
#hf-dialogue-dashboard .hf-dialogue-ref-section .hf-dialogue-ref-list {
  flex: 0 0 auto;
  flex-shrink: 0;
  min-height: 3.25rem;
  max-height: 10rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hf-dialogue-section-title {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

.hf-dialogue-title-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0 0 0.45rem;
}

.hf-dialogue-title-field-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #475569;
}

.hf-dialogue-session-title-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  font-size: 0.875rem;
}

.hf-dialogue-log-section,
.hf-dialogue-ref-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hf-dialogue-ref-list {
  min-height: 4.5rem;
  overflow: auto;
  padding: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.hf-dialogue-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  resize: vertical;
  min-height: 6.5rem;
}

.hf-studio-dialogue-entry {
  margin: 0.35rem 0;
}

/* ========== TKT-B2: 復習・図表連動ダッシュボード ========== */
.hf-learning-dashboard {
  position: fixed;
  /* Studio（右ペイン）を隠さないため、右側 30% 分は覆わない */
  inset: 0 40% 0 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  /* 内側枠を左寄せにして、右ペイン（音声/ペンボタン）に被りにくくする */
  justify-content: flex-start;
  padding: 1rem;
  /* 外側は「影で開いた感じ」を担うだけにして、Studio UI が見えなくならないよう薄くする */
  background: rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(1px);
  pointer-events: none;
}

.hf-studio-column {
  /* 学習ガイドのオーバーレイが視覚的に重なっても、音声/ペン入力ボタンは確実に見せる */
  position: relative;
  z-index: 1201;
}

.hf-learning-dashboard[hidden] {
  display: none !important;
}

.hf-learning-dashboard-inner {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 1rem;
  /* 本文量でモーダル全体の高さが伸び縮みしないよう、ビューポート基準で枠を固定 */
  width: min(100%, 960px);
  height: clamp(520px, min(88vh, 860px), 900px);
  max-height: 90vh;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  /* 基本はクリックを通す（Studio の音声/手書きボタンが重なっても機能するように） */
  pointer-events: none;
}

.hf-learning-dashboard * {
  pointer-events: none;
}

.hf-learning-dashboard-footer,
.hf-learning-dashboard *[id^="hf-learning-btn-"],
#hf-learning-dashboard-close,
#hf-learning-open-modal-fallback,
#hf-learning-review-scroll {
  pointer-events: auto;
}

.hf-learning-dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.hf-learning-dashboard-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.hf-learning-dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.hf-btn-text {
  background: transparent;
  border: none;
  color: #2563eb;
  text-decoration: underline;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

.hf-btn-text:hover {
  background: rgba(37, 99, 235, 0.08);
}

.hf-learning-dashboard-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 1rem;
  align-items: stretch;
  overflow: hidden;
}

.hf-learning-dashboard-left {
  flex: 0 0 42%;
  min-width: 0;
  max-width: 42%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  overflow: hidden;
}

.hf-learning-avatar-stage {
  position: relative;
  /* flex:1 だと右カラムの内容量で段の高さが変わりアバター枠が伸縮するため固定高 */
  flex: 0 0 auto;
  width: 100%;
  height: clamp(260px, 32vh, 380px);
  min-height: 260px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #dbeafe 0%, #e0e7ff 45%, #f8fafc 100%);
  box-shadow: 0 4px 24px rgba(30, 41, 59, 0.12);
}

/* Live2D: Cubism4 / model3.json（パス未設定時は canvas 非表示・CSS アバターのみ） */
.hf-learning-live2d-canvas {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.hf-learning-dashboard--live2d .hf-learning-avatar-figure,
.hf-learning-dashboard--live2d .hf-learning-avatar-mouth,
.hf-learning-dashboard--live2d .hf-learning-avatar-eyes,
.hf-learning-dashboard--live2d .hf-learning-wave {
  display: none !important;
}

/* Live2D の上に口・目の PNG オーバーレイを載せる（モデル単体では閉じ目のまま等のとき用） */
.hf-learning-dashboard--live2d.hf-learning-dashboard--live2d-face-overlay .hf-learning-avatar-mouth,
.hf-learning-dashboard--live2d.hf-learning-dashboard--live2d-face-overlay .hf-learning-avatar-eyes {
  display: block !important;
  z-index: 6;
}

.hf-learning-dashboard--live2d .hf-learning-live2d-canvas {
  display: block;
}

.hf-learning-avatar-figure {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-color: #cbd5e1;
}

/* 口パク: 既定は CSS 楕円。画像は .hf-learning-avatar-mouth-img（--hf-overlay-mouth-image または JS でクラス付与） */
.hf-learning-avatar-mouth {
  position: absolute;
  left: 43.8%;
  top: 42.3%;
  width: 21%;
  min-width: 36px;
  max-width: 96px;
  height: 6.5%;
  min-height: 12px;
  transform: translateX(-50%) scaleY(calc(0.58 + var(--hf-mouth-open, 0) * 1.45));
  transform-origin: center center;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.45) 0%, rgba(15, 23, 42, 0.65) 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 2;
  transition: transform 0.06s linear, opacity 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  opacity: 0.85;
}

.hf-learning-avatar-mouth-img {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  background-image: var(--hf-overlay-mouth-image, none);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.hf-learning-avatar-mouth--has-image {
  background: transparent;
  box-shadow: none;
  opacity: 1;
}

.hf-learning-avatar-mouth--has-image .hf-learning-avatar-mouth-img {
  opacity: 1;
}

/* 口が複数枚（DB のレベル列）のときは scaleY ではなく画像切替のみ */
.hf-learning-avatar-mouth--discrete-levels {
  transform: translateX(-50%) scaleY(1) !important;
}

/* サーバーTTS リップシンク時は単一画像口の開きをはっきり見せる（--hf-mouth-open のレンジ拡大） */
#hf-learning-dashboard.hf-learning-dashboard-lipsync .hf-learning-avatar-mouth.hf-learning-avatar-mouth--has-image:not(.hf-learning-avatar-mouth--discrete-levels) {
  transform: translateX(-50%) scaleY(calc(0.32 + var(--hf-mouth-open, 0) * 2.15));
}

#hf-learning-dashboard.hf-learning-dashboard-speaking:not(.hf-learning-dashboard-lipsync) .hf-learning-avatar-mouth--discrete-levels {
  animation: none;
}

/* CSS のみで差し込む例: #hf-learning-dashboard に --hf-overlay-* を書き、
   .hf-learning-avatar-mouth に .hf-learning-avatar-mouth--has-image、
   各 .hf-learning-avatar-eye-img に .hf-learning-avatar-eye-img--has-image を付与する。
   または window.__hfLearningOverlayMouthImageUrl 等（hf-learning-dashboard.js が参照）。 */

#hf-learning-dashboard.hf-learning-dashboard-speaking .hf-learning-avatar-mouth {
  opacity: 0.98;
}

/* Web Speech 時は RMS が無いため簡易ループで口元を動かす */
.hf-learning-dashboard-speaking:not(.hf-learning-dashboard-lipsync) .hf-learning-avatar-mouth {
  animation: hf-learning-mouth-fake 0.18s ease-in-out infinite alternate;
}

@keyframes hf-learning-mouth-fake {
  from {
    transform: translateX(-50%) scaleY(0.42);
  }
  to {
    transform: translateX(-50%) scaleY(0.78);
  }
}

/* 瞬き: まぶたは CSS。虹彩・口は .hf-learning-avatar-eye-img で画像差し込み（--hf-overlay-eye-l-image / --hf-overlay-eye-r-image） */
.hf-learning-avatar-eyes {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 3;
}

.hf-learning-avatar-eye-img {
  position: absolute;
  top: 30.8%;
  width: 9%;
  height: 4.2%;
  min-width: 10px;
  min-height: 5px;
  transform: translateX(-50%);
  transform-origin: center center;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.15s ease;
}

.hf-learning-avatar-eye-img--l {
  left: 37.5%;
  background-image: var(--hf-overlay-eye-l-image, none);
}

.hf-learning-avatar-eye-img--r {
  left: 49.5%;
  background-image: var(--hf-overlay-eye-r-image, none);
}

/* 目 PNG：不透明にし、CSS まぶたより手前。瞬きは PNG 側 keyframes（まぶたはオーバーレイ時は非表示）。 */
.hf-learning-avatar-eye-img--has-image {
  opacity: 1;
  z-index: 4;
  animation: hf-learning-eye-overlay-blink 4.2s ease-in-out infinite;
}

@keyframes hf-learning-eye-overlay-blink {
  0%,
  88%,
  100% {
    /* 通常は「開いて見える」状態（オーバーレイを薄く＆潰して Live2D/背景を優先） */
    transform: translateX(-50%) scaleY(0.12);
    opacity: 0.25;
  }
  90% {
    /* 瞬き（閉じ）だけ濃く見せる */
    transform: translateX(-50%) scaleY(1);
    opacity: 1;
  }
  92% {
    transform: translateX(-50%) scaleY(0.12);
    opacity: 0.25;
  }
}

/* 目オーバーレイ（PNG）があるときは CSS まぶたを隠す。
   まぶたは z-index:3 で目画像より上にあり、暗い帯が常に被ると「黒い枠／閉じ目」に見える。 */
#hf-learning-avatar-eye-img-l.hf-learning-avatar-eye-img--has-image ~ .hf-learning-avatar-eyelid--l,
#hf-learning-avatar-eye-img-r.hf-learning-avatar-eye-img--has-image ~ .hf-learning-avatar-eyelid--r {
  opacity: 0 !important;
  visibility: hidden !important;
  animation: none !important;
}

.hf-learning-avatar-eyelid {
  position: absolute;
  top: 31.8%;
  width: 8%;
  height: 3.2%;
  min-height: 4px;
  border-radius: 999px;
  transform-origin: center center;
  background: rgba(13, 14, 14, 0.78);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
  animation: hf-learning-blink 4.2s ease-in-out infinite;
  opacity: 0.88;
  z-index: 3;
}

.hf-learning-avatar-eyelid--l {
  left: 37.5%;
  transform: translateX(-50%);
}

.hf-learning-avatar-eyelid--r {
  left: 49.5%;
  transform: translateX(-50%);
}

@keyframes hf-learning-blink {
  0%,
  88%,
  100% {
    /* まばたきしない（通常）は薄い */
    transform: translateX(-50%) scaleY(0.14);
    opacity: 0.78;
  }
  90% {
    /* まばたき（閉じ）は太い */
    transform: translateX(-50%) scaleY(1);
    opacity: 0.92;
  }
  92% {
    transform: translateX(-50%) scaleY(0.14);
    opacity: 0.78;
  }
}

/* 発話中は瞬き間隔を少し伸ばす（読みやすさ優先） */
.hf-learning-dashboard-speaking .hf-learning-avatar-eyelid {
  animation-duration: 5.1s;
}

.hf-learning-dashboard-speaking .hf-learning-avatar-eye-img--has-image {
  animation-duration: 5.1s;
}

@media (prefers-reduced-motion: reduce) {
  .hf-learning-avatar-mouth,
  .hf-learning-avatar-eyelid {
    animation: none !important;
    transition: none !important;
  }
  .hf-learning-dashboard-speaking:not(.hf-learning-dashboard-lipsync) .hf-learning-avatar-mouth {
    animation: none !important;
  }
  .hf-learning-avatar-mouth-img,
  .hf-learning-avatar-eye-img {
    transition: none !important;
  }
  .hf-learning-avatar-eye-img--has-image {
    animation: none !important;
  }
}

.hf-learning-wave {
  display: none;
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 28%;
  height: 36px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.35) 20%,
    rgba(96, 165, 250, 0.85) 50%,
    rgba(59, 130, 246, 0.35) 80%,
    transparent 100%
  );
  border-radius: 999px;
  filter: blur(0.5px);
  animation: hf-learning-wave-pulse 1.2s ease-in-out infinite;
}

.hf-learning-dashboard-speaking .hf-learning-wave {
  display: block;
}

/* サーバーTTS リップシンク時は口元で十分なので、胸元に広がる波形帯を出さない（違和感低減） */
.hf-learning-dashboard-lipsync .hf-learning-wave {
  display: none !important;
}

/* Server TTS lip-sync (MVP): Live2D未導入でも「口が動く感」を出す */
.hf-learning-dashboard-lipsync #hf-learning-speaking-badge::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.35);
  transform: scale(calc(0.8 + (var(--hf-mouth-open, 0) * 0.7)));
  transition: transform 0.05s linear;
}

@keyframes hf-learning-wave-pulse {
  0%, 100% { opacity: 0.65; transform: scaleX(0.92); }
  50% { opacity: 1; transform: scaleX(1); }
}

.hf-learning-speaking-badge {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 5;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.72);
  border-radius: 6px;
  max-width: 90%;
}

.hf-learning-caption-box {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
}

.hf-learning-caption-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.hf-learning-caption-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #334155;
  min-height: 4.5em;
  max-height: 4.5em;
  overflow-y: auto;
}

.hf-learning-dashboard-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.hf-learning-section-title {
  margin: 0 0 0.5rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.hf-learning-review-section {
  flex: 1 1 55%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
}

.hf-learning-review-scroll {
  flex: 1 1 auto;
  min-height: 160px;
  overflow-y: auto;
  font-size: 0.875rem;
  line-height: 1.65;
  color: #334155;
  padding-right: 6px;
}

.hf-review-segment {
  margin: 0 0 0.65rem 0;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.hf-review-segment:last-child {
  margin-bottom: 0;
}

.hf-review-segment-active {
  background: #eff6ff;
  border-left-color: #3b82f6;
}

.hf-learning-visual-section {
  flex: 0 0 auto;
  min-height: 140px;
  max-height: min(200px, 24vh);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.hf-learning-visual-stage {
  flex: 1;
  min-height: 0;
  position: relative;
}

.hf-learning-visual-slide {
  height: 100%;
  overflow-y: auto;
}

.hf-learning-visual-card {
  padding: 0.5rem 0;
}

.hf-learning-visual-card-title {
  margin: 0 0 0.35rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

.hf-learning-visual-card-body {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #64748b;
}

.hf-learning-fake-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 72px;
  margin: 0.5rem 0;
  padding: 0 0.25rem;
}

.hf-learning-fake-chart span {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #93c5fd, #3b82f6);
  opacity: 0.85;
}

.hf-learning-fake-chart span:nth-child(1) { height: 40%; }
.hf-learning-fake-chart span:nth-child(2) { height: 70%; }
.hf-learning-fake-chart span:nth-child(3) { height: 55%; }

.hf-learning-dashboard-footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  border-top: 1px solid #e2e8f0;
}

.hf-learning-btn-end {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border: 1px solid #fecaca !important;
}

.hf-learning-btn-end:hover {
  background: #fee2e2 !important;
}

.hf-learning-btn-pause {
  min-width: 7rem;
}

.hf-learning-btn-play {
  min-width: 7rem;
  background: #202586 !important;
  color: #fff !important;
  border: none !important;
}

.hf-learning-btn-play:hover {
  filter: brightness(1.08);
}

.hf-studio-column #hf-voice-input-btn,
.hf-studio-column #hf-pen-input-btn {
  pointer-events: auto;
  position: relative;
  z-index: 2005;
}

.hf-studio-column #hf-voice-status {
  pointer-events: auto;
}

/* 種別スタジオ（LEARNING_DASHBOARD_KIND ≠ 0） */
.hf-studio-classic[hidden],
.hf-template-studio-pane[hidden] {
  display: none !important;
}

.hf-template-studio-pane .hf-ts-meta {
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

.hf-ts-kind-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e40af;
  background: #dbeafe;
  border-radius: 4px;
}

.hf-ts-display-title {
  font-weight: 600;
  font-size: 1rem;
}

.hf-ts-section {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.hf-ts-section-title {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
}

.hf-ts-subtitle {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
}

.hf-ts-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #475569;
  white-space: pre-wrap;
}

.hf-ts-content-preview {
  max-height: 6rem;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.hf-ts-content-preview::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5rem;
  background: linear-gradient(transparent, #fff);
  pointer-events: none;
}

.hf-ts-json-preview {
  margin: 0;
  padding: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.4;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.hf-ts-hint {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
}

.hf-ts-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hf-ts-roleplay-card {
  margin-bottom: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.hf-ts-answer-input {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  resize: vertical;
  box-sizing: border-box;
}

.hf-ts-inline-actions {
  margin-top: 0.5rem;
}

.hf-ts-btn-voice {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.hf-dialogue-roleplay-brief {
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.hf-dialogue-right-pane-panel {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: hidden;
}

.hf-dialogue-dashboard--voice-roleplay-ui .hf-dialogue-right-pane-panel.hf-dialogue-roleplay-brief {
  flex: 1 1 0;
}

.hf-dialogue-dashboard--voice-roleplay-ui.hf-dialogue-dashboard--conversation .hf-dialogue-roleplay-brief {
  display: none !important;
}

.hf-dialogue-dashboard--voice-roleplay-ui .hf-dialogue-conversation-pane {
  flex: 1 1 auto;
  min-height: 0;
}

.hf-dialogue-dashboard--voice-roleplay-ui.hf-dialogue-dashboard--conversation .hf-dialogue-log-section {
  flex: 0 0 auto;
  margin-top: 0.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e2e8f0;
}

.hf-dialogue-dashboard--voice-roleplay-ui .hf-dialogue-messages .hf-dialogue-turn {
  margin-left: 0;
  margin-right: 0;
  width: 100%;
  box-sizing: border-box;
}

.hf-dialogue-dashboard--voice-roleplay-ui .hf-dialogue-messages .hf-dialogue-turn-role {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.hf-dialogue-dashboard--voice-roleplay-ui .hf-dialogue-messages .hf-dialogue-turn-text {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}

.hf-dialogue-dashboard--voice-roleplay-ui .hf-dialogue-conversation-pane .hf-dialogue-messages {
  padding: 0.65rem 0.75rem;
}

.hf-dialogue-dashboard--voice-roleplay-ui:not(.hf-dialogue-dashboard--conversation) .hf-dialogue-conversation-pane {
  display: none !important;
}

.hf-dialogue-dashboard--voice-roleplay-ui .hf-dialogue-ref-section {
  display: none;
}

.hf-dialogue-dashboard:not(.hf-dialogue-dashboard--voice-roleplay-ui) .hf-dialogue-roleplay-brief {
  display: none !important;
}

.hf-dialogue-dashboard:not(.hf-dialogue-dashboard--voice-roleplay-ui) .hf-dialogue-conversation-pane {
  display: flex !important;
  flex: 1 1 0;
}

.hf-dialogue-dashboard:not(.hf-dialogue-dashboard--voice-roleplay-ui) .hf-dialogue-ref-section > .hf-dialogue-section-title {
  display: none;
}

.hf-dialogue-dashboard:not(.hf-dialogue-dashboard--voice-roleplay-ui) .hf-dialogue-conversation-pane > .hf-dialogue-section-title {
  display: block;
}

.hf-dialogue-pane-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.55rem 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.hf-dialogue-roleplay-brief-body {
  font-size: 0.875rem;
  line-height: 1.55;
  color: #334155;
}

.hf-dialogue-brief-seg {
  margin: 0 0 0.65rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.hf-dialogue-brief-seg:last-child {
  margin-bottom: 0;
}

.hf-dialogue-brief-seg--active {
  background: #dbeafe;
  box-shadow: inset 3px 0 0 #2563eb;
}

.hf-dialogue-brief-seg--done {
  color: #475569;
}

.hf-dialogue-conversation-pane .hf-dialogue-messages {
  flex: 1 1 0;
  min-height: 0;
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.4rem 0.5rem 0.55rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hf-dialogue-conversation-pane:has(#hf-dialogue-evaluation:not([hidden])) .hf-dialogue-messages {
  flex: 1 1 0;
  min-height: 5.5rem;
}

.hf-dialogue-evaluation {
  margin: 0.65rem 0 0;
  padding: 0.65rem 0.75rem;
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(42vh, 340px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 8px;
  color: #713f12;
}

.hf-dialogue-rp-row {
  margin-bottom: 0.5rem;
}

.hf-dialogue-rp-row:last-child {
  margin-bottom: 0;
}

.hf-dialogue-dashboard--briefing .hf-dialogue-conversation-row,
.hf-dialogue-dashboard--briefing .hf-dialogue-input-tools {
  opacity: 0.55;
}

.hf-dialogue-dashboard--briefing .hf-dialogue-turn--assistant:first-child {
  border-left: 3px solid #2563eb;
  padding-left: 0.65rem;
}

.hf-dialogue-rp-row strong {
  display: block;
  font-size: 0.75rem;
  color: #1e40af;
  margin-bottom: 0.15rem;
}

.hf-dialogue-rp-row p {
  margin: 0;
  white-space: pre-wrap;
}

.hf-dialogue-session-status {
  margin: 0 0 0.65rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 8px;
  color: #065f46;
  font-weight: 600;
}

.hf-dialogue-dashboard--session-ended .hf-dialogue-input,
.hf-dialogue-dashboard--session-ended #hf-dialogue-voice-input-btn,
.hf-dialogue-dashboard--session-ended #hf-dialogue-send {
  opacity: 0.65;
}

.hf-dialogue-dashboard--voice-session .hf-dialogue-conversation-row {
  background: #eff6ff;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

@media (max-width: 900px) {
  .hf-learning-dashboard {
    inset: 0;
  }
  .hf-learning-dashboard-inner {
    width: 100%;
    height: min(92vh, 900px);
    max-height: 92vh;
  }
  .hf-learning-dashboard-body {
    flex-direction: column;
  }
  .hf-learning-dashboard-left {
    flex: 0 0 auto;
    max-width: 100%;
    max-height: none;
  }
  .hf-learning-avatar-stage {
    height: clamp(220px, 40vh, 320px);
  }
  .hf-learning-visual-section {
    max-height: min(180px, 28vh);
  }
}

/* 対話セッション読み上げモーダル */
.hf-dialogue-playback-modal .hf-dialogue-playback-content {
  max-width: min(640px, 96vw);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
}

.hf-dialogue-playback-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
}

.hf-dialogue-playback-voice-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.hf-dialogue-playback-turns {
  flex: 1 1 auto;
  min-height: 12rem;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.55rem 0.65rem;
}

.hf-dialogue-playback-turn {
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.hf-dialogue-playback-turn:last-child {
  margin-bottom: 0;
}

.hf-dialogue-playback-turn--assistant {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
}

.hf-dialogue-playback-turn--user {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}

.hf-dialogue-playback-turn--active {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.hf-dialogue-playback-turn--done {
  opacity: 0.72;
}

.hf-dialogue-playback-turn-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.2rem;
}

.hf-dialogue-playback-turn-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.hf-dialogue-playback-status {
  margin: 0;
  min-height: 1.25rem;
  font-size: 0.8125rem;
  color: #64748b;
}

.hf-dialogue-playback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.hf-dialogue-playback-modal .hf-modal-footer {
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
}

.hf-dialogue-playback-empty {
  margin: 0;
  color: #64748b;
  font-size: 0.875rem;
}