:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #059669;
  --warn: #b45309;
  --err: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* topbar (sticky = スクロールしても残る) 2段構成 */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: #fff; border-bottom: 2px solid var(--brand);
  padding: 8px 20px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.topbar-row1 { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--brand-dark); white-space: nowrap; letter-spacing: .01em; }
.tagline { color: var(--muted); font-size: .82rem; flex: 1 1 auto; }
.about-link { font-size: .82rem; white-space: nowrap; }
.userbox { display: inline-flex; align-items: center; gap: 10px; font-size: .85rem; }
.username { font-weight: 700; color: inherit; text-decoration: none; }
.username:hover { text-decoration: underline; }
.rolebadge { background: #eef2f7; color: #334155; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }

/* 認証カード(ログイン/登録) */
.auth-card { max-width: 420px; margin: 24px auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 24px 28px; box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.auth-card h1 { margin-top: 0; font-size: 1.35rem; }
.auth-brand { text-align: center; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.auth-logo { font-size: 1.8rem; font-weight: 800; color: var(--brand-dark); letter-spacing: .01em; }
.auth-tagline { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* ワークフローナビ(=全体フロー)。狭い画面では折り返さず横スクロール。 */
.mainnav { display: flex; align-items: stretch; gap: 2px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
.mainnav::-webkit-scrollbar { height: 6px; }
.navitem {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 12px; border-radius: 8px 8px 0 0;
  color: var(--ink); font-size: .92rem; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.navitem:hover { text-decoration: none; background: #f1f5f9; }
.navnum { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #e2e8f0; color: #64748b; font-size: .72rem; font-weight: 700; }
.navitem.done .navnum { background: var(--ok); color: #fff; }
/* 現在地: 太字・大きめ・下線で明確に */
.navitem.current { background: #eef4ff; color: var(--brand-dark); font-weight: 800; font-size: 1rem; border-bottom-color: var(--brand); }
.navitem.current .navnum { background: var(--brand); color: #fff; }
.navhere { background: var(--brand); color: #fff; font-size: .65rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.navitem.disabled { color: var(--muted); cursor: pointer; }
.navitem.disabled .navnum { opacity: .55; }
.navlock { font-size: .7rem; opacity: .7; }
.navsep { display: inline-flex; align-items: center; color: #cbd5e1; }

/* 案内トースト */
.toast {
  position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 1200;
  background: #1f2933; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: .9rem; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: 90%;
}
.toast[hidden] { display: none; }

.container { max-width: 960px; margin: 0 auto; padding: 28px 24px 64px; }

h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; margin-top: 1.6em; }
.lead { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 2px 0 6px; }
.hint.inline { margin-left: 10px; }

/* banners */
.banner { padding: 10px 24px; font-size: .9rem; }
/* バナー内の操作ボタン列(「左の〜を押せ」参照をやめ、その場に操作を置く) */
.banner-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.banner-actions form { margin: 0; }
.banner.mock { background: #fef3c7; color: var(--warn); border-bottom: 1px solid #fde68a; }
.banner.ok { background: #d1fae5; color: var(--ok); border-radius: 8px; margin-bottom: 16px; }
.banner.err { background: #fee2e2; color: var(--err); border-radius: 8px; margin-bottom: 16px; }

/* ログイン後の役割ガイド（目立つ導入） */
.intro { background: #eef4ff; border: 1px solid #c7d7fe; border-left: 5px solid var(--brand);
  border-radius: 10px; padding: 16px 20px; margin: 4px 0 20px; }
.intro h2 { margin: 0 0 8px; font-size: 1.1rem; color: var(--brand-dark); }
.intro p { margin: 6px 0; }
.intro ol, .intro ul { margin: 6px 0 0; padding-left: 1.4em; }
.intro li { margin: 4px 0; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.card h2, .card h4 { margin-top: 0; }
.card.actor { border-left: 4px solid #6366f1; }
.card.buddy { border-left: 4px solid #14b8a6; }
.tag { display: inline-block; background: #eef2f7; color: #334155; font-size: .78rem; padding: 2px 8px; border-radius: 999px; }

/* blocks / forms */
.block { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin: 16px 0; }
.field { display: block; margin: 12px 0; }
/* 必須項目マーク: 作成・設定フォームのラベルに付ける赤い星と、フォーム冒頭の凡例 */
.req-mark { color: var(--err); font-weight: 700; margin-left: 2px; }
.req-legend { color: var(--muted); font-size: .82rem; margin: 0 0 8px; }
/* ラベル(最初の通常span)は太字。補足説明(.muted span)は細字で従属的に */
.field > span:not(.muted) { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field > span.muted { display: block; font-weight: 400; font-size: .8rem; margin-top: 4px; }
input[type=text], input[type=url], input[type=password], textarea, select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
/* 入力フォームのセクション枠(項目グループを視覚的に区切る) */
.formsec { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 14px 0; background: #fff; }
.formsec > .formsec-title { font-weight: 700; font-size: .98rem; color: var(--brand-dark); margin: 0 0 2px; }
/* 節内の小見出し(入れ子でも同じ見た目になるようクラスで直接指定) */
.formsec-sub { font-weight: 700; font-size: .93rem; color: var(--brand-dark); margin: 10px 0 2px; }
.formsec > .formsec-desc { color: var(--muted); font-size: .82rem; margin: 0 0 10px; }
.wide { width: 100%; }
textarea { width: 100%; resize: vertical; }
/* 長文用テキストエリア: 既定で広く。等幅寄りで長い指導方針・本文を編集しやすく。 */
textarea.tall { min-height: 360px; line-height: 1.55; font-size: .92rem;
  font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace; }
/* テキストファイル読み込みボタン + 状態表示 */
.file-fill { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; flex-wrap: wrap; }
.file-fill .btn { cursor: pointer; }
.file-fill .file-fill-note { }
/* ケース一覧の実施状況バッジ(#19): 未実施/実施中/実施済(N回) */
.progress-badge { display: inline-block; font-size: .74rem; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.progress-badge.new { background: #f1f5f9; color: var(--muted); border: 1px solid var(--line); }
.progress-badge.doing { background: #fef3c7; color: var(--warn); border: 1px solid #fde68a; }
.progress-badge.done { background: #d1fae5; color: var(--ok); border: 1px solid #a7f3d0; }
/* ケース作成/編集: 既定プロンプトの閲覧(#21・読み取り専用) */
.base-prompt { margin-top: 10px; }
.base-prompt > summary { cursor: pointer; }
.base-prompt-text { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; font-size: .8rem; line-height: 1.6; white-space: pre-wrap;
  max-height: 320px; overflow-y: auto; margin: 0; }
/* 選択問題(クリック回答): 構造化データからサーバ描画した選択肢ボタン。
   チャット内(設問の直後)に表示する。 */
.msg.quiz-inline { max-width: 92%; }
.quiz-choices { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 0; }
.quiz-choice-btn { text-align: left; white-space: normal; line-height: 1.5; padding: 10px 14px;
  border-color: var(--brand, #3a6ea5); font: inherit; }
.quiz-choice-btn:hover:not(:disabled) { background: #eef4ff; }
/* 回答済み: 選択肢は消さずに残す(見返せる)。選んだものだけ強調 */
.quiz-choice-btn:disabled { opacity: .65; cursor: default; border-color: var(--line); }
.quiz-choice-btn.chosen { border-color: var(--brand, #3a6ea5); background: #eef4ff; opacity: 1; }
/* 選択肢本文はMarkdown描画(図・表つき選択肢)。配置は末尾のまとめ定義で指定する
   (.btn 等の後続定義に上書きされないようにするため)。 */
.quiz-choice-body p { margin: 0 0 4px; }
.quiz-choice-body p:last-child { margin-bottom: 0; }
.quiz-choice-body img, .msg-body img { max-width: 100%; height: auto; }
.quiz-choice-body table { margin: 6px 0 2px; }
/* 設問と採点・解説をデザインで区別する */
.msg.quiz-question { max-width: 92%; }
.msg.quiz-question .msg-body { background: #eef4ff; border: 1px solid #c7d7fe;
  border-left: 4px solid var(--brand); border-radius: 8px; }
.msg.quiz-question .msg-speaker { color: var(--brand-dark); font-weight: 700; }
.msg.quiz-grade { max-width: 92%; }
.msg.quiz-grade .msg-body { border-radius: 8px; border: 1px solid var(--line); border-left: 4px solid var(--muted); background: #fff; }
.msg.quiz-grade.grade-ok .msg-body { background: #f0fdf4; border-color: #bbf7d0; border-left: 4px solid var(--ok); }
.msg.quiz-grade.grade-ng .msg-body { background: #fef2f2; border-color: #fecaca; border-left: 4px solid var(--err); }
.msg.quiz-grade .msg-speaker { font-weight: 700; }
.msg.quiz-summary .msg-body { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; }
/* 全問終了後の操作バー(追加出題・案内) */
.quiz-done-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; border-top: 1px solid var(--line); padding: 10px 12px 0; }
/* 進捗・正解数の常時表示バー(#14): チャットの下(スクロールしない位置)に固定 */
.quiz-status-bar { display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  padding: 6px 14px; border-top: 1px solid var(--line); background: #f8fafc;
  font-size: .92rem; color: #334155; }
.quiz-status-bar b { color: var(--brand); font-size: 1.05em; }
.quiz-status-bar[hidden] { display: none; }   /* display:flex が hidden 属性に勝たないように */
/* 対話への添付(＋ボタンとポップオーバー。撤去時はこの一角も削除してよい) */
.say-form .actions { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.say-form .actions .btn { padding: 4px 12px; }   /* 送信まわりを縦に詰める */
.attach-plus { font-weight: 700; line-height: 1.2; }
.attach-pop { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; box-shadow: 0 6px 20px rgba(0,0,0,.14);
  max-width: 320px; }
.say-form.dragover { outline: 2px dashed var(--brand); outline-offset: 3px; border-radius: 8px; }
/* 縦積みのカード列(評価結果 #23: 横並びの対比をやめ、読み順を上から下に統一) */
.stack { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 16px 0; }
@media print { .quiz-status-bar { display: none !important; } }
.radios label, .check { display: inline-flex; align-items: center; gap: 6px; margin-right: 20px; }
.radioline { display: inline-flex; align-items: center; gap: 6px; margin-right: 20px; font-size: .92rem; }
.check { display: flex; margin: 10px 0; }
.archetype-row { display: grid; grid-template-columns: 120px 200px 1fr; gap: 8px; margin-bottom: 10px; align-items: start; }

/* buttons */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font: inherit;
}
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; }
.btn.success { background: #059669; color: #fff; border-color: #059669; }
.btn.success:hover { background: #047857; color: #fff; }
.btn.accent { background: #0891b2; color: #fff; border-color: #0891b2; }
.btn.accent:hover { background: #0e7490; color: #fff; }
.btn.small { padding: 4px 10px; font-size: .8rem; vertical-align: middle; font-weight: 400; }
.btn.danger { background: #fff; color: var(--err); border-color: #fecaca; }
.btn.danger:hover { background: var(--err); color: #fff; border-color: var(--err); }
.danger-zone { display: flex; align-items: center; gap: 10px; }
.actions { margin: 20px 0; display: flex; gap: 10px; align-items: center; }

/* tables */
.table { width: 100%; border-collapse: collapse; margin: 12px 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.table thead th { background: #f8fafc; }
.kv { border-collapse: collapse; margin: 10px 0; }
.kv th { text-align: left; padding: 6px 14px 6px 0; color: var(--muted); font-weight: 600; vertical-align: top; white-space: nowrap; }
.kv td { padding: 6px 0; }

/* pills */
.pill { font-size: .78rem; padding: 2px 9px; border-radius: 999px; }
.pill.ok { background: #d1fae5; color: var(--ok); }
.pill.todo { background: #f1f5f9; color: var(--muted); }

.stat { font-size: 2rem; font-weight: 700; color: var(--brand); margin: 4px 0; }

/* 学習者: ページ最下部の次アクション */
.next-action { margin: 24px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }

/* admin 2-pane */
.admin-layout { display: flex; gap: 20px; align-items: flex-start; margin-top: 14px; }
.admin-side { flex: 0 0 180px; display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; position: sticky; top: 16px; }
.admin-link { display: block; padding: 9px 12px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .92rem; }
.admin-link:hover { background: #f1f5f9; }
.admin-link.active { background: var(--brand); color: #fff; font-weight: 600; }
/* 左ナビ内のアクション(フォーム送信ボタン)をリンク項目と同じ見た目に */
.admin-side form { margin: 0; }
button.admin-link { -webkit-appearance: none; appearance: none; width: 100%; text-align: left;
  border: none; background: none; cursor: pointer; font-family: inherit; font-size: .92rem; color: var(--text); }
.admin-side .navsplit { border-top: 1px solid var(--line); margin: 6px 0; }
.admin-content { flex: 1 1 auto; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px 22px; }
.admin-content h2 { margin-top: 0; }
@media (max-width: 720px) {
  .admin-layout { flex-direction: column; }
  .admin-side { flex-direction: row; flex-wrap: wrap; position: static; width: 100%; box-sizing: border-box; }
}

/* misc */
.id { font-size: .8rem; color: var(--muted); }
.quote, .doc { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; white-space: pre-wrap; }
.doc { white-space: normal; }
.doc h3 { font-size: 1rem; margin: 1em 0 .3em; }
/* 見出し直後の本文を少しインデントして読みやすく */
.doc h3 + p { margin: 0 0 .8em; padding-left: 14px; }
/* 登場人物・バディの一覧: 名前を行頭に、説明はインデント */
.person-list { margin: 4px 0 .8em; }
.person { margin: 0 0 10px; padding-left: 14px; border-left: 3px solid var(--line); }
.person .pname { font-weight: 600; }
.person .prole { color: var(--muted); font-size: .85rem; margin-left: 8px; }
.person .pdesc { margin: 2px 0 0; }
details { margin: 10px 0; }
summary { cursor: pointer; }
hr { border: none; border-top: 1px solid var(--line); margin: 28px 0; }
.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px; border-top: 1px solid var(--line); }

/* スマホ: ヘッダを1行に圧縮(2行目のキャッチコピー・バージョンは出さない)。
   ケース実行画面(body.runpage)ではさらに「CaseGymとは？」とフッタ1行目も省き、
   ケース側ヘッダ(左ペイン相当)のボタンを小型化して可動域を最大化する。 */
@media (max-width: 760px) {
  .topbar { padding: 6px 12px 0; }
  .tagline, .appver { display: none; }
  body.runpage .app-about { display: none; }
  body.runpage .footer { padding: 8px 12px; }
  body.runpage .footer-links { display: none; }
  body.runpage .run-title { font-size: 1rem; margin: 0; }
  body.runpage .run-side { gap: 6px; }
  body.runpage .run-side > p { display: none; }   /* モデル表示・概要などの補足行 */
  body.runpage .run-group-label { display: none; }
  body.runpage .run-actions { gap: 6px; }
  body.runpage .run-actions .btn { padding: 4px 10px; font-size: .8rem; font-weight: 400; }
}

/* バディ選択カード */
.card.selectable { cursor: pointer; display: block; }
.card.selectable input { margin-right: 6px; }
.card.selectable:hover { border-color: var(--brand); }

/* アクター選択カード(ボタン) */
button.card { width: 100%; text-align: left; font: inherit; cursor: pointer; }
button.card:hover { border-color: var(--brand); }
.card.actor.current { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.select-cta { display: inline-block; margin-top: 8px; font-size: .82rem; color: var(--brand); font-weight: 600; }

/* チャット */
.chat { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg .bubble { padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; }
.msg.learner { align-self: flex-end; align-items: flex-end; }
.msg.learner .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 3px; }
.msg.buddy { align-self: flex-start; }
.msg.buddy .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg .speaker { font-size: .78rem; color: var(--muted); margin: 0 0 2px 4px; }
.bubble.typing { color: var(--muted); font-style: italic; display: inline-flex; align-items: center; gap: 8px; }
.bubble.typing .dots { display: inline-flex; gap: 3px; }
.bubble.typing .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; animation: blink 1.2s infinite both; }
.bubble.typing .dots i:nth-child(2) { animation-delay: .2s; }
.bubble.typing .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.hidden { display: none; }
.msg.actor { align-self: flex-start; }
.msg.actor .bubble { background: #fff7ed; border: 1px solid #fed7aa; border-bottom-left-radius: 3px; }
.msg.system { align-self: center; max-width: 90%; }
.msg.system .sys-note { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; border-radius: 8px; padding: 6px 12px; font-size: .85rem; text-align: center; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; margin: 12px 0; }
.chat-input textarea { flex: 1; }
.approach { border-left: 3px solid #14b8a6; padding-left: 12px; margin: 10px 0; }
.drafts code { display: inline-block; margin: 2px 0; }

/* 出席者プロフィール */
.attendees { display: flex; flex-direction: column; gap: 8px; }
.attendee { display: flex; gap: 10px; align-items: baseline; }
.att-name { font-weight: 700; white-space: nowrap; }
.att-profile { color: var(--muted); font-size: .9rem; }

/* メッセージ入力 */
.chat-form { margin: 12px 0; }
.chat-form .hint { margin: 0 0 8px; }

/* 送信中ボタン */
.btn.is-busy { opacity: .6; cursor: progress; }

/* 使用量メーター */
.meter { width: 260px; max-width: 100%; height: 8px; background: #e2e8f0; border-radius: 999px; margin: 6px 0; overflow: hidden; }
.meter-bar { height: 100%; background: var(--brand); border-radius: 999px; min-width: 2px; }

/* 処理中オーバーレイ */
.loading-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center;
}
.loading-overlay[hidden] { display: none; }
.loading-box {
  background: #fff; border-radius: 12px; padding: 28px 36px; text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.2); max-width: 90%;
}
.loading-box p { margin: 8px 0 0; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 6px;
  border: 4px solid #e2e8f0; border-top-color: var(--brand);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-progress { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; margin: 4px 0; }
.inline-spinner { width: 18px; height: 18px; border-width: 3px; margin: 0; }

/* フローティング作戦メモ (position:fixed = 会話レイアウトを押し出さない) */
.memo-float {
  position: fixed; right: 16px; bottom: 16px; z-index: 900;
  width: 320px; max-width: calc(100vw - 32px); max-height: 72vh;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 34px rgba(0,0,0,.20);
}
.memo-float-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.memo-float-actions { display: flex; gap: 10px; align-items: center; }
.memo-float-x { border: none; background: none; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px; }
.memo-float-content { overflow: auto; padding: 10px 12px; }
.memo-float-open {
  position: fixed; right: 16px; bottom: 16px; z-index: 900;
  background: var(--brand); color: #fff; border: none; border-radius: 999px;
  padding: 10px 16px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.2); font: inherit;
}
.memo-sec { margin: 10px 0; }
.memo-sec.highlight { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 8px 10px; }
.memo-label { font-weight: 700; font-size: .8rem; color: var(--muted); margin-bottom: 3px; }
.memo-sec ul { margin: 2px 0 0; padding-left: 18px; }
.copyq { cursor: pointer; }
.copyq:hover { background: #dbeafe; }
.copyq.copied { background: #bbf7d0; }

/* 作戦メモ単独ページ */
.memo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.memo-actions { white-space: nowrap; }
@media print {
  .topbar, .footer, .memo-actions { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .block { border: none; padding: 0; }
}

/* CaseGym: 見出しと操作ボタンを横並びにする行 */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1, .page-head h3 { margin: 0; }
.page-head .actions { margin: 0; display: flex; gap: 8px; align-items: center; }
a.card { text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--brand); }

/* CaseGym: ファイルのドラッグ＆ドロップ領域 */
.dropzone { display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--line); border-radius: 10px; padding: 22px 16px; margin: 8px 0;
  color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: var(--brand); }
.dropzone.dragover { border-color: var(--brand); background: rgba(37,99,235,.06); color: var(--text); }
.dropzone.has-files { border-style: solid; border-color: var(--brand); color: var(--text); background: #f8fafc; }
.dz-text { line-height: 1.5; font-size: .9rem; }

/* CaseGym: 対話(チャット)UI */
.chat { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; min-height: 220px; max-height: 56vh; overflow-y: auto; }
.msg { max-width: 78%; }
.msg .msg-speaker { font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
.msg .msg-body { padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; line-height: 1.5; }
.msg.ai { align-self: flex-start; }
.msg.ai .msg-body { background: #f1f5f9; border: 1px solid var(--line); border-top-left-radius: 3px; }
.msg.me { align-self: flex-end; text-align: left; }
.msg.me .msg-body { background: var(--brand); color: #fff; border-top-right-radius: 3px; }
.msg.sys { align-self: center; max-width: 90%; }
.msg.sys .msg-body { background: #fffbeb; border: 1px solid #fde68a; color: var(--warn); font-size: .85rem; }
/* グループ対話: 自分以外の参加者(学習者・教員)の発言 */
.msg.peer { align-self: flex-start; }
.msg.peer .msg-body { background: #fff; border: 1px solid var(--line); border-top-left-radius: 3px; }
.msg.peer.teacher .msg-speaker { color: var(--brand-dark); font-weight: 600; }
/* 同じ人の連続発言は1つの吹き出しの中に行として積む(短文の積み重ねを促す) */
.msg .grp-line + .grp-line { margin-top: 8px; }
.say-form { margin-top: 12px; }

/* CaseGym: 対話の「考え中」インジケータ（最初のトークンが来るまで表示） */
.msg-body.typing { color: var(--muted); font-style: italic; display: inline-flex; align-items: center; gap: 8px; }
.msg-body.typing .think-label { font-size: .9rem; }
.msg-body.typing .dots { display: inline-flex; gap: 3px; }
.msg-body.typing .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; animation: blink 1.2s infinite both; }
.msg-body.typing .dots i:nth-child(2) { animation-delay: .2s; }
.msg-body.typing .dots i:nth-child(3) { animation-delay: .4s; }

/* CaseGym: 対話の「参照した知識（根拠）」表示 */
.msg .sources { margin-top: 6px; font-size: .85rem; }
.msg .sources summary { cursor: pointer; color: var(--brand); user-select: none; }
.msg .sources summary:hover { text-decoration: underline; }
.msg .sources-body { margin-top: 6px; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--line);
  border-radius: 8px; white-space: pre-wrap; max-height: 320px; overflow-y: auto; color: var(--text); line-height: 1.55; }
.msg.me .sources { text-align: left; }

/* CaseGym: 根拠(資料リンク)リストと公開チェック */
.msg .sources-list { margin: 6px 0 0; padding-left: 18px; }
.msg .sources-list li { margin: 2px 0; }
.pubcheck { display: block; margin: 6px 0; font-size: .85rem; color: var(--muted); }
.pubcheck input { margin-right: 6px; }

/* 印刷(PDF保存)用: アプリの枠・操作を隠し、会話だけを整えて出力 */
.print-only { display: none; }
@media print {
  .topbar, .footer, #toast, #loading-overlay, .actions, form,
  #vdebug-wrap, .say-form, #start-area, .run-side, .run-start, .run-video, .case-overview { display: none !important; }
  .run-layout { display: block !important; height: auto !important; min-height: 0 !important; margin: 0 !important; }
  .run-main { display: block !important; border: none !important; overflow: visible !important; }
  body { background: #fff; }
  .container { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .page-head { border: none; margin: 0 0 6px; display: block; }
  .page-head h1 { font-size: 15pt; margin: 0; }
  .print-only { display: block; color: #555; font-size: 9pt; margin: 0 0 10px; }
  .chat { display: block; height: auto !important; max-height: none !important; min-height: 0 !important;
    overflow: visible !important; padding: 0; gap: 0; border: none !important; }
  .msg { break-inside: avoid; page-break-inside: avoid; margin: 8px 0; max-width: 100% !important;
    align-self: auto !important; }
  .msg-speaker { font-size: 9pt; color: #444; }
  .msg-body { border: 1px solid #ccc !important; background: #fff !important; color: #000 !important;
    border-radius: 6px; padding: 8px 10px; }
  .msg.me .msg-body { background: #f2f6ff !important; }
  .sources, .sources[open] { display: block; }
  .sources summary { display: none; }
  .sources-list { display: block; font-size: 9pt; }
  a { color: #000; text-decoration: none; }
}

/* 対話画面はコンテナ上限を広げ、広い画面でAI発言の1行を長く使えるようにする */
.container.container-wide { max-width: 1400px; padding-bottom: 16px; }
/* AI発言バブルは幅に応じて可変。ただし読みやすさのため最大60字相当(60rem)で頭打ち。
   狭い画面では 90% が効いて自動で縮む(横スクロール不要)。 */
.run-main .msg.ai { max-width: min(90%, 60rem); }

/* 対話画面の2ペイン: 左=操作、右=会話＋入力(縦いっぱい) */
.run-layout { display: flex; gap: 16px; align-items: stretch;
  height: calc(100vh - 150px); min-height: 420px; margin-top: 8px; }
.run-side { flex: 0 0 210px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.run-title { font-size: 1.15rem; margin: 0; line-height: 1.3; }
.run-actions { display: flex; flex-direction: column; gap: 6px; }
.run-actions .btn { width: 100%; text-align: center; }
.run-actions form { margin: 0; }
.run-actions form .btn { width: 100%; }
.run-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.run-main .chat { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto;
  border: none; border-radius: 0; margin: 0; }
/* チャット以外の縦長コンテンツ(バディ選択・作戦メモ)をペイン内でスクロールさせる */
.run-main .run-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px; }
/* バディ作戦会議: 左ペインを広め、上部にケース状況・ヘルプの折りたたみを固定表示 */
.run-layout-buddy .run-side { flex: 0 0 300px; }
/* 右ペインは #run-scroll だけがスクロールする。折りたたみ群・チャットはその中で普通に流し、
   入れ子スクロールを作らない(これが「その先へ行けない」不具合の原因だった)。 */
.run-main .run-top { padding: 0 0 4px; }
.run-buddy { margin: 3px 0; padding: 5px 8px; background: #f0f8f4; border-radius: 6px; line-height: 1.45; }
.run-buddy.current { background: #eef4ff; border: 1px solid var(--brand, #3a6ea5); }
/* アクター面談: 面談相手を選ぶカード */
.actor-pick { margin: 8px 0; }
.actor-pick-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  cursor: pointer; border: 1px solid var(--line, #ddd); border-radius: 10px; padding: 10px 14px;
  background: #fff; font: inherit; }
.actor-pick-btn:hover { border-color: var(--brand, #3a6ea5); background: #f8fbff; }
.actor-pick-body { flex: 1 1 auto; line-height: 1.5; }
.actor-pick-go { flex: 0 0 auto; color: var(--brand, #3a6ea5); font-weight: 700; white-space: nowrap; }
.run-main .run-scroll .chat { max-height: none; min-height: 0; overflow: visible;
  border: none; padding: 0; margin: 8px 0 0; }
.run-main .run-top .case-overview { margin: 0 0 8px; }
@media (max-width: 760px) { .run-layout-buddy .run-side { flex: none; } }
.run-main .banner { margin: 10px; }
.run-main .run-start { padding: 12px; border-top: 1px solid var(--line); }
.run-main .say-form[hidden] { display: none; }  /* hidden属性を display:flex より優先させる */
.run-main .say-form { display: flex; gap: 8px; align-items: flex-end; flex: 0 0 auto;
  border-top: 1px solid var(--line); margin: 0; padding: 10px 12px; }
.run-main .say-form textarea { flex: 1; margin: 0; }
.run-main .say-form .actions { margin: 0; }
@media (max-width: 760px) {
  .run-layout { flex-direction: column; height: auto; min-height: 0; }
  .run-side { flex: none; }
  .run-actions { flex-direction: row; flex-wrap: wrap; }
  .run-actions .btn, .run-actions form { width: auto; }
  .run-main { height: 68vh; }
}

/* 対話画面 左ペインのコマンドグループ見出し */
.run-group-label { font-size: .72rem; color: var(--muted); font-weight: 700;
  margin: 10px 0 3px; padding-top: 8px; border-top: 1px solid var(--line); letter-spacing: .02em; }
.run-actions > .run-group-label:first-child { border-top: none; padding-top: 0; margin-top: 0; }
@media print { .run-group-label { display: none !important; } }

/* 上部メニューのドロップダウン(組織・教育プログラム) */
.navdd { position: relative; display: inline-flex; }
button.navdd-toggle { background: none; -webkit-appearance: none; appearance: none; cursor: pointer;
  font: inherit; border: none; border-bottom: 3px solid transparent; }
.navcaret { font-size: .7em; opacity: .7; }
.navdd-menu { position: fixed; display: none; z-index: 1500; min-width: 200px; max-width: 320px;
  max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.14); padding: 6px; }
.navdd-menu.open { display: block; }
.navdd-menu a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--ink);
  font-size: .9rem; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.navdd-menu a:hover { background: #f1f5f9; text-decoration: none; }
.navdd-sep { border-top: 1px solid var(--line); margin: 6px 0; }
@media print { .navdd-menu { display: none !important; } }

/* 音声入力中のステータス表示(対話画面内) */
.voice-status { margin: 0; padding: 8px 12px; border-top: 1px solid var(--line);
  background: #eef4ff; color: var(--brand-dark); font-size: .88rem; font-weight: 600; }
.voice-status[hidden] { display: none; }
@media print { .voice-status { display: none !important; } }

/* DXコンテキストジェネレータ: 課題の5段階評価テーブル */
/* スクロールしても見出し行が見えるよう、テーブルを高さ制限のコンテナ内でスクロールさせ
   thead を sticky にする(上部バーの高さに依存しない)。 */
.dx-rate-wrap { max-height: 62vh; overflow: auto; border: 1px solid var(--line, #ddd); border-radius: 6px; }
.dx-rate thead th { position: sticky; top: 0; z-index: 2; background: var(--brand-dark, #1f3a5f); color: #fff; }
.dx-rate th.dx-scale-h { font-size: 11px; font-weight: 600; text-align: center; white-space: nowrap; padding: 4px 6px; vertical-align: bottom; }
.dx-rate td.dx-scale-c { text-align: center; padding: 6px 8px; }
.dx-rate td.dx-scale-c label { display: block; cursor: pointer; }
.dx-rate td.dx-scale-c input[type=radio] { cursor: pointer; }
.dx-rate tbody tr:hover { background: rgba(43,108,176,0.06); }

/* 知識源のインライン編集(名称・テキスト本文) */
.src-name { margin-bottom: 2px; }
.src-tools { font-size: 0; }                 /* インライン要素間の余白を制御 */
.src-tools > * { font-size: .82rem; }
.src-sep { color: var(--muted, #999); margin: 0 6px; }
.src-edit { display: inline; }               /* summary を DL と同じ行に置く */
.src-edit > summary { cursor: pointer; display: inline; list-style: none; }
.src-edit > summary::-webkit-details-marker { display: none; }
.src-edit-sum { color: var(--brand-dark, #1f3a5f); font-weight: 600; }
.src-edit[open] > summary { margin-bottom: 4px; }
.src-edit form { margin-top: 6px; min-width: 360px; }
.src-edit textarea { margin-top: 4px; }

/* run画面: 動画教材パネル(視聴を促す。開閉可) */
.run-video { flex: 0 0 auto; margin-bottom: 10px; border: 1px solid var(--line, #ddd); border-radius: 8px; background: var(--card, #fff); }
.run-video > summary { cursor: pointer; padding: 8px 12px; font-weight: 700; color: var(--brand-dark, #1f3a5f); }
.run-video-body { padding: 0 12px 10px; }
.run-video-el { display: block; width: 100%; max-height: 42vh; background: #000; border-radius: 6px; }
.run-video-frame { position: relative; width: 100%; max-width: 720px; aspect-ratio: 16 / 9; max-height: 40vh; margin: 0 auto; }
.run-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 6px; }

/* rowspanでグループ化した表(科目=プログラム別 / ケース=科目別)の視認性。
   見出しセルは上詰め、グループの境界に明示的な罫線を引く。 */
.rowspan-groups td.rowspan-head { vertical-align: top; font-weight: 600; }
/* 上詰めで区切りは分かるので、境界の罫線は控えめに(薄いグレー1px)。 */
.rowspan-groups tr.group-start > td { border-top: 1px solid #cbd5e1; }

/* ヘッダのバージョン表示(gitタグ。控えめに) */
.appver { color: var(--muted); font-size: .68rem; opacity: .7; margin-left: -6px; }

/* コピーライト表示(控えめ) */
.copyright { font-size: .72rem; opacity: .7; margin-top: 6px; }

/* run画面: 学習者向けのケース概要(対話とは独立。チャット先頭に表示し一緒にスクロール) */
.case-overview { flex: 0 0 auto; margin-bottom: 10px; border: 1px solid var(--line, #ddd);
  border-radius: 8px; background: #eef4ff; }
.case-overview > summary { cursor: pointer; padding: 8px 12px; font-weight: 700; color: var(--brand-dark, #1f3a5f); }
.case-overview-body { padding: 0 12px 10px; white-space: pre-wrap; line-height: 1.7; }

/* チャット内の要素は縮めない。縦flexの既定(flex-shrink:1)だと「参照した資料」を開いた
   ときにメッセージが圧縮され、末尾の行が切れて入力欄の境目に隠れてしまうため。 */
.chat > * { flex-shrink: 0; }

/* Markdownとして描画したAI本文・ケース概要。ブロック要素を持つので pre-wrap を打ち消し、
   はみ出す表やコードは横スクロールに逃がす。 */
.msg-body.md, .case-overview-body.md { white-space: normal; overflow-x: auto; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: .5em 0; }
.md ul, .md ol { margin: .5em 0; padding-left: 1.4em; }
.md li { margin: .2em 0; }
.md h1, .md h2, .md h3, .md h4 { margin: .6em 0 .3em; line-height: 1.3; }
.md h1 { font-size: 1.25rem; } .md h2 { font-size: 1.15rem; } .md h3 { font-size: 1.03rem; }
.md code { background: rgba(0, 0, 0, .06); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.md pre { background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; color: inherit; }
.md blockquote { margin: .5em 0; padding: .2em .9em; border-left: 3px solid var(--line, #cbd5e1); color: #475569; }
.md table { border-collapse: collapse; margin: 8px 0; background: #fff; font-size: .92rem; }
.md th, .md td { border: 1px solid var(--line, #ddd); padding: 5px 9px; text-align: left; color: #111; vertical-align: top; }
.md thead th { background: #eef2f7; font-weight: 700; }
.md a { color: var(--brand, #3a6ea5); }

/* 科目のケース一覧: 見出し(セパレータ)＋ケースのグループ表示＋DnD並べ替え */
.layout-list { margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.layout-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid transparent; border-radius: 8px; background: #fff; }
.layout-item .drag-handle { color: #9aa5b1; cursor: grab; user-select: none; font-size: 1rem; line-height: 1; }
.layout-list.editable .layout-item { border-color: var(--line, #e2e8f0); }
.layout-item.dragging { opacity: .5; }
/* 見出しは目立たせる(左に太いアクセント・帯) */
.layout-item.heading { background: #eef4ff; border-left: 4px solid var(--brand, #3a6ea5);
  font-weight: 700; color: var(--brand-dark, #1f3a5f); margin-top: 8px; }
.layout-item.heading:first-child { margin-top: 0; }
.layout-item.heading .heading-text { flex: 1; }
.layout-item.heading .heading-tools { display: inline-flex; gap: 6px; }
/* ケースは見出しに付属して見えるようインデント */
.layout-item.case { margin-left: 18px; }
/* タイトルと説明を縦に積む(横1列に押し込むと説明が細い縦帯になり崩れるため) */
.layout-item.case .case-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.layout-item.case .case-title { font-weight: 600; }
.layout-item.case .case-summary { display: block; }
.layout-item.case .case-tools { margin-left: auto; flex: 0 0 auto; align-self: flex-start; }
.add-heading { display: flex; gap: 8px; margin-top: 10px; }
.add-heading input { flex: 1; padding: 6px 9px; border: 1px solid var(--line, #cbd5e1); border-radius: 6px; }

/* バディ選択カード(クリックで選択・選択状態を表示) */
.buddy-pick-card { display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  border: 1px solid var(--line, #e2e8f0); border-radius: 10px; padding: 12px 14px; margin: 8px 0;
  background: #fff; }
.buddy-pick-card:hover { border-color: var(--brand, #3a6ea5); background: #f8fbff; }
.buddy-pick-card input { position: absolute; opacity: 0; pointer-events: none; }
.buddy-pick-check { display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line, #cbd5e1);
  color: #fff; font-size: .85rem; flex-shrink: 0; }
.buddy-pick-card.selected { border-color: var(--brand, #3a6ea5); background: #eef4ff; }
.buddy-pick-card.selected .buddy-pick-check { background: var(--brand, #3a6ea5); border-color: var(--brand, #3a6ea5); }
.buddy-pick-body { line-height: 1.5; }

/* 表の中の見出し行を目立たせる(/cases 一覧・教育プログラムの科目一覧で共用) */
.case-heading-row { background: #eef4ff; font-weight: 700;
  color: var(--brand-dark, #1f3a5f); border-left: 4px solid var(--brand, #3a6ea5); }
.case-heading-row .heading-tools { margin-left: 10px; font-weight: 400; }
/* 見出しのあるグループでは、ケースを少しインデントして見出しに付属して見せる */
.rowspan-groups .case-indent { padding-left: 24px; }

/* ============ 学習者・ゲストの /cases カード表示 ============ */
/* 冒頭「はじめての方へ」折りたたみ */
.intro-more { margin: 6px 0 18px; }
.intro-more > summary { color: var(--brand-dark); font-weight: 600; }
.intro-more-body { background: #eef4ff; border: 1px solid #c7d7fe; border-radius: 8px;
  padding: 12px 16px; margin-top: 8px; }
.intro-more-body p { margin: 6px 0; }

/* 受講ゼロ時の歓迎カード */
.card.welcome { border-left: 5px solid var(--brand); background: #f7faff; }
.card.welcome h2 { color: var(--brand-dark); font-size: 1.15rem; }

/* 科目ごとのグループ見出し: 帯状にして科目の切れ目を一目で分かるようにする */
.case-group { margin: 26px 0; }
.case-group-title { font-size: 1.2rem; margin: 0 0 12px; padding: 9px 14px;
  background: #eef4ff; border-left: 6px solid var(--brand); border-radius: 8px;
  color: var(--brand-dark); }
.case-group.trial .case-group-title { background: #ecfdf5; border-left-color: var(--ok); color: #065f46; }
.trial-badge { display: inline-block; background: #fff; color: #047857;
  border: 1px solid #6ee7b7; font-size: .78rem; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; vertical-align: 2px; margin-left: 6px; }
/* 科目内の見出し(セパレータ): 左のアクセント線＋下線で区切りを明示 */
.case-subhead { font-size: 1rem; color: var(--ink); font-weight: 700; margin: 16px 0 6px;
  padding: 2px 0 4px 10px; border-left: 4px solid #93c5fd; border-bottom: 1px solid var(--line); }

/* ケースカード（左=情報 / 右=開始ボタン） */
.case-cards { display: flex; flex-direction: column; gap: 10px; }
.case-card { display: flex; align-items: center; gap: 16px; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; transition: border-color .15s, box-shadow .15s; }
.case-card:hover { border-color: var(--brand); box-shadow: 0 2px 12px rgba(37,99,235,.08); }
/* カード全面クリック(#17): 主リンク(.case-card-link)の当たり判定を ::after でカード全体に
   広げる(ホバーで枠が光るのにクリックできない戸惑いを解消)。主リンク以外の操作リンクは
   z-index で上に重ね、個別のクリックを保つ。 */
.case-card { position: relative; }
.case-card-link::after { content: ""; position: absolute; inset: 0; }
.case-card a:not(.case-card-link) { position: relative; z-index: 1; }
.case-card-main { min-width: 0; }
.case-card-title { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.case-card-title:hover { color: var(--brand-dark); }
.case-card-summary { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.case-card-action { display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  flex: 0 0 auto; white-space: nowrap; }
/* 2行目: 実施状況バッジと「詳細」を横並び(以前は3行に積んでいて縦に無駄があった) */
.case-card-meta { display: flex; align-items: center; gap: 10px; }
.case-card-detail { color: var(--muted); }
.btn.disabled { color: var(--muted); background: #f1f5f9; border-color: var(--line);
  cursor: default; pointer-events: none; }
.voice-btn { border: 1px solid var(--line); background: #fff; cursor: pointer; padding: 1px 8px;
  border-radius: 999px; font-size: .72rem; line-height: 1.4; color: var(--muted); }
.voice-btn:hover { color: var(--brand); border-color: var(--brand); }
/* 選択問題: クリックで回答できる選択肢ボタン(テキスト入力も併用可) */
.quiz-choices { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 2px; }
.quiz-choice-btn { text-align: left; white-space: normal; line-height: 1.4;
  border-color: var(--brand, #3a6ea5); }
.quiz-choice-btn:hover:not(:disabled) { background: #eef4ff; }
.quiz-choice-btn:disabled { opacity: .5; cursor: default; border-color: var(--line); }
/* ケース詳細の工程ナビ(1ケース＝作戦会議→面談→評価) */
.phase-entry-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.phase-entry-list > li { border: 1px solid var(--line, #ddd); border-radius: 10px; padding: 10px 14px; background: #fff; }
.phase-entry-head { display: flex; align-items: center; gap: 8px; }
.phase-entry-head .phase-no { font-weight: 800; color: var(--brand, #3a6ea5); font-size: 1.05rem; }
.phase-entry-list .pill { background: #f1f5f9; color: var(--muted); }
.phase-entry-list li.phase-entry-todo { background: #fafbfc; color: var(--muted); }
.phase-entry-list p { margin: 4px 0 8px; }
@media (max-width: 560px) {
  .case-card { flex-direction: column; align-items: stretch; }
  .case-card-action { flex-direction: row-reverse; align-items: center; justify-content: space-between; }
}

/* 一括再構築の進捗バー */
.vs-progress { margin: 10px 0; }
.vs-progress-bar { height: 10px; background: #e6e6e6; border-radius: 5px; overflow: hidden; }
.vs-progress-bar > span { display: block; height: 100%; width: 0; background: var(--brand, #3a6ea5);
  transition: width .4s ease; }
#vs-progress-text { margin: 6px 0 0; }

/* ============ /welcome 宣伝ページ(LP) ============ */
.lp-hero { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff;
  border-radius: 16px; padding: 44px 36px; margin: 4px 0 28px; text-align: center; }
.lp-hero h1 { color: #fff; font-size: 2rem; line-height: 1.4; margin: 0 0 14px; }
.lp-hero-sub { font-size: 1.05rem; opacity: .95; max-width: 640px; margin: 0 auto 22px; line-height: 1.8; }
.lp-cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.lp-cta { font-size: 1.05rem; padding: 12px 26px; font-weight: 700; }
.lp-hero .lp-cta-ghost { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.5); }
.lp-hero .lp-cta-ghost:hover { background: rgba(255,255,255,.22); }
.lp-h2 { font-size: 1.35rem; margin: 40px 0 14px; text-align: center; }
/* ADPISA誘導 */
.lp-adpisa { margin-top: 36px; }
.lp-adpisa-lead { max-width: 720px; margin: 0 auto 18px; line-height: 1.9; text-align: center; }
.adpisa-card { border-top: 4px solid var(--brand); display: flex; flex-direction: column; }
.adpisa-card h3 { margin: 0 0 4px; }
.adpisa-card .adpisa-tagline { font-weight: 700; color: var(--brand-dark); margin: 0 0 8px; }
.adpisa-card p { flex: 0 0 auto; }
.adpisa-card .btn { margin-top: auto; align-self: flex-start; }
/* 締めのCTA */
.lp-final { text-align: center; margin: 44px 0 8px; padding: 30px 20px;
  background: #eef4ff; border: 1px solid #c7d7fe; border-radius: 14px; }
.lp-final-copy { font-size: 1.1rem; font-weight: 700; line-height: 1.9; margin: 0 0 16px; }
@media (max-width: 560px) {
  .lp-hero { padding: 30px 20px; }
  .lp-hero h1 { font-size: 1.5rem; }
}

/* 企業向けLP(/business) */
.biz-hero { text-align: center; padding: 40px 20px 26px; background: #f0fdf4;
  border: 1px solid #bbf7d0; border-radius: 14px; }
.biz-hero-kicker { color: #047857; font-weight: 700; font-size: .92rem; margin: 0 0 8px; }
.biz-hero-title { font-size: 1.9rem; line-height: 1.5; margin: 0 0 8px; }
.biz-accent { color: #047857; }
.biz-hero-tagline { color: var(--muted); font-size: 1.05rem; margin: 0; }
.biz-pains .card h3 { margin: 0 0 8px; color: var(--brand-dark); }
/* /welcome: 内蔵知識の規模を示すスタット表示 */
.kb-stat { margin: 0 0 10px; }
.kb-stat strong { font-size: 2.2rem; color: var(--brand-dark); letter-spacing: .02em; }
.kb-unit { margin-left: 6px; font-weight: 700; }
.biz-pain-list { margin: 0; padding-left: 1.3em; }
.biz-pain-list li { margin: 5px 0; }
/* 「悩み」の引用ラベル → 答えの見出し */
.biz-q { margin: 0 0 6px; color: var(--muted); font-size: .88rem; }
.biz-q::before { content: "― "; }
.biz-answers .card h3 { margin: 0 0 8px; font-size: 1.05rem; color: #047857; }
.biz-facts { max-width: 780px; margin: 0 auto; }
.biz-fact-list { margin: 0 0 14px; padding-left: 1.3em; }
.biz-fact-list li { margin: 7px 0; }
.biz-step { display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: .9rem; margin-right: 6px; }
/* 企業向けバナーの透明ホットスポット(business_banner.png のボタン位置に合わせる)。
   基底 .lp-banner-hotspot(welcome用の位置指定)より後方で定義されるため、詳細度を上げて上書きする。 */
.lp-banner-hotspot.lp-banner-hotspot-biz-try { left: 49%; top: 71%; width: 26%; height: 8%; }
.lp-banner-hotspot.lp-banner-hotspot-biz-more { left: 81.5%; top: 89.5%; width: 16%; height: 7.5%; }
/* バナー右下カード(誤記載の「履修証明書」)を丸ごと置き換える提供元カード。
   背景色はカードの実測色(#eff2eb)に合わせ、切り貼り感を出さない。ロゴを主役に大きく。 */
.lp-banner-logo-overlay { position: absolute; left: 80.8%; top: 68%; width: 17.6%; height: 30.8%;
  background: #eff2eb; border-radius: 12px; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between; padding: 3.5% 1.5%; }
.lp-banner-logo-caption { color: #1f2933; font-weight: 700; text-align: center; line-height: 1.25;
  font-size: clamp(8px, 0.95vw, 14px); }
.lp-banner-logo-caption .nowrap { white-space: nowrap; }
.lp-banner-logo-overlay img { flex: 1 1 auto; min-height: 0; max-width: 92%; object-fit: contain;
  margin: 2% 0; border-radius: 10px; }
.lp-banner-logo-btn { background: #1f5c3d; color: #fff; font-weight: 700; white-space: nowrap;
  font-size: clamp(8px, 1vw, 14px); padding: 2.5% 12%; border-radius: 999px; }
.lp-banner-logo-overlay:hover, .lp-banner-logo-overlay:focus-visible {
  outline: 3px solid rgba(5,150,105,.65); outline-offset: 2px; }
/* 2026年度・限定5社の無料提供キャンペーン */
.biz-campaign { text-align: center; margin: 18px auto 4px; padding: 16px 20px; max-width: 720px;
  background: #fff1f2; border: 2px solid #fda4af; border-radius: 14px; }
.biz-campaign-badge { display: inline-block; background: #e11d48; color: #fff; font-weight: 800;
  padding: 3px 14px; border-radius: 999px; font-size: .95rem; letter-spacing: .02em; }
.biz-campaign-copy { font-size: 1.45rem; font-weight: 800; margin: 8px 0 4px; }
.biz-campaign-copy strong { color: #e11d48; font-size: 1.2em; white-space: nowrap; }
.biz-campaign-note { color: var(--muted); font-size: .9rem; margin: 0; }
.biz-campaign-grant { font-size: .78rem; margin-top: 4px; }
.biz-campaign-inline { margin: 0 0 16px; }
.biz-campaign-inline strong { color: #e11d48; }
@media (max-width: 560px) { .biz-hero-title { font-size: 1.4rem; }
  .biz-campaign-copy { font-size: 1.2rem; } }

/* ============ /compare 比較ページ ============ */
.vs-cards { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 18px; }
.vs-card { position: relative; display: flex; flex-direction: column; padding-top: 22px; }
.vs-card h2 { margin: 6px 0 2px; font-size: 1.3rem; }
.vs-casegym { border-top: 4px solid var(--brand); }
.vs-adpisa { border-top: 4px solid #059669; }
.vs-badge { position: absolute; top: -12px; left: 16px; background: var(--brand); color: #fff;
  font-size: .78rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; }
.vs-badge-adpisa { background: #059669; }
.vs-catch { font-weight: 700; color: var(--brand-dark); margin: 0 0 10px; }
.vs-adpisa .vs-catch { color: #047857; }
.vs-list { list-style: none; margin: 0 0 14px; padding: 0; }
.vs-list li { margin: 8px 0; line-height: 1.7; }
.vs-card .actions { margin-top: auto; }
/* 比較表: 狭い画面では横スクロール */
.compare-wrap { overflow-x: auto; }
.compare-table { min-width: 640px; }
.compare-table thead th { font-size: .95rem; }
.compare-table thead .col-casegym { color: var(--brand-dark); }
.compare-table thead .col-adpisa { color: #047857; }
.compare-table tbody th { white-space: nowrap; text-align: left; color: var(--muted);
  font-weight: 700; font-size: .88rem; vertical-align: top; }
/* 順路ステップ */
.path-steps { max-width: 720px; margin: 0 auto; padding-left: 1.6em; line-height: 2.0; }
.path-steps li { margin: 10px 0; }
.lp-compare-link { text-align: center; margin: 16px 0 0; font-weight: 600; }
/* /welcome ヒーローのバナー画像 */
.lp-banner-wrap { margin: 4px 0 28px; text-align: center; }
.lp-banner { width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.lp-banner-wrap .lp-cta-row { margin-top: 16px; }
/* /compare 冒頭リード(問いかけ)を目立たせる */
.compare-lead { max-width: 780px; margin: 0 auto 10px; padding: 22px 28px;
  background: linear-gradient(135deg, #eef4ff, #ecfdf5);
  border: 1px solid #c7d7fe; border-radius: 14px;
  font-size: 1.05rem; line-height: 2.0; text-align: center; }
.compare-lead .lead-casegym { color: var(--brand-dark); font-size: 1.1rem; }
.compare-lead .lead-adpisa { color: #047857; font-size: 1.1rem; }
.compare-lead-q { display: block; margin-top: 10px;
  font-size: 1.3rem; font-weight: 800; color: var(--brand-dark); }
/* バナー右下「詳しくはこちら」に重ねる透明リンク(位置は画像に対する%で追従) */
.lp-banner-box { position: relative; display: block; }
.lp-banner-hotspot { position: absolute; left: 82.4%; top: 85.2%; width: 15.7%; height: 10.8%;
  border-radius: 10px; }
.lp-banner-hotspot:hover, .lp-banner-hotspot:focus-visible {
  box-shadow: 0 0 0 3px rgba(5,150,105,.55); background: rgba(255,255,255,.10); }
/* バナー左中段「まずは気軽に体験！」の透明リンク */
.lp-banner-hotspot-try { left: 12.6%; top: 58.2%; width: 19.6%; height: 8.0%; }
.vs-progress > p { margin: 6px 0 0; }

/* ============ 取り込み(ZIP)の進捗。押した後に「何をすればよいか」を大きく出す ============ */
.impbox { margin: 14px 0 18px; padding: 16px 18px; border-radius: 12px;
  border: 2px solid var(--brand, #3a6ea5); background: #f4f8fd; }
.impbox.running { border-color: var(--brand, #3a6ea5); background: #eef5fd; }
.impbox.done { border-color: #2e7d32; background: #eef7ef; }
.impbox.failed { border-color: #c62828; background: #fdeeee; }
.impbox-title { margin: 0 0 10px; font-size: 1.15rem; font-weight: 700; line-height: 1.5; }
.impbox.running .impbox-title { color: var(--brand-dark, #274c73); }
.impbox.done .impbox-title { color: #2e7d32; }
.impbox.failed .impbox-title { color: #c62828; }
.impbox-action { margin: 10px 0 4px; font-size: 1rem; line-height: 1.7; }
.impbox-meta { margin: 2px 0 0; }
.impbox .vs-progress-bar { height: 14px; }
.impbox.running .vs-progress-bar > span { background-image:
  linear-gradient(45deg, rgba(255,255,255,.35) 25%, transparent 25%, transparent 50%,
  rgba(255,255,255,.35) 50%, rgba(255,255,255,.35) 75%, transparent 75%);
  background-size: 24px 24px; animation: impstripe 1s linear infinite; }
@keyframes impstripe { from { background-position: 0 0; } to { background-position: 24px 0; } }
.impbox.done .vs-progress-bar > span { background: #2e7d32; }
.impbox.failed .vs-progress-bar > span { background: #c62828; }

/* ============ 一覧のドラッグ並べ替え(運営者)。ケースの並べ替えと同じ操作感 ============ */
.card-wrap { position: relative; display: flex; }
/* カードの見た目は a.card 側にあるので、包んでもグリッドの升目を満たすようにする */
.card-wrap > .card { display: block; flex: 1; }
.card-wrap.reorder-item > .card { padding-right: 40px; }
.card-wrap .drag-handle { position: absolute; top: 12px; right: 12px; z-index: 1; }
.drag-handle { color: #9aa5b1; cursor: grab; user-select: none; font-size: 1rem; line-height: 1; }
.reorder-item { cursor: grab; }
.reorder-item.dragging { opacity: .5; }
tbody[data-reorder-url] .drag-cell { width: 1%; white-space: nowrap; }
.banner.viewas { background: #fff7ed; border: 1px solid #fdba74; color: #7c2d12;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============ 知識の取り込み直後の確認(#34) ============ */
.kb-added { margin: 10px 0 14px; padding: 12px 14px; border-radius: 10px;
  border: 2px solid #2e7d32; background: #eef7ef; }
.kb-added.warn { border-color: #c77700; background: #fff8ec; }
.kb-added-title { margin: 0 0 6px; }
.kb-added-note { margin: 6px 0; color: #8a4b00; font-weight: 700; }
.kb-added-preview { margin: 6px 0 0; padding: 8px 10px; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; max-height: 190px; overflow: auto; white-space: pre-wrap;
  font-size: .85rem; line-height: 1.6; }
.src-warn { color: #8a4b00; }

/* ============ 保存し忘れの防止(#26) ============ */
.unsaved-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 10px 16px; background: #fff8ec; border-top: 2px solid #c77700;
  box-shadow: 0 -2px 10px rgba(0,0,0,.08); }
.unsaved-msg { font-weight: 700; color: #8a4b00; }
.unsaved-modal-back { position: fixed; inset: 0; z-index: 60; display: flex;
  align-items: center; justify-content: center; background: rgba(15,23,42,.45); }
.unsaved-modal { background: var(--card, #fff); border-radius: 12px; padding: 20px 22px;
  max-width: 420px; width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 8px; }
.unsaved-modal-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.unsaved-modal .btn { width: 100%; }

/* 企業向けLP: 末尾の参考情報リンク */
.biz-reference { text-align: center; margin: 14px 0 4px; }
/* 比較ページ(/compare-biz)の導入イメージ(事例)カード */
.biz-case-card { max-width: 860px; margin: 0 auto; border-top: 4px solid var(--ok); }
/* ADPISA科目紹介(/adpisa-subjects): 困りごとチップと科目テーブル */
.subj-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 10px; }
.subj-chip { font: inherit; font-size: .9rem; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; }
.subj-chip:hover { border-color: var(--brand); background: #f8fbff; }
.subj-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
/* チェックボックス風の目印(複数選択できることを見た目で示す) */
.subj-chip-box { display: inline-block; width: 14px; height: 14px; margin-right: 7px;
  border: 2px solid #94a3b8; border-radius: 4px; vertical-align: -2px; background: #fff; }
.subj-chip.active .subj-chip-box { border-color: #fff; background: #fff; position: relative; }
.subj-chip.active .subj-chip-box::after { content: "✓"; position: absolute; left: 1px; top: -4px;
  color: var(--brand); font-weight: 900; font-size: 13px; }
.subj-chip-clear { color: var(--muted); border-style: dashed; }
.subj-toolbar { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 6px 0 12px; }
.subj-search { width: min(420px, 80%); }
.subj-table .subj-id { white-space: nowrap; color: var(--muted); }
.subj-table .subj-name { font-weight: 700; min-width: 12em; }
.subj-table .subj-hours { white-space: nowrap; }
.empty-note { text-align: center; margin: 18px 0; }
.req-note { color: var(--err); margin-left: 2px; }

/* ============ 選択問題の選択肢の配置(#32の続き・折返し対策) ============
   ラベルと本文を横に並べ、本文には残り幅をそのまま使わせる。以前は本文を
   inline-block にして固定で 2.2em 差し引いており、数ピクセル足りずに短い語句が
   2行に折り返されることがあった。この定義は .btn 等より後ろに置く(上書き防止)。 */
.quiz-choice-btn { display: flex; align-items: baseline; gap: 4px; text-align: left; }
.quiz-choice-label { flex: 0 0 auto; font-weight: 600; margin-right: 0; }
.quiz-choice-body { flex: 1 1 auto; min-width: 0; max-width: none; }
.quiz-choice-body > p { margin: 0 0 4px; }
.quiz-choice-body > p:last-child { margin-bottom: 0; }

/* 画面が狭いときは、選択肢まわりの余白を詰めて本文の幅を稼ぐ
   (短い語句が数ピクセル足りずに折り返されるのを防ぐ)。*/
@media (max-width: 520px) {
  .quiz-choice-btn { padding: 9px 10px; font-size: .95rem; }
  .chat { padding-left: 8px; padding-right: 8px; }
  .msg { max-width: 100%; }
  .msg.quiz-question { max-width: 100%; }
}

/* 設定画面の注意書き(例: 指導方針に問題数が書かれているが、そこでは指定できない) */
.warnbox { margin: 8px 0 12px; padding: 10px 12px; border-radius: 8px;
           background: #fef3c7; color: var(--warn); border: 1px solid #fde68a; }

/* 資料ビューア(回答に使った箇所の強調) */
.passage { padding: 10px 12px; border-radius: 8px; margin: 0 0 6px; }
.passage + .passage { border-top: 1px solid var(--line, #e5e7eb); }
.passage-key { margin: 0 0 4px; font-size: 1.05rem; }
.passage-focus { background: #fff8dc; box-shadow: 0 0 0 2px #f5d78e inset; }
/* 根拠に添える引用(回答に使った箇所の抜粋) */
.sources-hint { margin: 4px 0 2px; }
.ref-quote { margin: 4px 0 8px; padding: 6px 10px; border-left: 3px solid var(--line, #e5e7eb);
             color: var(--muted, #6b7280); font-size: .85rem; line-height: 1.6;
             white-space: pre-wrap; max-height: 8.5em; overflow: auto; }
.ref-spot { margin: 4px 0 0 2px; }

/* 並べ替えできる表(見出しクリック) */
table.sortable th.sort-col { cursor: pointer; user-select: none; white-space: nowrap; }
table.sortable th.sort-col::after { content: " ↕"; color: #9aa4b2; font-size: .85em; }
table.sortable th.sort-asc::after { content: " ▲"; color: var(--brand, #3a6ea5); }
table.sortable th.sort-desc::after { content: " ▼"; color: var(--brand, #3a6ea5); }
